Is this a feature ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux