mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[InstCombine] propagate fast-math-flags (FMF) to select when inverting fcmp+select
As noted by the FIXME comment, this is not correct based on our current FMF semantics. We should be propagating FMF from the final value in a sequence (in this case the 'select'). So the behavior even without this patch is wrong, but we did not allow FMF on 'select' until recently. But if we do the correct thing right now in this patch, we'll inevitably introduce regressions because we have not wired up FMF propagation for 'phi' and 'select' in other passes (like SimplifyCFG) or other places in InstCombine. I'm not seeing a better incremental way to make progress. That said, the potential extra damage over the existing wrong behavior from this patch is very limited. AFAIK, the only way to have different FMF on IR in the same function is if we have LTO inlined IR from 2 modules that were compiled using different fast-math settings. As seen in the tests, we may actually see some improvements with this patch because adding the FMF to the 'select' allows matching to min/max intrinsics that were previously missed (in the common case, the 'fcmp' and 'select' should have identical FMF to begin with). Next steps in the transition: Make similar changes in instcombine as needed. Enable phi-to-select FMF propagation in SimplifyCFG. Remove dependencies on fcmp with FMF. Deprecate FMF on fcmp. Differential Revision: https://reviews.llvm.org/D69720
This commit is contained in:
parent
325399186a
commit
fcfe9b03ff
@ -2344,12 +2344,12 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
|
||||
if (FCI->hasOneUse() && FCmpInst::isUnordered(FCI->getPredicate())) {
|
||||
FCmpInst::Predicate InvPred = FCI->getInversePredicate();
|
||||
IRBuilder<>::FastMathFlagGuard FMFG(Builder);
|
||||
// FIXME: The FMF should propagate from the select, not the fcmp.
|
||||
Builder.setFastMathFlags(FCI->getFastMathFlags());
|
||||
Value *NewCond = Builder.CreateFCmp(InvPred, Cmp0, Cmp1,
|
||||
FCI->getName() + ".inv");
|
||||
|
||||
return SelectInst::Create(NewCond, FalseVal, TrueVal,
|
||||
SI.getName() + ".p");
|
||||
Value *NewSel = Builder.CreateSelect(NewCond, FalseVal, TrueVal);
|
||||
return replaceInstUsesWith(SI, NewSel);
|
||||
}
|
||||
|
||||
// NOTE: if we wanted to, this is where to detect MIN/MAX
|
||||
|
@ -6,9 +6,8 @@ define float @clamp_float_fast_ordered_strict_maxmin(float %x) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@clamp_float_fast_ordered_strict_maxmin(
|
||||
; CHECK-NEXT: [[CMP2:%.*]] = fcmp fast olt float [[X:%.*]], 2.550000e+02
|
||||
; CHECK-NEXT: [[MIN:%.*]] = select i1 [[CMP2]], float [[X]], float 2.550000e+02
|
||||
; CHECK-NEXT: [[DOTINV:%.*]] = fcmp fast oge float [[MIN]], 1.000000e+00
|
||||
; CHECK-NEXT: [[R1:%.*]] = select i1 [[DOTINV]], float [[MIN]], float 1.000000e+00
|
||||
; CHECK-NEXT: ret float [[R1]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = call fast float @llvm.maxnum.f32(float [[MIN]], float 1.000000e+00)
|
||||
; CHECK-NEXT: ret float [[TMP1]]
|
||||
;
|
||||
%cmp2 = fcmp fast olt float %x, 255.0
|
||||
%min = select i1 %cmp2, float %x, float 255.0
|
||||
@ -22,9 +21,8 @@ define float @clamp_float_fast_ordered_nonstrict_maxmin(float %x) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@clamp_float_fast_ordered_nonstrict_maxmin(
|
||||
; CHECK-NEXT: [[CMP2:%.*]] = fcmp fast olt float [[X:%.*]], 2.550000e+02
|
||||
; CHECK-NEXT: [[MIN:%.*]] = select i1 [[CMP2]], float [[X]], float 2.550000e+02
|
||||
; CHECK-NEXT: [[DOTINV:%.*]] = fcmp fast oge float [[MIN]], 1.000000e+00
|
||||
; CHECK-NEXT: [[R1:%.*]] = select i1 [[DOTINV]], float [[MIN]], float 1.000000e+00
|
||||
; CHECK-NEXT: ret float [[R1]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = call fast float @llvm.maxnum.f32(float [[MIN]], float 1.000000e+00)
|
||||
; CHECK-NEXT: ret float [[TMP1]]
|
||||
;
|
||||
%cmp2 = fcmp fast olt float %x, 255.0
|
||||
%min = select i1 %cmp2, float %x, float 255.0
|
||||
@ -38,9 +36,8 @@ define float @clamp_float_fast_ordered_strict_minmax(float %x) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@clamp_float_fast_ordered_strict_minmax(
|
||||
; CHECK-NEXT: [[CMP2:%.*]] = fcmp fast ogt float [[X:%.*]], 1.000000e+00
|
||||
; CHECK-NEXT: [[MAX:%.*]] = select i1 [[CMP2]], float [[X]], float 1.000000e+00
|
||||
; CHECK-NEXT: [[DOTINV:%.*]] = fcmp fast ole float [[MAX]], 2.550000e+02
|
||||
; CHECK-NEXT: [[R1:%.*]] = select i1 [[DOTINV]], float [[MAX]], float 2.550000e+02
|
||||
; CHECK-NEXT: ret float [[R1]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = call fast float @llvm.minnum.f32(float [[MAX]], float 2.550000e+02)
|
||||
; CHECK-NEXT: ret float [[TMP1]]
|
||||
;
|
||||
%cmp2 = fcmp fast ogt float %x, 1.0
|
||||
%max = select i1 %cmp2, float %x, float 1.0
|
||||
@ -54,9 +51,8 @@ define float @clamp_float_fast_ordered_nonstrict_minmax(float %x) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@clamp_float_fast_ordered_nonstrict_minmax(
|
||||
; CHECK-NEXT: [[CMP2:%.*]] = fcmp fast ogt float [[X:%.*]], 1.000000e+00
|
||||
; CHECK-NEXT: [[MAX:%.*]] = select i1 [[CMP2]], float [[X]], float 1.000000e+00
|
||||
; CHECK-NEXT: [[DOTINV:%.*]] = fcmp fast ole float [[MAX]], 2.550000e+02
|
||||
; CHECK-NEXT: [[R1:%.*]] = select i1 [[DOTINV]], float [[MAX]], float 2.550000e+02
|
||||
; CHECK-NEXT: ret float [[R1]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = call fast float @llvm.minnum.f32(float [[MAX]], float 2.550000e+02)
|
||||
; CHECK-NEXT: ret float [[TMP1]]
|
||||
;
|
||||
%cmp2 = fcmp fast ogt float %x, 1.0
|
||||
%max = select i1 %cmp2, float %x, float 1.0
|
||||
@ -72,10 +68,9 @@ define float @clamp_float_fast_ordered_nonstrict_minmax(float %x) {
|
||||
define float @clamp_float_fast_unordered_strict_maxmin(float %x) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@clamp_float_fast_unordered_strict_maxmin(
|
||||
; CHECK-NEXT: [[CMP2_INV:%.*]] = fcmp fast oge float [[X:%.*]], 2.550000e+02
|
||||
; CHECK-NEXT: [[MIN:%.*]] = select i1 [[CMP2_INV]], float 2.550000e+02, float [[X]]
|
||||
; CHECK-NEXT: [[DOTINV:%.*]] = fcmp fast oge float [[MIN]], 1.000000e+00
|
||||
; CHECK-NEXT: [[R1:%.*]] = select i1 [[DOTINV]], float [[MIN]], float 1.000000e+00
|
||||
; CHECK-NEXT: ret float [[R1]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = select fast i1 [[CMP2_INV]], float 2.550000e+02, float [[X]]
|
||||
; CHECK-NEXT: [[TMP2:%.*]] = call fast float @llvm.maxnum.f32(float [[TMP1]], float 1.000000e+00)
|
||||
; CHECK-NEXT: ret float [[TMP2]]
|
||||
;
|
||||
%cmp2 = fcmp fast ult float %x, 255.0
|
||||
%min = select i1 %cmp2, float %x, float 255.0
|
||||
@ -88,10 +83,9 @@ define float @clamp_float_fast_unordered_strict_maxmin(float %x) {
|
||||
define float @clamp_float_fast_unordered_nonstrict_maxmin(float %x) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@clamp_float_fast_unordered_nonstrict_maxmin(
|
||||
; CHECK-NEXT: [[CMP2_INV:%.*]] = fcmp fast oge float [[X:%.*]], 2.550000e+02
|
||||
; CHECK-NEXT: [[MIN:%.*]] = select i1 [[CMP2_INV]], float 2.550000e+02, float [[X]]
|
||||
; CHECK-NEXT: [[DOTINV:%.*]] = fcmp fast oge float [[MIN]], 1.000000e+00
|
||||
; CHECK-NEXT: [[R1:%.*]] = select i1 [[DOTINV]], float [[MIN]], float 1.000000e+00
|
||||
; CHECK-NEXT: ret float [[R1]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = select fast i1 [[CMP2_INV]], float 2.550000e+02, float [[X]]
|
||||
; CHECK-NEXT: [[TMP2:%.*]] = call fast float @llvm.maxnum.f32(float [[TMP1]], float 1.000000e+00)
|
||||
; CHECK-NEXT: ret float [[TMP2]]
|
||||
;
|
||||
%cmp2 = fcmp fast ult float %x, 255.0
|
||||
%min = select i1 %cmp2, float %x, float 255.0
|
||||
@ -104,10 +98,9 @@ define float @clamp_float_fast_unordered_nonstrict_maxmin(float %x) {
|
||||
define float @clamp_float_fast_unordered_strict_minmax(float %x) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@clamp_float_fast_unordered_strict_minmax(
|
||||
; CHECK-NEXT: [[CMP2_INV:%.*]] = fcmp fast ole float [[X:%.*]], 1.000000e+00
|
||||
; CHECK-NEXT: [[MAX:%.*]] = select i1 [[CMP2_INV]], float 1.000000e+00, float [[X]]
|
||||
; CHECK-NEXT: [[DOTINV:%.*]] = fcmp fast ole float [[MAX]], 2.550000e+02
|
||||
; CHECK-NEXT: [[R1:%.*]] = select i1 [[DOTINV]], float [[MAX]], float 2.550000e+02
|
||||
; CHECK-NEXT: ret float [[R1]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = select fast i1 [[CMP2_INV]], float 1.000000e+00, float [[X]]
|
||||
; CHECK-NEXT: [[TMP2:%.*]] = call fast float @llvm.minnum.f32(float [[TMP1]], float 2.550000e+02)
|
||||
; CHECK-NEXT: ret float [[TMP2]]
|
||||
;
|
||||
%cmp2 = fcmp fast ugt float %x, 1.0
|
||||
%max = select i1 %cmp2, float %x, float 1.0
|
||||
@ -120,10 +113,9 @@ define float @clamp_float_fast_unordered_strict_minmax(float %x) {
|
||||
define float @clamp_float_fast_unordered_nonstrict_minmax(float %x) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@clamp_float_fast_unordered_nonstrict_minmax(
|
||||
; CHECK-NEXT: [[CMP2_INV:%.*]] = fcmp fast ole float [[X:%.*]], 1.000000e+00
|
||||
; CHECK-NEXT: [[MAX:%.*]] = select i1 [[CMP2_INV]], float 1.000000e+00, float [[X]]
|
||||
; CHECK-NEXT: [[DOTINV:%.*]] = fcmp fast ole float [[MAX]], 2.550000e+02
|
||||
; CHECK-NEXT: [[R1:%.*]] = select i1 [[DOTINV]], float [[MAX]], float 2.550000e+02
|
||||
; CHECK-NEXT: ret float [[R1]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = select fast i1 [[CMP2_INV]], float 1.000000e+00, float [[X]]
|
||||
; CHECK-NEXT: [[TMP2:%.*]] = call fast float @llvm.minnum.f32(float [[TMP1]], float 2.550000e+02)
|
||||
; CHECK-NEXT: ret float [[TMP2]]
|
||||
;
|
||||
%cmp2 = fcmp fast ugt float %x, 1.0
|
||||
%max = select i1 %cmp2, float %x, float 1.0
|
||||
@ -139,10 +131,9 @@ define float @clamp_float_fast_unordered_nonstrict_minmax(float %x) {
|
||||
define float @clamp_test_1(float %x) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@clamp_test_1(
|
||||
; CHECK-NEXT: [[INNER_CMP_INV:%.*]] = fcmp fast oge float [[X:%.*]], 2.550000e+02
|
||||
; CHECK-NEXT: [[INNER_SEL:%.*]] = select i1 [[INNER_CMP_INV]], float 2.550000e+02, float [[X]]
|
||||
; CHECK-NEXT: [[DOTINV:%.*]] = fcmp fast oge float [[INNER_SEL]], 1.000000e+00
|
||||
; CHECK-NEXT: [[R1:%.*]] = select i1 [[DOTINV]], float [[INNER_SEL]], float 1.000000e+00
|
||||
; CHECK-NEXT: ret float [[R1]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = select fast i1 [[INNER_CMP_INV]], float 2.550000e+02, float [[X]]
|
||||
; CHECK-NEXT: [[TMP2:%.*]] = call fast float @llvm.maxnum.f32(float [[TMP1]], float 1.000000e+00)
|
||||
; CHECK-NEXT: ret float [[TMP2]]
|
||||
;
|
||||
%inner_cmp = fcmp fast ult float %x, 255.0
|
||||
%inner_sel = select i1 %inner_cmp, float %x, float 255.0
|
||||
@ -157,9 +148,9 @@ define float @clamp_test_1(float %x) {
|
||||
define float @clamp_negative_wrong_const(float %x) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@clamp_negative_wrong_const(
|
||||
; CHECK-NEXT: [[INNER_CMP_INV:%.*]] = fcmp fast oge float [[X:%.*]], 2.550000e+02
|
||||
; CHECK-NEXT: [[INNER_SEL:%.*]] = select i1 [[INNER_CMP_INV]], float 2.550000e+02, float [[X]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = select fast i1 [[INNER_CMP_INV]], float 2.550000e+02, float [[X]]
|
||||
; CHECK-NEXT: [[OUTER_CMP:%.*]] = fcmp fast ugt float [[X]], 5.120000e+02
|
||||
; CHECK-NEXT: [[R:%.*]] = select i1 [[OUTER_CMP]], float [[INNER_SEL]], float 5.120000e+02
|
||||
; CHECK-NEXT: [[R:%.*]] = select i1 [[OUTER_CMP]], float [[TMP1]], float 5.120000e+02
|
||||
; CHECK-NEXT: ret float [[R]]
|
||||
;
|
||||
%inner_cmp = fcmp fast ult float %x, 255.0
|
||||
@ -173,9 +164,9 @@ define float @clamp_negative_wrong_const(float %x) {
|
||||
define float @clamp_negative_same_op(float %x) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@clamp_negative_same_op(
|
||||
; CHECK-NEXT: [[INNER_CMP_INV:%.*]] = fcmp fast oge float [[X:%.*]], 2.550000e+02
|
||||
; CHECK-NEXT: [[INNER_SEL:%.*]] = select i1 [[INNER_CMP_INV]], float 2.550000e+02, float [[X]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = select fast i1 [[INNER_CMP_INV]], float 2.550000e+02, float [[X]]
|
||||
; CHECK-NEXT: [[OUTER_CMP:%.*]] = fcmp fast ult float [[X]], 1.000000e+00
|
||||
; CHECK-NEXT: [[R:%.*]] = select i1 [[OUTER_CMP]], float [[INNER_SEL]], float 1.000000e+00
|
||||
; CHECK-NEXT: [[R:%.*]] = select i1 [[OUTER_CMP]], float [[TMP1]], float 1.000000e+00
|
||||
; CHECK-NEXT: ret float [[R]]
|
||||
;
|
||||
%inner_cmp = fcmp fast ult float %x, 255.0
|
||||
|
@ -922,11 +922,11 @@ define i32 @common_factor_umax_extra_use_both(i32 %a, i32 %b, i32 %c) {
|
||||
define float @not_min_of_min(i8 %i, float %x) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@not_min_of_min(
|
||||
; CHECK-NEXT: [[CMP1_INV:%.*]] = fcmp fast oge float [[X:%.*]], 1.000000e+00
|
||||
; CHECK-NEXT: [[MIN1:%.*]] = select i1 [[CMP1_INV]], float 1.000000e+00, float [[X]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = select fast i1 [[CMP1_INV]], float 1.000000e+00, float [[X]]
|
||||
; CHECK-NEXT: [[CMP2_INV:%.*]] = fcmp fast oge float [[X]], 2.000000e+00
|
||||
; CHECK-NEXT: [[MIN2:%.*]] = select i1 [[CMP2_INV]], float 2.000000e+00, float [[X]]
|
||||
; CHECK-NEXT: [[TMP2:%.*]] = select fast i1 [[CMP2_INV]], float 2.000000e+00, float [[X]]
|
||||
; CHECK-NEXT: [[CMP3:%.*]] = icmp ult i8 [[I:%.*]], 16
|
||||
; CHECK-NEXT: [[R:%.*]] = select i1 [[CMP3]], float [[MIN1]], float [[MIN2]]
|
||||
; CHECK-NEXT: [[R:%.*]] = select i1 [[CMP3]], float [[TMP1]], float [[TMP2]]
|
||||
; CHECK-NEXT: ret float [[R]]
|
||||
;
|
||||
%cmp1 = fcmp fast ult float %x, 1.0
|
||||
|
@ -149,9 +149,9 @@ define i8 @t9(float %a) {
|
||||
define i8 @t11(float %a, float %b) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@t11(
|
||||
; CHECK-NEXT: [[DOTINV:%.*]] = fcmp fast oge float [[B:%.*]], [[A:%.*]]
|
||||
; CHECK-NEXT: [[DOTV:%.*]] = select i1 [[DOTINV]], float [[A]], float [[B]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = fptosi float [[DOTV]] to i8
|
||||
; CHECK-NEXT: ret i8 [[TMP1]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = select fast i1 [[DOTINV]], float [[A]], float [[B]]
|
||||
; CHECK-NEXT: [[TMP2:%.*]] = fptosi float [[TMP1]] to i8
|
||||
; CHECK-NEXT: ret i8 [[TMP2]]
|
||||
;
|
||||
%1 = fcmp fast ult float %b, %a
|
||||
%2 = fptosi float %a to i8
|
||||
@ -164,9 +164,9 @@ define i8 @t11(float %a, float %b) {
|
||||
define i8 @t12(float %a, float %b) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@t12(
|
||||
; CHECK-NEXT: [[DOTINV:%.*]] = fcmp nnan oge float [[B:%.*]], [[A:%.*]]
|
||||
; CHECK-NEXT: [[DOTV:%.*]] = select i1 [[DOTINV]], float [[A]], float [[B]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = fptosi float [[DOTV]] to i8
|
||||
; CHECK-NEXT: ret i8 [[TMP1]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = select nnan i1 [[DOTINV]], float [[A]], float [[B]]
|
||||
; CHECK-NEXT: [[TMP2:%.*]] = fptosi float [[TMP1]] to i8
|
||||
; CHECK-NEXT: ret i8 [[TMP2]]
|
||||
;
|
||||
%1 = fcmp nnan ult float %b, %a
|
||||
%2 = fptosi float %a to i8
|
||||
@ -219,7 +219,7 @@ define i8 @t14_commute(float %a) {
|
||||
define i8 @t15(float %a) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@t15(
|
||||
; CHECK-NEXT: [[DOTINV:%.*]] = fcmp nsz oge float [[A:%.*]], 0.000000e+00
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = select i1 [[DOTINV]], float 0.000000e+00, float [[A]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = select nsz i1 [[DOTINV]], float 0.000000e+00, float [[A]]
|
||||
; CHECK-NEXT: [[TMP2:%.*]] = fptosi float [[TMP1]] to i8
|
||||
; CHECK-NEXT: ret i8 [[TMP2]]
|
||||
;
|
||||
@ -272,8 +272,8 @@ define float @fneg_fmax(float %x, float %y) {
|
||||
define <2 x float> @fsub_fmax(<2 x float> %x, <2 x float> %y) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@fsub_fmax(
|
||||
; CHECK-NEXT: [[COND_INV:%.*]] = fcmp nnan nsz ogt <2 x float> [[X:%.*]], [[Y:%.*]]
|
||||
; CHECK-NEXT: [[MAX_V:%.*]] = select <2 x i1> [[COND_INV]], <2 x float> [[Y]], <2 x float> [[X]]
|
||||
; CHECK-NEXT: [[MAX:%.*]] = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[MAX_V]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = select nnan nsz <2 x i1> [[COND_INV]], <2 x float> [[Y]], <2 x float> [[X]]
|
||||
; CHECK-NEXT: [[MAX:%.*]] = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[TMP1]]
|
||||
; CHECK-NEXT: ret <2 x float> [[MAX]]
|
||||
;
|
||||
%n1 = fsub <2 x float> <float -0.0, float -0.0>, %x
|
||||
@ -300,8 +300,8 @@ define <2 x double> @fsub_fmin(<2 x double> %x, <2 x double> %y) {
|
||||
define double @fneg_fmin(double %x, double %y) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@fneg_fmin(
|
||||
; CHECK-NEXT: [[COND_INV:%.*]] = fcmp nnan nsz olt double [[X:%.*]], [[Y:%.*]]
|
||||
; CHECK-NEXT: [[MAX_V:%.*]] = select i1 [[COND_INV]], double [[Y]], double [[X]]
|
||||
; CHECK-NEXT: [[MAX:%.*]] = fneg double [[MAX_V]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = select nnan nsz i1 [[COND_INV]], double [[Y]], double [[X]]
|
||||
; CHECK-NEXT: [[MAX:%.*]] = fneg double [[TMP1]]
|
||||
; CHECK-NEXT: ret double [[MAX]]
|
||||
;
|
||||
%n1 = fneg double %x
|
||||
|
@ -4,8 +4,8 @@
|
||||
define float @select_max_ugt(float %a, float %b) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@select_max_ugt(
|
||||
; CHECK-NEXT: [[CMP_INV:%.*]] = fcmp arcp ole float [[A:%.*]], [[B:%.*]]
|
||||
; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP_INV]], float [[B]], float [[A]]
|
||||
; CHECK-NEXT: ret float [[SEL]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = select arcp i1 [[CMP_INV]], float [[B]], float [[A]]
|
||||
; CHECK-NEXT: ret float [[TMP1]]
|
||||
;
|
||||
%cmp = fcmp arcp ugt float %a, %b
|
||||
%sel = select arcp i1 %cmp, float %a, float %b
|
||||
@ -15,8 +15,8 @@ define float @select_max_ugt(float %a, float %b) {
|
||||
define float @select_max_uge(float %a, float %b) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@select_max_uge(
|
||||
; CHECK-NEXT: [[CMP_INV:%.*]] = fcmp nnan olt float [[A:%.*]], [[B:%.*]]
|
||||
; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP_INV]], float [[B]], float [[A]]
|
||||
; CHECK-NEXT: ret float [[SEL]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = select nnan i1 [[CMP_INV]], float [[B]], float [[A]]
|
||||
; CHECK-NEXT: ret float [[TMP1]]
|
||||
;
|
||||
%cmp = fcmp nnan uge float %a, %b
|
||||
%sel = select ninf i1 %cmp, float %a, float %b
|
||||
@ -25,9 +25,8 @@ define float @select_max_uge(float %a, float %b) {
|
||||
|
||||
define float @select_min_ugt(float %a, float %b) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@select_min_ugt(
|
||||
; CHECK-NEXT: [[CMP_INV:%.*]] = fcmp fast ole float [[A:%.*]], [[B:%.*]]
|
||||
; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP_INV]], float [[A]], float [[B]]
|
||||
; CHECK-NEXT: ret float [[SEL]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = call fast float @llvm.minnum.f32(float [[A:%.*]], float [[B:%.*]])
|
||||
; CHECK-NEXT: ret float [[TMP1]]
|
||||
;
|
||||
%cmp = fcmp fast ugt float %a, %b
|
||||
%sel = select reassoc i1 %cmp, float %b, float %a
|
||||
@ -37,8 +36,8 @@ define float @select_min_ugt(float %a, float %b) {
|
||||
define float @select_min_uge(float %a, float %b) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@select_min_uge(
|
||||
; CHECK-NEXT: [[CMP_INV:%.*]] = fcmp nsz olt float [[A:%.*]], [[B:%.*]]
|
||||
; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP_INV]], float [[A]], float [[B]]
|
||||
; CHECK-NEXT: ret float [[SEL]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = select nsz i1 [[CMP_INV]], float [[A]], float [[B]]
|
||||
; CHECK-NEXT: ret float [[TMP1]]
|
||||
;
|
||||
%cmp = fcmp nsz uge float %a, %b
|
||||
%sel = select fast i1 %cmp, float %b, float %a
|
||||
@ -48,8 +47,8 @@ define float @select_min_uge(float %a, float %b) {
|
||||
define float @select_max_ult(float %a, float %b) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@select_max_ult(
|
||||
; CHECK-NEXT: [[CMP_INV:%.*]] = fcmp arcp oge float [[A:%.*]], [[B:%.*]]
|
||||
; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP_INV]], float [[A]], float [[B]]
|
||||
; CHECK-NEXT: ret float [[SEL]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = select arcp i1 [[CMP_INV]], float [[A]], float [[B]]
|
||||
; CHECK-NEXT: ret float [[TMP1]]
|
||||
;
|
||||
%cmp = fcmp arcp ult float %a, %b
|
||||
%sel = select ninf nnan i1 %cmp, float %b, float %a
|
||||
@ -58,9 +57,8 @@ define float @select_max_ult(float %a, float %b) {
|
||||
|
||||
define float @select_max_ule(float %a, float %b) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@select_max_ule(
|
||||
; CHECK-NEXT: [[CMP_INV:%.*]] = fcmp fast ogt float [[A:%.*]], [[B:%.*]]
|
||||
; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP_INV]], float [[A]], float [[B]]
|
||||
; CHECK-NEXT: ret float [[SEL]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = call fast float @llvm.maxnum.f32(float [[A:%.*]], float [[B:%.*]])
|
||||
; CHECK-NEXT: ret float [[TMP1]]
|
||||
;
|
||||
%cmp = fcmp fast ule float %a, %b
|
||||
%sel = select nsz i1 %cmp, float %b, float %a
|
||||
@ -70,8 +68,8 @@ define float @select_max_ule(float %a, float %b) {
|
||||
define float @select_min_ult(float %a, float %b) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@select_min_ult(
|
||||
; CHECK-NEXT: [[CMP_INV:%.*]] = fcmp nsz oge float [[A:%.*]], [[B:%.*]]
|
||||
; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP_INV]], float [[B]], float [[A]]
|
||||
; CHECK-NEXT: ret float [[SEL]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = select nsz i1 [[CMP_INV]], float [[B]], float [[A]]
|
||||
; CHECK-NEXT: ret float [[TMP1]]
|
||||
;
|
||||
%cmp = fcmp nsz ult float %a, %b
|
||||
%sel = select fast i1 %cmp, float %a, float %b
|
||||
@ -81,8 +79,8 @@ define float @select_min_ult(float %a, float %b) {
|
||||
define float @select_min_ule(float %a, float %b) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@select_min_ule(
|
||||
; CHECK-NEXT: [[CMP_INV:%.*]] = fcmp arcp ogt float [[A:%.*]], [[B:%.*]]
|
||||
; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP_INV]], float [[B]], float [[A]]
|
||||
; CHECK-NEXT: ret float [[SEL]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = select arcp i1 [[CMP_INV]], float [[B]], float [[A]]
|
||||
; CHECK-NEXT: ret float [[TMP1]]
|
||||
;
|
||||
%cmp = fcmp arcp ule float %a, %b
|
||||
%sel = select ninf i1 %cmp, float %a, float %b
|
||||
@ -92,8 +90,8 @@ define float @select_min_ule(float %a, float %b) {
|
||||
define float @select_fcmp_une(float %a, float %b) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@select_fcmp_une(
|
||||
; CHECK-NEXT: [[CMP_INV:%.*]] = fcmp reassoc oeq float [[A:%.*]], [[B:%.*]]
|
||||
; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP_INV]], float [[B]], float [[A]]
|
||||
; CHECK-NEXT: ret float [[SEL]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = select reassoc i1 [[CMP_INV]], float [[B]], float [[A]]
|
||||
; CHECK-NEXT: ret float [[TMP1]]
|
||||
;
|
||||
%cmp = fcmp reassoc une float %a, %b
|
||||
%sel = select nnan i1 %cmp, float %a, float %b
|
||||
@ -103,8 +101,8 @@ define float @select_fcmp_une(float %a, float %b) {
|
||||
define float @select_fcmp_ueq(float %a, float %b) {
|
||||
; CHECK-LABEL: define {{[^@]+}}@select_fcmp_ueq(
|
||||
; CHECK-NEXT: [[CMP_INV:%.*]] = fcmp reassoc one float [[A:%.*]], [[B:%.*]]
|
||||
; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP_INV]], float [[B]], float [[A]]
|
||||
; CHECK-NEXT: ret float [[SEL]]
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = select reassoc i1 [[CMP_INV]], float [[B]], float [[A]]
|
||||
; CHECK-NEXT: ret float [[TMP1]]
|
||||
;
|
||||
%cmp = fcmp reassoc ueq float %a, %b
|
||||
%sel = select arcp nnan i1 %cmp, float %a, float %b
|
||||
|
Loading…
x
Reference in New Issue
Block a user