@@ -80,3 +80,67 @@ define i32 @all_true_4_i64(<4 x i64> %v) {
8080 %conv3 = zext i1 %3 to i32
8181 ret i32 %conv3
8282}
83+
84+
85+ ; setcc (iN (bitcast (set_cc (vNi1 X), 0, ne)), 0, ne
86+ ; => any_true (set_cc (X), 0, ne)
87+ ; => any_true (X)
88+ define i32 @any_true_1_4_i32 (<4 x i32 > %v ) {
89+ ; CHECK-LABEL: any_true_1_4_i32:
90+ ; CHECK: .functype any_true_1_4_i32 (v128) -> (i32)
91+ ; CHECK-NEXT: # %bb.0:
92+ ; CHECK-NEXT: v128.const $push0=, 0, 0, 0, 0
93+ ; CHECK-NEXT: i32x4.ne $push1=, $0, $pop0
94+ ; CHECK-NEXT: v128.any_true $push2=, $pop1
95+ ; CHECK-NEXT: return $pop2
96+ %1 = icmp ne <4 x i32 > %v , zeroinitializer
97+ %2 = bitcast <4 x i1 > %1 to i4
98+ %3 = icmp ne i4 %2 , 0
99+ %conv3 = zext i1 %3 to i32
100+ ret i32 %conv3
101+ }
102+
103+ ; setcc (iN (bitcast (set_cc (vNi1 X), 0, eq)), -1, ne
104+ ; => not all_true (set_cc (X), 0, eq)
105+ ; => not all_true (set_cc (X), 0, eq)
106+ ; => not not any_true (X)
107+ ; => any_true (X)
108+ define i32 @any_true_2_4_i32 (<4 x i32 > %v ) {
109+ ; CHECK-LABEL: any_true_2_4_i32:
110+ ; CHECK: .functype any_true_2_4_i32 (v128) -> (i32)
111+ ; CHECK-NEXT: # %bb.0:
112+ ; CHECK-NEXT: v128.const $push0=, 0, 0, 0, 0
113+ ; CHECK-NEXT: i32x4.eq $push1=, $0, $pop0
114+ ; CHECK-NEXT: i32x4.all_true $push2=, $pop1
115+ ; CHECK-NEXT: i32.const $push3=, -1
116+ ; CHECK-NEXT: i32.xor $push4=, $pop2, $pop3
117+ ; CHECK-NEXT: i32.const $push5=, 1
118+ ; CHECK-NEXT: i32.and $push6=, $pop4, $pop5
119+ ; CHECK-NEXT: return $pop6
120+ %1 = icmp eq <4 x i32 > %v , zeroinitializer
121+ %2 = bitcast <4 x i1 > %1 to i4
122+ %3 = icmp ne i4 %2 , -1
123+ %conv3 = zext i1 %3 to i32
124+ ret i32 %conv3
125+ }
126+
127+
128+ ; setcc (iN (bitcast (set_cc (vNi1 X), 0, ne)), -1, eq
129+ ; => all_true (set_cc (X), 0, ne)
130+ ; => all_true (X)
131+ define i32 @all_true_2_4_i32 (<4 x i32 > %v ) {
132+ ; CHECK-LABEL: all_true_2_4_i32:
133+ ; CHECK: .functype all_true_2_4_i32 (v128) -> (i32)
134+ ; CHECK-NEXT: # %bb.0:
135+ ; CHECK-NEXT: v128.const $push0=, 0, 0, 0, 0
136+ ; CHECK-NEXT: i32x4.ne $push1=, $0, $pop0
137+ ; CHECK-NEXT: i32x4.all_true $push2=, $pop1
138+ ; CHECK-NEXT: return $pop2
139+ %1 = icmp ne <4 x i32 > %v , zeroinitializer
140+ %2 = bitcast <4 x i1 > %1 to i4
141+ %3 = icmp eq i4 %2 , -1
142+ %conv3 = zext i1 %3 to i32
143+ ret i32 %conv3
144+ }
145+
146+
0 commit comments