[llvm] [X86][MC] Add alias for `{evex} cmp` and `{evex} test`. (PR #99277)

Freddy Ye via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 24 22:53:12 PDT 2024


================
@@ -3784,6 +3784,68 @@ bool X86AsmParser::processInstruction(MCInst &Inst, const OperandVector &Ops) {
     Inst.setOpcode(X86::INT3);
     return true;
   }
+  // `{evex} cmp <>, <>` is alias of `ccmpt {dfv=} <>, <>`
+#define FROM_TO(FROM, TO)                                                      \
+  case X86::FROM: {                                                            \
+    if (ForcedOpcodePrefix == OpcodePrefix_EVEX) {                             \
----------------
FreddyLeaf wrote:

> Can we hoist out this check in each case, e.g.,
> 
> ```
> if (ForcedOpcodePrefix == OpcodePrefix_EVEX) {
>   switch (Inst.getOpcode()) {
>     FROM_TO(CMP64rr, CCMP64rr)
>     ...
> }
> ```

Sorry, I don't quite understand the benefit. Even without hoisting, at runtime `if (ForcedOpcodePrefix == OpcodePrefix_EVEX)` will be checked once, and it can utilize the current `Inst.getOpcode()` above.

https://github.com/llvm/llvm-project/pull/99277


More information about the llvm-commits mailing list