1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -expandmemcmp -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
4 declare i32 @memcmp(ptr nocapture, ptr nocapture, i32)
6 define i32 @cmp2(ptr nocapture readonly %x, ptr nocapture readonly %y) {
8 ; X32-NEXT: [[TMP3:%.*]] = load i16, ptr [[X:%.*]], align 1
9 ; X32-NEXT: [[TMP4:%.*]] = load i16, ptr [[Y:%.*]], align 1
10 ; X32-NEXT: [[TMP5:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP3]])
11 ; X32-NEXT: [[TMP6:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP4]])
12 ; X32-NEXT: [[TMP7:%.*]] = zext i16 [[TMP5]] to i32
13 ; X32-NEXT: [[TMP8:%.*]] = zext i16 [[TMP6]] to i32
14 ; X32-NEXT: [[TMP9:%.*]] = sub i32 [[TMP7]], [[TMP8]]
15 ; X32-NEXT: ret i32 [[TMP9]]
17 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 2)
21 define i32 @cmp2_align2(ptr nocapture readonly align 2 %x, ptr nocapture readonly align 2 %y) {
22 ; X32-LABEL: @cmp2_align2(
23 ; X32-NEXT: [[TMP3:%.*]] = load i16, ptr [[X:%.*]], align 2
24 ; X32-NEXT: [[TMP4:%.*]] = load i16, ptr [[Y:%.*]], align 2
25 ; X32-NEXT: [[TMP5:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP3]])
26 ; X32-NEXT: [[TMP6:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP4]])
27 ; X32-NEXT: [[TMP7:%.*]] = zext i16 [[TMP5]] to i32
28 ; X32-NEXT: [[TMP8:%.*]] = zext i16 [[TMP6]] to i32
29 ; X32-NEXT: [[TMP9:%.*]] = sub i32 [[TMP7]], [[TMP8]]
30 ; X32-NEXT: ret i32 [[TMP9]]
32 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 2)
36 define i32 @cmp3(ptr nocapture readonly %x, ptr nocapture readonly %y) {
38 ; X32-NEXT: br label [[LOADBB:%.*]]
40 ; X32-NEXT: [[TMP1:%.*]] = icmp ult i16 [[TMP7:%.*]], [[TMP8:%.*]]
41 ; X32-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
42 ; X32-NEXT: br label [[ENDBLOCK:%.*]]
44 ; X32-NEXT: [[TMP5:%.*]] = load i16, ptr [[X:%.*]], align 1
45 ; X32-NEXT: [[TMP6:%.*]] = load i16, ptr [[Y:%.*]], align 1
46 ; X32-NEXT: [[TMP7]] = call i16 @llvm.bswap.i16(i16 [[TMP5]])
47 ; X32-NEXT: [[TMP8]] = call i16 @llvm.bswap.i16(i16 [[TMP6]])
48 ; X32-NEXT: [[TMP9:%.*]] = icmp eq i16 [[TMP7]], [[TMP8]]
49 ; X32-NEXT: br i1 [[TMP9]], label [[LOADBB1:%.*]], label [[RES_BLOCK:%.*]]
51 ; X32-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[X]], i64 2
52 ; X32-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[Y]], i64 2
53 ; X32-NEXT: [[TMP12:%.*]] = load i8, ptr [[TMP10]], align 1
54 ; X32-NEXT: [[TMP13:%.*]] = load i8, ptr [[TMP11]], align 1
55 ; X32-NEXT: [[TMP14:%.*]] = zext i8 [[TMP12]] to i32
56 ; X32-NEXT: [[TMP15:%.*]] = zext i8 [[TMP13]] to i32
57 ; X32-NEXT: [[TMP16:%.*]] = sub i32 [[TMP14]], [[TMP15]]
58 ; X32-NEXT: br label [[ENDBLOCK]]
60 ; X32-NEXT: [[PHI_RES:%.*]] = phi i32 [ [[TMP16]], [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
61 ; X32-NEXT: ret i32 [[PHI_RES]]
63 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 3)
67 define i32 @cmp4(ptr nocapture readonly %x, ptr nocapture readonly %y) {
69 ; X32-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 1
70 ; X32-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 1
71 ; X32-NEXT: [[TMP5:%.*]] = call i32 @llvm.bswap.i32(i32 [[TMP3]])
72 ; X32-NEXT: [[TMP6:%.*]] = call i32 @llvm.bswap.i32(i32 [[TMP4]])
73 ; X32-NEXT: [[TMP7:%.*]] = icmp ugt i32 [[TMP5]], [[TMP6]]
74 ; X32-NEXT: [[TMP8:%.*]] = icmp ult i32 [[TMP5]], [[TMP6]]
75 ; X32-NEXT: [[TMP9:%.*]] = zext i1 [[TMP7]] to i32
76 ; X32-NEXT: [[TMP10:%.*]] = zext i1 [[TMP8]] to i32
77 ; X32-NEXT: [[TMP11:%.*]] = sub i32 [[TMP9]], [[TMP10]]
78 ; X32-NEXT: ret i32 [[TMP11]]
80 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 4)
84 define i32 @cmp5(ptr nocapture readonly %x, ptr nocapture readonly %y) {
86 ; X32-NEXT: br label [[LOADBB:%.*]]
88 ; X32-NEXT: [[TMP1:%.*]] = icmp ult i32 [[TMP7:%.*]], [[TMP8:%.*]]
89 ; X32-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
90 ; X32-NEXT: br label [[ENDBLOCK:%.*]]
92 ; X32-NEXT: [[TMP5:%.*]] = load i32, ptr [[X:%.*]], align 1
93 ; X32-NEXT: [[TMP6:%.*]] = load i32, ptr [[Y:%.*]], align 1
94 ; X32-NEXT: [[TMP7]] = call i32 @llvm.bswap.i32(i32 [[TMP5]])
95 ; X32-NEXT: [[TMP8]] = call i32 @llvm.bswap.i32(i32 [[TMP6]])
96 ; X32-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP7]], [[TMP8]]
97 ; X32-NEXT: br i1 [[TMP9]], label [[LOADBB1:%.*]], label [[RES_BLOCK:%.*]]
99 ; X32-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[X]], i64 4
100 ; X32-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[Y]], i64 4
101 ; X32-NEXT: [[TMP12:%.*]] = load i8, ptr [[TMP10]], align 1
102 ; X32-NEXT: [[TMP13:%.*]] = load i8, ptr [[TMP11]], align 1
103 ; X32-NEXT: [[TMP14:%.*]] = zext i8 [[TMP12]] to i32
104 ; X32-NEXT: [[TMP15:%.*]] = zext i8 [[TMP13]] to i32
105 ; X32-NEXT: [[TMP16:%.*]] = sub i32 [[TMP14]], [[TMP15]]
106 ; X32-NEXT: br label [[ENDBLOCK]]
108 ; X32-NEXT: [[PHI_RES:%.*]] = phi i32 [ [[TMP16]], [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
109 ; X32-NEXT: ret i32 [[PHI_RES]]
111 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 5)
115 define i32 @cmp6(ptr nocapture readonly %x, ptr nocapture readonly %y) {
117 ; X32-NEXT: br label [[LOADBB:%.*]]
119 ; X32-NEXT: [[PHI_SRC1:%.*]] = phi i32 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP18:%.*]], [[LOADBB1:%.*]] ]
120 ; X32-NEXT: [[PHI_SRC2:%.*]] = phi i32 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP19:%.*]], [[LOADBB1]] ]
121 ; X32-NEXT: [[TMP1:%.*]] = icmp ult i32 [[PHI_SRC1]], [[PHI_SRC2]]
122 ; X32-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
123 ; X32-NEXT: br label [[ENDBLOCK:%.*]]
125 ; X32-NEXT: [[TMP5:%.*]] = load i32, ptr [[X:%.*]], align 1
126 ; X32-NEXT: [[TMP6:%.*]] = load i32, ptr [[Y:%.*]], align 1
127 ; X32-NEXT: [[TMP7]] = call i32 @llvm.bswap.i32(i32 [[TMP5]])
128 ; X32-NEXT: [[TMP8]] = call i32 @llvm.bswap.i32(i32 [[TMP6]])
129 ; X32-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP7]], [[TMP8]]
130 ; X32-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
132 ; X32-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[X]], i64 4
133 ; X32-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[Y]], i64 4
134 ; X32-NEXT: [[TMP14:%.*]] = load i16, ptr [[TMP10]], align 1
135 ; X32-NEXT: [[TMP15:%.*]] = load i16, ptr [[TMP11]], align 1
136 ; X32-NEXT: [[TMP16:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP14]])
137 ; X32-NEXT: [[TMP17:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP15]])
138 ; X32-NEXT: [[TMP18]] = zext i16 [[TMP16]] to i32
139 ; X32-NEXT: [[TMP19]] = zext i16 [[TMP17]] to i32
140 ; X32-NEXT: [[TMP20:%.*]] = icmp eq i32 [[TMP18]], [[TMP19]]
141 ; X32-NEXT: br i1 [[TMP20]], label [[ENDBLOCK]], label [[RES_BLOCK]]
143 ; X32-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
144 ; X32-NEXT: ret i32 [[PHI_RES]]
146 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 6)
150 define i32 @cmp7(ptr nocapture readonly %x, ptr nocapture readonly %y) {
152 ; X32-NEXT: br label [[LOADBB:%.*]]
154 ; X32-NEXT: [[PHI_SRC1:%.*]] = phi i32 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP16:%.*]], [[LOADBB1:%.*]] ]
155 ; X32-NEXT: [[PHI_SRC2:%.*]] = phi i32 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP17:%.*]], [[LOADBB1]] ]
156 ; X32-NEXT: [[TMP1:%.*]] = icmp ult i32 [[PHI_SRC1]], [[PHI_SRC2]]
157 ; X32-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
158 ; X32-NEXT: br label [[ENDBLOCK:%.*]]
160 ; X32-NEXT: [[TMP5:%.*]] = load i32, ptr [[X:%.*]], align 1
161 ; X32-NEXT: [[TMP6:%.*]] = load i32, ptr [[Y:%.*]], align 1
162 ; X32-NEXT: [[TMP7]] = call i32 @llvm.bswap.i32(i32 [[TMP5]])
163 ; X32-NEXT: [[TMP8]] = call i32 @llvm.bswap.i32(i32 [[TMP6]])
164 ; X32-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP7]], [[TMP8]]
165 ; X32-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
167 ; X32-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[X]], i64 3
168 ; X32-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[Y]], i64 3
169 ; X32-NEXT: [[TMP14:%.*]] = load i32, ptr [[TMP10]], align 1
170 ; X32-NEXT: [[TMP15:%.*]] = load i32, ptr [[TMP11]], align 1
171 ; X32-NEXT: [[TMP16]] = call i32 @llvm.bswap.i32(i32 [[TMP14]])
172 ; X32-NEXT: [[TMP17]] = call i32 @llvm.bswap.i32(i32 [[TMP15]])
173 ; X32-NEXT: [[TMP18:%.*]] = icmp eq i32 [[TMP16]], [[TMP17]]
174 ; X32-NEXT: br i1 [[TMP18]], label [[ENDBLOCK]], label [[RES_BLOCK]]
176 ; X32-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
177 ; X32-NEXT: ret i32 [[PHI_RES]]
179 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 7)
183 define i32 @cmp8(ptr nocapture readonly %x, ptr nocapture readonly %y) {
185 ; X32-NEXT: br label [[LOADBB:%.*]]
187 ; X32-NEXT: [[PHI_SRC1:%.*]] = phi i32 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP16:%.*]], [[LOADBB1:%.*]] ]
188 ; X32-NEXT: [[PHI_SRC2:%.*]] = phi i32 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP17:%.*]], [[LOADBB1]] ]
189 ; X32-NEXT: [[TMP1:%.*]] = icmp ult i32 [[PHI_SRC1]], [[PHI_SRC2]]
190 ; X32-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
191 ; X32-NEXT: br label [[ENDBLOCK:%.*]]
193 ; X32-NEXT: [[TMP5:%.*]] = load i32, ptr [[X:%.*]], align 1
194 ; X32-NEXT: [[TMP6:%.*]] = load i32, ptr [[Y:%.*]], align 1
195 ; X32-NEXT: [[TMP7]] = call i32 @llvm.bswap.i32(i32 [[TMP5]])
196 ; X32-NEXT: [[TMP8]] = call i32 @llvm.bswap.i32(i32 [[TMP6]])
197 ; X32-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP7]], [[TMP8]]
198 ; X32-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
200 ; X32-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[X]], i64 4
201 ; X32-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[Y]], i64 4
202 ; X32-NEXT: [[TMP14:%.*]] = load i32, ptr [[TMP10]], align 1
203 ; X32-NEXT: [[TMP15:%.*]] = load i32, ptr [[TMP11]], align 1
204 ; X32-NEXT: [[TMP16]] = call i32 @llvm.bswap.i32(i32 [[TMP14]])
205 ; X32-NEXT: [[TMP17]] = call i32 @llvm.bswap.i32(i32 [[TMP15]])
206 ; X32-NEXT: [[TMP18:%.*]] = icmp eq i32 [[TMP16]], [[TMP17]]
207 ; X32-NEXT: br i1 [[TMP18]], label [[ENDBLOCK]], label [[RES_BLOCK]]
209 ; X32-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
210 ; X32-NEXT: ret i32 [[PHI_RES]]
212 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 8)
216 define i32 @cmp9(ptr nocapture readonly %x, ptr nocapture readonly %y) {
218 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 9)
219 ; X32-NEXT: ret i32 [[CALL]]
221 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 9)
225 define i32 @cmp10(ptr nocapture readonly %x, ptr nocapture readonly %y) {
227 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 10)
228 ; X32-NEXT: ret i32 [[CALL]]
230 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 10)
234 define i32 @cmp11(ptr nocapture readonly %x, ptr nocapture readonly %y) {
236 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 11)
237 ; X32-NEXT: ret i32 [[CALL]]
239 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 11)
243 define i32 @cmp12(ptr nocapture readonly %x, ptr nocapture readonly %y) {
245 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 12)
246 ; X32-NEXT: ret i32 [[CALL]]
248 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 12)
252 define i32 @cmp13(ptr nocapture readonly %x, ptr nocapture readonly %y) {
254 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 13)
255 ; X32-NEXT: ret i32 [[CALL]]
257 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 13)
261 define i32 @cmp14(ptr nocapture readonly %x, ptr nocapture readonly %y) {
263 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 14)
264 ; X32-NEXT: ret i32 [[CALL]]
266 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 14)
270 define i32 @cmp15(ptr nocapture readonly %x, ptr nocapture readonly %y) {
272 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 15)
273 ; X32-NEXT: ret i32 [[CALL]]
275 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 15)
279 define i32 @cmp16(ptr nocapture readonly %x, ptr nocapture readonly %y) {
281 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 16)
282 ; X32-NEXT: ret i32 [[CALL]]
284 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 16)
288 define i32 @cmp_eq2(ptr nocapture readonly %x, ptr nocapture readonly %y) {
289 ; X32-LABEL: @cmp_eq2(
290 ; X32-NEXT: [[TMP3:%.*]] = load i16, ptr [[X:%.*]], align 1
291 ; X32-NEXT: [[TMP4:%.*]] = load i16, ptr [[Y:%.*]], align 1
292 ; X32-NEXT: [[TMP5:%.*]] = icmp ne i16 [[TMP3]], [[TMP4]]
293 ; X32-NEXT: [[TMP6:%.*]] = zext i1 [[TMP5]] to i32
294 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP6]], 0
295 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
296 ; X32-NEXT: ret i32 [[CONV]]
298 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 2)
299 %cmp = icmp eq i32 %call, 0
300 %conv = zext i1 %cmp to i32
304 define i32 @cmp_eq3(ptr nocapture readonly %x, ptr nocapture readonly %y) {
305 ; X32-LABEL: @cmp_eq3(
306 ; X32-NEXT: [[TMP3:%.*]] = load i16, ptr [[X:%.*]], align 1
307 ; X32-NEXT: [[TMP4:%.*]] = load i16, ptr [[Y:%.*]], align 1
308 ; X32-NEXT: [[TMP5:%.*]] = xor i16 [[TMP3]], [[TMP4]]
309 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 2
310 ; X32-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 2
311 ; X32-NEXT: [[TMP8:%.*]] = load i8, ptr [[TMP6]], align 1
312 ; X32-NEXT: [[TMP9:%.*]] = load i8, ptr [[TMP7]], align 1
313 ; X32-NEXT: [[TMP10:%.*]] = zext i8 [[TMP8]] to i16
314 ; X32-NEXT: [[TMP11:%.*]] = zext i8 [[TMP9]] to i16
315 ; X32-NEXT: [[TMP12:%.*]] = xor i16 [[TMP10]], [[TMP11]]
316 ; X32-NEXT: [[TMP13:%.*]] = or i16 [[TMP5]], [[TMP12]]
317 ; X32-NEXT: [[TMP14:%.*]] = icmp ne i16 [[TMP13]], 0
318 ; X32-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
319 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
320 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
321 ; X32-NEXT: ret i32 [[CONV]]
323 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 3)
324 %cmp = icmp eq i32 %call, 0
325 %conv = zext i1 %cmp to i32
329 define i32 @cmp_eq4(ptr nocapture readonly %x, ptr nocapture readonly %y) {
330 ; X32-LABEL: @cmp_eq4(
331 ; X32-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 1
332 ; X32-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 1
333 ; X32-NEXT: [[TMP5:%.*]] = icmp ne i32 [[TMP3]], [[TMP4]]
334 ; X32-NEXT: [[TMP6:%.*]] = zext i1 [[TMP5]] to i32
335 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP6]], 0
336 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
337 ; X32-NEXT: ret i32 [[CONV]]
339 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 4)
340 %cmp = icmp eq i32 %call, 0
341 %conv = zext i1 %cmp to i32
345 define i32 @cmp_eq5(ptr nocapture readonly %x, ptr nocapture readonly %y) {
346 ; X32-LABEL: @cmp_eq5(
347 ; X32-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 1
348 ; X32-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 1
349 ; X32-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
350 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 4
351 ; X32-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 4
352 ; X32-NEXT: [[TMP8:%.*]] = load i8, ptr [[TMP6]], align 1
353 ; X32-NEXT: [[TMP9:%.*]] = load i8, ptr [[TMP7]], align 1
354 ; X32-NEXT: [[TMP10:%.*]] = zext i8 [[TMP8]] to i32
355 ; X32-NEXT: [[TMP11:%.*]] = zext i8 [[TMP9]] to i32
356 ; X32-NEXT: [[TMP12:%.*]] = xor i32 [[TMP10]], [[TMP11]]
357 ; X32-NEXT: [[TMP13:%.*]] = or i32 [[TMP5]], [[TMP12]]
358 ; X32-NEXT: [[TMP14:%.*]] = icmp ne i32 [[TMP13]], 0
359 ; X32-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
360 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
361 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
362 ; X32-NEXT: ret i32 [[CONV]]
364 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 5)
365 %cmp = icmp eq i32 %call, 0
366 %conv = zext i1 %cmp to i32
370 define i32 @cmp_eq6(ptr nocapture readonly %x, ptr nocapture readonly %y) {
371 ; X32-LABEL: @cmp_eq6(
372 ; X32-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 1
373 ; X32-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 1
374 ; X32-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
375 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 4
376 ; X32-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 4
377 ; X32-NEXT: [[TMP10:%.*]] = load i16, ptr [[TMP6]], align 1
378 ; X32-NEXT: [[TMP11:%.*]] = load i16, ptr [[TMP7]], align 1
379 ; X32-NEXT: [[TMP12:%.*]] = zext i16 [[TMP10]] to i32
380 ; X32-NEXT: [[TMP13:%.*]] = zext i16 [[TMP11]] to i32
381 ; X32-NEXT: [[TMP14:%.*]] = xor i32 [[TMP12]], [[TMP13]]
382 ; X32-NEXT: [[TMP15:%.*]] = or i32 [[TMP5]], [[TMP14]]
383 ; X32-NEXT: [[TMP16:%.*]] = icmp ne i32 [[TMP15]], 0
384 ; X32-NEXT: [[TMP17:%.*]] = zext i1 [[TMP16]] to i32
385 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP17]], 0
386 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
387 ; X32-NEXT: ret i32 [[CONV]]
389 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 6)
390 %cmp = icmp eq i32 %call, 0
391 %conv = zext i1 %cmp to i32
395 define i32 @cmp_eq6_align4(ptr nocapture readonly align 4 %x, ptr nocapture readonly align 4 %y) {
396 ; X32-LABEL: @cmp_eq6_align4(
397 ; X32-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 4
398 ; X32-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 4
399 ; X32-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
400 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 4
401 ; X32-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 4
402 ; X32-NEXT: [[TMP10:%.*]] = load i16, ptr [[TMP6]], align 4
403 ; X32-NEXT: [[TMP11:%.*]] = load i16, ptr [[TMP7]], align 4
404 ; X32-NEXT: [[TMP12:%.*]] = zext i16 [[TMP10]] to i32
405 ; X32-NEXT: [[TMP13:%.*]] = zext i16 [[TMP11]] to i32
406 ; X32-NEXT: [[TMP14:%.*]] = xor i32 [[TMP12]], [[TMP13]]
407 ; X32-NEXT: [[TMP15:%.*]] = or i32 [[TMP5]], [[TMP14]]
408 ; X32-NEXT: [[TMP16:%.*]] = icmp ne i32 [[TMP15]], 0
409 ; X32-NEXT: [[TMP17:%.*]] = zext i1 [[TMP16]] to i32
410 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP17]], 0
411 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
412 ; X32-NEXT: ret i32 [[CONV]]
414 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 6)
415 %cmp = icmp eq i32 %call, 0
416 %conv = zext i1 %cmp to i32
420 define i32 @cmp_eq7(ptr nocapture readonly %x, ptr nocapture readonly %y) {
421 ; X32-LABEL: @cmp_eq7(
422 ; X32-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 1
423 ; X32-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 1
424 ; X32-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
425 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 3
426 ; X32-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 3
427 ; X32-NEXT: [[TMP10:%.*]] = load i32, ptr [[TMP6]], align 1
428 ; X32-NEXT: [[TMP11:%.*]] = load i32, ptr [[TMP7]], align 1
429 ; X32-NEXT: [[TMP12:%.*]] = xor i32 [[TMP10]], [[TMP11]]
430 ; X32-NEXT: [[TMP13:%.*]] = or i32 [[TMP5]], [[TMP12]]
431 ; X32-NEXT: [[TMP14:%.*]] = icmp ne i32 [[TMP13]], 0
432 ; X32-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
433 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
434 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
435 ; X32-NEXT: ret i32 [[CONV]]
437 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 7)
438 %cmp = icmp eq i32 %call, 0
439 %conv = zext i1 %cmp to i32
443 define i32 @cmp_eq8(ptr nocapture readonly %x, ptr nocapture readonly %y) {
444 ; X32-LABEL: @cmp_eq8(
445 ; X32-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 1
446 ; X32-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 1
447 ; X32-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
448 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 4
449 ; X32-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 4
450 ; X32-NEXT: [[TMP10:%.*]] = load i32, ptr [[TMP6]], align 1
451 ; X32-NEXT: [[TMP11:%.*]] = load i32, ptr [[TMP7]], align 1
452 ; X32-NEXT: [[TMP12:%.*]] = xor i32 [[TMP10]], [[TMP11]]
453 ; X32-NEXT: [[TMP13:%.*]] = or i32 [[TMP5]], [[TMP12]]
454 ; X32-NEXT: [[TMP14:%.*]] = icmp ne i32 [[TMP13]], 0
455 ; X32-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
456 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
457 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
458 ; X32-NEXT: ret i32 [[CONV]]
460 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 8)
461 %cmp = icmp eq i32 %call, 0
462 %conv = zext i1 %cmp to i32
466 define i32 @cmp_eq9(ptr nocapture readonly %x, ptr nocapture readonly %y) {
467 ; X32-LABEL: @cmp_eq9(
468 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 9)
469 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
470 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
471 ; X32-NEXT: ret i32 [[CONV]]
473 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 9)
474 %cmp = icmp eq i32 %call, 0
475 %conv = zext i1 %cmp to i32
479 define i32 @cmp_eq10(ptr nocapture readonly %x, ptr nocapture readonly %y) {
480 ; X32-LABEL: @cmp_eq10(
481 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 10)
482 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
483 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
484 ; X32-NEXT: ret i32 [[CONV]]
486 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 10)
487 %cmp = icmp eq i32 %call, 0
488 %conv = zext i1 %cmp to i32
492 define i32 @cmp_eq11(ptr nocapture readonly %x, ptr nocapture readonly %y) {
493 ; X32-LABEL: @cmp_eq11(
494 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 11)
495 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
496 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
497 ; X32-NEXT: ret i32 [[CONV]]
499 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 11)
500 %cmp = icmp eq i32 %call, 0
501 %conv = zext i1 %cmp to i32
505 define i32 @cmp_eq12(ptr nocapture readonly %x, ptr nocapture readonly %y) {
506 ; X32-LABEL: @cmp_eq12(
507 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 12)
508 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
509 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
510 ; X32-NEXT: ret i32 [[CONV]]
512 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 12)
513 %cmp = icmp eq i32 %call, 0
514 %conv = zext i1 %cmp to i32
518 define i32 @cmp_eq13(ptr nocapture readonly %x, ptr nocapture readonly %y) {
519 ; X32-LABEL: @cmp_eq13(
520 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 13)
521 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
522 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
523 ; X32-NEXT: ret i32 [[CONV]]
525 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 13)
526 %cmp = icmp eq i32 %call, 0
527 %conv = zext i1 %cmp to i32
531 define i32 @cmp_eq14(ptr nocapture readonly %x, ptr nocapture readonly %y) {
532 ; X32-LABEL: @cmp_eq14(
533 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 14)
534 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
535 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
536 ; X32-NEXT: ret i32 [[CONV]]
538 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 14)
539 %cmp = icmp eq i32 %call, 0
540 %conv = zext i1 %cmp to i32
544 define i32 @cmp_eq15(ptr nocapture readonly %x, ptr nocapture readonly %y) {
545 ; X32-LABEL: @cmp_eq15(
546 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 15)
547 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
548 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
549 ; X32-NEXT: ret i32 [[CONV]]
551 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 15)
552 %cmp = icmp eq i32 %call, 0
553 %conv = zext i1 %cmp to i32
557 define i32 @cmp_eq16(ptr nocapture readonly %x, ptr nocapture readonly %y) {
558 ; X32-LABEL: @cmp_eq16(
559 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 16)
560 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
561 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
562 ; X32-NEXT: ret i32 [[CONV]]
564 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 16)
565 %cmp = icmp eq i32 %call, 0
566 %conv = zext i1 %cmp to i32