On Friday, 5 March 2021 at 12:57:43 UTC, z wrote:
...
Then it seems the only way to get AVX-compatible inline
assembly(ldc.llvmasm excluded) is to use an external assembler.
For example :
import std.stdio;
extern(C) void vxorps_d(ubyte[32]*);
void main() {
ubyte[32] a = 2;
writefln!"Contents of a before : %( %s %)"(a);
vxorps_d(&a);
writefln!"Contents of a after : %( %s %)"(a);
}
BITS 64
global vxorps_d
section .text2
vxorps_d:
vmovups ymm0, [rcx];
mov rdx, zerofilled
vbroadcastss ymm1, [rdx]
vxorps ymm0, ymm0, ymm1
vmovups [rcx], ymm0
ret
zerofilled:
db 0xFF,0xFF,0xFF,0xFF
nasm -g -f win64 asmfile.asm
dmd vxorpstest.d asmfile.obj -m64
ldc vxorpstest.d asmfile.obj -m64
vxorpstest.exe
Contents of a before : 2 2 2... (0x02/0b0000_0010)
Contents of a after : 253 253 253...(0xFD/0b1111_1101)