From af8cb5c5e8b60bb02d1726688bc050a0f5c285c9 Mon Sep 17 00:00:00 2001 From: David Edelsohn Date: Mon, 19 Aug 2002 16:32:54 +0000 Subject: [PATCH] rs6000.c (rs6000_emit_set_const): Inline multi-instruction SImode constant. * config/rs6000/rs6000.c (rs6000_emit_set_const): Inline multi-instruction SImode constant. Add REG_EQUAL note. * config/rs6000/rs6000.md (movsi splitter): Use rs6000_emit_set_const. From-SVN: r56439 --- gcc/ChangeLog | 7 ++++++ gcc/config/rs6000/rs6000.c | 46 ++++++++++++++++++++++++++++--------- gcc/config/rs6000/rs6000.md | 9 +++++--- 3 files changed, 48 insertions(+), 14 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8675cf07a27..8d3077e41e1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2002-08-19 David Edelsohn + + * config/rs6000/rs6000.c (rs6000_emit_set_const): Inline + multi-instruction SImode constant. Add REG_EQUAL note. + * config/rs6000/rs6000.md (movsi splitter): Use + rs6000_emit_set_const. + 2002-08-19 Kaveh R. Ghazi * tree-inline.c (initialize_inlined_parameters): Wrap variable in diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 5b69dd58a19..399608af5db 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -2368,35 +2368,59 @@ rs6000_emit_set_const (dest, mode, source, n) enum machine_mode mode; int n ATTRIBUTE_UNUSED; { + rtx result, insn, set; HOST_WIDE_INT c0, c1; - if (mode == QImode || mode == HImode || mode == SImode) + if (mode == QImode || mode == HImode) { if (dest == NULL) dest = gen_reg_rtx (mode); emit_insn (gen_rtx_SET (VOIDmode, dest, source)); return dest; } - - if (GET_CODE (source) == CONST_INT) + else if (mode == SImode) { - c0 = INTVAL (source); - c1 = -(c0 < 0); + result = no_new_pseudos ? dest : gen_reg_rtx (SImode); + + emit_insn (gen_rtx_SET (VOIDmode, result, + GEN_INT (INTVAL (source) + & (~ (HOST_WIDE_INT) 0xffff)))); + emit_insn (gen_rtx_SET (VOIDmode, dest, + gen_rtx_IOR (SImode, result, + GEN_INT (INTVAL (source) & 0xffff)))); + result = dest; } - else if (GET_CODE (source) == CONST_DOUBLE) + else if (mode == DImode) { + if (GET_CODE (source) == CONST_INT) + { + c0 = INTVAL (source); + c1 = -(c0 < 0); + } + else if (GET_CODE (source) == CONST_DOUBLE) + { #if HOST_BITS_PER_WIDE_INT >= 64 - c0 = CONST_DOUBLE_LOW (source); - c1 = -(c0 < 0); + c0 = CONST_DOUBLE_LOW (source); + c1 = -(c0 < 0); #else - c0 = CONST_DOUBLE_LOW (source); - c1 = CONST_DOUBLE_HIGH (source); + c0 = CONST_DOUBLE_LOW (source); + c1 = CONST_DOUBLE_HIGH (source); #endif + } + else + abort (); + + result = rs6000_emit_set_long_const (dest, c0, c1); } else abort (); - return rs6000_emit_set_long_const (dest, c0, c1); + insn = get_last_insn (); + set = single_set (insn); + if (! CONSTANT_P (SET_SRC (set))) + set_unique_reg_note (insn, REG_EQUAL, source); + + return result; } /* Having failed to find a 3 insn sequence in rs6000_emit_set_const, diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 4a441e22447..c3ff213832e 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -8215,9 +8215,12 @@ (ior:SI (match_dup 0) (match_dup 3)))] " -{ - operands[2] = GEN_INT (INTVAL (operands[1]) & (~ (HOST_WIDE_INT) 0xffff)); - operands[3] = GEN_INT (INTVAL (operands[1]) & 0xffff); +{ rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2); + + if (tem == operands[0]) + DONE; + else + FAIL; }") (define_insn "*movsi_internal2" -- 2.30.2