public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/38751]  New: Odd performance regression with -Os
@ 2009-01-07 10:04 aph at gcc dot gnu dot org
  2009-01-07 10:11 ` [Bug middle-end/38751] [4.2/4.3/4.4] odd " ebotcazou at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: aph at gcc dot gnu dot org @ 2009-01-07 10:04 UTC (permalink / raw)
  To: gcc-bugs

Here's a strange case of poor code generation with -Os.

unsigned short foo2 (unsigned char on_off, unsigned short *puls)
{
  return puls[on_off-1];
}

With -O2, it's fine:

        movzbl  %dil, %edi
        movzwl  -2(%rsi,%rdi,2), %eax
        ret

With -Os it's really weird:

        movzbl  %dil, %eax
        movl    $1, %edi
        subq    %rax, %rdi
        imulq   $-2, %rdi, %rdi
        movw    (%rdi,%rsi), %ax
        ret

The problem here seems to be that the FE (or the GIMPLE generation)
transforms

        addr + ((on_off-1)*2)

into

        addr + ((1-on_off)*-2)

and nothing in -Os has the wit to recover.  This badly affects targets
with no hardware multiplier, which end up calling libgcc to do the
multiply.

http://gcc.gnu.org/ml/gcc/2008-12/msg00329.html


-- 
           Summary: Odd performance regression with -Os
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: aph at gcc dot gnu dot org


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


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

* [Bug middle-end/38751] [4.2/4.3/4.4] odd performance regression with -Os
  2009-01-07 10:04 [Bug middle-end/38751] New: Odd performance regression with -Os aph at gcc dot gnu dot org
@ 2009-01-07 10:11 ` ebotcazou at gcc dot gnu dot org
  2009-01-07 10:53 ` [Bug middle-end/38751] [4.2/4.3/4.4 regression] " rguenth at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2009-01-07 10:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from ebotcazou at gcc dot gnu dot org  2009-01-07 10:11 -------
Fallout of the change made for PR middle-end/23294 in GCC 4.2.


-- 

ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-01-07 10:11:38
               date|                            |
            Summary|Odd performance regression  |[4.2/4.3/4.4] odd
                   |with -Os                    |performance regression with
                   |                            |-Os


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


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

* [Bug middle-end/38751] [4.2/4.3/4.4 regression] odd performance regression with -Os
  2009-01-07 10:04 [Bug middle-end/38751] New: Odd performance regression with -Os aph at gcc dot gnu dot org
  2009-01-07 10:11 ` [Bug middle-end/38751] [4.2/4.3/4.4] odd " ebotcazou at gcc dot gnu dot org
@ 2009-01-07 10:53 ` rguenth at gcc dot gnu dot org
  2009-01-15  1:13 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-01-07 10:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2009-01-07 10:53 -------
Subject: Bug 38751

Author: rguenth
Date: Wed Jan  7 10:53:30 2009
New Revision: 143152

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143152
Log:
2009-01-07  Richard Guenther  <rguenther@suse.de>

        PR middle-end/38751
        * fold-const.c (extract_muldiv): Remove obsolete comment.
        (fold_plusminus_mult_expr): Undo MINUS_EXPR
        to PLUS_EXPR canonicalization for the canonicalization.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c


-- 


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


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

* [Bug middle-end/38751] [4.2/4.3/4.4 regression] odd performance regression with -Os
  2009-01-07 10:04 [Bug middle-end/38751] New: Odd performance regression with -Os aph at gcc dot gnu dot org
  2009-01-07 10:11 ` [Bug middle-end/38751] [4.2/4.3/4.4] odd " ebotcazou at gcc dot gnu dot org
  2009-01-07 10:53 ` [Bug middle-end/38751] [4.2/4.3/4.4 regression] " rguenth at gcc dot gnu dot org
@ 2009-01-15  1:13 ` pinskia at gcc dot gnu dot org
  2009-01-15 13:57 ` [Bug middle-end/38751] [4.2/4.3 " jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-01-15  1:13 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
           Keywords|                            |missed-optimization
   Target Milestone|---                         |4.2.5


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


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

* [Bug middle-end/38751] [4.2/4.3 regression] odd performance regression with -Os
  2009-01-07 10:04 [Bug middle-end/38751] New: Odd performance regression with -Os aph at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-01-15  1:13 ` pinskia at gcc dot gnu dot org
@ 2009-01-15 13:57 ` jakub at gcc dot gnu dot org
  2009-01-15 16:16 ` rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-01-15 13:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2009-01-15 13:57 -------
Fixed on the trunk:
-O2:
        movzbl  %dil, %edi
        movzwl  -2(%rsi,%rdi,2), %eax
        ret
-Os:
        movzbl  %dil, %edi
        movw    -2(%rsi,%rdi,2), %ax
        ret


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.2/4.3/4.4 regression] odd|[4.2/4.3 regression] odd
                   |performance regression with |performance regression with
                   |-Os                         |-Os


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


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

* [Bug middle-end/38751] [4.2/4.3 regression] odd performance regression with -Os
  2009-01-07 10:04 [Bug middle-end/38751] New: Odd performance regression with -Os aph at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2009-01-15 13:57 ` [Bug middle-end/38751] [4.2/4.3 " jakub at gcc dot gnu dot org
@ 2009-01-15 16:16 ` rguenth at gcc dot gnu dot org
  2009-03-31 21:07 ` [Bug middle-end/38751] [4.3 " jsm28 at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-01-15 16:16 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug middle-end/38751] [4.3 regression] odd performance regression with -Os
  2009-01-07 10:04 [Bug middle-end/38751] New: Odd performance regression with -Os aph at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2009-01-15 16:16 ` rguenth at gcc dot gnu dot org
@ 2009-03-31 21:07 ` jsm28 at gcc dot gnu dot org
  2009-04-22 15:20 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-31 21:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jsm28 at gcc dot gnu dot org  2009-03-31 21:06 -------
Closing 4.2 branch.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.2/4.3 regression] odd    |[4.3 regression] odd
                   |performance regression with |performance regression with
                   |-Os                         |-Os
   Target Milestone|4.2.5                       |4.3.4


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


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

* [Bug middle-end/38751] [4.3 regression] odd performance regression with -Os
  2009-01-07 10:04 [Bug middle-end/38751] New: Odd performance regression with -Os aph at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2009-03-31 21:07 ` [Bug middle-end/38751] [4.3 " jsm28 at gcc dot gnu dot org
@ 2009-04-22 15:20 ` rguenth at gcc dot gnu dot org
  2009-06-25 12:39 ` [Bug middle-end/38751] [4.3 Regression] " rguenth at gcc dot gnu dot org
  2009-06-25 12:39 ` rguenth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-22 15:20 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2009-01-07 10:11:38         |2009-04-22 15:20:44
               date|                            |


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


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

* [Bug middle-end/38751] [4.3 Regression] odd performance regression with -Os
  2009-01-07 10:04 [Bug middle-end/38751] New: Odd performance regression with -Os aph at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2009-06-25 12:39 ` [Bug middle-end/38751] [4.3 Regression] " rguenth at gcc dot gnu dot org
@ 2009-06-25 12:39 ` rguenth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-06-25 12:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2009-06-25 12:39 -------
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

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


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


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

* [Bug middle-end/38751] [4.3 Regression] odd performance regression with -Os
  2009-01-07 10:04 [Bug middle-end/38751] New: Odd performance regression with -Os aph at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2009-04-22 15:20 ` rguenth at gcc dot gnu dot org
@ 2009-06-25 12:39 ` rguenth at gcc dot gnu dot org
  2009-06-25 12:39 ` rguenth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-06-25 12:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2009-06-25 12:39 -------
Subject: Bug 38751

Author: rguenth
Date: Thu Jun 25 12:39:01 2009
New Revision: 148943

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=148943
Log:
2009-06-25  Richard Guenther  <rguenther@suse.de>

        Backport from mainline
        2009-01-07  Richard Guenther  <rguenther@suse.de>

        PR middle-end/38751
        * fold-const.c (extract_muldiv): Remove obsolete comment.
        (fold_plusminus_mult_expr): Undo MINUS_EXPR
        to PLUS_EXPR canonicalization for the canonicalization.

Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/fold-const.c


-- 


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


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

end of thread, other threads:[~2009-06-25 12:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-07 10:04 [Bug middle-end/38751] New: Odd performance regression with -Os aph at gcc dot gnu dot org
2009-01-07 10:11 ` [Bug middle-end/38751] [4.2/4.3/4.4] odd " ebotcazou at gcc dot gnu dot org
2009-01-07 10:53 ` [Bug middle-end/38751] [4.2/4.3/4.4 regression] " rguenth at gcc dot gnu dot org
2009-01-15  1:13 ` pinskia at gcc dot gnu dot org
2009-01-15 13:57 ` [Bug middle-end/38751] [4.2/4.3 " jakub at gcc dot gnu dot org
2009-01-15 16:16 ` rguenth at gcc dot gnu dot org
2009-03-31 21:07 ` [Bug middle-end/38751] [4.3 " jsm28 at gcc dot gnu dot org
2009-04-22 15:20 ` rguenth at gcc dot gnu dot org
2009-06-25 12:39 ` [Bug middle-end/38751] [4.3 Regression] " rguenth at gcc dot gnu dot org
2009-06-25 12:39 ` rguenth 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).