public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/51274] New: Starting with GCC 4.5, powerpc generated different code for x != 0.
@ 2011-11-22 23:42 meissner at gcc dot gnu.org
  2011-11-22 23:57 ` [Bug target/51274] " meissner at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: meissner at gcc dot gnu.org @ 2011-11-22 23:42 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51274
           Summary: Starting with GCC 4.5, powerpc generated different
                    code for x != 0.
    Classification: Unclassified
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: meissner@gcc.gnu.org
              Host: powerpc64-linux power-linux
            Target: powerpc64-linux
             Build: powerpc64-linux


In doing some investigation for optimizations of comparisons for power7, I
noticed that starting with GCC 4.5, the compiler no longer generates the code
it used to for setting x = (y != 0).  In the rs6000.md file, these
optimizations start with the insn "ne0si".

In the 4.4 time frame, for -m32 (and for -m32 -mpowerpc64, which is PR 36557),
gcc would generate:
        addic 9,3,-1
        subfe 0,9,3

However, it wouldn't generate this code for -m64.  Starting with 4.5, it
generates the code for !(x == 0), or:
        cntlzw 3,3
        srwi 3,3,5
        xori 3,3,1

We should either remove the insns in rs6000.md that no longer are matching, or
fix them so they do match.  I suspect that the longer code sequence is actually
faster on the newer processors, since you don't need to track the carry between
the two insns.


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

* [Bug target/51274] Starting with GCC 4.5, powerpc generated different code for x != 0.
  2011-11-22 23:42 [Bug target/51274] New: Starting with GCC 4.5, powerpc generated different code for x != 0 meissner at gcc dot gnu.org
@ 2011-11-22 23:57 ` meissner at gcc dot gnu.org
  2012-09-26  5:19 ` segher at gcc dot gnu.org
  2012-09-26  5:35 ` segher at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: meissner at gcc dot gnu.org @ 2011-11-22 23:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Michael Meissner <meissner at gcc dot gnu.org> 2011-11-22 23:12:43 UTC ---
Created attachment 25889
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25889
Example test case


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

* [Bug target/51274] Starting with GCC 4.5, powerpc generated different code for x != 0.
  2011-11-22 23:42 [Bug target/51274] New: Starting with GCC 4.5, powerpc generated different code for x != 0 meissner at gcc dot gnu.org
  2011-11-22 23:57 ` [Bug target/51274] " meissner at gcc dot gnu.org
@ 2012-09-26  5:19 ` segher at gcc dot gnu.org
  2012-09-26  5:35 ` segher at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: segher at gcc dot gnu.org @ 2012-09-26  5:19 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Segher Boessenkool <segher at gcc dot gnu.org> 2012-09-26 05:18:49 UTC ---
Author: segher
Date: Wed Sep 26 05:18:43 2012
New Revision: 191752

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191752
Log:
gcc/
    PR target/51274
    PR target/53087
    * config/rs6000/rs6000.md (ne0si): Remove unnecessary
    earlyclobber.  Merge with...
    (ne0di): ... to...
    (ne0_<mode>): New.
    (plus_ne0si): Merge with...
    (plus_ne0di): ... to...
    (plus_ne0_<mode>): New.
    (compare_plus_ne0si): Merge with...
    (compare_plus_ne0di)... to...
    (compare_plus_ne0_<mode>): New.
    (compare_plus_ne0_<mode>_1): New.
    (plus_ne0si_compare): Merge with...
    (plus_ne0di_compare)... to...
    (plus_ne0_<mode>_compare): New.

gcc/testsuite/
    PR target/51274
    PR target/53087
    * gcc.target/powerpc/ppc-ne0-1.c: New.

Added:
    trunk/gcc/testsuite/gcc.target/powerpc/ppc-ne0-1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/rs6000/rs6000.md
    trunk/gcc/testsuite/ChangeLog


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

* [Bug target/51274] Starting with GCC 4.5, powerpc generated different code for x != 0.
  2011-11-22 23:42 [Bug target/51274] New: Starting with GCC 4.5, powerpc generated different code for x != 0 meissner at gcc dot gnu.org
  2011-11-22 23:57 ` [Bug target/51274] " meissner at gcc dot gnu.org
  2012-09-26  5:19 ` segher at gcc dot gnu.org
@ 2012-09-26  5:35 ` segher at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: segher at gcc dot gnu.org @ 2012-09-26  5:35 UTC (permalink / raw)
  To: gcc-bugs


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

Segher Boessenkool <segher at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |segher at gcc dot gnu.org
         Resolution|                            |FIXED

--- Comment #3 from Segher Boessenkool <segher at gcc dot gnu.org> 2012-09-26 05:35:06 UTC ---
Fixed.


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

end of thread, other threads:[~2012-09-26  5:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-22 23:42 [Bug target/51274] New: Starting with GCC 4.5, powerpc generated different code for x != 0 meissner at gcc dot gnu.org
2011-11-22 23:57 ` [Bug target/51274] " meissner at gcc dot gnu.org
2012-09-26  5:19 ` segher at gcc dot gnu.org
2012-09-26  5:35 ` segher at gcc dot gnu.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).