[llvm] [X86] Support EGPR (R16-R31) for APX (PR #67702)

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 29 06:46:37 PDT 2023


================
@@ -1208,6 +1208,44 @@ namespace X86II {
     return false;
   }
 
+  inline bool canUseApxExtendedReg(const MCInstrDesc &Desc) {
+    uint64_t TSFlags = Desc.TSFlags;
+    uint64_t Encoding = TSFlags & EncodingMask;
+    // EVEX can always use egpr.
+    if (Encoding == X86II::EVEX)
+      return true;
+
+    // MAP OB/TB in legacy encoding space can always use egpr except
+    // XSAVE*/XRSTOR*.
+    unsigned Opcode = Desc.Opcode;
+    bool IsSpecial = false;
+    switch (Opcode) {
+    default:
+      // To be conservative, egpr is not used for all pseudo instructions
+      // because we are not sure what instruction it will become.
+      // FIXME: Could we improve it in X86ExpandPseudo?
+      IsSpecial = isPseudo(TSFlags);
----------------
phoebewang wrote:

Can return `false` directly?

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


More information about the llvm-commits mailing list