public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/45739]  New: [missed optimization] static evaluation of SSE intrinsics (pxor)
@ 2010-09-21 10:13 kretz at kde dot org
  2010-09-21 10:25 ` [Bug target/45739] " rguenth at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: kretz at kde dot org @ 2010-09-21 10:13 UTC (permalink / raw)
  To: gcc-bugs

Testcase:
#include <emmintrin.h>
__m128i foo;
int main()
{
    foo = _mm_xor_si128(_mm_setzero_si128(), foo);
    return 0;
}

Resulting Assembly (with -O3):
pxor    %xmm0, %xmm0
xorl    %eax, %eax
pxor    foo(%rip), %xmm0
movdqa  %xmm0, foo(%rip)
ret

Expected Result:
since any value xor zero does not change the value the static evaluation step
of GCC should eliminate the pxor instruction altogether.

Likewise the call to _mm_xor_si128 on two constants should be statically
evaluated and if the destination register would not change the call should be
eliminated.

Rationale:
a) of course removing unnecessary code is always nice
b) the implementation of correct unsigned integer compare can be done with pxor
and 0x80000000. All unsigned compares against constant values can thus be
improved.


-- 
           Summary: [missed optimization] static evaluation of SSE
                    intrinsics (pxor)
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kretz at kde dot org
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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


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

* [Bug target/45739] static evaluation of SSE intrinsics (pxor)
  2010-09-21 10:13 [Bug middle-end/45739] New: [missed optimization] static evaluation of SSE intrinsics (pxor) kretz at kde dot org
@ 2010-09-21 10:25 ` rguenth at gcc dot gnu dot org
  2010-09-21 11:27 ` jakub at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-09-21 10:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2010-09-21 10:25 -------
Confirmed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
          Component|middle-end                  |target
     Ever Confirmed|0                           |1
           Keywords|                            |missed-optimization
   Last reconfirmed|0000-00-00 00:00:00         |2010-09-21 10:25:16
               date|                            |
            Summary|[missed optimization] static|static evaluation of SSE
                   |evaluation of SSE intrinsics|intrinsics (pxor)
                   |(pxor)                      |


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


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

* [Bug target/45739] static evaluation of SSE intrinsics (pxor)
  2010-09-21 10:13 [Bug middle-end/45739] New: [missed optimization] static evaluation of SSE intrinsics (pxor) kretz at kde dot org
  2010-09-21 10:25 ` [Bug target/45739] " rguenth at gcc dot gnu dot org
@ 2010-09-21 11:27 ` jakub at gcc dot gnu dot org
  2010-09-21 12:24 ` [Bug rtl-optimization/45739] " jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-09-21 11:27 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|2010-09-21 10:25:16         |2010-09-21 11:27:37
               date|                            |


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


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

* [Bug rtl-optimization/45739] static evaluation of SSE intrinsics (pxor)
  2010-09-21 10:13 [Bug middle-end/45739] New: [missed optimization] static evaluation of SSE intrinsics (pxor) kretz at kde dot org
  2010-09-21 10:25 ` [Bug target/45739] " rguenth at gcc dot gnu dot org
  2010-09-21 11:27 ` jakub at gcc dot gnu dot org
@ 2010-09-21 12:24 ` jakub at gcc dot gnu dot org
  2010-09-21 23:33 ` jakub at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-09-21 12:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2010-09-21 12:23 -------
Created an attachment (id=21856)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21856&action=view)
gcc46-pr45739.patch

Fix.  For further optimizations (like vector A | ~0, A | ~A, A ^ ~0, A & ~0), I
guess we'd need something like CONST_ALL_ONES_RTX (mode) and sharing that in
const_tiny_rtx.


-- 


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


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

* [Bug rtl-optimization/45739] static evaluation of SSE intrinsics (pxor)
  2010-09-21 10:13 [Bug middle-end/45739] New: [missed optimization] static evaluation of SSE intrinsics (pxor) kretz at kde dot org
                   ` (2 preceding siblings ...)
  2010-09-21 12:24 ` [Bug rtl-optimization/45739] " jakub at gcc dot gnu dot org
@ 2010-09-21 23:33 ` jakub at gcc dot gnu dot org
  2010-09-22  0:06 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-09-21 23:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2010-09-21 23:33 -------
Subject: Bug 45739

Author: jakub
Date: Tue Sep 21 23:33:01 2010
New Revision: 164501

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164501
Log:
        PR rtl-optimization/45739
        * simplify-rtx.c (simplify_binary_operation_1): Optimize even
        vector mode | CONST0_RTX (mode) and ^ CONST0_RTX (mode).

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

Added:
    trunk/gcc/testsuite/gcc.target/i386/pr45739.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/simplify-rtx.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug rtl-optimization/45739] static evaluation of SSE intrinsics (pxor)
  2010-09-21 10:13 [Bug middle-end/45739] New: [missed optimization] static evaluation of SSE intrinsics (pxor) kretz at kde dot org
                   ` (3 preceding siblings ...)
  2010-09-21 23:33 ` jakub at gcc dot gnu dot org
@ 2010-09-22  0:06 ` jakub at gcc dot gnu dot org
  2010-09-22  2:57 ` howarth at nitro dot med dot uc dot edu
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-09-22  0:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2010-09-22 00:06 -------
Fixed.


-- 

jakub at gcc dot gnu dot org changed:

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


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


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

* [Bug rtl-optimization/45739] static evaluation of SSE intrinsics (pxor)
  2010-09-21 10:13 [Bug middle-end/45739] New: [missed optimization] static evaluation of SSE intrinsics (pxor) kretz at kde dot org
                   ` (4 preceding siblings ...)
  2010-09-22  0:06 ` jakub at gcc dot gnu dot org
@ 2010-09-22  2:57 ` howarth at nitro dot med dot uc dot edu
  2010-09-22  3:11 ` howarth at nitro dot med dot uc dot edu
  2010-09-22  8:58 ` jakub at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: howarth at nitro dot med dot uc dot edu @ 2010-09-22  2:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from howarth at nitro dot med dot uc dot edu  2010-09-22 02:56 -------
(In reply to comment #4)
> Fixed.
> 

The new trunk/gcc/testsuite/gcc.target/i386/pr45739.c erroneously fails on
x86_64-apple-darwin10 as ...

FAIL: gcc.target/i386/pr45739.c scan-assembler-not por

since it is matching...

        .section
__TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support

Adding...

/* { dg-prune-output ".*live_support*" } */

to gcc.target/i386/pr45739.c solves this issue.


-- 


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


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

* [Bug rtl-optimization/45739] static evaluation of SSE intrinsics (pxor)
  2010-09-21 10:13 [Bug middle-end/45739] New: [missed optimization] static evaluation of SSE intrinsics (pxor) kretz at kde dot org
                   ` (5 preceding siblings ...)
  2010-09-22  2:57 ` howarth at nitro dot med dot uc dot edu
@ 2010-09-22  3:11 ` howarth at nitro dot med dot uc dot edu
  2010-09-22  8:58 ` jakub at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: howarth at nitro dot med dot uc dot edu @ 2010-09-22  3:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from howarth at nitro dot med dot uc dot edu  2010-09-22 03:10 -------
My mistake... dg-prune-output is insufficient to prevent scan-assembler-not
from accidentally matching on live_support in the intel darwin assembly.


-- 

howarth at nitro dot med dot uc dot edu changed:

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


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


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

* [Bug rtl-optimization/45739] static evaluation of SSE intrinsics (pxor)
  2010-09-21 10:13 [Bug middle-end/45739] New: [missed optimization] static evaluation of SSE intrinsics (pxor) kretz at kde dot org
                   ` (6 preceding siblings ...)
  2010-09-22  3:11 ` howarth at nitro dot med dot uc dot edu
@ 2010-09-22  8:58 ` jakub at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-09-22  8:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jakub at gcc dot gnu dot org  2010-09-22 08:57 -------
Subject: Bug 45739

Author: jakub
Date: Wed Sep 22 08:57:38 2010
New Revision: 164516

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164516
Log:
        PR rtl-optimization/45739
        * gcc.target/i386/pr45739.c: Tighten up scan-assembler-not
        regexps.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.target/i386/pr45739.c


-- 


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


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

end of thread, other threads:[~2010-09-22  8:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-21 10:13 [Bug middle-end/45739] New: [missed optimization] static evaluation of SSE intrinsics (pxor) kretz at kde dot org
2010-09-21 10:25 ` [Bug target/45739] " rguenth at gcc dot gnu dot org
2010-09-21 11:27 ` jakub at gcc dot gnu dot org
2010-09-21 12:24 ` [Bug rtl-optimization/45739] " jakub at gcc dot gnu dot org
2010-09-21 23:33 ` jakub at gcc dot gnu dot org
2010-09-22  0:06 ` jakub at gcc dot gnu dot org
2010-09-22  2:57 ` howarth at nitro dot med dot uc dot edu
2010-09-22  3:11 ` howarth at nitro dot med dot uc dot edu
2010-09-22  8:58 ` jakub 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).