public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/29978]  New: suboptimal code generation
@ 2006-11-25 18:22 vda dot linux at googlemail dot com
  2007-07-21 23:36 ` [Bug rtl-optimization/29978] " vda dot linux at googlemail dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: vda dot linux at googlemail dot com @ 2006-11-25 18:22 UTC (permalink / raw)
  To: gcc-bugs

With following testcase gcc 4.1.1 with -Os produces two back-to-back jumps:
"jump to L2 if less; jump to L2 if less-or-equal;" the first one is not needed.

-O2 is worse, but I usually use -Os anyway.

void g();
void f(long long v) {
        if (v > 0777777777777LL)
                g();
        g();
}

/* gcc -v:
Target: i386-pc-linux-gnu
 [skip]
Thread model: posix
gcc version 4.1.1
================
gcc -Os -fomit-frame-pointer -S tar.c
f:
        cmpl    $15, 8(%esp)
        jl      .L2     // not needed
        jle     .L2
        call    g
.L2:
        jmp     g
================
gcc -O2 -fomit-frame-pointer -S tar.c
f:
        subl    $12, %esp       // not needed
        cmpl    $15, 20(%esp)
        jl      .L2     // not needed
        jle     .L2
        call    g
        .p2align 2,,3
.L2:
        addl    $12, %esp       // not needed
        jmp     g

*/


-- 
           Summary: suboptimal code generation
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: vda dot linux at googlemail dot com
 GCC build triplet: i386-pc-linux-gnu
  GCC host triplet: i386-pc-linux-gnu
GCC target triplet: i386-pc-linux-gnu


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


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

* [Bug rtl-optimization/29978] suboptimal code generation
  2006-11-25 18:22 [Bug rtl-optimization/29978] New: suboptimal code generation vda dot linux at googlemail dot com
@ 2007-07-21 23:36 ` vda dot linux at googlemail dot com
  2007-12-14 11:05 ` [Bug rtl-optimization/29978] [4.0/4.1/4.2/4.3 Regression] redundant jumps aldot at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: vda dot linux at googlemail dot com @ 2007-07-21 23:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from vda dot linux at googlemail dot com  2007-07-21 23:36 -------
With 4.2.1 gcc regressed a bit:

gcc -Os -fomit-frame-pointer -S u.c

        .file   "u.c"
        .text
.globl f
        .type   f, @function
f:
        subl    $12, %esp
        cmpl    $15, 20(%esp)
        jl      .L2
        jle     .L2
        call    g
.L2:
        addl    $12, %esp
        jmp     g
        .size   f, .-f
        .ident  "GCC: (GNU) 4.2.1"
        .section        .note.GNU-stack,"",@progbits

In addition to unnecessary jl, we have unnecessary stack manipulations.
(I created separate bug 32849 for this stack problem)


-- 

vda dot linux at googlemail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|4.1.1                       |4.2.1


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


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

* [Bug rtl-optimization/29978] [4.0/4.1/4.2/4.3 Regression] redundant jumps
  2006-11-25 18:22 [Bug rtl-optimization/29978] New: suboptimal code generation vda dot linux at googlemail dot com
  2007-07-21 23:36 ` [Bug rtl-optimization/29978] " vda dot linux at googlemail dot com
@ 2007-12-14 11:05 ` aldot at gcc dot gnu dot org
  2007-12-14 11:24 ` aldot at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: aldot at gcc dot gnu dot org @ 2007-12-14 11:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from aldot at gcc dot gnu dot org  2007-12-14 11:05 -------
Confirmed. gcc-2.95.4 works as expected:

$ gcc-2.95 -Os -fomit-frame-pointer pr29978.i -S -o -
        .file   "pr29978.i"
        .version        "01.01"
gcc2_compiled.:
.text
        .align 16
.globl f
        .type    f,@function
f:
        subl $12,%esp
        cmpl $15,20(%esp)
        jle .L3
        call g
.L3:
        call g
        addl $12,%esp
        ret
.Lfe1:
        .size    f,.Lfe1-f
        .ident  "GCC: (GNU) 2.95.4 20011002 (Debian prerelease)"


-- 

aldot at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aldot at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |missed-optimization
      Known to fail|                            |3.3 3.4.6 4.0.4 4.1.3 4.2.2
      Known to work|                            |2.95.4
   Last reconfirmed|0000-00-00 00:00:00         |2007-12-14 11:05:43
               date|                            |
            Summary|suboptimal code generation  |[4.0/4.1/4.2/4.3 Regression]
                   |                            |redundant jumps


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


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

* [Bug rtl-optimization/29978] [4.0/4.1/4.2/4.3 Regression] redundant jumps
  2006-11-25 18:22 [Bug rtl-optimization/29978] New: suboptimal code generation vda dot linux at googlemail dot com
  2007-07-21 23:36 ` [Bug rtl-optimization/29978] " vda dot linux at googlemail dot com
  2007-12-14 11:05 ` [Bug rtl-optimization/29978] [4.0/4.1/4.2/4.3 Regression] redundant jumps aldot at gcc dot gnu dot org
@ 2007-12-14 11:24 ` aldot at gcc dot gnu dot org
  2007-12-14 11:32 ` [Bug target/29978] " pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: aldot at gcc dot gnu dot org @ 2007-12-14 11:24 UTC (permalink / raw)
  To: gcc-bugs



-- 

aldot at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.3.0


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


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

* [Bug target/29978] [4.0/4.1/4.2/4.3 Regression] redundant jumps
  2006-11-25 18:22 [Bug rtl-optimization/29978] New: suboptimal code generation vda dot linux at googlemail dot com
                   ` (2 preceding siblings ...)
  2007-12-14 11:24 ` aldot at gcc dot gnu dot org
@ 2007-12-14 11:32 ` pinskia at gcc dot gnu dot org
  2007-12-14 13:04 ` jakub at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-12-14 11:32 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
          Component|rtl-optimization            |target
  GCC build triplet|i386-pc-linux-gnu           |
   GCC host triplet|i386-pc-linux-gnu           |
   Target Milestone|4.3.0                       |4.1.3


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


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

* [Bug target/29978] [4.0/4.1/4.2/4.3 Regression] redundant jumps
  2006-11-25 18:22 [Bug rtl-optimization/29978] New: suboptimal code generation vda dot linux at googlemail dot com
                   ` (3 preceding siblings ...)
  2007-12-14 11:32 ` [Bug target/29978] " pinskia at gcc dot gnu dot org
@ 2007-12-14 13:04 ` jakub at gcc dot gnu dot org
  2007-12-14 18:01 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-12-14 13:04 UTC (permalink / raw)
  To: gcc-bugs



-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-12-14 11:05:43         |2007-12-14 13:03:59
               date|                            |


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


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

* [Bug target/29978] [4.0/4.1/4.2/4.3 Regression] redundant jumps
  2006-11-25 18:22 [Bug rtl-optimization/29978] New: suboptimal code generation vda dot linux at googlemail dot com
                   ` (4 preceding siblings ...)
  2007-12-14 13:04 ` jakub at gcc dot gnu dot org
@ 2007-12-14 18:01 ` jakub at gcc dot gnu dot org
  2007-12-14 18:31 ` [Bug target/29978] [4.0/4.1/4.2 " jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-12-14 18:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2007-12-14 18:00 -------
Subject: Bug 29978

Author: jakub
Date: Fri Dec 14 18:00:39 2007
New Revision: 130938

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130938
Log:
        PR target/29978
        * config/i386/i386.c (ix86_expand_branch): Optimize LE/LEU/GT/GTU
        DImode comparisons against constant with all 1's in the lower word.

        * gcc.target/i386/pr29978.c: New test.

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


-- 


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


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

* [Bug target/29978] [4.0/4.1/4.2 Regression] redundant jumps
  2006-11-25 18:22 [Bug rtl-optimization/29978] New: suboptimal code generation vda dot linux at googlemail dot com
                   ` (5 preceding siblings ...)
  2007-12-14 18:01 ` jakub at gcc dot gnu dot org
@ 2007-12-14 18:31 ` jakub at gcc dot gnu dot org
  2008-07-04 21:45 ` [Bug target/29978] [4.2 " jsm28 at gcc dot gnu dot org
  2009-03-30 19:43 ` jsm28 at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-12-14 18:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2007-12-14 18:30 -------
Fixed on the trunk.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|2.95.4                      |2.95.4 4.3.0
            Summary|[4.0/4.1/4.2/4.3 Regression]|[4.0/4.1/4.2 Regression]
                   |redundant jumps             |redundant jumps


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


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

* [Bug target/29978] [4.2 Regression] redundant jumps
  2006-11-25 18:22 [Bug rtl-optimization/29978] New: suboptimal code generation vda dot linux at googlemail dot com
                   ` (6 preceding siblings ...)
  2007-12-14 18:31 ` [Bug target/29978] [4.0/4.1/4.2 " jakub at gcc dot gnu dot org
@ 2008-07-04 21:45 ` jsm28 at gcc dot gnu dot org
  2009-03-30 19:43 ` jsm28 at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 21:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jsm28 at gcc dot gnu dot org  2008-07-04 21:44 -------
Closing 4.1 branch.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.1/4.2 Regression]        |[4.2 Regression] redundant
                   |redundant jumps             |jumps
   Target Milestone|4.1.3                       |4.2.5


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


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

* [Bug target/29978] [4.2 Regression] redundant jumps
  2006-11-25 18:22 [Bug rtl-optimization/29978] New: suboptimal code generation vda dot linux at googlemail dot com
                   ` (7 preceding siblings ...)
  2008-07-04 21:45 ` [Bug target/29978] [4.2 " jsm28 at gcc dot gnu dot org
@ 2009-03-30 19:43 ` jsm28 at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-30 19:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jsm28 at gcc dot gnu dot org  2009-03-30 19:42 -------
Closing 4.2 branch, fixed in 4.3.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to fail|3.3 3.4.6 4.0.4 4.1.3 4.2.2 |3.3 3.4.6 4.0.4 4.1.3 4.2.2
                   |                            |4.2.5
         Resolution|                            |FIXED
   Target Milestone|4.2.5                       |4.3.0


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


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

end of thread, other threads:[~2009-03-30 19:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-25 18:22 [Bug rtl-optimization/29978] New: suboptimal code generation vda dot linux at googlemail dot com
2007-07-21 23:36 ` [Bug rtl-optimization/29978] " vda dot linux at googlemail dot com
2007-12-14 11:05 ` [Bug rtl-optimization/29978] [4.0/4.1/4.2/4.3 Regression] redundant jumps aldot at gcc dot gnu dot org
2007-12-14 11:24 ` aldot at gcc dot gnu dot org
2007-12-14 11:32 ` [Bug target/29978] " pinskia at gcc dot gnu dot org
2007-12-14 13:04 ` jakub at gcc dot gnu dot org
2007-12-14 18:01 ` jakub at gcc dot gnu dot org
2007-12-14 18:31 ` [Bug target/29978] [4.0/4.1/4.2 " jakub at gcc dot gnu dot org
2008-07-04 21:45 ` [Bug target/29978] [4.2 " jsm28 at gcc dot gnu dot org
2009-03-30 19:43 ` jsm28 at gcc dot gnu dot org

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