[llvm] [X86][CodeGen] Support long instruction fixup for APX NDD instructions (PR #83578)

Shengchen Kan via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 1 18:47:59 PST 2024


================
@@ -1315,6 +1315,35 @@ inline bool isKMasked(uint64_t TSFlags) {
 inline bool isKMergeMasked(uint64_t TSFlags) {
   return isKMasked(TSFlags) && (TSFlags & X86II::EVEX_Z) == 0;
 }
+
+/// \returns true if the intruction needs a SIB.
+inline bool needSIB(unsigned BaseReg, unsigned IndexReg, bool In64BitMode) {
+  // The SIB byte must be used if there is an index register.
+  if (IndexReg)
+    return true;
+
+  // The SIB byte must be used if the base is ESP/RSP/R12/R20/R28, all of
+  // which encode to an R/M value of 4, which indicates that a SIB byte is
+  // present.
+  switch (BaseReg) {
+  default:
+    break;
----------------
KanRobert wrote:

Done

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


More information about the llvm-commits mailing list