https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46235
Bug 46235 depends on bug 104982, which changed state.
Bug 104982 Summary: [12 Regression] FAIL: gcc.target/i386/bt-5.c by r12-7687
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104982
What|Removed |Added
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46235
Roger Sayle changed:
What|Removed |Added
CC||roger at nextmovesoftware dot
com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46235
--- Comment #6 from CVS Commits ---
The master branch has been updated by Roger Sayle :
https://gcc.gnu.org/g:3155d51bfd1de8b6c4645dcb2292248a8d7cc3c9
commit r12-1525-g3155d51bfd1de8b6c4645dcb2292248a8d7cc3c9
Author: Roger Sayle
Date: Wed Ju
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46235
--- Comment #5 from chris.a.ferguson at gmail dot com ---
This optimization opportunity is still being missed as of GCC 4.9.
Test cases:
bool IsBitSet1(unsigned char byte, int index)
{
return (byte & (1<> index) & 1;
}
>From GCC 4.9:
IsBit
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46235
--- Comment #4 from Tony Poppleton 2011-01-28
18:08:15 UTC ---
As a quick test, I commented out the block with the following comment in
fold-const.c:
/* If this is an EQ or NE comparison with zero and ARG0 is
(1 << foo) & bar, conv
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46235
--- Comment #3 from Tony Poppleton 2011-01-28
17:02:50 UTC ---
Actually what I said above isn't correct - had it compiled down to "bt $4, %al"
then it would make sense to do that special case, but as it used "testb" it is
inconclusive.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46235
--- Comment #2 from Tony Poppleton 2011-01-28
16:55:48 UTC ---
Based on Richard's comment, I tried a modified version of the code replacing
the (1 << x) with just (16).
This shows that GCC (4.6 & 4.5.2) does perform an optimization similar to ll
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46235
--- Comment #1 from Richard Guenther 2010-10-30
18:21:48 UTC ---
We canonicalize a & (1 << x) to (a >> x) & 1 very early.