[llvm] [X86][MC] Support decoding of EGPR for APX (PR #72102)

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 19:38:02 PST 2023


================
@@ -855,8 +884,31 @@ static int fixupReg(struct InternalInstruction *insn,
     if (!valid)
       return -1;
     break;
-  case ENCODING_SIB:
   CASE_ENCODING_RM:
+    if (insn->vectorExtensionType == TYPE_EVEX && insn->mode == MODE_64BIT &&
+        modFromModRM(insn->modRM) == 3) {
+      // EVEX_X can extend the register id to 32 for a non-GPR register that is
+      // encoded in RM.
+      // mode : MODE_64_BIT
+      //  Only 8 vector registers are available in 32 bit mode
+      // mod : 3
+      //  RM encodes a register
+      switch (op->type) {
+      case TYPE_Rv:
+      case TYPE_R8:
+      case TYPE_R16:
+      case TYPE_R32:
+      case TYPE_R64:
+        break;
+      default:
----------------
phoebewang wrote:

Should this list only XMM/YMM/ZMM cases? I don't think others like TMM etc. need this bit.

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


More information about the llvm-commits mailing list