This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/30315] optimize unsigned-add overflow test on x86 to use cpu flags from addl
- From: "raeburn at raeburn dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Jun 2007 14:51:06 -0000
- Subject: [Bug target/30315] optimize unsigned-add overflow test on x86 to use cpu flags from addl
- References: <bug-30315-11337@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from raeburn at raeburn dot org 2007-06-06 14:51 -------
Subject: Re: optimize unsigned-add overflow test on x86 to use cpu flags from
addl
On Jun 6, 2007, at 04:15, ubizjak at gmail dot com wrote:
> 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.
Actually, I think the test I want is just for the carry flag, which
can be done with one branch instruction using the flags set by addl.
If gcc's description of addl doesn't support that, well, then that's
what I'm requesting be enhanced. :-)
Rask's approach looks interesting, though I wouldn't want to have to
rewrite simple, portable tests for unsigned overflow to use wider
types, especially if I'm adding unsigned long long values, where I
don't have portable wider types.
Ken
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30315