1
1
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2
2
; RUN: opt < %s -instsimplify -S | FileCheck %s
3
3
4
- ; FIXME: isKnownNonZero should work for integer vectors.
5
-
6
4
define <2 x i1 > @nonzero_vec_splat (<2 x i32 > %x ) {
7
5
; CHECK-LABEL: @nonzero_vec_splat(
8
- ; CHECK-NEXT: [[Y:%.*]] = or <2 x i32> %x, <i32 1, i32 1>
9
- ; CHECK-NEXT: [[C:%.*]] = icmp eq <2 x i32> [[Y]], zeroinitializer
10
- ; CHECK-NEXT: ret <2 x i1> [[C]]
6
+ ; CHECK-NEXT: ret <2 x i1> zeroinitializer
11
7
;
12
8
%y = or <2 x i32 > %x , <i32 1 , i32 1 >
13
9
%c = icmp eq <2 x i32 > %y , zeroinitializer
@@ -16,9 +12,7 @@ define <2 x i1> @nonzero_vec_splat(<2 x i32> %x) {
16
12
17
13
define <2 x i1 > @nonzero_vec_nonsplat (<2 x i32 > %x ) {
18
14
; CHECK-LABEL: @nonzero_vec_nonsplat(
19
- ; CHECK-NEXT: [[Y:%.*]] = or <2 x i32> %x, <i32 2, i32 1>
20
- ; CHECK-NEXT: [[C:%.*]] = icmp ne <2 x i32> [[Y]], zeroinitializer
21
- ; CHECK-NEXT: ret <2 x i1> [[C]]
15
+ ; CHECK-NEXT: ret <2 x i1> <i1 true, i1 true>
22
16
;
23
17
%y = or <2 x i32 > %x , <i32 2 , i32 1 >
24
18
%c = icmp ne <2 x i32 > %y , zeroinitializer
@@ -27,9 +21,7 @@ define <2 x i1> @nonzero_vec_nonsplat(<2 x i32> %x) {
27
21
28
22
define <2 x i1 > @nonzero_vec_undef_elt (<2 x i32 > %x ) {
29
23
; CHECK-LABEL: @nonzero_vec_undef_elt(
30
- ; CHECK-NEXT: [[Y:%.*]] = or <2 x i32> %x, <i32 undef, i32 1>
31
- ; CHECK-NEXT: [[C:%.*]] = icmp eq <2 x i32> [[Y]], zeroinitializer
32
- ; CHECK-NEXT: ret <2 x i1> [[C]]
24
+ ; CHECK-NEXT: ret <2 x i1> zeroinitializer
33
25
;
34
26
%y = or <2 x i32 > %x , <i32 undef , i32 1 >
35
27
%c = icmp eq <2 x i32 > %y , zeroinitializer
@@ -50,11 +42,7 @@ define <2 x i1> @may_be_zero_vec(<2 x i32> %x) {
50
42
; Multiplies of non-zero numbers are non-zero if there is no unsigned overflow.
51
43
define <2 x i1 > @nonzero_vec_mul_nuw (<2 x i32 > %x , <2 x i32 > %y ) {
52
44
; CHECK-LABEL: @nonzero_vec_mul_nuw(
53
- ; CHECK-NEXT: [[XNZ:%.*]] = or <2 x i32> %x, <i32 1, i32 2>
54
- ; CHECK-NEXT: [[YNZ:%.*]] = or <2 x i32> %y, <i32 3, i32 undef>
55
- ; CHECK-NEXT: [[M:%.*]] = mul nuw <2 x i32> [[XNZ]], [[YNZ]]
56
- ; CHECK-NEXT: [[C:%.*]] = icmp eq <2 x i32> [[M]], zeroinitializer
57
- ; CHECK-NEXT: ret <2 x i1> [[C]]
45
+ ; CHECK-NEXT: ret <2 x i1> zeroinitializer
58
46
;
59
47
%xnz = or <2 x i32 > %x , <i32 1 , i32 2 >
60
48
%ynz = or <2 x i32 > %y , <i32 3 , i32 undef >
@@ -66,11 +54,7 @@ define <2 x i1> @nonzero_vec_mul_nuw(<2 x i32> %x, <2 x i32> %y) {
66
54
; Multiplies of non-zero numbers are non-zero if there is no signed overflow.
67
55
define <2 x i1 > @nonzero_vec_mul_nsw (<2 x i32 > %x , <2 x i32 > %y ) {
68
56
; CHECK-LABEL: @nonzero_vec_mul_nsw(
69
- ; CHECK-NEXT: [[XNZ:%.*]] = or <2 x i32> %x, <i32 undef, i32 2>
70
- ; CHECK-NEXT: [[YNZ:%.*]] = or <2 x i32> %y, <i32 3, i32 4>
71
- ; CHECK-NEXT: [[M:%.*]] = mul nsw <2 x i32> [[XNZ]], [[YNZ]]
72
- ; CHECK-NEXT: [[C:%.*]] = icmp ne <2 x i32> [[M]], zeroinitializer
73
- ; CHECK-NEXT: ret <2 x i1> [[C]]
57
+ ; CHECK-NEXT: ret <2 x i1> <i1 true, i1 true>
74
58
;
75
59
%xnz = or <2 x i32 > %x , <i32 undef , i32 2 >
76
60
%ynz = or <2 x i32 > %y , <i32 3 , i32 4 >
0 commit comments