[NFC][InstSimplify] Precommit new unary fneg test

llvm-svn: 361060
This commit is contained in:
Cameron McInally 2019-05-17 18:34:35 +00:00
parent e78ac9cc72
commit bebc7d6a4e
2 changed files with 49 additions and 2 deletions

View File

@ -28,6 +28,18 @@ define float @fsub_-0_-0_x(float %a) {
ret float %ret
}
; fsub -0.0, (fneg X) ==> X
define float @fneg_x(float %a) {
; CHECK-LABEL: @fneg_x(
; CHECK-NEXT: %t1 = fneg float %a
; CHECK-NEXT: %ret = fsub float -0.000000e+00, %t1
; CHECK-NEXT: ret float %ret
;
%t1 = fneg float %a
%ret = fsub float -0.0, %t1
ret float %ret
}
define <2 x float> @fsub_-0_-0_x_vec(<2 x float> %a) {
; CHECK-LABEL: @fsub_-0_-0_x_vec(
; CHECK-NEXT: ret <2 x float> [[A:%.*]]
@ -37,6 +49,17 @@ define <2 x float> @fsub_-0_-0_x_vec(<2 x float> %a) {
ret <2 x float> %ret
}
define <2 x float> @fneg_x_vec(<2 x float> %a) {
; CHECK-LABEL: @fneg_x_vec(
; CHECK-NEXT: %t1 = fneg <2 x float> %a
; CHECK-NEXT: %ret = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, %t1
; CHECK-NEXT: ret <2 x float> %ret
;
%t1 = fneg <2 x float> %a
%ret = fsub <2 x float> <float -0.0, float -0.0>, %t1
ret <2 x float> %ret
}
define <2 x float> @fsub_-0_-0_x_vec_undef_elts(<2 x float> %a) {
; CHECK-LABEL: @fsub_-0_-0_x_vec_undef_elts(
; CHECK-NEXT: ret <2 x float> [[A:%.*]]
@ -46,6 +69,17 @@ define <2 x float> @fsub_-0_-0_x_vec_undef_elts(<2 x float> %a) {
ret <2 x float> %ret
}
define <2 x float> @fneg_x_vec_undef_elts(<2 x float> %a) {
; CHECK-LABEL: @fneg_x_vec_undef_elts(
; CHECK-NEXT: %t1 = fneg <2 x float> %a
; CHECK-NEXT: %ret = fsub <2 x float> <float -0.000000e+00, float undef>, %t1
; CHECK-NEXT: ret <2 x float> %ret
;
%t1 = fneg <2 x float> %a
%ret = fsub <2 x float> <float -0.0, float undef>, %t1
ret <2 x float> %ret
}
; fsub -0.0, (fsub 0.0, X) != X
define float @fsub_-0_0_x(float %a) {
; CHECK-LABEL: @fsub_-0_0_x(

View File

@ -255,8 +255,8 @@ define i1 @nnan_fsub(double %arg0, double %arg1) {
ret i1 %tmp
}
define i1 @nnan_fneg() {
; CHECK-LABEL: @nnan_fneg(
define i1 @nnan_binary_fneg() {
; CHECK-LABEL: @nnan_binary_fneg(
; CHECK-NEXT: [[NNAN:%.*]] = call nnan double @func()
; CHECK-NEXT: [[OP:%.*]] = fsub double -0.000000e+00, [[NNAN]]
; CHECK-NEXT: [[TMP:%.*]] = fcmp ord double [[OP]], [[OP]]
@ -268,6 +268,19 @@ define i1 @nnan_fneg() {
ret i1 %tmp
}
define i1 @nnan_unary_fneg() {
; CHECK-LABEL: @nnan_unary_fneg(
; CHECK-NEXT: [[NNAN:%.*]] = call nnan double @func()
; CHECK-NEXT: [[OP:%.*]] = fneg double [[NNAN]]
; CHECK-NEXT: [[TMP:%.*]] = fcmp ord double [[OP]], [[OP]]
; CHECK-NEXT: ret i1 [[TMP]]
;
%nnan = call nnan double @func()
%op = fneg double %nnan
%tmp = fcmp ord double %op, %op
ret i1 %tmp
}
define i1 @sitofp(i32 %arg0) {
; CHECK-LABEL: @sitofp(
; CHECK-NEXT: ret i1 false