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

* [Bug target/33555] x86 missed opportunity for sbb
  2007-09-25 18:17 [Bug target/33555] New: x86 missed opportunity for sbb astrange at ithinksw dot com
@ 2008-02-16 20:19 ` astrange at ithinksw dot com
  2008-02-18  9:58 ` ubizjak at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: astrange at ithinksw dot com @ 2008-02-16 20:19 UTC (permalink / raw)
  To: gcc-bugs



-- 

astrange at ithinksw dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|minor                       |enhancement


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


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

* [Bug target/33555] x86 missed opportunity for sbb
  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
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ubizjak at gmail dot com @ 2008-02-18  9:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from ubizjak at gmail dot com  2008-02-18 09:58 -------
Created an attachment (id=15183)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15183&action=view)
Patch to implement missed optimization.

2008-02-18  Uros Bizjak  <ubizjak@gmail.com>

        PR target/33555
        * config/i386/i386.md (*x86_movsicc_0_m1_se): New insn pattern.
        (*x86_movdicc_0_m1_se): Ditto.

testsuite/ChangeLog:

2008-02-18  Uros Bizjak  <ubizjak@gmail.com>

        PR target/33555
        * gcc.target/i386/pr33555.c: New test.


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |ubizjak at gmail dot com
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED


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


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

* [Bug target/33555] x86 missed opportunity for sbb
  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
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: uros at gcc dot gnu dot org @ 2008-02-19  7:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from uros at gcc dot gnu dot org  2008-02-19 07:24 -------
Subject: Bug 33555

Author: uros
Date: Tue Feb 19 07:23:30 2008
New Revision: 132414

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132414
Log:
        PR target/33555
        * config/i386/i386.md (*x86_movsicc_0_m1_se): New insn pattern.
        (*x86_movdicc_0_m1_se): Ditto.

testsuite/ChangeLog:

        PR target/33555
        * gcc.target/i386/pr33555.c: New test.


Added:
    trunk/gcc/testsuite/gcc.target/i386/pr33555.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.md
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug target/33555] x86 missed opportunity for sbb
  2007-09-25 18:17 [Bug target/33555] New: x86 missed opportunity for sbb astrange at ithinksw dot com
                   ` (2 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: ubizjak at gmail dot com @ 2008-02-19  7:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from ubizjak at gmail dot com  2008-02-19 07:41 -------
Fixed.


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug target/33555] x86 missed opportunity for sbb
  2007-09-25 18:17 [Bug target/33555] New: x86 missed opportunity for sbb astrange at ithinksw dot com
                   ` (3 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: ubizjak at gmail dot com @ 2008-02-19  8:18 UTC (permalink / raw)
  To: gcc-bugs



-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.4.0


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


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

* [Bug target/33555] x86 missed opportunity for sbb
  2007-09-25 18:17 [Bug target/33555] New: x86 missed opportunity for sbb astrange at ithinksw dot com
                   ` (4 preceding siblings ...)
  2008-02-19  8:18 ` ubizjak at gmail dot com
@ 2009-10-11 20:18 ` ubizjak at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: ubizjak at gmail dot com @ 2009-10-11 20:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from ubizjak at gmail dot com  2009-10-11 20:18 -------
*** Bug 41677 has been marked as a duplicate of this bug. ***


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl dot tools at gmail dot
                   |                            |com


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).