llvm.org GIT mirror llvm / 4edb268
[NFC][InstSimplify] Precommit new unary fneg test git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361060 91177308-0d34-0410-b5e6-96231b3b80d8 Cameron McInally 4 months ago
2 changed file(s) with 49 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
2727 ret float %ret
2828 }
2929
30 ; fsub -0.0, (fneg X) ==> X
31 define float @fneg_x(float %a) {
32 ; CHECK-LABEL: @fneg_x(
33 ; CHECK-NEXT: %t1 = fneg float %a
34 ; CHECK-NEXT: %ret = fsub float -0.000000e+00, %t1
35 ; CHECK-NEXT: ret float %ret
36 ;
37 %t1 = fneg float %a
38 %ret = fsub float -0.0, %t1
39 ret float %ret
40 }
41
3042 define <2 x float> @fsub_-0_-0_x_vec(<2 x float> %a) {
3143 ; CHECK-LABEL: @fsub_-0_-0_x_vec(
3244 ; CHECK-NEXT: ret <2 x float> [[A:%.*]]
3648 ret <2 x float> %ret
3749 }
3850
51 define <2 x float> @fneg_x_vec(<2 x float> %a) {
52 ; CHECK-LABEL: @fneg_x_vec(
53 ; CHECK-NEXT: %t1 = fneg <2 x float> %a
54 ; CHECK-NEXT: %ret = fsub <2 x float> , %t1
55 ; CHECK-NEXT: ret <2 x float> %ret
56 ;
57 %t1 = fneg <2 x float> %a
58 %ret = fsub <2 x float> , %t1
59 ret <2 x float> %ret
60 }
61
3962 define <2 x float> @fsub_-0_-0_x_vec_undef_elts(<2 x float> %a) {
4063 ; CHECK-LABEL: @fsub_-0_-0_x_vec_undef_elts(
4164 ; CHECK-NEXT: ret <2 x float> [[A:%.*]]
4265 ;
4366 %t1 = fsub <2 x float> , %a
67 %ret = fsub <2 x float> , %t1
68 ret <2 x float> %ret
69 }
70
71 define <2 x float> @fneg_x_vec_undef_elts(<2 x float> %a) {
72 ; CHECK-LABEL: @fneg_x_vec_undef_elts(
73 ; CHECK-NEXT: %t1 = fneg <2 x float> %a
74 ; CHECK-NEXT: %ret = fsub <2 x float> , %t1
75 ; CHECK-NEXT: ret <2 x float> %ret
76 ;
77 %t1 = fneg <2 x float> %a
4478 %ret = fsub <2 x float> , %t1
4579 ret <2 x float> %ret
4680 }
254254 ret i1 %tmp
255255 }
256256
257 define i1 @nnan_fneg() {
258 ; CHECK-LABEL: @nnan_fneg(
257 define i1 @nnan_binary_fneg() {
258 ; CHECK-LABEL: @nnan_binary_fneg(
259259 ; CHECK-NEXT: [[NNAN:%.*]] = call nnan double @func()
260260 ; CHECK-NEXT: [[OP:%.*]] = fsub double -0.000000e+00, [[NNAN]]
261261 ; CHECK-NEXT: [[TMP:%.*]] = fcmp ord double [[OP]], [[OP]]
263263 ;
264264 %nnan = call nnan double @func()
265265 %op = fsub double -0.0, %nnan
266 %tmp = fcmp ord double %op, %op
267 ret i1 %tmp
268 }
269
270 define i1 @nnan_unary_fneg() {
271 ; CHECK-LABEL: @nnan_unary_fneg(
272 ; CHECK-NEXT: [[NNAN:%.*]] = call nnan double @func()
273 ; CHECK-NEXT: [[OP:%.*]] = fneg double [[NNAN]]
274 ; CHECK-NEXT: [[TMP:%.*]] = fcmp ord double [[OP]], [[OP]]
275 ; CHECK-NEXT: ret i1 [[TMP]]
276 ;
277 %nnan = call nnan double @func()
278 %op = fneg double %nnan
266279 %tmp = fcmp ord double %op, %op
267280 ret i1 %tmp
268281 }