public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/33555]  New: x86 missed opportunity for sbb
@ 2007-09-25 18:17 astrange at ithinksw dot com
  2008-02-16 20:19 ` [Bug target/33555] " astrange at ithinksw dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: astrange at ithinksw dot com @ 2007-09-25 18:17 UTC (permalink / raw)
  To: gcc-bugs

> /usr/local/gcc43/bin/gcc -v
Using built-in specs.
Target: i386-apple-darwin8.10.1
Configured with: ../gcc/configure --prefix=/usr/local/gcc43 --with-arch=nocona
--with-tune=nocona --with-gmp=/sw --with-system-zlib
--enable-languages=c,c++,objc,obj-c++
Thread model: posix
gcc version 4.3.0 20070925 (experimental) (GCC) 

> /usr/local/gcc43/bin/gcc -Os -fno-pic -S sbb.c -fomit-frame-pointer
        .text
.globl _cmpb_sbb
_cmpb_sbb:
        subl    $12, %esp
        movl    16(%esp), %eax
        movl    20(%esp), %ecx
        xorl    %edx, %edx
        cmpl    24(%esp), %ecx
        setb   %dl
        negl    %edx
        andl    %ecx, %edx
        subl    %edx, %eax
        addl    $12, %esp
        ret
        .subsections_via_symbols

Source:
unsigned cmpb_sbb(unsigned a, unsigned b, unsigned c)
{
        unsigned mask = -(b < c);

        a -= b & mask;
        return a;
}

"setb, negl" is the same as 0 - (0 + eflags.CF), so it can be replaced with
"sbb %edx, %edx".
This is useful for if-conversion, since it's the same as "if (b < c) a -= b;"


-- 
           Summary: x86 missed opportunity for sbb
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: astrange at ithinksw dot com
 GCC build triplet: i386-apple-darwin8.10.1
  GCC host triplet: i386-apple-darwin8.10.1
GCC target triplet: i386-apple-darwin8.10.1


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-10-11 20:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-25 18:17 [Bug target/33555] New: x86 missed opportunity for sbb astrange at ithinksw dot com
2008-02-16 20:19 ` [Bug target/33555] " astrange at ithinksw dot com
2008-02-18  9:58 ` ubizjak at gmail dot com
2008-02-19  7:24 ` uros at gcc dot gnu dot org
2008-02-19  7:42 ` ubizjak at gmail dot com
2008-02-19  8:18 ` ubizjak at gmail dot com
2009-10-11 20:18 ` ubizjak at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).