public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/43233] New: x86 flags not combined across blocks
@ 2010-03-02 19:17 astrange at ithinksw dot com
2010-05-13 23:33 ` [Bug target/43233] " steven at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: astrange at ithinksw dot com @ 2010-03-02 19:17 UTC (permalink / raw)
To: gcc-bugs
Source:
int g1,g2,g3;
int f1(int a, int b)
{
a &= 1;
if (a) return g1;
return g2;
}
int f2(int a, int b)
{
a &= 1;
if (b)
g3++;
if (a) return g1;
return g2;
}
Compiled with:
> gcc -O3 -fomit-frame-pointer -S and_flags.c
f1 is ok but f2 generates this:
_f2:
andl $1, %edi <-- #1
testl %esi, %esi
je L7
movq _g3@GOTPCREL(%rip), %rax
incl (%rax)
L7:
testl %edi, %edi <-- #2
jne L10
movq _g2@GOTPCREL(%rip), %rax
movl (%rax), %eax
ret
.align 4,0x90
L10:
movq _g1@GOTPCREL(%rip), %rax
movl (%rax), %eax
ret
The andl and testl should be folded into one andl.
Code is reduced from ffmpeg h264 decoder. It's easy to work around by
reordering source lines, so not too important.
--
Summary: x86 flags not combined across blocks
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: astrange at ithinksw dot com
GCC host triplet: x86_64-*-*
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43233
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug target/43233] x86 flags not combined across blocks
2010-03-02 19:17 [Bug target/43233] New: x86 flags not combined across blocks astrange at ithinksw dot com
@ 2010-05-13 23:33 ` steven at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: steven at gcc dot gnu dot org @ 2010-05-13 23:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from steven at gcc dot gnu dot org 2010-05-13 23:33 -------
Confirmed, this is a case where a def could be sunk closer to its first use.
--
steven at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |missed-optimization
Last reconfirmed|0000-00-00 00:00:00 |2010-05-13 23:33:29
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43233
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-05-13 23:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-02 19:17 [Bug target/43233] New: x86 flags not combined across blocks astrange at ithinksw dot com
2010-05-13 23:33 ` [Bug target/43233] " steven 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).