public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/11457] New:
@ 2003-07-07 22:20 gcc-bugzilla at gcc dot gnu dot org
2003-07-07 22:34 ` [Bug target/11457] [3.3/3.4 Regression] redundant compare pinskia at physics dot uc dot edu
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2003-07-07 22:20 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11457
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: user42 at zip dot com dot au
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i386-pc-linux-gnu
GCC host triplet: i386-pc-linux-gnu
GCC target triplet: i386-pc-linux-gnu
When presented with tests like "n>=0" followed by "n==0", two i386
"test" instructions are generated, where one would suffice. This is
apparently a regression from some point, since for instance gcc 2.95.4
generates only one.
Environment:
System: Linux blah 2.2.15 #1 Tue Apr 25 17:13:48 EST 2000 i586 unknown unknown GNU/Linux
Architecture: i586
<machine, os, target, libraries (multiple lines)>
host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i386-linux
How-To-Repeat:
A file foo.c containing
void
foo (int n)
{
if (n >= 0)
{
if (n == 0)
zero ();
else
non_negative ();
}
else
negative ();
}
compiled with
gcc -O2 -S foo.c
produces foo.s containing the sequence
testl %eax, %eax
js .L2
testl %eax, %eax
jne .L3
I think the second "testl" is unnecessary, and that the code would be
smaller and probably faster if it was omitted.
It seems this was done in the past, for instance a recent Debian
packaged gcc 2.95.4 does it,
testl %eax,%eax
jl .L3
jne .L4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/11457] [3.3/3.4 Regression] redundant compare
2003-07-07 22:20 [Bug optimization/11457] New: gcc-bugzilla at gcc dot gnu dot org
@ 2003-07-07 22:34 ` pinskia at physics dot uc dot edu
2003-07-19 20:55 ` pinskia at physics dot uc dot edu
2003-08-24 19:43 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-07 22:34 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11457
pinskia at physics dot uc dot edu changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Component|optimization |target
Ever Confirmed| |1
Keywords| |pessimizes-code
Priority|P3 |P2
Last reconfirmed|0000-00-00 00:00:00 |2003-07-07 22:34:41
date| |
Summary| |[3.3/3.4 Regression]
| |redundant compare
Target Milestone|--- |3.4
------- Additional Comments From pinskia at physics dot uc dot edu 2003-07-07 22:34 -------
I can confirm this on 3.3.1 (20030616) and the mainline (20030707), 3.2.3, and 3.0.4 but 2.95.3
did not produce the redundant compare so this is a regression.
On PPC, I do not get a redundant compare though:
_foo:
cmpwi cr7,r3,0
blt- cr7,L2
bne- cr7,L3
b L_zero$stub
L3:
b L_non_negative$stub
L2:
b L_negative$stub
Or on Vax:
foo:
.word 0x0
subl2 $4,%sp
movl 4(%ap),%r0
jlss .L2
jneq .L3
calls $0,zero
ret
.L3:
calls $0,non_negative
ret
.L2:
calls $0,negative
ret
Or arm:
foo:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
cmp r0, #0
@ lr needed for prologue
blt .L2
bne .L3
b zero
.L3:
b non_negative
.L2:
b negative
So it looks very ia32 specific.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/11457] [3.3/3.4 Regression] redundant compare
2003-07-07 22:20 [Bug optimization/11457] New: gcc-bugzilla at gcc dot gnu dot org
2003-07-07 22:34 ` [Bug target/11457] [3.3/3.4 Regression] redundant compare pinskia at physics dot uc dot edu
@ 2003-07-19 20:55 ` pinskia at physics dot uc dot edu
2003-08-24 19:43 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-19 20:55 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11457
pinskia at physics dot uc dot edu changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|3.4 |3.3.2
------- Additional Comments From pinskia at physics dot uc dot edu 2003-07-19 20:55 -------
Moving target to 3.3.2 since this is a regression.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/11457] [3.3/3.4 Regression] redundant compare
2003-07-07 22:20 [Bug optimization/11457] New: gcc-bugzilla at gcc dot gnu dot org
2003-07-07 22:34 ` [Bug target/11457] [3.3/3.4 Regression] redundant compare pinskia at physics dot uc dot edu
2003-07-19 20:55 ` pinskia at physics dot uc dot edu
@ 2003-08-24 19:43 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-24 19:43 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11457
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |DUPLICATE
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-08-24 19:43 -------
This is a dup of bug 1532 which has a different testcase but it shows the same bug.
*** This bug has been marked as a duplicate of 1532 ***
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-08-24 19:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-07 22:20 [Bug optimization/11457] New: gcc-bugzilla at gcc dot gnu dot org
2003-07-07 22:34 ` [Bug target/11457] [3.3/3.4 Regression] redundant compare pinskia at physics dot uc dot edu
2003-07-19 20:55 ` pinskia at physics dot uc dot edu
2003-08-24 19:43 ` pinskia 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).