[Issue 21041] core.bitop.byteswap(ushort) should used ROL/ROR instead of XCHG

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 12 13:06:39 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=21041

--- Comment #2 from safety0ff.bugz <safety0ff.bugz at gmail.com> ---
(In reply to Bruce Carneal from comment #1)
> I didn't find a 'byteswap' in the core.bitop documentation.  There is a
> bswap but only for uints and ulongs AFAICT.

The intrinsic in question was added in the master branch here:
https://github.com/dlang/dmd/pull/11388

Also the 64 bit version is to be added here:
https://github.com/dlang/dmd/pull/11408

> For the above code ldc at -O or above generates:
>   movl %edi, %eax
>   rolw $8, %ax
>   retq

I'd expect that since C/C++ clang emit that.

--


More information about the Digitalmars-d-bugs mailing list