Displaying 2 results from an estimated 2 matches for "my_bswap".
2018 Nov 25
2
BUGS n code generated for target i386 compiling __bswapdi3, and for target x86-64 compiling __bswapsi2()
I just compiled the two attached files in 32-bit mode and ran it.
It printed efcdab8967452301.
I verified via objdump that the my_bswap function contains the follow
assembly which I believe matches the assembly you linked to on godbolt.
_my_bswap:
1f70: 55 pushl %ebp
1f71: 89 e5 movl %esp, %ebp
1f73: 8b 55 08 movl 8(%ebp), %edx
1f76: 8b 45 0c movl 12(%ebp), %eax
1f79: 0f c8 bswapl %eax
1f7b: 0f ca bswapl %e...
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