public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/45617] New: optimize bit shift+compare at RTL level
@ 2010-09-09 17:48 zsojka at seznam dot cz
2010-09-09 17:51 ` [Bug rtl-optimization/45617] " zsojka at seznam dot cz
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: zsojka at seznam dot cz @ 2010-09-09 17:48 UTC (permalink / raw)
To: gcc-bugs
+++ This bug was initially created as a clone of Bug #20517 +++
>From comment #4:
----- testcase.c -----
_Bool foo(unsigned i)
{
return (i >> 5) > 10;
}
_Bool bar(unsigned i)
{
return i > (10 << 5) + 31;
}
int fooi(unsigned i)
{
return (i >> 5) > 10;
}
int bari(unsigned i)
{
return i > (10 << 5) + 31;
}
----------------------
Compiled with:
$ gcc-4.6.0-pre9999 tst6.c -O3 -S -m32 -fomit-frame-pointer
(svn r162190)
Results in:
foo:
movl 4(%esp), %eax
shrl $5, %eax
cmpl $10, %eax
seta %al
ret
bar:
cmpl $351, 4(%esp)
seta %al
ret
fooi:
movl 4(%esp), %eax
shrl $5, %eax
cmpl $10, %eax
seta %al
movzbl %al, %eax
ret
bari:
xorl %eax, %eax
cmpl $351, 4(%esp)
seta %al
ret
--
Summary: optimize bit shift+compare at RTL level
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: zsojka at seznam dot cz
GCC target triplet: x86(_64)-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45617
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug rtl-optimization/45617] optimize bit shift+compare at RTL level
2010-09-09 17:48 [Bug rtl-optimization/45617] New: optimize bit shift+compare at RTL level zsojka at seznam dot cz
@ 2010-09-09 17:51 ` zsojka at seznam dot cz
2010-09-13 21:00 ` jakub at gcc dot gnu dot org
2010-09-13 21:10 ` jakub at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: zsojka at seznam dot cz @ 2010-09-09 17:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from zsojka at seznam dot cz 2010-09-09 17:51 -------
Created an attachment (id=21756)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21756&action=view)
Jakub's patch from PR20517 comment #6
gcc bootstrapped fine
The resulting code for foo() and fooi() is the same as for bar() and bari(),
respectively.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45617
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug rtl-optimization/45617] optimize bit shift+compare at RTL level
2010-09-09 17:48 [Bug rtl-optimization/45617] New: optimize bit shift+compare at RTL level zsojka at seznam dot cz
2010-09-09 17:51 ` [Bug rtl-optimization/45617] " zsojka at seznam dot cz
@ 2010-09-13 21:00 ` jakub at gcc dot gnu dot org
2010-09-13 21:10 ` jakub at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-09-13 21:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from jakub at gcc dot gnu dot org 2010-09-13 21:00 -------
Subject: Bug 45617
Author: jakub
Date: Mon Sep 13 21:00:03 2010
New Revision: 164257
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164257
Log:
PR rtl-optimization/45617
* combine.c (simplify_comparison): Optimize (X >> N) {>,>=,<,<=} C
even if low N bits of X aren't known to be zero.
* gcc.target/i386/pr45617.c: New test.
Added:
trunk/gcc/testsuite/gcc.target/i386/pr45617.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/combine.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45617
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug rtl-optimization/45617] optimize bit shift+compare at RTL level
2010-09-09 17:48 [Bug rtl-optimization/45617] New: optimize bit shift+compare at RTL level zsojka at seznam dot cz
2010-09-09 17:51 ` [Bug rtl-optimization/45617] " zsojka at seznam dot cz
2010-09-13 21:00 ` jakub at gcc dot gnu dot org
@ 2010-09-13 21:10 ` jakub at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-09-13 21:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jakub at gcc dot gnu dot org 2010-09-13 21:10 -------
Committed.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45617
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-09-13 21:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-09 17:48 [Bug rtl-optimization/45617] New: optimize bit shift+compare at RTL level zsojka at seznam dot cz
2010-09-09 17:51 ` [Bug rtl-optimization/45617] " zsojka at seznam dot cz
2010-09-13 21:00 ` jakub at gcc dot gnu dot org
2010-09-13 21:10 ` jakub 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).