[llvm] [X86][MC] Support encoding of EGPR for APX (PR #71909)

Shengchen Kan via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 12 20:29:41 PST 2023


================
@@ -168,11 +194,34 @@ class X86OpcodePrefixHelper {
     setR(Encoding);
     setR2(Encoding);
   }
+  void setM(bool V) { M = V; }
+  void setXX2(const MCInst &MI, unsigned OpNum) {
+    unsigned Reg = MI.getOperand(OpNum).getReg();
+    unsigned Encoding = MRI.getEncodingValue(Reg);
+    setX(Encoding);
+    // Index can be a vector register while X2 is used to extend GPR only
+    if (Kind <= REX2 || X86II::isApxExtendedReg(Reg))
----------------
KanRobert wrote:

It does include `Kind == None` and it's expected. `determineOptimalKind()` is called to get the optimal prefix and any Kind <= REX2 may be promoted to REX2.

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


More information about the llvm-commits mailing list