[NFC][InstCombine] Add unary FNeg tests to fcmp.ll

llvm-svn: 362234
This commit is contained in:
Cameron McInally 2019-05-31 15:40:03 +00:00
parent 96eb40626f
commit fa2b38d876

View File

@ -68,6 +68,16 @@ define i1 @fneg_constant_swap_pred(float %x) {
ret i1 %cmp
}
define i1 @unary_fneg_constant_swap_pred(float %x) {
; CHECK-LABEL: @unary_fneg_constant_swap_pred(
; CHECK-NEXT: [[CMP:%.*]] = fcmp olt float [[X:%.*]], -1.000000e+00
; CHECK-NEXT: ret i1 [[CMP]]
;
%neg = fneg float %x
%cmp = fcmp ogt float %neg, 1.0
ret i1 %cmp
}
define <2 x i1> @fneg_constant_swap_pred_vec(<2 x float> %x) {
; CHECK-LABEL: @fneg_constant_swap_pred_vec(
; CHECK-NEXT: [[CMP:%.*]] = fcmp olt <2 x float> [[X:%.*]], <float -1.000000e+00, float -2.000000e+00>
@ -78,6 +88,16 @@ define <2 x i1> @fneg_constant_swap_pred_vec(<2 x float> %x) {
ret <2 x i1> %cmp
}
define <2 x i1> @unary_fneg_constant_swap_pred_vec(<2 x float> %x) {
; CHECK-LABEL: @unary_fneg_constant_swap_pred_vec(
; CHECK-NEXT: [[CMP:%.*]] = fcmp olt <2 x float> [[X:%.*]], <float -1.000000e+00, float -2.000000e+00>
; CHECK-NEXT: ret <2 x i1> [[CMP]]
;
%neg = fneg <2 x float> %x
%cmp = fcmp ogt <2 x float> %neg, <float 1.0, float 2.0>
ret <2 x i1> %cmp
}
define <2 x i1> @fneg_constant_swap_pred_vec_undef(<2 x float> %x) {
; CHECK-LABEL: @fneg_constant_swap_pred_vec_undef(
; CHECK-NEXT: [[CMP:%.*]] = fcmp olt <2 x float> [[X:%.*]], <float -1.000000e+00, float -2.000000e+00>
@ -100,6 +120,16 @@ define i1 @fneg_fmf(float %x) {
ret i1 %r
}
define i1 @unary_fneg_fmf(float %x) {
; CHECK-LABEL: @unary_fneg_fmf(
; CHECK-NEXT: [[R:%.*]] = fcmp fast oeq float [[X:%.*]], -4.200000e+01
; CHECK-NEXT: ret i1 [[R]]
;
%n = fneg fast float %x
%r = fcmp fast oeq float %n, 42.0
ret i1 %r
}
; The new fcmp should have the same FMF as the original, vector edition.
define <2 x i1> @fcmp_fneg_fmf_vec(<2 x float> %x) {
@ -123,6 +153,39 @@ define i1 @fneg_fneg_swap_pred(float %x, float %y) {
ret i1 %cmp
}
define i1 @unary_fneg_unary_fneg_swap_pred(float %x, float %y) {
; CHECK-LABEL: @unary_fneg_unary_fneg_swap_pred(
; CHECK-NEXT: [[CMP:%.*]] = fcmp nnan ogt float [[X:%.*]], [[Y:%.*]]
; CHECK-NEXT: ret i1 [[CMP]]
;
%neg1 = fneg float %x
%neg2 = fneg float %y
%cmp = fcmp nnan olt float %neg1, %neg2
ret i1 %cmp
}
define i1 @unary_fneg_fneg_swap_pred(float %x, float %y) {
; CHECK-LABEL: @unary_fneg_fneg_swap_pred(
; CHECK-NEXT: [[CMP:%.*]] = fcmp nnan ogt float [[X:%.*]], [[Y:%.*]]
; CHECK-NEXT: ret i1 [[CMP]]
;
%neg1 = fneg float %x
%neg2 = fsub float -0.0, %y
%cmp = fcmp nnan olt float %neg1, %neg2
ret i1 %cmp
}
define i1 @fneg_unary_fneg_swap_pred(float %x, float %y) {
; CHECK-LABEL: @fneg_unary_fneg_swap_pred(
; CHECK-NEXT: [[CMP:%.*]] = fcmp nnan ogt float [[X:%.*]], [[Y:%.*]]
; CHECK-NEXT: ret i1 [[CMP]]
;
%neg1 = fsub float -0.0, %x
%neg2 = fneg float %y
%cmp = fcmp nnan olt float %neg1, %neg2
ret i1 %cmp
}
define <2 x i1> @fneg_fneg_swap_pred_vec(<2 x float> %x, <2 x float> %y) {
; CHECK-LABEL: @fneg_fneg_swap_pred_vec(
; CHECK-NEXT: [[CMP:%.*]] = fcmp ninf ogt <2 x float> [[X:%.*]], [[Y:%.*]]
@ -134,6 +197,39 @@ define <2 x i1> @fneg_fneg_swap_pred_vec(<2 x float> %x, <2 x float> %y) {
ret <2 x i1> %cmp
}
define <2 x i1> @unary_fneg_unary_fneg_swap_pred_vec(<2 x float> %x, <2 x float> %y) {
; CHECK-LABEL: @unary_fneg_unary_fneg_swap_pred_vec(
; CHECK-NEXT: [[CMP:%.*]] = fcmp ninf ogt <2 x float> [[X:%.*]], [[Y:%.*]]
; CHECK-NEXT: ret <2 x i1> [[CMP]]
;
%neg1 = fneg <2 x float> %x
%neg2 = fneg <2 x float> %y
%cmp = fcmp ninf olt <2 x float> %neg1, %neg2
ret <2 x i1> %cmp
}
define <2 x i1> @unary_fneg_fneg_swap_pred_vec(<2 x float> %x, <2 x float> %y) {
; CHECK-LABEL: @unary_fneg_fneg_swap_pred_vec(
; CHECK-NEXT: [[CMP:%.*]] = fcmp ninf ogt <2 x float> [[X:%.*]], [[Y:%.*]]
; CHECK-NEXT: ret <2 x i1> [[CMP]]
;
%neg1 = fneg <2 x float> %x
%neg2 = fsub <2 x float> <float -0.0, float -0.0>, %y
%cmp = fcmp ninf olt <2 x float> %neg1, %neg2
ret <2 x i1> %cmp
}
define <2 x i1> @fneg_unary_fneg_swap_pred_vec(<2 x float> %x, <2 x float> %y) {
; CHECK-LABEL: @fneg_unary_fneg_swap_pred_vec(
; CHECK-NEXT: [[CMP:%.*]] = fcmp ninf ogt <2 x float> [[X:%.*]], [[Y:%.*]]
; CHECK-NEXT: ret <2 x i1> [[CMP]]
;
%neg1 = fsub <2 x float> <float -0.0, float -0.0>, %x
%neg2 = fneg <2 x float> %y
%cmp = fcmp ninf olt <2 x float> %neg1, %neg2
ret <2 x i1> %cmp
}
define <2 x i1> @fneg_fneg_swap_pred_vec_undef(<2 x float> %x, <2 x float> %y) {
; CHECK-LABEL: @fneg_fneg_swap_pred_vec_undef(
; CHECK-NEXT: [[CMP:%.*]] = fcmp ogt <2 x float> [[X:%.*]], [[Y:%.*]]
@ -145,6 +241,28 @@ define <2 x i1> @fneg_fneg_swap_pred_vec_undef(<2 x float> %x, <2 x float> %y) {
ret <2 x i1> %cmp
}
define <2 x i1> @unary_fneg_fneg_swap_pred_vec_undef(<2 x float> %x, <2 x float> %y) {
; CHECK-LABEL: @unary_fneg_fneg_swap_pred_vec_undef(
; CHECK-NEXT: [[CMP:%.*]] = fcmp ogt <2 x float> [[X:%.*]], [[Y:%.*]]
; CHECK-NEXT: ret <2 x i1> [[CMP]]
;
%neg1 = fneg <2 x float> %x
%neg2 = fsub <2 x float> <float undef, float -0.0>, %y
%cmp = fcmp olt <2 x float> %neg1, %neg2
ret <2 x i1> %cmp
}
define <2 x i1> @fneg_unary_fneg_swap_pred_vec_undef(<2 x float> %x, <2 x float> %y) {
; CHECK-LABEL: @fneg_unary_fneg_swap_pred_vec_undef(
; CHECK-NEXT: [[CMP:%.*]] = fcmp ogt <2 x float> [[X:%.*]], [[Y:%.*]]
; CHECK-NEXT: ret <2 x i1> [[CMP]]
;
%neg1 = fsub <2 x float> <float -0.0, float undef>, %x
%neg2 = fneg <2 x float> %y
%cmp = fcmp olt <2 x float> %neg1, %neg2
ret <2 x i1> %cmp
}
define i1 @test7(float %x) {
; CHECK-LABEL: @test7(
; CHECK-NEXT: [[CMP:%.*]] = fcmp ogt float [[X:%.*]], 0.000000e+00