Strange optimization in GCC 4.7.2
David Given
dg@cowlark.com
Tue Jul 23 12:57:00 GMT 2013
Konstantin Vladimirov wrote:
[...]
> x = (y & ~(1 << 7)) | (((value >> 9) & 1) << 7);
[...]
> x = y & 4294967167 | (value >> 9) << 7 & 255; <--------- WAT?
((value >> 9) & 1) << 7
== ((value >> 9) << 7) & (1 << 7)
== ((value >> 9) << 7) & 0x80
== ((value >> 9) << 7) & 0xff
...I think.
That last step is probably being done because anding with 0xff is really
cheap on x86 (you just pick the appropriate subreg --- al instead of
eax, for example).
--
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│ "USER'S MANUAL VERSION 1.0: The information presented in this
│ publication has been carefully for reliability." --- anonymous
│ computer hardware manual
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20130723/d20aa15d/attachment.sig>
More information about the Gcc
mailing list