Skip to content

[MIPS] Fix -msingle-float doesn't work with double on O32 #107543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions llvm/lib/Target/Mips/MipsSEISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1244,6 +1244,11 @@ SDValue MipsSETargetLowering::lowerBITCAST(SDValue Op,

// Bitcast double to i64.
if (Src == MVT::f64 && Dest == MVT::i64) {
// Skip lower bitcast when operand0 has converted float results to integer
// which was done by function SoftenFloatResult.
if (getTypeAction(*DAG.getContext(), Op.getOperand(0).getValueType()) ==
TargetLowering::TypeSoftenFloat)
return SDValue();
SDValue Lo =
DAG.getNode(MipsISD::ExtractElementF64, DL, MVT::i32, Op.getOperand(0),
DAG.getConstant(0, DL, MVT::i32));
Expand Down
18 changes: 14 additions & 4 deletions llvm/test/CodeGen/Mips/2008-07-06-fadd64.ll
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
; RUN: llc -march=mips -mattr=single-float < %s | FileCheck %s
; RUN: llc -mtriple=mipsel-linux-gnu -mcpu=mips32 -mattr=+single-float < %s | FileCheck %s
; RUN: llc -mtriple=mipsel-linux-gnu -mcpu=mips32r2 -mattr=+single-float < %s | FileCheck %s

define double @dofloat(double %a, double %b) nounwind {
; CHECK-LABEL: dofloat:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: addiu $sp, $sp, -24
; CHECK-NEXT: sw $ra, 20($sp)
; CHECK-NEXT: jal __adddf3
; CHECK-NEXT: nop
; CHECK-NEXT: lw $ra, 20($sp)
; CHECK-NEXT: jr $ra
; CHECK-NEXT: addiu $sp, $sp, 24

entry:
; CHECK: __adddf3
fadd double %a, %b ; <double>:0 [#uses=1]
ret double %0
fadd double %a, %b ; <double>:0 [#uses=1]
ret double %0
}
Loading