[PATCH] D133340: [PowerPC][GISel]select floating point constant from TOC

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 22 18:11:38 PST 2022


arsenm added a comment.

If I'm reading this correctly, the DAG handles this by letting the ConstantFP lower to a generic load with a constant pool PseudoSourceValue. I think that would be a better approach, rather than directly selecting G_FCONSTANT. You would avoid needing special 64-bit and 32-bit handling



================
Comment at: llvm/lib/Target/PowerPC/GISel/PPCInstructionSelector.cpp:135
+  // TODO: handle 32-bit.
+  assert(STI.isPPC64() && "Only 64-bit is supported!");
+
----------------
Return false to fallback is probably a better idea 


================
Comment at: llvm/lib/Target/PowerPC/GISel/PPCInstructionSelector.cpp:177
+    LoadInst =
+        &*(BuildMI(*I.getParent(), I, DbgLoc, TII.get(LoadOpcode), DstReg)
+               .addImm(0)
----------------
Don't need &*


================
Comment at: llvm/lib/Target/PowerPC/GISel/PPCInstructionSelector.cpp:205
+      LoadInst =
+          &*(BuildMI(*I.getParent(), I, DbgLoc, TII.get(LoadOpcode), DstReg)
+                 .addConstantPoolIndex(CPI, 0, PPCII::MO_TOC_LO)
----------------
Ditto


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133340/new/

https://reviews.llvm.org/D133340



More information about the llvm-commits mailing list