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

Shengchen Kan via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 10 18:22:35 PST 2023


================
@@ -139,7 +147,20 @@ class X86OpcodePrefixHelper {
   }
 
   void setR(unsigned Encoding) { R = Encoding >> 3 & 1; }
-  void setR2(unsigned Encoding) { EVEX_R2 = Encoding >> 4 & 1; }
+  void setR2(unsigned Encoding) {
+    R2 = Encoding >> 4 & 1;
+    assert((!R2 || (Kind <= REX2 || Kind == EVEX)) && "invalid setting");
----------------
KanRobert wrote:

It does include `Kind == None` and it's expected. `determineOptimalKind()` is called at line 1354 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