1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s | FileCheck -check-prefixes=RV32 %s
3 ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s | FileCheck -check-prefixes=RV64 %s
5 define i64 @test_clear_mask_i64_i32(i64 %x) nounwind {
6 ; RV32-LABEL: test_clear_mask_i64_i32:
7 ; RV32: # %bb.0: # %entry
8 ; RV32-NEXT: bltz a0, .LBB0_2
9 ; RV32-NEXT: # %bb.1: # %t
11 ; RV32-NEXT: li a0, 42
12 ; RV32-NEXT: .LBB0_2: # %f
15 ; RV64-LABEL: test_clear_mask_i64_i32:
16 ; RV64: # %bb.0: # %entry
17 ; RV64-NEXT: slli a1, a0, 32
18 ; RV64-NEXT: bltz a1, .LBB0_2
19 ; RV64-NEXT: # %bb.1: # %t
20 ; RV64-NEXT: li a0, 42
21 ; RV64-NEXT: .LBB0_2: # %f
24 %a = and i64 %x, 2147483648
25 %r = icmp eq i64 %a, 0
26 br i1 %r, label %t, label %f
30 %ret = phi i64 [ %x, %entry], [ 42, %t]
34 define i64 @test_set_mask_i64_i32(i64 %x) nounwind {
35 ; RV32-LABEL: test_set_mask_i64_i32:
36 ; RV32: # %bb.0: # %entry
37 ; RV32-NEXT: bgez a0, .LBB1_2
38 ; RV32-NEXT: # %bb.1: # %t
40 ; RV32-NEXT: li a0, 42
41 ; RV32-NEXT: .LBB1_2: # %f
44 ; RV64-LABEL: test_set_mask_i64_i32:
45 ; RV64: # %bb.0: # %entry
46 ; RV64-NEXT: slli a1, a0, 32
47 ; RV64-NEXT: bgez a1, .LBB1_2
48 ; RV64-NEXT: # %bb.1: # %t
49 ; RV64-NEXT: li a0, 42
50 ; RV64-NEXT: .LBB1_2: # %f
53 %a = and i64 %x, 2147483648
54 %r = icmp ne i64 %a, 0
55 br i1 %r, label %t, label %f
59 %ret = phi i64 [ %x, %entry], [ 42, %t]
63 define i64 @test_clear_mask_i64_i16(i64 %x) nounwind {
64 ; RV32-LABEL: test_clear_mask_i64_i16:
65 ; RV32: # %bb.0: # %entry
66 ; RV32-NEXT: slli a2, a0, 16
67 ; RV32-NEXT: bltz a2, .LBB2_2
68 ; RV32-NEXT: # %bb.1: # %t
70 ; RV32-NEXT: li a0, 42
71 ; RV32-NEXT: .LBB2_2: # %f
74 ; RV64-LABEL: test_clear_mask_i64_i16:
75 ; RV64: # %bb.0: # %entry
76 ; RV64-NEXT: slli a1, a0, 48
77 ; RV64-NEXT: bltz a1, .LBB2_2
78 ; RV64-NEXT: # %bb.1: # %t
79 ; RV64-NEXT: li a0, 42
80 ; RV64-NEXT: .LBB2_2: # %f
83 %a = and i64 %x, 32768
84 %r = icmp eq i64 %a, 0
85 br i1 %r, label %t, label %f
89 %ret = phi i64 [ %x, %entry], [ 42, %t]
93 define i64 @test_set_mask_i64_i16(i64 %x) nounwind {
94 ; RV32-LABEL: test_set_mask_i64_i16:
95 ; RV32: # %bb.0: # %entry
96 ; RV32-NEXT: slli a2, a0, 16
97 ; RV32-NEXT: bgez a2, .LBB3_2
98 ; RV32-NEXT: # %bb.1: # %t
100 ; RV32-NEXT: li a0, 42
101 ; RV32-NEXT: .LBB3_2: # %f
104 ; RV64-LABEL: test_set_mask_i64_i16:
105 ; RV64: # %bb.0: # %entry
106 ; RV64-NEXT: slli a1, a0, 48
107 ; RV64-NEXT: bgez a1, .LBB3_2
108 ; RV64-NEXT: # %bb.1: # %t
109 ; RV64-NEXT: li a0, 42
110 ; RV64-NEXT: .LBB3_2: # %f
113 %a = and i64 %x, 32768
114 %r = icmp ne i64 %a, 0
115 br i1 %r, label %t, label %f
119 %ret = phi i64 [ %x, %entry], [ 42, %t]
123 define i64 @test_clear_mask_i64_i8(i64 %x) nounwind {
124 ; RV32-LABEL: test_clear_mask_i64_i8:
125 ; RV32: # %bb.0: # %entry
126 ; RV32-NEXT: andi a2, a0, 128
127 ; RV32-NEXT: bnez a2, .LBB4_2
128 ; RV32-NEXT: # %bb.1: # %t
129 ; RV32-NEXT: li a1, 0
130 ; RV32-NEXT: li a0, 42
131 ; RV32-NEXT: .LBB4_2: # %f
134 ; RV64-LABEL: test_clear_mask_i64_i8:
135 ; RV64: # %bb.0: # %entry
136 ; RV64-NEXT: andi a1, a0, 128
137 ; RV64-NEXT: bnez a1, .LBB4_2
138 ; RV64-NEXT: # %bb.1: # %t
139 ; RV64-NEXT: li a0, 42
140 ; RV64-NEXT: .LBB4_2: # %f
144 %r = icmp eq i64 %a, 0
145 br i1 %r, label %t, label %f
149 %ret = phi i64 [ %x, %entry], [ 42, %t]
153 define i64 @test_set_mask_i64_i8(i64 %x) nounwind {
154 ; RV32-LABEL: test_set_mask_i64_i8:
155 ; RV32: # %bb.0: # %entry
156 ; RV32-NEXT: andi a2, a0, 128
157 ; RV32-NEXT: beqz a2, .LBB5_2
158 ; RV32-NEXT: # %bb.1: # %t
159 ; RV32-NEXT: li a1, 0
160 ; RV32-NEXT: li a0, 42
161 ; RV32-NEXT: .LBB5_2: # %f
164 ; RV64-LABEL: test_set_mask_i64_i8:
165 ; RV64: # %bb.0: # %entry
166 ; RV64-NEXT: andi a1, a0, 128
167 ; RV64-NEXT: beqz a1, .LBB5_2
168 ; RV64-NEXT: # %bb.1: # %t
169 ; RV64-NEXT: li a0, 42
170 ; RV64-NEXT: .LBB5_2: # %f
174 %r = icmp ne i64 %a, 0
175 br i1 %r, label %t, label %f
179 %ret = phi i64 [ %x, %entry], [ 42, %t]
183 define i32 @test_clear_mask_i32_i16(i32 %x) nounwind {
184 ; RV32-LABEL: test_clear_mask_i32_i16:
185 ; RV32: # %bb.0: # %entry
186 ; RV32-NEXT: slli a1, a0, 16
187 ; RV32-NEXT: bltz a1, .LBB6_2
188 ; RV32-NEXT: # %bb.1: # %t
189 ; RV32-NEXT: li a0, 42
190 ; RV32-NEXT: .LBB6_2: # %f
193 ; RV64-LABEL: test_clear_mask_i32_i16:
194 ; RV64: # %bb.0: # %entry
195 ; RV64-NEXT: slli a1, a0, 48
196 ; RV64-NEXT: bltz a1, .LBB6_2
197 ; RV64-NEXT: # %bb.1: # %t
198 ; RV64-NEXT: li a0, 42
199 ; RV64-NEXT: .LBB6_2: # %f
202 %a = and i32 %x, 32768
203 %r = icmp eq i32 %a, 0
204 br i1 %r, label %t, label %f
208 %ret = phi i32 [ %x, %entry], [ 42, %t]
212 define i32 @test_set_mask_i32_i16(i32 %x) nounwind {
213 ; RV32-LABEL: test_set_mask_i32_i16:
214 ; RV32: # %bb.0: # %entry
215 ; RV32-NEXT: slli a1, a0, 16
216 ; RV32-NEXT: bgez a1, .LBB7_2
217 ; RV32-NEXT: # %bb.1: # %t
218 ; RV32-NEXT: li a0, 42
219 ; RV32-NEXT: .LBB7_2: # %f
222 ; RV64-LABEL: test_set_mask_i32_i16:
223 ; RV64: # %bb.0: # %entry
224 ; RV64-NEXT: slli a1, a0, 48
225 ; RV64-NEXT: bgez a1, .LBB7_2
226 ; RV64-NEXT: # %bb.1: # %t
227 ; RV64-NEXT: li a0, 42
228 ; RV64-NEXT: .LBB7_2: # %f
231 %a = and i32 %x, 32768
232 %r = icmp ne i32 %a, 0
233 br i1 %r, label %t, label %f
237 %ret = phi i32 [ %x, %entry], [ 42, %t]
241 define i32 @test_clear_mask_i32_i8(i32 %x) nounwind {
242 ; RV32-LABEL: test_clear_mask_i32_i8:
243 ; RV32: # %bb.0: # %entry
244 ; RV32-NEXT: andi a1, a0, 128
245 ; RV32-NEXT: bnez a1, .LBB8_2
246 ; RV32-NEXT: # %bb.1: # %t
247 ; RV32-NEXT: li a0, 42
248 ; RV32-NEXT: .LBB8_2: # %f
251 ; RV64-LABEL: test_clear_mask_i32_i8:
252 ; RV64: # %bb.0: # %entry
253 ; RV64-NEXT: andi a1, a0, 128
254 ; RV64-NEXT: bnez a1, .LBB8_2
255 ; RV64-NEXT: # %bb.1: # %t
256 ; RV64-NEXT: li a0, 42
257 ; RV64-NEXT: .LBB8_2: # %f
261 %r = icmp eq i32 %a, 0
262 br i1 %r, label %t, label %f
266 %ret = phi i32 [ %x, %entry], [ 42, %t]
270 define i32 @test_set_mask_i32_i8(i32 %x) nounwind {
271 ; RV32-LABEL: test_set_mask_i32_i8:
272 ; RV32: # %bb.0: # %entry
273 ; RV32-NEXT: andi a1, a0, 128
274 ; RV32-NEXT: beqz a1, .LBB9_2
275 ; RV32-NEXT: # %bb.1: # %t
276 ; RV32-NEXT: li a0, 42
277 ; RV32-NEXT: .LBB9_2: # %f
280 ; RV64-LABEL: test_set_mask_i32_i8:
281 ; RV64: # %bb.0: # %entry
282 ; RV64-NEXT: andi a1, a0, 128
283 ; RV64-NEXT: beqz a1, .LBB9_2
284 ; RV64-NEXT: # %bb.1: # %t
285 ; RV64-NEXT: li a0, 42
286 ; RV64-NEXT: .LBB9_2: # %f
290 %r = icmp ne i32 %a, 0
291 br i1 %r, label %t, label %f
295 %ret = phi i32 [ %x, %entry], [ 42, %t]
299 define i16 @test_clear_mask_i16_i8(i16 %x) nounwind {
300 ; RV32-LABEL: test_clear_mask_i16_i8:
301 ; RV32: # %bb.0: # %entry
302 ; RV32-NEXT: andi a1, a0, 128
303 ; RV32-NEXT: bnez a1, .LBB10_2
304 ; RV32-NEXT: # %bb.1: # %t
305 ; RV32-NEXT: li a0, 42
306 ; RV32-NEXT: .LBB10_2: # %f
309 ; RV64-LABEL: test_clear_mask_i16_i8:
310 ; RV64: # %bb.0: # %entry
311 ; RV64-NEXT: andi a1, a0, 128
312 ; RV64-NEXT: bnez a1, .LBB10_2
313 ; RV64-NEXT: # %bb.1: # %t
314 ; RV64-NEXT: li a0, 42
315 ; RV64-NEXT: .LBB10_2: # %f
319 %r = icmp eq i16 %a, 0
320 br i1 %r, label %t, label %f
324 %ret = phi i16 [ %x, %entry], [ 42, %t]
328 define i16 @test_set_mask_i16_i8(i16 %x) nounwind {
329 ; RV32-LABEL: test_set_mask_i16_i8:
330 ; RV32: # %bb.0: # %entry
331 ; RV32-NEXT: andi a1, a0, 128
332 ; RV32-NEXT: beqz a1, .LBB11_2
333 ; RV32-NEXT: # %bb.1: # %t
334 ; RV32-NEXT: li a0, 42
335 ; RV32-NEXT: .LBB11_2: # %f
338 ; RV64-LABEL: test_set_mask_i16_i8:
339 ; RV64: # %bb.0: # %entry
340 ; RV64-NEXT: andi a1, a0, 128
341 ; RV64-NEXT: beqz a1, .LBB11_2
342 ; RV64-NEXT: # %bb.1: # %t
343 ; RV64-NEXT: li a0, 42
344 ; RV64-NEXT: .LBB11_2: # %f
348 %r = icmp ne i16 %a, 0
349 br i1 %r, label %t, label %f
353 %ret = phi i16 [ %x, %entry], [ 42, %t]
357 define i16 @test_set_mask_i16_i7(i16 %x) nounwind {
358 ; RV32-LABEL: test_set_mask_i16_i7:
359 ; RV32: # %bb.0: # %entry
360 ; RV32-NEXT: andi a1, a0, 64
361 ; RV32-NEXT: beqz a1, .LBB12_2
362 ; RV32-NEXT: # %bb.1: # %t
363 ; RV32-NEXT: li a0, 42
364 ; RV32-NEXT: .LBB12_2: # %f
367 ; RV64-LABEL: test_set_mask_i16_i7:
368 ; RV64: # %bb.0: # %entry
369 ; RV64-NEXT: andi a1, a0, 64
370 ; RV64-NEXT: beqz a1, .LBB12_2
371 ; RV64-NEXT: # %bb.1: # %t
372 ; RV64-NEXT: li a0, 42
373 ; RV64-NEXT: .LBB12_2: # %f
377 %r = icmp ne i16 %a, 0
378 br i1 %r, label %t, label %f
382 %ret = phi i16 [ %x, %entry], [ 42, %t]