[llvm] [X86][GlobalISel] Support addr matching in SDAG patterns (PR #130445)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 8 03:54:16 PDT 2025


================
@@ -445,6 +450,19 @@ bool X86InstructionSelector::select(MachineInstr &I) {
   return false;
 }
 
+unsigned X86InstructionSelector::getPtrLoadStoreOp(const LLT &Ty,
+                                                   const RegisterBank &RB,
+                                                   unsigned Opc) const {
+  assert((Opc == TargetOpcode::G_STORE || Opc == TargetOpcode::G_LOAD) &&
+         "Only G_STORE and G_LOAD are expected for selection");
+  bool IsLoad = (Opc == TargetOpcode::G_LOAD);
+  if (Ty == LLT::pointer(0, 32) && X86::GPRRegBankID == RB.getID())
+    return IsLoad ? X86::MOV32rm : X86::MOV32mr;
+  if (Ty == LLT::pointer(0, 64) && X86::GPRRegBankID == RB.getID())
----------------
arsenm wrote:

Check isPointer and the size? This will fail on non-0 address spaces 

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


More information about the llvm-commits mailing list