Add missing disassembler support for EVEX-encoded instructions with rounding control and/or SAE attribute.
Details
Diff Detail
Event Timeline
lib/Target/X86/X86InstrAVX512.td | ||
---|---|---|
1886 | I don't see LIG specification in the "sae" form of VCMP: EVEX.NDS.512.66.0F.W1 C2 /r ib FV V/V AVX512F Compare packed double-precision floating-point values | |
5817 | Why do you need to remove EVEX_V512 from the second pattern? |
lib/Target/X86/X86InstrAVX512.td | ||
---|---|---|
1886 | The spec for SAE says it "applies to scalar and 512-bit vector lengths". I don't know how CPU actually treats L'L when {sae} is set, except that LLVM assembler generates {0,0}, not {1,0} that corresponds to 512-bit length. As a result if you feed assembler output to disassembler it causes disassembler to fail. I can speculate that LIG is implied in this case, but folks at Intel would know better. Could you check? | |
5817 | Because RC implies 512-bit length ("Vector Length Orthogonality"), and putting EVEX_V512 enforces disassembler to accept L'L={1,0} only, while LLVM assembler generates {0,0} IIRC. |
lib/Target/X86/X86InstrAVX512.td | ||
---|---|---|
1886 | According to table 4-7 in the spec: | |
5817 | I read the spec again. "When EVEX is used to encode scalar instructions, L’L is generally ignored" | |
utils/TableGen/X86RecognizableInstr.cpp | ||
996 | Why IMM8 ? |
lib/Target/X86/X86InstrAVX512.td | ||
---|---|---|
1886 |
| |
utils/TableGen/X86RecognizableInstr.cpp | ||
996 | Where? |
I think the focus should be on fixing the state of LLVM's disassembler for AVX-512. While there could be issues with the encoder too, and it's important to find out if indeed the encoder has to be fixed, that has to be handled separately. This diff fixes multiple failures of LLVM disassembler while handling binaries with AVX-512, but it does not fix them all.
Since you have encoding tests - you can pass the output of assembler to disassembler. It's one line in .test file(s).
lib/Target/X86/X86InstrAVX512.td | ||
---|---|---|
1886 |
|
Can you send me old and new encoding of vmpps with {sae}?
I'll try to check.
I also sent a question to our architects.
Why do you need VEX_LIG for disassembler?
EVEX_B in reg-reg form says that you have SAE.
EVEX_RC says that you have RC.
I agree with Elena, we should use the other flags to ignore the vector size in the disassembler table generation. This is what we already do in the encoder. Let's keep the intention of the L and L2 bits in TSFlags as they are.
I don't see LIG specification in the "sae" form of VCMP:
EVEX.NDS.512.66.0F.W1 C2 /r ib FV V/V AVX512F Compare packed double-precision floating-point values
in zmm3/m512/m64bcst and zmm2 using bits 4:0 of
imm8 as a comparison predicate with writemask k2
and leave the result in mask register k1.
VCMPPD k1 {k2}, zmm2,
zmm3/m512/m64bcst{sae}, imm8