Displaying 2 results from an estimated 2 matches for "0123456789abcdefh".
Did you mean:
0123456789abcdef
2018 Nov 25
3
BUGS n code generated for target i386 compiling __bswapdi3, and for target x86-64 compiling __bswapsi2()
bswapdi2 for i386 is correct
Bits 31:0 of the source are loaded into edx. Bits 63:32 are loaded into
eax. Those are each bswapped. The ABI for the return is edx contains bits
[63:32] and eax contains [31:0]. This is opposite of how the register were
loaded.
~Craig
On Sun, Nov 25, 2018 at 10:36 AM Craig Topper <craig.topper at gmail.com>
wrote:
> bswapsi2 on the x86-64 isn't using
2018 Nov 25
2
BUGS n code generated for target i386 compiling __bswapdi3, and for target x86-64 compiling __bswapsi2()
...oaded into EDX:EAX, the instruction sequence
>
> bswap edx
> bswap eax
> xchg eax, edx
>
> is NOT equivalent to
>
> bswap rdi
>
> with the 64-bit argument loaded into RDI.
>
> Just run the following code on x86-64:
>
> mov rdi, 0123456789abcdefh ; pass (fake) argument in RDI
> ; split argument into high and low part
> mov rdx, rdi
> shr rdx, 32 ; high part in EDX
> mov eax, rdi ; low part in EAX
> ; perform __bswapdi2() as in 32-bit mode
> xchg eax, edx...