[llvm] [MIPS] Support MIPS I hard-float double loads/stores with LWC1/SWC1 (PR #209362)

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 24 02:11:19 PDT 2026


================
@@ -297,6 +297,33 @@ bool MipsSEDAGToDAGISel::selectAddrFrameIndexOffset(
 
       Offset = CurDAG->getTargetConstant(CN->getZExtValue(), SDLoc(Addr),
                                          ValTy);
+      if (Base.getOpcode() == ISD::ADD &&
+          (Subtarget->hasMips1() && !Subtarget->hasMips2())) {
+        // Instead of:
+        //  lui $2, %hi($CPI1_0)
+        //  addiu $2, $2, %lo($CPI1_0)
+        //  lwc1 $f0, 4($2)
+        // Generate:
+        //  lui $2, %hi($CPI1_0)
+        //  lwc1 $f0, %lo($CPI1_0+4)($2)
+        if (Base.getOperand(1).getOpcode() == MipsISD::Lo ||
+            Base.getOperand(1).getOpcode() == MipsISD::GPRel) {
+          SDValue Opnd0 = Base.getOperand(1).getOperand(0);
+          if (isa<ConstantPoolSDNode>(Opnd0) ||
+              isa<GlobalAddressSDNode>(Opnd0) || isa<JumpTableSDNode>(Opnd0)) {
+            Base = Base.getOperand(0);
+            if (GlobalAddressSDNode *GA =
+                    dyn_cast<GlobalAddressSDNode>(Opnd0)) {
----------------
yingopq wrote:

Applied. Is it right?

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


More information about the llvm-commits mailing list