Feature request concerning bitwise operations
Wen Li
wenli380@gmail.com
Mon Jan 11 07:14:00 GMT 2010
On x86 processors, I think bitwise operators should be optimized for
individual bit accesses, which should be converted to BT instructions.
For example:
x |= 1<<y; compiles to BTS instead of SHL/OR
x ^= 1<<y; compiles to BTC instead of SHL/XOR
x &= ~(1<<y); compiles to BTR instead of SHL/NOT/AND
if (x&(1<<y))... compiles to BT instead of SHL/AND
Especially when y is not known at compile time, this will provide a
significant performance increase.
More information about the Gcc
mailing list