public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/29401]  New: [regression] missed-optimization (in unneeded code elimination)
@ 2006-10-09 12:52 Petr dot Salinger at seznam dot cz
  2006-10-09 12:57 ` [Bug target/29401] " pluto at agmk dot net
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Petr dot Salinger at seznam dot cz @ 2006-10-09 12:52 UTC (permalink / raw)
  To: gcc-bugs

Hi.

There is a regression on i386 platforms.


int f(int a, int b)
{return (((long long) a) * b) >> 15;}

The gcc 4.0/4.1 generates with "-O3 -fomit-frame-pointer"

        movl    8(%esp), %eax
        imull   4(%esp)
        shrdl   $15, %edx, %eax
        sarl    $15, %edx
        ret

While gcc-3.3/3.4 generates equal and faster

        movl    8(%esp), %eax
        imull   4(%esp)
        shrdl   $15, %edx, %eax
        ret


-- 
           Summary: [regression] missed-optimization (in unneeded code
                    elimination)
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Petr dot Salinger at seznam dot cz
  GCC host triplet: i486


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


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

* [Bug target/29401] [regression] missed-optimization (in unneeded code elimination)
  2006-10-09 12:52 [Bug target/29401] New: [regression] missed-optimization (in unneeded code elimination) Petr dot Salinger at seznam dot cz
@ 2006-10-09 12:57 ` pluto at agmk dot net
  2006-10-09 12:59 ` pluto at agmk dot net
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pluto at agmk dot net @ 2006-10-09 12:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pluto at agmk dot net  2006-10-09 12:57 -------
looks similar to PR26674.


-- 

pluto at agmk dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pluto at agmk dot net


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


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

* [Bug target/29401] [regression] missed-optimization (in unneeded code elimination)
  2006-10-09 12:52 [Bug target/29401] New: [regression] missed-optimization (in unneeded code elimination) Petr dot Salinger at seznam dot cz
  2006-10-09 12:57 ` [Bug target/29401] " pluto at agmk dot net
@ 2006-10-09 12:59 ` pluto at agmk dot net
  2006-10-09 14:58 ` [Bug target/29401] [4.0/4.1/4.2 Regression] " rguenth at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pluto at agmk dot net @ 2006-10-09 12:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pluto at agmk dot net  2006-10-09 12:59 -------
(In reply to comment #1)
> looks similar to PR26674.
> 

oops, please ignore this comment.


-- 

pluto at agmk dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|pluto at agmk dot net       |


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


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

* [Bug target/29401] [4.0/4.1/4.2 Regression] missed-optimization (in unneeded code elimination)
  2006-10-09 12:52 [Bug target/29401] New: [regression] missed-optimization (in unneeded code elimination) Petr dot Salinger at seznam dot cz
  2006-10-09 12:57 ` [Bug target/29401] " pluto at agmk dot net
  2006-10-09 12:59 ` pluto at agmk dot net
@ 2006-10-09 14:58 ` rguenth at gcc dot gnu dot org
  2006-10-15 21:19 ` mmitchel at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-10-09 14:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2006-10-09 14:58 -------
Confirmed.  Ok for x86_64:

f:
.LFB2:
        movslq  %edi,%rdi
        movslq  %esi,%rsi
        imulq   %rdi, %rsi
        sarq    $15, %rsi
        movl    %esi, %eax
        ret

We are expanding (int) ((long long int) b * (long long int) a >> 15).

We split

(insn:HI 11 31 12 2 (parallel [
            (set (reg:DI 0 ax [62])
                (mult:DI (sign_extend:DI (reg/v:SI 0 ax [orig:60 b ] [60]))
                    (sign_extend:DI (mem/c/i:SI (plus:SI (reg/f:SI 7 sp)
                                (const_int 4 [0x4])) [2 a+0 S4 A32]))))
            (clobber (reg:CC 17 flags))
        ]) 265 {*mulsidi3_insn} (insn_list:REG_DEP_TRUE 7 (nil))
    (expr_list:REG_UNUSED (reg:CC 17 flags)
        (nil)))

(insn:HI 12 11 17 2 (parallel [
            (set (reg:DI 0 ax [62])
                (ashiftrt:DI (reg:DI 0 ax [62])
                    (const_int 15 [0xf])))
            (clobber (reg:CC 17 flags))
        ]) 437 {*ashrdi3_1} (insn_list:REG_DEP_TRUE 11 (nil))
    (expr_list:REG_UNUSED (reg:CC 17 flags)
        (expr_list:REG_UNUSED (reg:SI 1 dx)
            (nil))))

into

(insn:TI 11 31 37 2 (parallel [
            (set (reg:DI 0 ax [62])
                (mult:DI (sign_extend:DI (reg/v:SI 0 ax [orig:60 b ] [60]))
                    (sign_extend:DI (mem/c/i:SI (plus:SI (reg/f:SI 7 sp)
                                (const_int 4 [0x4])) [2 a+0 S4 A32]))))
            (clobber (reg:CC 17 flags))
        ]) 265 {*mulsidi3_insn} (nil)
    (expr_list:REG_UNUSED (reg:CC 17 flags)
        (nil)))

(insn:TI 37 11 38 2 (parallel [
            (set (reg:SI 0 ax [62])
                (ior:SI (ashiftrt:SI (reg:SI 0 ax [62])
                        (const_int 15 [0xf]))
                    (ashift:SI (reg:SI 1 dx [+4 ])
                        (minus:QI (const_int 32 [0x20])
                            (const_int 15 [0xf])))))
            (clobber (reg:CC 17 flags))
        ]) 438 {x86_shrd_1} (nil)
    (expr_list:REG_UNUSED (reg:CC 17 flags)
        (nil)))

(insn:TI 38 37 26 2 (parallel [
            (set (reg:SI 1 dx [+4 ])
                (ashiftrt:SI (reg:SI 1 dx [+4 ])
                    (const_int 15 [0xf])))
            (clobber (reg:CC 17 flags))
        ]) 443 {*ashrsi3_1} (nil)
    (expr_list:REG_UNUSED (reg:CC 17 flags)
        (expr_list:REG_UNUSED (reg:SI 1 dx [+4 ])
            (nil))))

note the problematic partially dead DI ax:dx which flow does not handle,
so the redundant instruction does not get deleted.  A peephole might be
able to fix this until new dataflow maybe handles this case(?).


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org, hubicka at gcc dot gnu
                   |                            |dot org
           Severity|enhancement                 |normal
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   GCC host triplet|i486                        |
 GCC target triplet|                            |i?86-*-*
      Known to fail|4.0.3 4.1.1                 |4.0.3 4.1.1 4.2.0
   Last reconfirmed|0000-00-00 00:00:00         |2006-10-09 14:58:01
               date|                            |
            Summary|[regression] missed-        |[4.0/4.1/4.2 Regression]
                   |optimization (in unneeded   |missed-optimization (in
                   |code elimination)           |unneeded code elimination)
   Target Milestone|---                         |4.0.4


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


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

* [Bug target/29401] [4.0/4.1/4.2 Regression] missed-optimization (in unneeded code elimination)
  2006-10-09 12:52 [Bug target/29401] New: [regression] missed-optimization (in unneeded code elimination) Petr dot Salinger at seznam dot cz
                   ` (2 preceding siblings ...)
  2006-10-09 14:58 ` [Bug target/29401] [4.0/4.1/4.2 Regression] " rguenth at gcc dot gnu dot org
@ 2006-10-15 21:19 ` mmitchel at gcc dot gnu dot org
  2006-10-15 22:20 ` hubicka at ucw dot cz
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-10-15 21:19 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

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


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


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

* [Bug target/29401] [4.0/4.1/4.2 Regression] missed-optimization (in unneeded code elimination)
  2006-10-09 12:52 [Bug target/29401] New: [regression] missed-optimization (in unneeded code elimination) Petr dot Salinger at seznam dot cz
                   ` (3 preceding siblings ...)
  2006-10-15 21:19 ` mmitchel at gcc dot gnu dot org
@ 2006-10-15 22:20 ` hubicka at ucw dot cz
  2007-02-03 20:34 ` [Bug target/29401] [4.0/4.1/4.2/4.3 " gdr at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: hubicka at ucw dot cz @ 2006-10-15 22:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from hubicka at ucw dot cz  2006-10-15 22:20 -------
Subject: Re:  [4.0/4.1/4.2 Regression] missed-optimization (in unneeded code
elimination)

> (insn:TI 38 37 26 2 (parallel [
>             (set (reg:SI 1 dx [+4 ])
>                 (ashiftrt:SI (reg:SI 1 dx [+4 ])
>                     (const_int 15 [0xf])))
>             (clobber (reg:CC 17 flags))
>         ]) 443 {*ashrsi3_1} (nil)
>     (expr_list:REG_UNUSED (reg:CC 17 flags)
>         (expr_list:REG_UNUSED (reg:SI 1 dx [+4 ])
>             (nil))))
> 
> note the problematic partially dead DI ax:dx which flow does not handle,
> so the redundant instruction does not get deleted.  A peephole might be
> able to fix this until new dataflow maybe handles this case(?).

It seems to me that the instruction is completely dead from post-reload
dataflow point of view (ie return value is just eax and both sets are
correctly marked as unused).  Perhaps we just somehow managed to drop
post-read DCE?

Honza


-- 


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


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

* [Bug target/29401] [4.0/4.1/4.2/4.3 Regression] missed-optimization (in unneeded code elimination)
  2006-10-09 12:52 [Bug target/29401] New: [regression] missed-optimization (in unneeded code elimination) Petr dot Salinger at seznam dot cz
                   ` (4 preceding siblings ...)
  2006-10-15 22:20 ` hubicka at ucw dot cz
@ 2007-02-03 20:34 ` gdr at gcc dot gnu dot org
  2007-02-03 21:01 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: gdr at gcc dot gnu dot org @ 2007-02-03 20:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from gdr at gcc dot gnu dot org  2007-02-03 20:33 -------
won't fix in GCC-4.0.x.  Adjusting milestone.


-- 

gdr at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.4                       |4.1.3


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


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

* [Bug target/29401] [4.0/4.1/4.2/4.3 Regression] missed-optimization (in unneeded code elimination)
  2006-10-09 12:52 [Bug target/29401] New: [regression] missed-optimization (in unneeded code elimination) Petr dot Salinger at seznam dot cz
                   ` (5 preceding siblings ...)
  2007-02-03 20:34 ` [Bug target/29401] [4.0/4.1/4.2/4.3 " gdr at gcc dot gnu dot org
@ 2007-02-03 21:01 ` pinskia at gcc dot gnu dot org
  2007-02-14  9:18 ` mmitchel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-03 21:01 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.1.3                       |4.1.2


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


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

* [Bug target/29401] [4.0/4.1/4.2/4.3 Regression] missed-optimization (in unneeded code elimination)
  2006-10-09 12:52 [Bug target/29401] New: [regression] missed-optimization (in unneeded code elimination) Petr dot Salinger at seznam dot cz
                   ` (6 preceding siblings ...)
  2007-02-03 21:01 ` pinskia at gcc dot gnu dot org
@ 2007-02-14  9:18 ` mmitchel at gcc dot gnu dot org
  2007-06-18  5:31 ` [Bug target/29401] [4.0/4.1/4.2 " pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-02-14  9:18 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.1.2                       |4.1.3


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


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

* [Bug target/29401] [4.0/4.1/4.2 Regression] missed-optimization (in unneeded code elimination)
  2006-10-09 12:52 [Bug target/29401] New: [regression] missed-optimization (in unneeded code elimination) Petr dot Salinger at seznam dot cz
                   ` (7 preceding siblings ...)
  2007-02-14  9:18 ` mmitchel at gcc dot gnu dot org
@ 2007-06-18  5:31 ` pinskia at gcc dot gnu dot org
  2008-07-04 21:37 ` [Bug target/29401] [4.2 " jsm28 at gcc dot gnu dot org
  2009-03-30 19:39 ` jsm28 at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-06-18  5:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2007-06-18 05:31 -------
This has now been fixed on the trunk.  I think most likely by the dataflow
branch merge.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|3.3.6 3.4.6                 |3.3.6 3.4.6 4.3.0
            Summary|[4.0/4.1/4.2/4.3 Regression]|[4.0/4.1/4.2 Regression]
                   |missed-optimization (in     |missed-optimization (in
                   |unneeded code elimination)  |unneeded code elimination)


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


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

* [Bug target/29401] [4.2 Regression] missed-optimization (in unneeded code elimination)
  2006-10-09 12:52 [Bug target/29401] New: [regression] missed-optimization (in unneeded code elimination) Petr dot Salinger at seznam dot cz
                   ` (8 preceding siblings ...)
  2007-06-18  5:31 ` [Bug target/29401] [4.0/4.1/4.2 " pinskia at gcc dot gnu dot org
@ 2008-07-04 21:37 ` jsm28 at gcc dot gnu dot org
  2009-03-30 19:39 ` jsm28 at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 21:37 UTC (permalink / raw)
  To: gcc-bugs



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


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.1/4.2 Regression] missed-|[4.2 Regression] missed-
                   |optimization (in unneeded   |optimization (in unneeded
                   |code elimination)           |code elimination)
   Target Milestone|4.1.3                       |4.2.5


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


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

* [Bug target/29401] [4.2 Regression] missed-optimization (in unneeded code elimination)
  2006-10-09 12:52 [Bug target/29401] New: [regression] missed-optimization (in unneeded code elimination) Petr dot Salinger at seznam dot cz
                   ` (9 preceding siblings ...)
  2008-07-04 21:37 ` [Bug target/29401] [4.2 " jsm28 at gcc dot gnu dot org
@ 2009-03-30 19:39 ` jsm28 at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-30 19:39 UTC (permalink / raw)
  To: gcc-bugs



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


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to fail|4.0.3 4.0.4 4.1.1 4.2.0     |4.0.3 4.0.4 4.1.1 4.2.0
                   |                            |4.2.5
         Resolution|                            |FIXED
   Target Milestone|4.2.5                       |4.3.0


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


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

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

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-09 12:52 [Bug target/29401] New: [regression] missed-optimization (in unneeded code elimination) Petr dot Salinger at seznam dot cz
2006-10-09 12:57 ` [Bug target/29401] " pluto at agmk dot net
2006-10-09 12:59 ` pluto at agmk dot net
2006-10-09 14:58 ` [Bug target/29401] [4.0/4.1/4.2 Regression] " rguenth at gcc dot gnu dot org
2006-10-15 21:19 ` mmitchel at gcc dot gnu dot org
2006-10-15 22:20 ` hubicka at ucw dot cz
2007-02-03 20:34 ` [Bug target/29401] [4.0/4.1/4.2/4.3 " gdr at gcc dot gnu dot org
2007-02-03 21:01 ` pinskia at gcc dot gnu dot org
2007-02-14  9:18 ` mmitchel at gcc dot gnu dot org
2007-06-18  5:31 ` [Bug target/29401] [4.0/4.1/4.2 " pinskia at gcc dot gnu dot org
2008-07-04 21:37 ` [Bug target/29401] [4.2 " jsm28 at gcc dot gnu dot org
2009-03-30 19:39 ` 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).