[PATCH] D90817: [RISCV] Use the 'si' lib call for (double (fp_to_sint/uint i32 X)) when F extension is enabled.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 5 10:47:40 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGce5f4f22e9ef: [RISCV] Use the 'si' lib call for (double (fp_to_sint/uint i32 X)) when F… (authored by craig.topper).
Herald added a subscriber: jrtc27.
Changed prior to commit:
https://reviews.llvm.org/D90817?vs=303023&id=303188#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D90817/new/
https://reviews.llvm.org/D90817
Files:
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/rv64i-double-softfloat.ll
Index: llvm/test/CodeGen/RISCV/rv64i-double-softfloat.ll
===================================================================
--- llvm/test/CodeGen/RISCV/rv64i-double-softfloat.ll
+++ llvm/test/CodeGen/RISCV/rv64i-double-softfloat.ll
@@ -21,7 +21,7 @@
; RV64IF: # %bb.0: # %entry
; RV64IF-NEXT: addi sp, sp, -16
; RV64IF-NEXT: sd ra, 8(sp)
-; RV64IF-NEXT: call __fixunsdfdi
+; RV64IF-NEXT: call __fixunsdfsi
; RV64IF-NEXT: ld ra, 8(sp)
; RV64IF-NEXT: addi sp, sp, 16
; RV64IF-NEXT: ret
@@ -44,7 +44,7 @@
; RV64IF: # %bb.0: # %entry
; RV64IF-NEXT: addi sp, sp, -16
; RV64IF-NEXT: sd ra, 8(sp)
-; RV64IF-NEXT: call __fixdfdi
+; RV64IF-NEXT: call __fixdfsi
; RV64IF-NEXT: ld ra, 8(sp)
; RV64IF-NEXT: addi sp, sp, 16
; RV64IF-NEXT: ret
@@ -72,7 +72,7 @@
; RV64IF: # %bb.0: # %entry
; RV64IF-NEXT: addi sp, sp, -16
; RV64IF-NEXT: sd ra, 8(sp)
-; RV64IF-NEXT: call __fixunsdfdi
+; RV64IF-NEXT: call __fixunsdfsi
; RV64IF-NEXT: ld ra, 8(sp)
; RV64IF-NEXT: addi sp, sp, 16
; RV64IF-NEXT: ret
@@ -95,7 +95,7 @@
; RV64IF: # %bb.0: # %entry
; RV64IF-NEXT: addi sp, sp, -16
; RV64IF-NEXT: sd ra, 8(sp)
-; RV64IF-NEXT: call __fixdfdi
+; RV64IF-NEXT: call __fixdfsi
; RV64IF-NEXT: ld ra, 8(sp)
; RV64IF-NEXT: addi sp, sp, 16
; RV64IF-NEXT: ret
Index: llvm/lib/Target/RISCV/RISCVISelLowering.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -212,8 +212,7 @@
setTruncStoreAction(MVT::f64, MVT::f16, Expand);
}
- if (Subtarget.is64Bit() &&
- !(Subtarget.hasStdExtD() || Subtarget.hasStdExtF())) {
+ if (Subtarget.is64Bit()) {
setOperationAction(ISD::FP_TO_UINT, MVT::i32, Custom);
setOperationAction(ISD::FP_TO_SINT, MVT::i32, Custom);
setOperationAction(ISD::STRICT_FP_TO_UINT, MVT::i32, Custom);
@@ -941,6 +940,13 @@
assert(N->getValueType(0) == MVT::i32 && Subtarget.is64Bit() &&
"Unexpected custom legalisation");
SDValue Op0 = IsStrict ? N->getOperand(1) : N->getOperand(0);
+ // If the FP type needs to be softened, emit a library call using the 'si'
+ // version. If we left it to default legalization we'd end up with 'di'. If
+ // the FP type doesn't need to be softened just let generic type
+ // legalization promote the result type.
+ if (getTypeAction(*DAG.getContext(), Op0.getValueType()) !=
+ TargetLowering::TypeSoftenFloat)
+ return;
RTLIB::Libcall LC;
if (N->getOpcode() == ISD::FP_TO_SINT ||
N->getOpcode() == ISD::STRICT_FP_TO_SINT)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90817.303188.patch
Type: text/x-patch
Size: 2690 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201105/e3b614a1/attachment.bin>
More information about the llvm-commits
mailing list