Skip to content

Commit 72cacf1

Browse files
authored
[MIPS] Fix -msingle-float doesn't work with double on O32 (#107543)
Skip the following function 'CustomLowerNode' when the operand had done `SoftenFloatResult`. Fix #93052
1 parent b847076 commit 72cacf1

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

llvm/lib/Target/Mips/MipsSEISelLowering.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,6 +1244,11 @@ SDValue MipsSETargetLowering::lowerBITCAST(SDValue Op,
12441244

12451245
// Bitcast double to i64.
12461246
if (Src == MVT::f64 && Dest == MVT::i64) {
1247+
// Skip lower bitcast when operand0 has converted float results to integer
1248+
// which was done by function SoftenFloatResult.
1249+
if (getTypeAction(*DAG.getContext(), Op.getOperand(0).getValueType()) ==
1250+
TargetLowering::TypeSoftenFloat)
1251+
return SDValue();
12471252
SDValue Lo =
12481253
DAG.getNode(MipsISD::ExtractElementF64, DL, MVT::i32, Op.getOperand(0),
12491254
DAG.getConstant(0, DL, MVT::i32));
Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1-
; RUN: llc -march=mips -mattr=single-float < %s | FileCheck %s
1+
; RUN: llc -mtriple=mipsel-linux-gnu -mcpu=mips32 -mattr=+single-float < %s | FileCheck %s
2+
; RUN: llc -mtriple=mipsel-linux-gnu -mcpu=mips32r2 -mattr=+single-float < %s | FileCheck %s
23

34
define double @dofloat(double %a, double %b) nounwind {
5+
; CHECK-LABEL: dofloat:
6+
; CHECK: # %bb.0: # %entry
7+
; CHECK-NEXT: addiu $sp, $sp, -24
8+
; CHECK-NEXT: sw $ra, 20($sp)
9+
; CHECK-NEXT: jal __adddf3
10+
; CHECK-NEXT: nop
11+
; CHECK-NEXT: lw $ra, 20($sp)
12+
; CHECK-NEXT: jr $ra
13+
; CHECK-NEXT: addiu $sp, $sp, 24
14+
415
entry:
5-
; CHECK: __adddf3
6-
fadd double %a, %b ; <double>:0 [#uses=1]
7-
ret double %0
16+
fadd double %a, %b ; <double>:0 [#uses=1]
17+
ret double %0
818
}

0 commit comments

Comments
 (0)