[Bug target/54963] [4.8 Regression] Wrong code generated for libgfortran/generated/eoshift3_8.c on SH

olegendo at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Oct 29 11:13:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54963

--- Comment #5 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-10-29 11:13:19 UTC ---
(In reply to comment #4)
> (In reply to comment #3)
> > Created attachment 28551 [details]
> > Proposed patch
> > 
> > This patch fixes the problem, by using 'emit_move_insn' instead of manually
> > doing the DImode reg copy.
> 
> Does the pattern in negdi_cond
> 
>   emit_insn (gen_negc (low_dst, low_src));
>   emit_label_after (skip_neg_label, emit_insn (gen_negc (high_dst, high_src)));
> 
> work in the problematic situation?  Perhaps I've missed something.

Ugh, you're right.  The negdi will go wrong if input and output regs overlap. 
I guess making the output operand a "=&r" for DImode should fix the issue (as
it's done in the adddi3 or subdi3 patterns).  Moreover, I think it should be OK
to split up the absdi pattern before reload, except for negdi_cond.  I'll try
that out.



More information about the Gcc-bugs mailing list