1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-unknown \
3 ; RUN: -ppc-asm-full-reg-names < %s | FileCheck %s
4 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-unknown \
5 ; RUN: -ppc-asm-full-reg-names < %s | FileCheck %s
7 define zeroext i1 @eq1(i1 zeroext %x, i1 zeroext %y) {
10 ; CHECK-NEXT: add r3, r4, r3
11 ; CHECK-NEXT: cntlzw r3, r3
12 ; CHECK-NEXT: srwi r3, r3, 5
14 %sub = sext i1 %x to i32
15 %conv3 = zext i1 %y to i32
16 %cmp = icmp eq i32 %sub, %conv3
20 define zeroext i8 @eq2(i8 zeroext %x, i8 zeroext %y) {
23 ; CHECK-NEXT: add r3, r4, r3
24 ; CHECK-NEXT: cntlzw r3, r3
25 ; CHECK-NEXT: srwi r3, r3, 5
27 %conv = zext i8 %x to i32
28 %sub = sub nsw i32 0, %conv
29 %conv1 = zext i8 %y to i32
30 %cmp = icmp eq i32 %sub, %conv1
31 %conv3 = zext i1 %cmp to i8
35 define signext i16 @eq3(i16 signext %x, i16 signext %y) {
38 ; CHECK-NEXT: add r3, r4, r3
39 ; CHECK-NEXT: cntlzw r3, r3
40 ; CHECK-NEXT: srwi r3, r3, 5
42 %conv = sext i16 %x to i32
43 %sub = sub nsw i32 0, %conv
44 %conv1 = sext i16 %y to i32
45 %cmp = icmp eq i32 %sub, %conv1
46 %conv3 = zext i1 %cmp to i16
50 define zeroext i16 @eq4(i16 zeroext %x, i16 zeroext %y) {
53 ; CHECK-NEXT: add r3, r4, r3
54 ; CHECK-NEXT: cntlzw r3, r3
55 ; CHECK-NEXT: srwi r3, r3, 5
57 %conv = zext i16 %x to i32
58 %sub = sub nsw i32 0, %conv
59 %conv1 = zext i16 %y to i32
60 %cmp = icmp eq i32 %sub, %conv1
61 %conv3 = zext i1 %cmp to i16
65 define signext i32 @eq5(i32 signext %x, i32 signext %y) {
68 ; CHECK-NEXT: add r3, r4, r3
69 ; CHECK-NEXT: cntlzw r3, r3
70 ; CHECK-NEXT: srwi r3, r3, 5
72 %sub = sub nsw i32 0, %x
73 %cmp = icmp eq i32 %sub, %y
74 %conv = zext i1 %cmp to i32
78 define zeroext i32 @eq6(i32 zeroext %x, i32 zeroext %y) {
81 ; CHECK-NEXT: add r3, r4, r3
82 ; CHECK-NEXT: cntlzw r3, r3
83 ; CHECK-NEXT: srwi r3, r3, 5
86 %cmp = icmp eq i32 %sub, %y
87 %conv = zext i1 %cmp to i32
91 define i64 @eq7(i64 %x, i64 %y) {
94 ; CHECK-NEXT: add r3, r4, r3
95 ; CHECK-NEXT: cntlzd r3, r3
96 ; CHECK-NEXT: rldicl r3, r3, 58, 63
98 %sub = sub nsw i64 0, %x
99 %cmp = icmp eq i64 %sub, %y
100 %zext = zext i1 %cmp to i64
104 define zeroext i1 @eq8(i1 zeroext %x, i1 zeroext %y) {
107 ; CHECK-NEXT: add r3, r4, r3
108 ; CHECK-NEXT: cntlzw r3, r3
109 ; CHECK-NEXT: srwi r3, r3, 5
111 %conv = zext i1 %y to i32
112 %sub = sext i1 %x to i32
113 %cmp = icmp eq i32 %conv, %sub
117 define zeroext i8 @eq9(i8 zeroext %x, i8 zeroext %y) {
120 ; CHECK-NEXT: add r3, r3, r4
121 ; CHECK-NEXT: cntlzw r3, r3
122 ; CHECK-NEXT: srwi r3, r3, 5
124 %conv = zext i8 %x to i32
125 %conv1 = zext i8 %y to i32
126 %sub = sub nsw i32 0, %conv1
127 %cmp = icmp eq i32 %conv, %sub
128 %conv3 = zext i1 %cmp to i8
132 define signext i16 @eq10(i16 signext %x, i16 signext %y) {
135 ; CHECK-NEXT: add r3, r3, r4
136 ; CHECK-NEXT: cntlzw r3, r3
137 ; CHECK-NEXT: srwi r3, r3, 5
139 %conv = sext i16 %x to i32
140 %conv1 = sext i16 %y to i32
141 %sub = sub nsw i32 0, %conv1
142 %cmp = icmp eq i32 %conv, %sub
143 %conv3 = zext i1 %cmp to i16
147 define zeroext i16 @eq11(i16 zeroext %x, i16 zeroext %y) {
150 ; CHECK-NEXT: add r3, r3, r4
151 ; CHECK-NEXT: cntlzw r3, r3
152 ; CHECK-NEXT: srwi r3, r3, 5
154 %conv = zext i16 %x to i32
155 %conv1 = zext i16 %y to i32
156 %sub = sub nsw i32 0, %conv1
157 %cmp = icmp eq i32 %conv, %sub
158 %conv3 = zext i1 %cmp to i16
162 define signext i32 @eq12(i32 signext %x, i32 signext %y) {
165 ; CHECK-NEXT: add r3, r3, r4
166 ; CHECK-NEXT: cntlzw r3, r3
167 ; CHECK-NEXT: srwi r3, r3, 5
169 %sub = sub nsw i32 0, %y
170 %cmp = icmp eq i32 %sub, %x
171 %conv = zext i1 %cmp to i32
175 define zeroext i32 @eq13(i32 zeroext %x, i32 zeroext %y) {
178 ; CHECK-NEXT: add r3, r3, r4
179 ; CHECK-NEXT: cntlzw r3, r3
180 ; CHECK-NEXT: srwi r3, r3, 5
183 %cmp = icmp eq i32 %sub, %x
184 %conv = zext i1 %cmp to i32
188 define i64 @eq14(i64 %x, i64 %y) {
191 ; CHECK-NEXT: add r3, r3, r4
192 ; CHECK-NEXT: cntlzd r3, r3
193 ; CHECK-NEXT: rldicl r3, r3, 58, 63
195 %sub = sub nsw i64 0, %y
196 %cmp = icmp eq i64 %sub, %x
197 %conv1 = zext i1 %cmp to i64
201 define zeroext i1 @neq1(i1 zeroext %x, i1 zeroext %y) {
204 ; CHECK-NEXT: add r3, r4, r3
205 ; CHECK-NEXT: cntlzw r3, r3
206 ; CHECK-NEXT: srwi r3, r3, 5
207 ; CHECK-NEXT: xori r3, r3, 1
209 %sub = sext i1 %x to i32
210 %conv3 = zext i1 %y to i32
211 %cmp = icmp ne i32 %sub, %conv3
215 define zeroext i8 @neq2(i8 zeroext %x, i8 zeroext %y) {
218 ; CHECK-NEXT: add r3, r4, r3
219 ; CHECK-NEXT: cntlzw r3, r3
220 ; CHECK-NEXT: srwi r3, r3, 5
221 ; CHECK-NEXT: xori r3, r3, 1
223 %conv = zext i8 %x to i32
224 %sub = sub nsw i32 0, %conv
225 %conv1 = zext i8 %y to i32
226 %cmp = icmp ne i32 %sub, %conv1
227 %conv3 = zext i1 %cmp to i8
231 define signext i16 @neq3(i16 signext %x, i16 signext %y) {
234 ; CHECK-NEXT: add r3, r4, r3
235 ; CHECK-NEXT: cntlzw r3, r3
236 ; CHECK-NEXT: srwi r3, r3, 5
237 ; CHECK-NEXT: xori r3, r3, 1
239 %conv = sext i16 %x to i32
240 %sub = sub nsw i32 0, %conv
241 %conv1 = sext i16 %y to i32
242 %cmp = icmp ne i32 %sub, %conv1
243 %conv3 = zext i1 %cmp to i16
247 define zeroext i16 @neq4(i16 zeroext %x, i16 zeroext %y) {
250 ; CHECK-NEXT: add r3, r4, r3
251 ; CHECK-NEXT: cntlzw r3, r3
252 ; CHECK-NEXT: srwi r3, r3, 5
253 ; CHECK-NEXT: xori r3, r3, 1
255 %conv = zext i16 %x to i32
256 %sub = sub nsw i32 0, %conv
257 %conv1 = zext i16 %y to i32
258 %cmp = icmp ne i32 %sub, %conv1
259 %conv3 = zext i1 %cmp to i16
263 define signext i32 @neq5(i32 signext %x, i32 signext %y) {
266 ; CHECK-NEXT: add r3, r4, r3
267 ; CHECK-NEXT: cntlzw r3, r3
268 ; CHECK-NEXT: srwi r3, r3, 5
269 ; CHECK-NEXT: xori r3, r3, 1
271 %sub = sub nsw i32 0, %x
272 %cmp = icmp ne i32 %sub, %y
273 %conv = zext i1 %cmp to i32
277 define zeroext i32 @neq6(i32 zeroext %x, i32 zeroext %y) {
280 ; CHECK-NEXT: add r3, r4, r3
281 ; CHECK-NEXT: cntlzw r3, r3
282 ; CHECK-NEXT: srwi r3, r3, 5
283 ; CHECK-NEXT: xori r3, r3, 1
286 %cmp = icmp ne i32 %sub, %y
287 %conv = zext i1 %cmp to i32
291 define i64 @neq7(i64 %x, i64 %y) {
294 ; CHECK-NEXT: add r3, r4, r3
295 ; CHECK-NEXT: addic r4, r3, -1
296 ; CHECK-NEXT: subfe r3, r4, r3
298 %sub = sub nsw i64 0, %x
299 %cmp = icmp ne i64 %sub, %y
300 %zext = zext i1 %cmp to i64
304 define zeroext i1 @neq8(i1 zeroext %x, i1 zeroext %y) {
307 ; CHECK-NEXT: add r3, r4, r3
308 ; CHECK-NEXT: cntlzw r3, r3
309 ; CHECK-NEXT: srwi r3, r3, 5
310 ; CHECK-NEXT: xori r3, r3, 1
312 %conv = zext i1 %y to i32
313 %sub = sext i1 %x to i32
314 %cmp = icmp ne i32 %conv, %sub
318 define zeroext i8 @neq9(i8 zeroext %x, i8 zeroext %y) {
321 ; CHECK-NEXT: add r3, r4, r3
322 ; CHECK-NEXT: cntlzw r3, r3
323 ; CHECK-NEXT: srwi r3, r3, 5
324 ; CHECK-NEXT: xori r3, r3, 1
326 %conv = zext i8 %y to i32
327 %conv1 = zext i8 %x to i32
328 %sub = sub nsw i32 0, %conv1
329 %cmp = icmp ne i32 %conv, %sub
330 %conv3 = zext i1 %cmp to i8
334 define signext i16 @neq10(i16 signext %x, i16 signext %y) {
335 ; CHECK-LABEL: neq10:
337 ; CHECK-NEXT: add r3, r4, r3
338 ; CHECK-NEXT: cntlzw r3, r3
339 ; CHECK-NEXT: srwi r3, r3, 5
340 ; CHECK-NEXT: xori r3, r3, 1
342 %conv = sext i16 %y to i32
343 %conv1 = sext i16 %x to i32
344 %sub = sub nsw i32 0, %conv1
345 %cmp = icmp ne i32 %conv, %sub
346 %conv3 = zext i1 %cmp to i16
350 define zeroext i16 @neq11(i16 zeroext %x, i16 zeroext %y) {
351 ; CHECK-LABEL: neq11:
352 ; CHECK: # %bb.0: # %entry
353 ; CHECK-NEXT: add r3, r4, r3
354 ; CHECK-NEXT: cntlzw r3, r3
355 ; CHECK-NEXT: srwi r3, r3, 5
356 ; CHECK-NEXT: xori r3, r3, 1
359 %conv = zext i16 %y to i32
360 %conv1 = zext i16 %x to i32
361 %sub = sub nsw i32 0, %conv1
362 %cmp = icmp ne i32 %conv, %sub
363 %conv3 = zext i1 %cmp to i16
367 define signext i32 @neq12(i32 signext %x, i32 signext %y) {
368 ; CHECK-LABEL: neq12:
369 ; CHECK: # %bb.0: # %entry
370 ; CHECK-NEXT: add r3, r4, r3
371 ; CHECK-NEXT: cntlzw r3, r3
372 ; CHECK-NEXT: srwi r3, r3, 5
373 ; CHECK-NEXT: xori r3, r3, 1
376 %sub = sub nsw i32 0, %x
377 %cmp = icmp ne i32 %sub, %y
378 %conv = zext i1 %cmp to i32
382 define zeroext i32 @neq13(i32 zeroext %x, i32 zeroext %y) {
383 ; CHECK-LABEL: neq13:
384 ; CHECK: # %bb.0: # %entry
385 ; CHECK-NEXT: add r3, r4, r3
386 ; CHECK-NEXT: cntlzw r3, r3
387 ; CHECK-NEXT: srwi r3, r3, 5
388 ; CHECK-NEXT: xori r3, r3, 1
392 %cmp = icmp ne i32 %sub, %y
393 %conv = zext i1 %cmp to i32
397 define i64 @neq14(i64 %x, i64 %y) {
398 ; CHECK-LABEL: neq14:
400 ; CHECK-NEXT: add r3, r4, r3
401 ; CHECK-NEXT: addic r4, r3, -1
402 ; CHECK-NEXT: subfe r3, r4, r3
404 %sub = sub nsw i64 0, %x
405 %cmp = icmp ne i64 %y, %sub
406 %zext = zext i1 %cmp to i64