This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Code generation problem with optimizations enabled
----- Original Message ----
> From: Jim Wilson <wilson@codesourcery.com>
> To: Jamie Prescott <jpresss@yahoo.com>
> Cc: Paolo Bonzini <bonzini@gnu.org>; gcc@gcc.gnu.org
> Sent: Wednesday, May 13, 2009 6:15:07 PM
> Subject: Re: Code generation problem with optimizations enabled
>
> Jamie Prescott wrote:
> > Thank you Paolo, I'll take a look at it.
> > Is there a reason why the fcmp insn was dropped with such implementation?
>
> The code that optimizes away redundant cc0 compares is in final.c, in
> final_scan_insn(). It is about line 2310 in my tree, near the comment "Check
> for redundant test and compare instructions". Try stepping through that code to
> see what is going on. Maybe you are setting cc_status.value1 but not
> cc_status.value2?
>
> In any case, as Paolo mentioned, you are better off not using cc0. cc0 should
> only be used if you have no other choice. And even then, you still probably
> shouldn't use it. Every couple of years someone tries to eliminate the cc0
> code, and eventually someone will succeed.
Thanks for the insight. But anyway, I took the path Paolo told me using CCmode and
now it's working nicely.
- Jamie