The X86 decision assumes the compare will produce a result in an XMM
register, but that can't happen for an fp128 compare since those
go to a libcall the returns an i32. Pass the VT so X86 can check
the type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371775
91177308-0d34-0410-b5e6-
96231b3b80d8
/// a constant pool load whose address depends on the select condition. The
/// parameter may be used to differentiate a select with FP compare from
/// integer compare.
- virtual bool reduceSelectOfFPConstantLoads(bool IsFPSetCC) const {
+ virtual bool reduceSelectOfFPConstantLoads(EVT CmpOpVT) const {
return true;
}
SDValue DAGCombiner::convertSelectOfFPConstantsToLoadOffset(
const SDLoc &DL, SDValue N0, SDValue N1, SDValue N2, SDValue N3,
ISD::CondCode CC) {
- if (!TLI.reduceSelectOfFPConstantLoads(N0.getValueType().isFloatingPoint()))
+ if (!TLI.reduceSelectOfFPConstantLoads(N0.getValueType()))
return SDValue();
// If we are before legalize types, we want the other legalization to happen
return true;
}
-bool X86TargetLowering::reduceSelectOfFPConstantLoads(bool IsFPSetCC) const {
+bool X86TargetLowering::reduceSelectOfFPConstantLoads(EVT CmpOpVT) const {
// If we are using XMM registers in the ABI and the condition of the select is
// a floating-point compare and we have blendv or conditional move, then it is
// cheaper to select instead of doing a cross-register move and creating a
// load that depends on the compare result.
+ bool IsFPSetCC = CmpOpVT.isFloatingPoint() && CmpOpVT != MVT::f128;
return !IsFPSetCC || !Subtarget.isTarget64BitLP64() || !Subtarget.hasAVX();
}
bool shouldConvertConstantLoadToIntImm(const APInt &Imm,
Type *Ty) const override;
- bool reduceSelectOfFPConstantLoads(bool IsFPSetCC) const override;
+ bool reduceSelectOfFPConstantLoads(EVT CmpOpVT) const override;
bool convertSelectOfConstantsToMath(EVT VT) const override;
; AVX-NEXT: vmovaps (%rsp), %xmm0
; AVX-NEXT: vmovaps {{.*}}(%rip), %xmm1
; AVX-NEXT: callq __lttf2
+; AVX-NEXT: xorl %ecx, %ecx
; AVX-NEXT: testl %eax, %eax
-; AVX-NEXT: js .LBB2_1
-; AVX-NEXT: # %bb.2: # %entry
-; AVX-NEXT: vmovaps {{.*}}(%rip), %xmm0
-; AVX-NEXT: addq $40, %rsp
-; AVX-NEXT: retq
-; AVX-NEXT: .LBB2_1:
-; AVX-NEXT: vmovaps {{.*}}(%rip), %xmm0
+; AVX-NEXT: sets %cl
+; AVX-NEXT: shlq $4, %rcx
+; AVX-NEXT: vmovaps {{\.LCPI.*}}(%rcx), %xmm0
; AVX-NEXT: addq $40, %rsp
; AVX-NEXT: retq
entry: