public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/42522] (zero_extract:SI (mem:QI) ...) misoptimized
       [not found] <bug-42522-4@http.gcc.gnu.org/bugzilla/>
@ 2011-05-03 13:00 ` ami_stuff at o2 dot pl
  2012-02-20  2:02 ` mikpe at it dot uu.se
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: ami_stuff at o2 dot pl @ 2011-05-03 13:00 UTC (permalink / raw)
  To: gcc-bugs

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

ami_stuff <ami_stuff at o2 dot pl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |

--- Comment #15 from ami_stuff <ami_stuff at o2 dot pl> 2011-05-03 12:34:47 UTC ---
Almost 1,5 year passed and still no one cares to fix a long-standing, critical
bug which generates a broken code for m68k target (ffmpeg, sox, ...).


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

* [Bug rtl-optimization/42522] (zero_extract:SI (mem:QI) ...) misoptimized
       [not found] <bug-42522-4@http.gcc.gnu.org/bugzilla/>
  2011-05-03 13:00 ` [Bug rtl-optimization/42522] (zero_extract:SI (mem:QI) ...) misoptimized ami_stuff at o2 dot pl
@ 2012-02-20  2:02 ` mikpe at it dot uu.se
  2015-02-06 22:06 ` law at redhat dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: mikpe at it dot uu.se @ 2012-02-20  2:02 UTC (permalink / raw)
  To: gcc-bugs

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

Mikael Pettersson <mikpe at it dot uu.se> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikpe at it dot uu.se

--- Comment #16 from Mikael Pettersson <mikpe at it dot uu.se> 2012-02-19 23:48:41 UTC ---
Since r171341 (a big complex optabs cleanup patch) trunk aka 4.7 generates

bar:
        move.l 4(%sp),%a0
        tst.b (%a0)
        jne .L3
        clr.l %d1
        move.b 1(%a0),%d1
        swap %d1
        clr.w %d1
        clr.l %d0
        move.b 2(%a0),%d0
        lsl.l #8,%d0
        or.l %d1,%d0
        or.b 3(%a0),%d0
        moveq #8,%d1
        cmp.l %d0,%d1
        scs %d0
        extb.l %d0
        neg.l %d0
        rts
.L3:
        clr.l %d0
        rts

for the m68k-elf target.  (The code is much better for m68k-linux.)


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

* [Bug rtl-optimization/42522] (zero_extract:SI (mem:QI) ...) misoptimized
       [not found] <bug-42522-4@http.gcc.gnu.org/bugzilla/>
  2011-05-03 13:00 ` [Bug rtl-optimization/42522] (zero_extract:SI (mem:QI) ...) misoptimized ami_stuff at o2 dot pl
  2012-02-20  2:02 ` mikpe at it dot uu.se
@ 2015-02-06 22:06 ` law at redhat dot com
  2015-04-15 12:25 ` law at gcc dot gnu.org
  2015-04-15 12:27 ` law at redhat dot com
  4 siblings, 0 replies; 9+ messages in thread
From: law at redhat dot com @ 2015-02-06 22:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42522

Jeffrey A. Law <law at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at redhat dot com

--- Comment #17 from Jeffrey A. Law <law at redhat dot com> ---
This bug has gone latent on the trunk; however, the problem still remains that
cse will incorrectly simplify a ZERO/SIGN_EXTRACT in some cases.

ZERO/SIGN_EXTRACT are somewhat special in that if they are extracting from a
memory operand, that memory operand will always have QImode regardless of the
size of the extracted field.

ie, the mode of the MEM in a ZERO/SIGN_EXTRACT does not really mean anything
and the ZERO/SIGN_EXTRACT can read bits beyond QImode.

So given a (mem:QI x) with an equivalence to (const_int 0) in the hash tables. 
If we have an extraction like

(zero_extract:SI (mem:QI x) (const_int 0) (const_int 24))

CSE will substitute (const_int 0) for the MEM in the extraction resulting in

(zero_extract:SI (const_int 0) (const_int 0) (const_int 24))

Which simplifies to (const_int 0)

For REGs, the mode is the same as the operand of the insv/extv pattern, and may
(or may not) more closely resemble reality depending on the target.

The safe thing to do in CSE is to lookup the ZERO/SIGN_EXTRACT as a whole.

Given the bug is latent and not currently a regression this will need to wait
for the next stage1 development cycle.


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

* [Bug rtl-optimization/42522] (zero_extract:SI (mem:QI) ...) misoptimized
       [not found] <bug-42522-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2015-02-06 22:06 ` law at redhat dot com
@ 2015-04-15 12:25 ` law at gcc dot gnu.org
  2015-04-15 12:27 ` law at redhat dot com
  4 siblings, 0 replies; 9+ messages in thread
From: law at gcc dot gnu.org @ 2015-04-15 12:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42522

--- Comment #18 from Jeffrey A. Law <law at gcc dot gnu.org> ---
Author: law
Date: Wed Apr 15 12:24:28 2015
New Revision: 222125

URL: https://gcc.gnu.org/viewcvs?rev=222125&root=gcc&view=rev
Log:
        PR rtl-optimization/42522
        * cse.c (fold_rtx): Try to simplify a ZERO_EXTRACT or
        SIGN_EXTRACT as a whole object rather than simplifying
        its operand.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cse.c


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

* [Bug rtl-optimization/42522] (zero_extract:SI (mem:QI) ...) misoptimized
       [not found] <bug-42522-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2015-04-15 12:25 ` law at gcc dot gnu.org
@ 2015-04-15 12:27 ` law at redhat dot com
  4 siblings, 0 replies; 9+ messages in thread
From: law at redhat dot com @ 2015-04-15 12:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42522

Jeffrey A. Law <law at redhat dot com> changed:

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

--- Comment #19 from Jeffrey A. Law <law at redhat dot com> ---
This bug was latent on the trunk.  I've committed a fix so that it shouldn't
ever come back again.


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

* [Bug rtl-optimization/42522] (zero_extract:SI (mem:QI) ...) misoptimized
  2009-12-28 20:15 [Bug c/42522] New: [m68k] Wrong code generated with -O2/-O3 ami_stuff at o2 dot pl
                   ` (2 preceding siblings ...)
  2010-01-18 10:26 ` rguenth at gcc dot gnu dot org
@ 2010-05-09 13:54 ` ami_stuff at o2 dot pl
  3 siblings, 0 replies; 9+ messages in thread
From: ami_stuff at o2 dot pl @ 2010-05-09 13:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from ami_stuff at o2 dot pl  2010-05-09 13:54 -------
Any chance to see this bug fixed in the near future?


-- 


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


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

* [Bug rtl-optimization/42522] (zero_extract:SI (mem:QI) ...) misoptimized
  2009-12-28 20:15 [Bug c/42522] New: [m68k] Wrong code generated with -O2/-O3 ami_stuff at o2 dot pl
  2010-01-17 22:27 ` [Bug rtl-optimization/42522] (zero_extract:SI (mem:QI) ...) misoptimized schwab at linux-m68k dot org
  2010-01-17 22:35 ` schwab at linux-m68k dot org
@ 2010-01-18 10:26 ` rguenth at gcc dot gnu dot org
  2010-05-09 13:54 ` ami_stuff at o2 dot pl
  3 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-01-18 10:26 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
      Known to fail|4.3.4 4.4.3                 |4.3.4 4.4.3 4.5.0
   Target Milestone|4.4.4                       |---


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


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

* [Bug rtl-optimization/42522] (zero_extract:SI (mem:QI) ...) misoptimized
  2009-12-28 20:15 [Bug c/42522] New: [m68k] Wrong code generated with -O2/-O3 ami_stuff at o2 dot pl
  2010-01-17 22:27 ` [Bug rtl-optimization/42522] (zero_extract:SI (mem:QI) ...) misoptimized schwab at linux-m68k dot org
@ 2010-01-17 22:35 ` schwab at linux-m68k dot org
  2010-01-18 10:26 ` rguenth at gcc dot gnu dot org
  2010-05-09 13:54 ` ami_stuff at o2 dot pl
  3 siblings, 0 replies; 9+ messages in thread
From: schwab at linux-m68k dot org @ 2010-01-17 22:35 UTC (permalink / raw)
  To: gcc-bugs



-- 

schwab at linux-m68k dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |4.3.4 4.4.3
   Target Milestone|---                         |4.4.4


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


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

* [Bug rtl-optimization/42522] (zero_extract:SI (mem:QI) ...) misoptimized
  2009-12-28 20:15 [Bug c/42522] New: [m68k] Wrong code generated with -O2/-O3 ami_stuff at o2 dot pl
@ 2010-01-17 22:27 ` schwab at linux-m68k dot org
  2010-01-17 22:35 ` schwab at linux-m68k dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: schwab at linux-m68k dot org @ 2010-01-17 22:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from schwab at linux-m68k dot org  2010-01-17 22:27 -------
The bug exists since the dawn of time.  The problem is that cse thinks that
(zero_extract:SI (mem:QI ...) ...) is zero if (mem:QI ...) is known to be zero,
but the first argument of zero_extract is only a base address if it is a memory
address.  On m68k this is only generated when STRICT_ALIGNMENT, and the bug was
hidden until e2496245b8453f49bb4428f281af7686be09ddf8:

2000-07-17  Zack Weinberg  <zack@wolery.cumb.org>
        (simplify_ternary_operation):  Do not examine MODE_BITSIZE of
           a CONST_INT, it will always be zero.


-- 

schwab at linux-m68k dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|target                      |rtl-optimization
     Ever Confirmed|0                           |1
 GCC target triplet|m68k-*-*                    |m68k-*-elf
   Last reconfirmed|0000-00-00 00:00:00         |2010-01-17 22:27:47
               date|                            |
            Summary|[m68k] Wrong code generated |(zero_extract:SI (mem:QI)
                   |with -O2/-O3                |...) misoptimized


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


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

end of thread, other threads:[~2015-04-15 12:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-42522-4@http.gcc.gnu.org/bugzilla/>
2011-05-03 13:00 ` [Bug rtl-optimization/42522] (zero_extract:SI (mem:QI) ...) misoptimized ami_stuff at o2 dot pl
2012-02-20  2:02 ` mikpe at it dot uu.se
2015-02-06 22:06 ` law at redhat dot com
2015-04-15 12:25 ` law at gcc dot gnu.org
2015-04-15 12:27 ` law at redhat dot com
2009-12-28 20:15 [Bug c/42522] New: [m68k] Wrong code generated with -O2/-O3 ami_stuff at o2 dot pl
2010-01-17 22:27 ` [Bug rtl-optimization/42522] (zero_extract:SI (mem:QI) ...) misoptimized schwab at linux-m68k dot org
2010-01-17 22:35 ` schwab at linux-m68k dot org
2010-01-18 10:26 ` rguenth at gcc dot gnu dot org
2010-05-09 13:54 ` ami_stuff at o2 dot pl

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