1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -expand-memcmp -mtriple=i686-unknown-unknown -data-layout=e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128 < %s | FileCheck %s --check-prefix=X32
3 ; RUN: opt -S -passes=expand-memcmp -mtriple=i686-unknown-unknown -data-layout=e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128 < %s | FileCheck %s --check-prefix=X32
5 declare i32 @memcmp(ptr nocapture, ptr nocapture, i32)
7 define i32 @cmp2(ptr nocapture readonly %x, ptr nocapture readonly %y) {
9 ; X32-NEXT: [[TMP3:%.*]] = load i16, ptr [[X:%.*]], align 1
10 ; X32-NEXT: [[TMP4:%.*]] = load i16, ptr [[Y:%.*]], align 1
11 ; X32-NEXT: [[TMP5:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP3]])
12 ; X32-NEXT: [[TMP6:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP4]])
13 ; X32-NEXT: [[TMP7:%.*]] = zext i16 [[TMP5]] to i32
14 ; X32-NEXT: [[TMP8:%.*]] = zext i16 [[TMP6]] to i32
15 ; X32-NEXT: [[TMP9:%.*]] = sub i32 [[TMP7]], [[TMP8]]
16 ; X32-NEXT: ret i32 [[TMP9]]
18 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 2)
22 define i32 @cmp2_align2(ptr nocapture readonly align 2 %x, ptr nocapture readonly align 2 %y) {
23 ; X32-LABEL: @cmp2_align2(
24 ; X32-NEXT: [[TMP3:%.*]] = load i16, ptr [[X:%.*]], align 2
25 ; X32-NEXT: [[TMP4:%.*]] = load i16, ptr [[Y:%.*]], align 2
26 ; X32-NEXT: [[TMP5:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP3]])
27 ; X32-NEXT: [[TMP6:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP4]])
28 ; X32-NEXT: [[TMP7:%.*]] = zext i16 [[TMP5]] to i32
29 ; X32-NEXT: [[TMP8:%.*]] = zext i16 [[TMP6]] to i32
30 ; X32-NEXT: [[TMP9:%.*]] = sub i32 [[TMP7]], [[TMP8]]
31 ; X32-NEXT: ret i32 [[TMP9]]
33 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 2)
37 define i32 @cmp3(ptr nocapture readonly %x, ptr nocapture readonly %y) {
39 ; X32-NEXT: br label [[LOADBB:%.*]]
41 ; X32-NEXT: [[TMP1:%.*]] = icmp ult i16 [[TMP7:%.*]], [[TMP8:%.*]]
42 ; X32-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
43 ; X32-NEXT: br label [[ENDBLOCK:%.*]]
45 ; X32-NEXT: [[TMP5:%.*]] = load i16, ptr [[X:%.*]], align 1
46 ; X32-NEXT: [[TMP6:%.*]] = load i16, ptr [[Y:%.*]], align 1
47 ; X32-NEXT: [[TMP7]] = call i16 @llvm.bswap.i16(i16 [[TMP5]])
48 ; X32-NEXT: [[TMP8]] = call i16 @llvm.bswap.i16(i16 [[TMP6]])
49 ; X32-NEXT: [[TMP9:%.*]] = icmp eq i16 [[TMP7]], [[TMP8]]
50 ; X32-NEXT: br i1 [[TMP9]], label [[LOADBB1:%.*]], label [[RES_BLOCK:%.*]]
52 ; X32-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[X]], i64 2
53 ; X32-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[Y]], i64 2
54 ; X32-NEXT: [[TMP12:%.*]] = load i8, ptr [[TMP10]], align 1
55 ; X32-NEXT: [[TMP13:%.*]] = load i8, ptr [[TMP11]], align 1
56 ; X32-NEXT: [[TMP14:%.*]] = zext i8 [[TMP12]] to i32
57 ; X32-NEXT: [[TMP15:%.*]] = zext i8 [[TMP13]] to i32
58 ; X32-NEXT: [[TMP16:%.*]] = sub i32 [[TMP14]], [[TMP15]]
59 ; X32-NEXT: br label [[ENDBLOCK]]
61 ; X32-NEXT: [[PHI_RES:%.*]] = phi i32 [ [[TMP16]], [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
62 ; X32-NEXT: ret i32 [[PHI_RES]]
64 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 3)
68 define i32 @cmp4(ptr nocapture readonly %x, ptr nocapture readonly %y) {
70 ; X32-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 1
71 ; X32-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 1
72 ; X32-NEXT: [[TMP5:%.*]] = call i32 @llvm.bswap.i32(i32 [[TMP3]])
73 ; X32-NEXT: [[TMP6:%.*]] = call i32 @llvm.bswap.i32(i32 [[TMP4]])
74 ; X32-NEXT: [[TMP11:%.*]] = call i32 @llvm.ucmp.i32.i32(i32 [[TMP5]], i32 [[TMP6]])
75 ; X32-NEXT: ret i32 [[TMP11]]
77 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 4)
81 define i32 @cmp5(ptr nocapture readonly %x, ptr nocapture readonly %y) {
83 ; X32-NEXT: br label [[LOADBB:%.*]]
85 ; X32-NEXT: [[TMP1:%.*]] = icmp ult i32 [[TMP7:%.*]], [[TMP8:%.*]]
86 ; X32-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
87 ; X32-NEXT: br label [[ENDBLOCK:%.*]]
89 ; X32-NEXT: [[TMP5:%.*]] = load i32, ptr [[X:%.*]], align 1
90 ; X32-NEXT: [[TMP6:%.*]] = load i32, ptr [[Y:%.*]], align 1
91 ; X32-NEXT: [[TMP7]] = call i32 @llvm.bswap.i32(i32 [[TMP5]])
92 ; X32-NEXT: [[TMP8]] = call i32 @llvm.bswap.i32(i32 [[TMP6]])
93 ; X32-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP7]], [[TMP8]]
94 ; X32-NEXT: br i1 [[TMP9]], label [[LOADBB1:%.*]], label [[RES_BLOCK:%.*]]
96 ; X32-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[X]], i64 4
97 ; X32-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[Y]], i64 4
98 ; X32-NEXT: [[TMP12:%.*]] = load i8, ptr [[TMP10]], align 1
99 ; X32-NEXT: [[TMP13:%.*]] = load i8, ptr [[TMP11]], align 1
100 ; X32-NEXT: [[TMP14:%.*]] = zext i8 [[TMP12]] to i32
101 ; X32-NEXT: [[TMP15:%.*]] = zext i8 [[TMP13]] to i32
102 ; X32-NEXT: [[TMP16:%.*]] = sub i32 [[TMP14]], [[TMP15]]
103 ; X32-NEXT: br label [[ENDBLOCK]]
105 ; X32-NEXT: [[PHI_RES:%.*]] = phi i32 [ [[TMP16]], [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
106 ; X32-NEXT: ret i32 [[PHI_RES]]
108 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 5)
112 define i32 @cmp6(ptr nocapture readonly %x, ptr nocapture readonly %y) {
114 ; X32-NEXT: br label [[LOADBB:%.*]]
116 ; X32-NEXT: [[PHI_SRC1:%.*]] = phi i32 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP18:%.*]], [[LOADBB1:%.*]] ]
117 ; X32-NEXT: [[PHI_SRC2:%.*]] = phi i32 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP19:%.*]], [[LOADBB1]] ]
118 ; X32-NEXT: [[TMP1:%.*]] = icmp ult i32 [[PHI_SRC1]], [[PHI_SRC2]]
119 ; X32-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
120 ; X32-NEXT: br label [[ENDBLOCK:%.*]]
122 ; X32-NEXT: [[TMP5:%.*]] = load i32, ptr [[X:%.*]], align 1
123 ; X32-NEXT: [[TMP6:%.*]] = load i32, ptr [[Y:%.*]], align 1
124 ; X32-NEXT: [[TMP7]] = call i32 @llvm.bswap.i32(i32 [[TMP5]])
125 ; X32-NEXT: [[TMP8]] = call i32 @llvm.bswap.i32(i32 [[TMP6]])
126 ; X32-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP7]], [[TMP8]]
127 ; X32-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
129 ; X32-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[X]], i64 4
130 ; X32-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[Y]], i64 4
131 ; X32-NEXT: [[TMP14:%.*]] = load i16, ptr [[TMP10]], align 1
132 ; X32-NEXT: [[TMP15:%.*]] = load i16, ptr [[TMP11]], align 1
133 ; X32-NEXT: [[TMP16:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP14]])
134 ; X32-NEXT: [[TMP17:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP15]])
135 ; X32-NEXT: [[TMP18]] = zext i16 [[TMP16]] to i32
136 ; X32-NEXT: [[TMP19]] = zext i16 [[TMP17]] to i32
137 ; X32-NEXT: [[TMP20:%.*]] = icmp eq i32 [[TMP18]], [[TMP19]]
138 ; X32-NEXT: br i1 [[TMP20]], label [[ENDBLOCK]], label [[RES_BLOCK]]
140 ; X32-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
141 ; X32-NEXT: ret i32 [[PHI_RES]]
143 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 6)
147 define i32 @cmp7(ptr nocapture readonly %x, ptr nocapture readonly %y) {
149 ; X32-NEXT: br label [[LOADBB:%.*]]
151 ; X32-NEXT: [[PHI_SRC1:%.*]] = phi i32 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP16:%.*]], [[LOADBB1:%.*]] ]
152 ; X32-NEXT: [[PHI_SRC2:%.*]] = phi i32 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP17:%.*]], [[LOADBB1]] ]
153 ; X32-NEXT: [[TMP1:%.*]] = icmp ult i32 [[PHI_SRC1]], [[PHI_SRC2]]
154 ; X32-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
155 ; X32-NEXT: br label [[ENDBLOCK:%.*]]
157 ; X32-NEXT: [[TMP5:%.*]] = load i32, ptr [[X:%.*]], align 1
158 ; X32-NEXT: [[TMP6:%.*]] = load i32, ptr [[Y:%.*]], align 1
159 ; X32-NEXT: [[TMP7]] = call i32 @llvm.bswap.i32(i32 [[TMP5]])
160 ; X32-NEXT: [[TMP8]] = call i32 @llvm.bswap.i32(i32 [[TMP6]])
161 ; X32-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP7]], [[TMP8]]
162 ; X32-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
164 ; X32-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[X]], i64 3
165 ; X32-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[Y]], i64 3
166 ; X32-NEXT: [[TMP14:%.*]] = load i32, ptr [[TMP10]], align 1
167 ; X32-NEXT: [[TMP15:%.*]] = load i32, ptr [[TMP11]], align 1
168 ; X32-NEXT: [[TMP16]] = call i32 @llvm.bswap.i32(i32 [[TMP14]])
169 ; X32-NEXT: [[TMP17]] = call i32 @llvm.bswap.i32(i32 [[TMP15]])
170 ; X32-NEXT: [[TMP18:%.*]] = icmp eq i32 [[TMP16]], [[TMP17]]
171 ; X32-NEXT: br i1 [[TMP18]], label [[ENDBLOCK]], label [[RES_BLOCK]]
173 ; X32-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
174 ; X32-NEXT: ret i32 [[PHI_RES]]
176 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 7)
180 define i32 @cmp8(ptr nocapture readonly %x, ptr nocapture readonly %y) {
182 ; X32-NEXT: br label [[LOADBB:%.*]]
184 ; X32-NEXT: [[PHI_SRC1:%.*]] = phi i32 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP16:%.*]], [[LOADBB1:%.*]] ]
185 ; X32-NEXT: [[PHI_SRC2:%.*]] = phi i32 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP17:%.*]], [[LOADBB1]] ]
186 ; X32-NEXT: [[TMP1:%.*]] = icmp ult i32 [[PHI_SRC1]], [[PHI_SRC2]]
187 ; X32-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
188 ; X32-NEXT: br label [[ENDBLOCK:%.*]]
190 ; X32-NEXT: [[TMP5:%.*]] = load i32, ptr [[X:%.*]], align 1
191 ; X32-NEXT: [[TMP6:%.*]] = load i32, ptr [[Y:%.*]], align 1
192 ; X32-NEXT: [[TMP7]] = call i32 @llvm.bswap.i32(i32 [[TMP5]])
193 ; X32-NEXT: [[TMP8]] = call i32 @llvm.bswap.i32(i32 [[TMP6]])
194 ; X32-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP7]], [[TMP8]]
195 ; X32-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
197 ; X32-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[X]], i64 4
198 ; X32-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[Y]], i64 4
199 ; X32-NEXT: [[TMP14:%.*]] = load i32, ptr [[TMP10]], align 1
200 ; X32-NEXT: [[TMP15:%.*]] = load i32, ptr [[TMP11]], align 1
201 ; X32-NEXT: [[TMP16]] = call i32 @llvm.bswap.i32(i32 [[TMP14]])
202 ; X32-NEXT: [[TMP17]] = call i32 @llvm.bswap.i32(i32 [[TMP15]])
203 ; X32-NEXT: [[TMP18:%.*]] = icmp eq i32 [[TMP16]], [[TMP17]]
204 ; X32-NEXT: br i1 [[TMP18]], label [[ENDBLOCK]], label [[RES_BLOCK]]
206 ; X32-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
207 ; X32-NEXT: ret i32 [[PHI_RES]]
209 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 8)
213 define i32 @cmp9(ptr nocapture readonly %x, ptr nocapture readonly %y) {
215 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 9)
216 ; X32-NEXT: ret i32 [[CALL]]
218 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 9)
222 define i32 @cmp10(ptr nocapture readonly %x, ptr nocapture readonly %y) {
224 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 10)
225 ; X32-NEXT: ret i32 [[CALL]]
227 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 10)
231 define i32 @cmp11(ptr nocapture readonly %x, ptr nocapture readonly %y) {
233 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 11)
234 ; X32-NEXT: ret i32 [[CALL]]
236 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 11)
240 define i32 @cmp12(ptr nocapture readonly %x, ptr nocapture readonly %y) {
242 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 12)
243 ; X32-NEXT: ret i32 [[CALL]]
245 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 12)
249 define i32 @cmp13(ptr nocapture readonly %x, ptr nocapture readonly %y) {
251 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 13)
252 ; X32-NEXT: ret i32 [[CALL]]
254 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 13)
258 define i32 @cmp14(ptr nocapture readonly %x, ptr nocapture readonly %y) {
260 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 14)
261 ; X32-NEXT: ret i32 [[CALL]]
263 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 14)
267 define i32 @cmp15(ptr nocapture readonly %x, ptr nocapture readonly %y) {
269 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 15)
270 ; X32-NEXT: ret i32 [[CALL]]
272 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 15)
276 define i32 @cmp16(ptr nocapture readonly %x, ptr nocapture readonly %y) {
278 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 16)
279 ; X32-NEXT: ret i32 [[CALL]]
281 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 16)
285 define i32 @cmp_eq2(ptr nocapture readonly %x, ptr nocapture readonly %y) {
286 ; X32-LABEL: @cmp_eq2(
287 ; X32-NEXT: [[TMP3:%.*]] = load i16, ptr [[X:%.*]], align 1
288 ; X32-NEXT: [[TMP4:%.*]] = load i16, ptr [[Y:%.*]], align 1
289 ; X32-NEXT: [[TMP5:%.*]] = icmp ne i16 [[TMP3]], [[TMP4]]
290 ; X32-NEXT: [[TMP6:%.*]] = zext i1 [[TMP5]] to i32
291 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP6]], 0
292 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
293 ; X32-NEXT: ret i32 [[CONV]]
295 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 2)
296 %cmp = icmp eq i32 %call, 0
297 %conv = zext i1 %cmp to i32
301 define i32 @cmp_eq3(ptr nocapture readonly %x, ptr nocapture readonly %y) {
302 ; X32-LABEL: @cmp_eq3(
303 ; X32-NEXT: [[TMP3:%.*]] = load i16, ptr [[X:%.*]], align 1
304 ; X32-NEXT: [[TMP4:%.*]] = load i16, ptr [[Y:%.*]], align 1
305 ; X32-NEXT: [[TMP5:%.*]] = xor i16 [[TMP3]], [[TMP4]]
306 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 2
307 ; X32-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 2
308 ; X32-NEXT: [[TMP8:%.*]] = load i8, ptr [[TMP6]], align 1
309 ; X32-NEXT: [[TMP9:%.*]] = load i8, ptr [[TMP7]], align 1
310 ; X32-NEXT: [[TMP10:%.*]] = zext i8 [[TMP8]] to i16
311 ; X32-NEXT: [[TMP11:%.*]] = zext i8 [[TMP9]] to i16
312 ; X32-NEXT: [[TMP12:%.*]] = xor i16 [[TMP10]], [[TMP11]]
313 ; X32-NEXT: [[TMP13:%.*]] = or i16 [[TMP5]], [[TMP12]]
314 ; X32-NEXT: [[TMP14:%.*]] = icmp ne i16 [[TMP13]], 0
315 ; X32-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
316 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
317 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
318 ; X32-NEXT: ret i32 [[CONV]]
320 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 3)
321 %cmp = icmp eq i32 %call, 0
322 %conv = zext i1 %cmp to i32
326 define i32 @cmp_eq4(ptr nocapture readonly %x, ptr nocapture readonly %y) {
327 ; X32-LABEL: @cmp_eq4(
328 ; X32-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 1
329 ; X32-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 1
330 ; X32-NEXT: [[TMP5:%.*]] = icmp ne i32 [[TMP3]], [[TMP4]]
331 ; X32-NEXT: [[TMP6:%.*]] = zext i1 [[TMP5]] to i32
332 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP6]], 0
333 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
334 ; X32-NEXT: ret i32 [[CONV]]
336 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 4)
337 %cmp = icmp eq i32 %call, 0
338 %conv = zext i1 %cmp to i32
342 define i32 @cmp_eq5(ptr nocapture readonly %x, ptr nocapture readonly %y) {
343 ; X32-LABEL: @cmp_eq5(
344 ; X32-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 1
345 ; X32-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 1
346 ; X32-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
347 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 4
348 ; X32-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 4
349 ; X32-NEXT: [[TMP8:%.*]] = load i8, ptr [[TMP6]], align 1
350 ; X32-NEXT: [[TMP9:%.*]] = load i8, ptr [[TMP7]], align 1
351 ; X32-NEXT: [[TMP10:%.*]] = zext i8 [[TMP8]] to i32
352 ; X32-NEXT: [[TMP11:%.*]] = zext i8 [[TMP9]] to i32
353 ; X32-NEXT: [[TMP12:%.*]] = xor i32 [[TMP10]], [[TMP11]]
354 ; X32-NEXT: [[TMP13:%.*]] = or i32 [[TMP5]], [[TMP12]]
355 ; X32-NEXT: [[TMP14:%.*]] = icmp ne i32 [[TMP13]], 0
356 ; X32-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
357 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
358 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
359 ; X32-NEXT: ret i32 [[CONV]]
361 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 5)
362 %cmp = icmp eq i32 %call, 0
363 %conv = zext i1 %cmp to i32
367 define i32 @cmp_eq6(ptr nocapture readonly %x, ptr nocapture readonly %y) {
368 ; X32-LABEL: @cmp_eq6(
369 ; X32-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 1
370 ; X32-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 1
371 ; X32-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
372 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 4
373 ; X32-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 4
374 ; X32-NEXT: [[TMP10:%.*]] = load i16, ptr [[TMP6]], align 1
375 ; X32-NEXT: [[TMP11:%.*]] = load i16, ptr [[TMP7]], align 1
376 ; X32-NEXT: [[TMP12:%.*]] = zext i16 [[TMP10]] to i32
377 ; X32-NEXT: [[TMP13:%.*]] = zext i16 [[TMP11]] to i32
378 ; X32-NEXT: [[TMP14:%.*]] = xor i32 [[TMP12]], [[TMP13]]
379 ; X32-NEXT: [[TMP15:%.*]] = or i32 [[TMP5]], [[TMP14]]
380 ; X32-NEXT: [[TMP16:%.*]] = icmp ne i32 [[TMP15]], 0
381 ; X32-NEXT: [[TMP17:%.*]] = zext i1 [[TMP16]] to i32
382 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP17]], 0
383 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
384 ; X32-NEXT: ret i32 [[CONV]]
386 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 6)
387 %cmp = icmp eq i32 %call, 0
388 %conv = zext i1 %cmp to i32
392 define i32 @cmp_eq6_align4(ptr nocapture readonly align 4 %x, ptr nocapture readonly align 4 %y) {
393 ; X32-LABEL: @cmp_eq6_align4(
394 ; X32-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 4
395 ; X32-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 4
396 ; X32-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
397 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 4
398 ; X32-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 4
399 ; X32-NEXT: [[TMP10:%.*]] = load i16, ptr [[TMP6]], align 4
400 ; X32-NEXT: [[TMP11:%.*]] = load i16, ptr [[TMP7]], align 4
401 ; X32-NEXT: [[TMP12:%.*]] = zext i16 [[TMP10]] to i32
402 ; X32-NEXT: [[TMP13:%.*]] = zext i16 [[TMP11]] to i32
403 ; X32-NEXT: [[TMP14:%.*]] = xor i32 [[TMP12]], [[TMP13]]
404 ; X32-NEXT: [[TMP15:%.*]] = or i32 [[TMP5]], [[TMP14]]
405 ; X32-NEXT: [[TMP16:%.*]] = icmp ne i32 [[TMP15]], 0
406 ; X32-NEXT: [[TMP17:%.*]] = zext i1 [[TMP16]] to i32
407 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP17]], 0
408 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
409 ; X32-NEXT: ret i32 [[CONV]]
411 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 6)
412 %cmp = icmp eq i32 %call, 0
413 %conv = zext i1 %cmp to i32
417 define i32 @cmp_eq7(ptr nocapture readonly %x, ptr nocapture readonly %y) {
418 ; X32-LABEL: @cmp_eq7(
419 ; X32-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 1
420 ; X32-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 1
421 ; X32-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
422 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 3
423 ; X32-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 3
424 ; X32-NEXT: [[TMP10:%.*]] = load i32, ptr [[TMP6]], align 1
425 ; X32-NEXT: [[TMP11:%.*]] = load i32, ptr [[TMP7]], align 1
426 ; X32-NEXT: [[TMP12:%.*]] = xor i32 [[TMP10]], [[TMP11]]
427 ; X32-NEXT: [[TMP13:%.*]] = or i32 [[TMP5]], [[TMP12]]
428 ; X32-NEXT: [[TMP14:%.*]] = icmp ne i32 [[TMP13]], 0
429 ; X32-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
430 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
431 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
432 ; X32-NEXT: ret i32 [[CONV]]
434 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 7)
435 %cmp = icmp eq i32 %call, 0
436 %conv = zext i1 %cmp to i32
440 define i32 @cmp_eq8(ptr nocapture readonly %x, ptr nocapture readonly %y) {
441 ; X32-LABEL: @cmp_eq8(
442 ; X32-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 1
443 ; X32-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 1
444 ; X32-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
445 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 4
446 ; X32-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 4
447 ; X32-NEXT: [[TMP10:%.*]] = load i32, ptr [[TMP6]], align 1
448 ; X32-NEXT: [[TMP11:%.*]] = load i32, ptr [[TMP7]], align 1
449 ; X32-NEXT: [[TMP12:%.*]] = xor i32 [[TMP10]], [[TMP11]]
450 ; X32-NEXT: [[TMP13:%.*]] = or i32 [[TMP5]], [[TMP12]]
451 ; X32-NEXT: [[TMP14:%.*]] = icmp ne i32 [[TMP13]], 0
452 ; X32-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
453 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
454 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
455 ; X32-NEXT: ret i32 [[CONV]]
457 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 8)
458 %cmp = icmp eq i32 %call, 0
459 %conv = zext i1 %cmp to i32
463 define i32 @cmp_eq9(ptr nocapture readonly %x, ptr nocapture readonly %y) {
464 ; X32-LABEL: @cmp_eq9(
465 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 9)
466 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
467 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
468 ; X32-NEXT: ret i32 [[CONV]]
470 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 9)
471 %cmp = icmp eq i32 %call, 0
472 %conv = zext i1 %cmp to i32
476 define i32 @cmp_eq10(ptr nocapture readonly %x, ptr nocapture readonly %y) {
477 ; X32-LABEL: @cmp_eq10(
478 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 10)
479 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
480 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
481 ; X32-NEXT: ret i32 [[CONV]]
483 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 10)
484 %cmp = icmp eq i32 %call, 0
485 %conv = zext i1 %cmp to i32
489 define i32 @cmp_eq11(ptr nocapture readonly %x, ptr nocapture readonly %y) {
490 ; X32-LABEL: @cmp_eq11(
491 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 11)
492 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
493 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
494 ; X32-NEXT: ret i32 [[CONV]]
496 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 11)
497 %cmp = icmp eq i32 %call, 0
498 %conv = zext i1 %cmp to i32
502 define i32 @cmp_eq12(ptr nocapture readonly %x, ptr nocapture readonly %y) {
503 ; X32-LABEL: @cmp_eq12(
504 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 12)
505 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
506 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
507 ; X32-NEXT: ret i32 [[CONV]]
509 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 12)
510 %cmp = icmp eq i32 %call, 0
511 %conv = zext i1 %cmp to i32
515 define i32 @cmp_eq13(ptr nocapture readonly %x, ptr nocapture readonly %y) {
516 ; X32-LABEL: @cmp_eq13(
517 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 13)
518 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
519 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
520 ; X32-NEXT: ret i32 [[CONV]]
522 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 13)
523 %cmp = icmp eq i32 %call, 0
524 %conv = zext i1 %cmp to i32
528 define i32 @cmp_eq14(ptr nocapture readonly %x, ptr nocapture readonly %y) {
529 ; X32-LABEL: @cmp_eq14(
530 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 14)
531 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
532 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
533 ; X32-NEXT: ret i32 [[CONV]]
535 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 14)
536 %cmp = icmp eq i32 %call, 0
537 %conv = zext i1 %cmp to i32
541 define i32 @cmp_eq15(ptr nocapture readonly %x, ptr nocapture readonly %y) {
542 ; X32-LABEL: @cmp_eq15(
543 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 15)
544 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
545 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
546 ; X32-NEXT: ret i32 [[CONV]]
548 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 15)
549 %cmp = icmp eq i32 %call, 0
550 %conv = zext i1 %cmp to i32
554 define i32 @cmp_eq16(ptr nocapture readonly %x, ptr nocapture readonly %y) {
555 ; X32-LABEL: @cmp_eq16(
556 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 16)
557 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
558 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
559 ; X32-NEXT: ret i32 [[CONV]]
561 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 16)
562 %cmp = icmp eq i32 %call, 0
563 %conv = zext i1 %cmp to i32