Is it possible to use ymm16 - ymm31 for AVX2 vpcmpeq{size} instructions?

Viewed 248

I am wondering if it is possible to do something along the lines of:

vpcmpeqb %ymm16, %ymm17, %ymm16

Trying to do this an compiling with gcc I get:

Assembler messages: Error: unsupported instruction `vpcmpeqb'

AFAICT this is impossible felixcloutier says that the only EVEX prefix instructions for cmpeq have a mask destination but possibly there is something I am missing or a way to do this directly with the byte encoding.

Thanks!

1 Answers

X / YMM16..31 require an EVEX to access at all.

You can't use them with AVX1 / AVX2 forms of instructions.
So no, either compare only into mask regs, or use ymm0..15.

A VEX prefix + modrm only has a total of 4 bits per instruction, so there'd be no way for the AVX1/2 encoding to use a register number that needs 5 bits.


GAS's error message is unhelpful. Perhaps it decides that it's the EVEX form based on the use of AVX-512-only registers, then notices that it's the wrong set of operands.

NASM says "invalid combination of opcode and operands" which is not very specific either, but at least correct.

clang's built-in assembler is probably the best:

foo.s:1:26: error: invalid operand for instruction
vpcmpeqb %ymm16, %ymm17, %ymm16
                         ^~~~~~
Related