Currently I am trying to move from using NASM, to using inline assembly in c, as this would make linking a lot easier in the future (especially with inlining). However, I can't get my vector instructions to play nicely. In Intel assembly, I was able to do the following:
vpcmpeqb ymm0, [rdi]
This would read 32 bytes from rdi
, compare with ymm0
and mark the equal bytes. With AT&T I tried doing the following in c inline asm but it just doesn't work, it keeps complaining about mismatched operand sizes (where %1 is the input as"r"(s)
):
vpcmpeqb %%ymm0, %%ymm0, (%1)
I am compiling on gcc version 9.2.1
.
AT&T uses a different order for operands. To fix your issue, you should use
vpcmpeqb (%1), %%ymm0, %%ymm0
Also, read the thread under the conversation for more information about this topic.