This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Is this a feature ?
- From: "raok at city dot fi" <raok at city dot fi>
- To: gcc-help at gcc dot gnu dot org
- Cc:
- Date: Mon, 11 May 2009 20:31:40 +0300
- Subject: Is this a feature ?
Hello,
I do not know if this is the right place to write, but please redirect
me if I should ask from some other place.
I wrote a code and compiled it with -O3. The interesting line is
following:
reg = (reg >> 8) ^ table[reg & 0xFF];
It produced:
mov edx, eax
movzx eax, al
shr dx, 8
xor dx, WORD PTR [ebx+eax*2]
I was wondering why there was that extra mov on the first line. So I
ended up to write it all as:
reg = table[reg & 0xFF] ^ (reg >> 8);
And it produced:
movzx edx, al
shr ax, 8
xor ax, WORD PTR [ebx+edx*2]
I do not know if this is a feature or bug but which ever it is, it would
be nice to know.
Risto Kivilahti
-----------------------------------------------------------------
Nuoren Suomen 24/7-seksitutkimus: http://www.vikakerta.fi/