------- Comment #5 from pinskia at gcc dot gnu dot org 2009-01-15 19:58 -------
This is the patch which fixes the issue:Index: regrename.c
===================================================================
--- regrename.c (revision 3023)
+++ regrename.c (working copy)
@@ -1374,6 +1374,10 @@ maybe_mode_change (enum machine_mode ori
enum machine_mode new_mode, unsigned int regno,
unsigned int copy_regno ATTRIBUTE_UNUSED)
{
+ if (GET_MODE_SIZE (copy_mode) == GET_MODE_SIZE (new_mode)
+ && hard_regno_nregs[copy_regno][copy_mode] ==
hard_regno_nregs[copy_regno][new_mode]
+ && hard_regno_nregs[regno][copy_mode] ==
hard_regno_nregs[copy_regno][new_mode])
+ return gen_rtx_raw_REG (new_mode, regno);
if (orig_mode == new_mode)
return gen_rtx_raw_REG (new_mode, regno);
else if (mode_change_ok (orig_mode, new_mode, regno))
Index: config/rs6000/rs6000.md
===================================================================
--- config/rs6000/rs6000.md (revision 3023)
+++ config/rs6000/rs6000.md (working copy)
@@ -5247,10 +5247,17 @@ (define_insn_and_split "*extendsfdf2_fpr
#
fmr %0,%1
lfs%U1%X1 %0,%1"
- "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO
(operands[1])"
+ "&& reload_completed && REG_P (operands[1])"
[(const_int 0)]
{
- emit_note (NOTE_INSN_DELETED);
+ if (REGNO (operands[0]) == REGNO (operands[1]))
+ emit_note (NOTE_INSN_DELETED);
+ else
+ {
+ rtx op0 = gen_rtx_REG (DFmode, REGNO (operands[0]));
+ rtx op1 = gen_rtx_REG (DFmode, REGNO (operands[1]));
+ emit_insn (gen_move_insn (op0, op1));
+ }
DONE;
}
[(set_attr "type" "fp,fp,fpload")])
The rs6000 part is to tell the compiler what is really going on after register
allocator. The regrename part allows to do a hard register copy propagation
after reload.
So we have:
(set (reg:SF 1) ... )
(set (reg:DF 2) (reg:DF 1))
(use (reg:DF 2))
After the rs6000.md patch. Since the copy, is using the register in the larger
mode (DF), the last instruction should be just (use (reg:DF 1)). This patch
allows for that.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17381