public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
[parent not found: <bug-16458-8614@http.gcc.gnu.org/bugzilla/>]
* [Bug regression/16458] New: PowerPC - redundant compare
@ 2004-07-09 18:05 gcc-bugzilla at gcc dot gnu dot org
  2004-11-10 10:27 ` [Bug middle-end/16458] " nathan at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2004-07-09 18:05 UTC (permalink / raw)
  To: gcc-bugs

Description:
A non-optimal compare sequence is illustrated.  Two compares are being
done, one signed and the other unsigned.  One unsigned compare would
suffice.  Duplicate using gcc 3.5 and command line:

gcc -O3 -m64 -c test.c

Testcase:
unsigned int a, b;

int foo ()
{
  if (a == b) return 1;
  if (a > b)  return 2;
  if (a < b)  return 3;
  if (a != b) return 4;
  return 0;
}

Assembly:
      ld 9,.LC1@toc(2)
      li 3,1
      ld 11,.LC0@toc(2)
      lwz 10,0(9)
      lwz 0,0(11)
      cmpw 7,0,10   - signed compare of a and b
      cmplw 6,0,10  - unsigned compare of a and b
      beqlr- 7      - (a == b uses signed compare)
      li 3,2
      bgtlr- 6      - (a > b uses unsigned compare)
      li 3,4
      bgelr- 6      - (a != b uses unsigned compare)
      li 3,3
      blr



-- 
           Summary: PowerPC - redundant compare
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P1
         Component: regression
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: steinmtz at us dot ibm dot com
                CC: gcc-bugs at gcc dot gnu dot org,steinmtz at us dot ibm
                    dot com
 GCC build triplet: powerpc64-linux
  GCC host triplet: powerpc64-linux
GCC target triplet: powerpc64-linux


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


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

end of thread, other threads:[~2013-02-28 20:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-16458-4@http.gcc.gnu.org/bugzilla/>
2011-12-14 22:46 ` [Bug middle-end/16458] PowerPC - redundant compare bergner at gcc dot gnu.org
2012-01-27 15:31 ` bergner at gcc dot gnu.org
2012-02-24 17:43 ` [Bug target/16458] " bergner at gcc dot gnu.org
2012-04-11 11:52 ` bergner at gcc dot gnu.org
2012-04-11 12:00 ` bergner at gcc dot gnu.org
2012-06-02 20:29 ` bergner at gcc dot gnu.org
2013-02-28 20:21 ` bergner at gcc dot gnu.org
     [not found] <bug-16458-8614@http.gcc.gnu.org/bugzilla/>
2005-11-02 17:16 ` [Bug middle-end/16458] " pinskia at gcc dot gnu dot org
2004-07-09 18:05 [Bug regression/16458] New: " gcc-bugzilla at gcc dot gnu dot org
2004-11-10 10:27 ` [Bug middle-end/16458] " nathan at gcc dot gnu dot org
2004-11-11  8:39 ` nathan at gcc dot gnu dot org
2004-11-11  8:41 ` cvs-commit 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).