public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/52070] New: missing integer comparison optimization
@ 2012-01-31 21:12 drepper.fsp at gmail dot com
2012-02-01 2:32 ` [Bug tree-optimization/52070] " pinskia at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: drepper.fsp at gmail dot com @ 2012-01-31 21:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52070
Bug #: 52070
Summary: missing integer comparison optimization
Classification: Unclassified
Product: gcc
Version: 4.6.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: drepper.fsp@gmail.com
Compile this code with gcc 4.6.2:
#include <stddef.h>
size_t b;
int f(size_t a)
{
return b == 0 || a < b;
}
For x86-64 I see this result:
f: movq b(%rip), %rdx
movl $1, %eax
testq %rdx, %rdx
je .L2
xorl %eax, %eax
cmpq %rdi, %rdx
seta %al
.L2: rep ret
This can be more done without a conditional jump:
f: movq b(%rip), %rdx
xorl %eax, %eax
subq $1, %rdx
cmpq %rdi, %rdx
setae %al
rep ret
Unless the b==0 test is marked as likely I'd say this code is performing better
on all architectures.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/52070] missing integer comparison optimization
2012-01-31 21:12 [Bug tree-optimization/52070] New: missing integer comparison optimization drepper.fsp at gmail dot com
@ 2012-02-01 2:32 ` pinskia at gcc dot gnu.org
2012-02-01 9:25 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-02-01 2:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52070
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-02-01
Ever Confirmed|0 |1
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-02-01 02:31:51 UTC ---
Confirmed, I have a few patches which might improve this but maybe not for
x86_64; it does help MIPS right now.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/52070] missing integer comparison optimization
2012-01-31 21:12 [Bug tree-optimization/52070] New: missing integer comparison optimization drepper.fsp at gmail dot com
2012-02-01 2:32 ` [Bug tree-optimization/52070] " pinskia at gcc dot gnu.org
@ 2012-02-01 9:25 ` rguenth at gcc dot gnu.org
2021-07-26 20:13 ` [Bug middle-end/52070] " pinskia at gcc dot gnu.org
2023-07-01 11:21 ` roger at nextmovesoftware dot com
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-02-01 9:25 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52070
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/52070] missing integer comparison optimization
2012-01-31 21:12 [Bug tree-optimization/52070] New: missing integer comparison optimization drepper.fsp at gmail dot com
2012-02-01 2:32 ` [Bug tree-optimization/52070] " pinskia at gcc dot gnu.org
2012-02-01 9:25 ` rguenth at gcc dot gnu.org
@ 2021-07-26 20:13 ` pinskia at gcc dot gnu.org
2023-07-01 11:21 ` roger at nextmovesoftware dot com
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-26 20:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52070
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2012-02-01 00:00:00 |2021-7-26
Component|tree-optimization |middle-end
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
_6 = b.1_1 > a_4(D);
_7 = b.1_1 == 0;
_8 = _6 | _7;
So this is an expansion issue I think.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/52070] missing integer comparison optimization
2012-01-31 21:12 [Bug tree-optimization/52070] New: missing integer comparison optimization drepper.fsp at gmail dot com
` (2 preceding siblings ...)
2021-07-26 20:13 ` [Bug middle-end/52070] " pinskia at gcc dot gnu.org
@ 2023-07-01 11:21 ` roger at nextmovesoftware dot com
3 siblings, 0 replies; 5+ messages in thread
From: roger at nextmovesoftware dot com @ 2023-07-01 11:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52070
Roger Sayle <roger at nextmovesoftware dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |roger at nextmovesoftware dot com
Resolution|--- |FIXED
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=96674
Target Milestone|--- |13.0
Status|NEW |RESOLVED
--- Comment #3 from Roger Sayle <roger at nextmovesoftware dot com> ---
This has been fixed (optimally) since GCC 13, by Eugene Rozenfeld's fix for PR
tree-optimization/96674. The conditional jump was eliminated back in GCC 4.9,
but the combination of the two tests into a subtraction and a single comparison
was implemented (at the tree level) by Eugene.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-07-01 11:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-31 21:12 [Bug tree-optimization/52070] New: missing integer comparison optimization drepper.fsp at gmail dot com
2012-02-01 2:32 ` [Bug tree-optimization/52070] " pinskia at gcc dot gnu.org
2012-02-01 9:25 ` rguenth at gcc dot gnu.org
2021-07-26 20:13 ` [Bug middle-end/52070] " pinskia at gcc dot gnu.org
2023-07-01 11:21 ` roger at nextmovesoftware dot com
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).