diff options
author | Craig Topper <craig.topper@intel.com> | 2019-09-03 05:57:18 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2019-09-03 05:57:18 +0000 |
commit | 9dc8c448ed4511b7802d78f78a29c0714868c7b0 (patch) | |
tree | 4a55d374a616242edf3c55c257a2de3dae396a8f /llvm/lib/Target | |
parent | f255f443361687d65e59a830f3c2bfc128552de9 (diff) | |
download | bcm5719-llvm-9dc8c448ed4511b7802d78f78a29c0714868c7b0.tar.gz bcm5719-llvm-9dc8c448ed4511b7802d78f78a29c0714868c7b0.zip |
[X86] Don't use Expand for i32 fp_to_uint on SSE1/2 targets on 32-bit target.
Use Custom lowering instead. Fall back to default expansion only
when the scalar FP type belongs in an XMM register. This improves
lowering for i32 to fp80, and also i32 to double on SSE1 only.
llvm-svn: 370699
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 6f0fb3ac97b..b6649daa682 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -287,19 +287,8 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM, setOperationAction(ISD::FP_TO_UINT , MVT::i64 , Expand); } } else if (!Subtarget.useSoftFloat()) { - // Since AVX is a superset of SSE3, only check for SSE here. - if (Subtarget.hasSSE1() && !Subtarget.hasSSE3()) - // Expand FP_TO_UINT into a select. - // FIXME: We would like to use a Custom expander here eventually to do - // the optimal thing for SSE vs. the default expansion in the legalizer. - setOperationAction(ISD::FP_TO_UINT , MVT::i32 , Expand); - else - // With AVX512 we can use vcvts[ds]2usi for f32/f64->i32, f80 is custom. - // With SSE3 we can use fisttpll to convert to a signed i64; without - // SSE, we're stuck with a fistpll. - setOperationAction(ISD::FP_TO_UINT , MVT::i32 , Custom); - - setOperationAction(ISD::FP_TO_UINT , MVT::i64 , Custom); + setOperationAction(ISD::FP_TO_UINT, MVT::i32, Custom); + setOperationAction(ISD::FP_TO_UINT, MVT::i64, Custom); } // TODO: when we have SSE, these could be more efficient, by using movd/movq. @@ -19425,6 +19414,11 @@ SDValue X86TargetLowering::LowerFP_TO_INT(SDValue Op, SelectionDAG &DAG) const { if (UseSSEReg && IsSigned) return Op; + // Use default expansion for SSE1/2 targets without SSE3. With SSE3 we can use + // fisttp. + if (!IsSigned && UseSSEReg && !Subtarget.hasSSE3()) + return SDValue(); + // Fall back to X87. if (SDValue V = FP_TO_INTHelper(Op, DAG, IsSigned)) return V; |