------- Comment #2 from ubizjak at gmail dot com  2007-06-06 08:15 -------
(In reply to comment #0)

> After the addition, which sets the ALU flags, the compiler issues two compare
> instructions and conditional branches.  This sequence could be replaced by a
> conditional branch following the addl, testing one of the flags (overflow?
> carry? I forget which) set by it.

in config/i386/i386-modes.def, documentation says:

   Add CCGOC to indicate comparisons against zero that allows
   unspecified garbage in the Carry and Overflow flag. This
   mode is used to simulate comparisons of (a-b) and (a+b)
   against zero using sub/cmp/add operations.

addl operates in CCGOCmode, but you are requesting GTU conditional jump that
requires Carry flag=0 and Zero flag=0. GTU is incompatible with CCGOCmode due
to Carry flag handling.

Change one of conditions to "if (sum == 0) abort();" and you will see insn
elimination in action.

And BTW - wrapping is undefined operation.


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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

Reply via email to