[llvm] [Mips] Add lowerConstantFP to optimize some floating load instrs to mtc1+mthc1 (PR #196226)

Jiaxun Yang via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 03:52:01 PDT 2026


================
@@ -2043,6 +2048,43 @@ MachineBasicBlock *MipsTargetLowering::emitAtomicCmpSwapPartword(
   return exitMBB;
 }
 
+SDValue MipsTargetLowering::lowerConstantFP(SDValue Op,
+                                            SelectionDAG &DAG) const {
+  EVT VT = Op.getValueType();
+  ConstantFPSDNode *CFP = cast<ConstantFPSDNode>(Op);
+  const APFloat &FPVal = CFP->getValueAPF();
+
+  if (!isPositionIndependent())
----------------
FlyGoat wrote:

Well, load and store is usually more expensive than one extra arithmetic :-O

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


More information about the llvm-commits mailing list