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: [[TMP7:%.*]] = icmp ugt i32 [[TMP5]], [[TMP6]]
75 ; X32-NEXT: [[TMP8:%.*]] = icmp ult i32 [[TMP5]], [[TMP6]]
76 ; X32-NEXT: [[TMP9:%.*]] = zext i1 [[TMP7]] to i32
77 ; X32-NEXT: [[TMP10:%.*]] = zext i1 [[TMP8]] to i32
78 ; X32-NEXT: [[TMP11:%.*]] = sub i32 [[TMP9]], [[TMP10]]
79 ; X32-NEXT: ret i32 [[TMP11]]
81 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 4)
85 define i32 @cmp5(ptr nocapture readonly %x, ptr nocapture readonly %y) {
87 ; X32-NEXT: br label [[LOADBB:%.*]]
89 ; X32-NEXT: [[TMP1:%.*]] = icmp ult i32 [[TMP7:%.*]], [[TMP8:%.*]]
90 ; X32-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
91 ; X32-NEXT: br label [[ENDBLOCK:%.*]]
93 ; X32-NEXT: [[TMP5:%.*]] = load i32, ptr [[X:%.*]], align 1
94 ; X32-NEXT: [[TMP6:%.*]] = load i32, ptr [[Y:%.*]], align 1
95 ; X32-NEXT: [[TMP7]] = call i32 @llvm.bswap.i32(i32 [[TMP5]])
96 ; X32-NEXT: [[TMP8]] = call i32 @llvm.bswap.i32(i32 [[TMP6]])
97 ; X32-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP7]], [[TMP8]]
98 ; X32-NEXT: br i1 [[TMP9]], label [[LOADBB1:%.*]], label [[RES_BLOCK:%.*]]
100 ; X32-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[X]], i64 4
101 ; X32-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[Y]], i64 4
102 ; X32-NEXT: [[TMP12:%.*]] = load i8, ptr [[TMP10]], align 1
103 ; X32-NEXT: [[TMP13:%.*]] = load i8, ptr [[TMP11]], align 1
104 ; X32-NEXT: [[TMP14:%.*]] = zext i8 [[TMP12]] to i32
105 ; X32-NEXT: [[TMP15:%.*]] = zext i8 [[TMP13]] to i32
106 ; X32-NEXT: [[TMP16:%.*]] = sub i32 [[TMP14]], [[TMP15]]
107 ; X32-NEXT: br label [[ENDBLOCK]]
109 ; X32-NEXT: [[PHI_RES:%.*]] = phi i32 [ [[TMP16]], [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
110 ; X32-NEXT: ret i32 [[PHI_RES]]
112 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 5)
116 define i32 @cmp6(ptr nocapture readonly %x, ptr nocapture readonly %y) {
118 ; X32-NEXT: br label [[LOADBB:%.*]]
120 ; X32-NEXT: [[PHI_SRC1:%.*]] = phi i32 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP18:%.*]], [[LOADBB1:%.*]] ]
121 ; X32-NEXT: [[PHI_SRC2:%.*]] = phi i32 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP19:%.*]], [[LOADBB1]] ]
122 ; X32-NEXT: [[TMP1:%.*]] = icmp ult i32 [[PHI_SRC1]], [[PHI_SRC2]]
123 ; X32-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
124 ; X32-NEXT: br label [[ENDBLOCK:%.*]]
126 ; X32-NEXT: [[TMP5:%.*]] = load i32, ptr [[X:%.*]], align 1
127 ; X32-NEXT: [[TMP6:%.*]] = load i32, ptr [[Y:%.*]], align 1
128 ; X32-NEXT: [[TMP7]] = call i32 @llvm.bswap.i32(i32 [[TMP5]])
129 ; X32-NEXT: [[TMP8]] = call i32 @llvm.bswap.i32(i32 [[TMP6]])
130 ; X32-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP7]], [[TMP8]]
131 ; X32-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
133 ; X32-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[X]], i64 4
134 ; X32-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[Y]], i64 4
135 ; X32-NEXT: [[TMP14:%.*]] = load i16, ptr [[TMP10]], align 1
136 ; X32-NEXT: [[TMP15:%.*]] = load i16, ptr [[TMP11]], align 1
137 ; X32-NEXT: [[TMP16:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP14]])
138 ; X32-NEXT: [[TMP17:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP15]])
139 ; X32-NEXT: [[TMP18]] = zext i16 [[TMP16]] to i32
140 ; X32-NEXT: [[TMP19]] = zext i16 [[TMP17]] to i32
141 ; X32-NEXT: [[TMP20:%.*]] = icmp eq i32 [[TMP18]], [[TMP19]]
142 ; X32-NEXT: br i1 [[TMP20]], label [[ENDBLOCK]], label [[RES_BLOCK]]
144 ; X32-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
145 ; X32-NEXT: ret i32 [[PHI_RES]]
147 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 6)
151 define i32 @cmp7(ptr nocapture readonly %x, ptr nocapture readonly %y) {
153 ; X32-NEXT: br label [[LOADBB:%.*]]
155 ; X32-NEXT: [[PHI_SRC1:%.*]] = phi i32 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP16:%.*]], [[LOADBB1:%.*]] ]
156 ; X32-NEXT: [[PHI_SRC2:%.*]] = phi i32 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP17:%.*]], [[LOADBB1]] ]
157 ; X32-NEXT: [[TMP1:%.*]] = icmp ult i32 [[PHI_SRC1]], [[PHI_SRC2]]
158 ; X32-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
159 ; X32-NEXT: br label [[ENDBLOCK:%.*]]
161 ; X32-NEXT: [[TMP5:%.*]] = load i32, ptr [[X:%.*]], align 1
162 ; X32-NEXT: [[TMP6:%.*]] = load i32, ptr [[Y:%.*]], align 1
163 ; X32-NEXT: [[TMP7]] = call i32 @llvm.bswap.i32(i32 [[TMP5]])
164 ; X32-NEXT: [[TMP8]] = call i32 @llvm.bswap.i32(i32 [[TMP6]])
165 ; X32-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP7]], [[TMP8]]
166 ; X32-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
168 ; X32-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[X]], i64 3
169 ; X32-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[Y]], i64 3
170 ; X32-NEXT: [[TMP14:%.*]] = load i32, ptr [[TMP10]], align 1
171 ; X32-NEXT: [[TMP15:%.*]] = load i32, ptr [[TMP11]], align 1
172 ; X32-NEXT: [[TMP16]] = call i32 @llvm.bswap.i32(i32 [[TMP14]])
173 ; X32-NEXT: [[TMP17]] = call i32 @llvm.bswap.i32(i32 [[TMP15]])
174 ; X32-NEXT: [[TMP18:%.*]] = icmp eq i32 [[TMP16]], [[TMP17]]
175 ; X32-NEXT: br i1 [[TMP18]], label [[ENDBLOCK]], label [[RES_BLOCK]]
177 ; X32-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
178 ; X32-NEXT: ret i32 [[PHI_RES]]
180 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 7)
184 define i32 @cmp8(ptr nocapture readonly %x, ptr nocapture readonly %y) {
186 ; X32-NEXT: br label [[LOADBB:%.*]]
188 ; X32-NEXT: [[PHI_SRC1:%.*]] = phi i32 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP16:%.*]], [[LOADBB1:%.*]] ]
189 ; X32-NEXT: [[PHI_SRC2:%.*]] = phi i32 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP17:%.*]], [[LOADBB1]] ]
190 ; X32-NEXT: [[TMP1:%.*]] = icmp ult i32 [[PHI_SRC1]], [[PHI_SRC2]]
191 ; X32-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
192 ; X32-NEXT: br label [[ENDBLOCK:%.*]]
194 ; X32-NEXT: [[TMP5:%.*]] = load i32, ptr [[X:%.*]], align 1
195 ; X32-NEXT: [[TMP6:%.*]] = load i32, ptr [[Y:%.*]], align 1
196 ; X32-NEXT: [[TMP7]] = call i32 @llvm.bswap.i32(i32 [[TMP5]])
197 ; X32-NEXT: [[TMP8]] = call i32 @llvm.bswap.i32(i32 [[TMP6]])
198 ; X32-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP7]], [[TMP8]]
199 ; X32-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
201 ; X32-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[X]], i64 4
202 ; X32-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[Y]], i64 4
203 ; X32-NEXT: [[TMP14:%.*]] = load i32, ptr [[TMP10]], align 1
204 ; X32-NEXT: [[TMP15:%.*]] = load i32, ptr [[TMP11]], align 1
205 ; X32-NEXT: [[TMP16]] = call i32 @llvm.bswap.i32(i32 [[TMP14]])
206 ; X32-NEXT: [[TMP17]] = call i32 @llvm.bswap.i32(i32 [[TMP15]])
207 ; X32-NEXT: [[TMP18:%.*]] = icmp eq i32 [[TMP16]], [[TMP17]]
208 ; X32-NEXT: br i1 [[TMP18]], label [[ENDBLOCK]], label [[RES_BLOCK]]
210 ; X32-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
211 ; X32-NEXT: ret i32 [[PHI_RES]]
213 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 8)
217 define i32 @cmp9(ptr nocapture readonly %x, ptr nocapture readonly %y) {
219 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 9)
220 ; X32-NEXT: ret i32 [[CALL]]
222 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 9)
226 define i32 @cmp10(ptr nocapture readonly %x, ptr nocapture readonly %y) {
228 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 10)
229 ; X32-NEXT: ret i32 [[CALL]]
231 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 10)
235 define i32 @cmp11(ptr nocapture readonly %x, ptr nocapture readonly %y) {
237 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 11)
238 ; X32-NEXT: ret i32 [[CALL]]
240 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 11)
244 define i32 @cmp12(ptr nocapture readonly %x, ptr nocapture readonly %y) {
246 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 12)
247 ; X32-NEXT: ret i32 [[CALL]]
249 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 12)
253 define i32 @cmp13(ptr nocapture readonly %x, ptr nocapture readonly %y) {
255 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 13)
256 ; X32-NEXT: ret i32 [[CALL]]
258 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 13)
262 define i32 @cmp14(ptr nocapture readonly %x, ptr nocapture readonly %y) {
264 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 14)
265 ; X32-NEXT: ret i32 [[CALL]]
267 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 14)
271 define i32 @cmp15(ptr nocapture readonly %x, ptr nocapture readonly %y) {
273 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 15)
274 ; X32-NEXT: ret i32 [[CALL]]
276 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 15)
280 define i32 @cmp16(ptr nocapture readonly %x, ptr nocapture readonly %y) {
282 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 16)
283 ; X32-NEXT: ret i32 [[CALL]]
285 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 16)
289 define i32 @cmp_eq2(ptr nocapture readonly %x, ptr nocapture readonly %y) {
290 ; X32-LABEL: @cmp_eq2(
291 ; X32-NEXT: [[TMP3:%.*]] = load i16, ptr [[X:%.*]], align 1
292 ; X32-NEXT: [[TMP4:%.*]] = load i16, ptr [[Y:%.*]], align 1
293 ; X32-NEXT: [[TMP5:%.*]] = icmp ne i16 [[TMP3]], [[TMP4]]
294 ; X32-NEXT: [[TMP6:%.*]] = zext i1 [[TMP5]] to i32
295 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP6]], 0
296 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
297 ; X32-NEXT: ret i32 [[CONV]]
299 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 2)
300 %cmp = icmp eq i32 %call, 0
301 %conv = zext i1 %cmp to i32
305 define i32 @cmp_eq3(ptr nocapture readonly %x, ptr nocapture readonly %y) {
306 ; X32-LABEL: @cmp_eq3(
307 ; X32-NEXT: [[TMP3:%.*]] = load i16, ptr [[X:%.*]], align 1
308 ; X32-NEXT: [[TMP4:%.*]] = load i16, ptr [[Y:%.*]], align 1
309 ; X32-NEXT: [[TMP5:%.*]] = xor i16 [[TMP3]], [[TMP4]]
310 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 2
311 ; X32-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 2
312 ; X32-NEXT: [[TMP8:%.*]] = load i8, ptr [[TMP6]], align 1
313 ; X32-NEXT: [[TMP9:%.*]] = load i8, ptr [[TMP7]], align 1
314 ; X32-NEXT: [[TMP10:%.*]] = zext i8 [[TMP8]] to i16
315 ; X32-NEXT: [[TMP11:%.*]] = zext i8 [[TMP9]] to i16
316 ; X32-NEXT: [[TMP12:%.*]] = xor i16 [[TMP10]], [[TMP11]]
317 ; X32-NEXT: [[TMP13:%.*]] = or i16 [[TMP5]], [[TMP12]]
318 ; X32-NEXT: [[TMP14:%.*]] = icmp ne i16 [[TMP13]], 0
319 ; X32-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
320 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
321 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
322 ; X32-NEXT: ret i32 [[CONV]]
324 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 3)
325 %cmp = icmp eq i32 %call, 0
326 %conv = zext i1 %cmp to i32
330 define i32 @cmp_eq4(ptr nocapture readonly %x, ptr nocapture readonly %y) {
331 ; X32-LABEL: @cmp_eq4(
332 ; X32-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 1
333 ; X32-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 1
334 ; X32-NEXT: [[TMP5:%.*]] = icmp ne i32 [[TMP3]], [[TMP4]]
335 ; X32-NEXT: [[TMP6:%.*]] = zext i1 [[TMP5]] to i32
336 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP6]], 0
337 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
338 ; X32-NEXT: ret i32 [[CONV]]
340 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 4)
341 %cmp = icmp eq i32 %call, 0
342 %conv = zext i1 %cmp to i32
346 define i32 @cmp_eq5(ptr nocapture readonly %x, ptr nocapture readonly %y) {
347 ; X32-LABEL: @cmp_eq5(
348 ; X32-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 1
349 ; X32-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 1
350 ; X32-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
351 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 4
352 ; X32-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 4
353 ; X32-NEXT: [[TMP8:%.*]] = load i8, ptr [[TMP6]], align 1
354 ; X32-NEXT: [[TMP9:%.*]] = load i8, ptr [[TMP7]], align 1
355 ; X32-NEXT: [[TMP10:%.*]] = zext i8 [[TMP8]] to i32
356 ; X32-NEXT: [[TMP11:%.*]] = zext i8 [[TMP9]] to i32
357 ; X32-NEXT: [[TMP12:%.*]] = xor i32 [[TMP10]], [[TMP11]]
358 ; X32-NEXT: [[TMP13:%.*]] = or i32 [[TMP5]], [[TMP12]]
359 ; X32-NEXT: [[TMP14:%.*]] = icmp ne i32 [[TMP13]], 0
360 ; X32-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
361 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
362 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
363 ; X32-NEXT: ret i32 [[CONV]]
365 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 5)
366 %cmp = icmp eq i32 %call, 0
367 %conv = zext i1 %cmp to i32
371 define i32 @cmp_eq6(ptr nocapture readonly %x, ptr nocapture readonly %y) {
372 ; X32-LABEL: @cmp_eq6(
373 ; X32-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 1
374 ; X32-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 1
375 ; X32-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
376 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 4
377 ; X32-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 4
378 ; X32-NEXT: [[TMP10:%.*]] = load i16, ptr [[TMP6]], align 1
379 ; X32-NEXT: [[TMP11:%.*]] = load i16, ptr [[TMP7]], align 1
380 ; X32-NEXT: [[TMP12:%.*]] = zext i16 [[TMP10]] to i32
381 ; X32-NEXT: [[TMP13:%.*]] = zext i16 [[TMP11]] to i32
382 ; X32-NEXT: [[TMP14:%.*]] = xor i32 [[TMP12]], [[TMP13]]
383 ; X32-NEXT: [[TMP15:%.*]] = or i32 [[TMP5]], [[TMP14]]
384 ; X32-NEXT: [[TMP16:%.*]] = icmp ne i32 [[TMP15]], 0
385 ; X32-NEXT: [[TMP17:%.*]] = zext i1 [[TMP16]] to i32
386 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP17]], 0
387 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
388 ; X32-NEXT: ret i32 [[CONV]]
390 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 6)
391 %cmp = icmp eq i32 %call, 0
392 %conv = zext i1 %cmp to i32
396 define i32 @cmp_eq6_align4(ptr nocapture readonly align 4 %x, ptr nocapture readonly align 4 %y) {
397 ; X32-LABEL: @cmp_eq6_align4(
398 ; X32-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 4
399 ; X32-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 4
400 ; X32-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
401 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 4
402 ; X32-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 4
403 ; X32-NEXT: [[TMP10:%.*]] = load i16, ptr [[TMP6]], align 4
404 ; X32-NEXT: [[TMP11:%.*]] = load i16, ptr [[TMP7]], align 4
405 ; X32-NEXT: [[TMP12:%.*]] = zext i16 [[TMP10]] to i32
406 ; X32-NEXT: [[TMP13:%.*]] = zext i16 [[TMP11]] to i32
407 ; X32-NEXT: [[TMP14:%.*]] = xor i32 [[TMP12]], [[TMP13]]
408 ; X32-NEXT: [[TMP15:%.*]] = or i32 [[TMP5]], [[TMP14]]
409 ; X32-NEXT: [[TMP16:%.*]] = icmp ne i32 [[TMP15]], 0
410 ; X32-NEXT: [[TMP17:%.*]] = zext i1 [[TMP16]] to i32
411 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP17]], 0
412 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
413 ; X32-NEXT: ret i32 [[CONV]]
415 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 6)
416 %cmp = icmp eq i32 %call, 0
417 %conv = zext i1 %cmp to i32
421 define i32 @cmp_eq7(ptr nocapture readonly %x, ptr nocapture readonly %y) {
422 ; X32-LABEL: @cmp_eq7(
423 ; X32-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 1
424 ; X32-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 1
425 ; X32-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
426 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 3
427 ; X32-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 3
428 ; X32-NEXT: [[TMP10:%.*]] = load i32, ptr [[TMP6]], align 1
429 ; X32-NEXT: [[TMP11:%.*]] = load i32, ptr [[TMP7]], align 1
430 ; X32-NEXT: [[TMP12:%.*]] = xor i32 [[TMP10]], [[TMP11]]
431 ; X32-NEXT: [[TMP13:%.*]] = or i32 [[TMP5]], [[TMP12]]
432 ; X32-NEXT: [[TMP14:%.*]] = icmp ne i32 [[TMP13]], 0
433 ; X32-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
434 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
435 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
436 ; X32-NEXT: ret i32 [[CONV]]
438 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 7)
439 %cmp = icmp eq i32 %call, 0
440 %conv = zext i1 %cmp to i32
444 define i32 @cmp_eq8(ptr nocapture readonly %x, ptr nocapture readonly %y) {
445 ; X32-LABEL: @cmp_eq8(
446 ; X32-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 1
447 ; X32-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 1
448 ; X32-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
449 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 4
450 ; X32-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 4
451 ; X32-NEXT: [[TMP10:%.*]] = load i32, ptr [[TMP6]], align 1
452 ; X32-NEXT: [[TMP11:%.*]] = load i32, ptr [[TMP7]], align 1
453 ; X32-NEXT: [[TMP12:%.*]] = xor i32 [[TMP10]], [[TMP11]]
454 ; X32-NEXT: [[TMP13:%.*]] = or i32 [[TMP5]], [[TMP12]]
455 ; X32-NEXT: [[TMP14:%.*]] = icmp ne i32 [[TMP13]], 0
456 ; X32-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
457 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
458 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
459 ; X32-NEXT: ret i32 [[CONV]]
461 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 8)
462 %cmp = icmp eq i32 %call, 0
463 %conv = zext i1 %cmp to i32
467 define i32 @cmp_eq9(ptr nocapture readonly %x, ptr nocapture readonly %y) {
468 ; X32-LABEL: @cmp_eq9(
469 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 9)
470 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
471 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
472 ; X32-NEXT: ret i32 [[CONV]]
474 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 9)
475 %cmp = icmp eq i32 %call, 0
476 %conv = zext i1 %cmp to i32
480 define i32 @cmp_eq10(ptr nocapture readonly %x, ptr nocapture readonly %y) {
481 ; X32-LABEL: @cmp_eq10(
482 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 10)
483 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
484 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
485 ; X32-NEXT: ret i32 [[CONV]]
487 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 10)
488 %cmp = icmp eq i32 %call, 0
489 %conv = zext i1 %cmp to i32
493 define i32 @cmp_eq11(ptr nocapture readonly %x, ptr nocapture readonly %y) {
494 ; X32-LABEL: @cmp_eq11(
495 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 11)
496 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
497 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
498 ; X32-NEXT: ret i32 [[CONV]]
500 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 11)
501 %cmp = icmp eq i32 %call, 0
502 %conv = zext i1 %cmp to i32
506 define i32 @cmp_eq12(ptr nocapture readonly %x, ptr nocapture readonly %y) {
507 ; X32-LABEL: @cmp_eq12(
508 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 12)
509 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
510 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
511 ; X32-NEXT: ret i32 [[CONV]]
513 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 12)
514 %cmp = icmp eq i32 %call, 0
515 %conv = zext i1 %cmp to i32
519 define i32 @cmp_eq13(ptr nocapture readonly %x, ptr nocapture readonly %y) {
520 ; X32-LABEL: @cmp_eq13(
521 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 13)
522 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
523 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
524 ; X32-NEXT: ret i32 [[CONV]]
526 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 13)
527 %cmp = icmp eq i32 %call, 0
528 %conv = zext i1 %cmp to i32
532 define i32 @cmp_eq14(ptr nocapture readonly %x, ptr nocapture readonly %y) {
533 ; X32-LABEL: @cmp_eq14(
534 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 14)
535 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
536 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
537 ; X32-NEXT: ret i32 [[CONV]]
539 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 14)
540 %cmp = icmp eq i32 %call, 0
541 %conv = zext i1 %cmp to i32
545 define i32 @cmp_eq15(ptr nocapture readonly %x, ptr nocapture readonly %y) {
546 ; X32-LABEL: @cmp_eq15(
547 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 15)
548 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
549 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
550 ; X32-NEXT: ret i32 [[CONV]]
552 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 15)
553 %cmp = icmp eq i32 %call, 0
554 %conv = zext i1 %cmp to i32
558 define i32 @cmp_eq16(ptr nocapture readonly %x, ptr nocapture readonly %y) {
559 ; X32-LABEL: @cmp_eq16(
560 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr [[X:%.*]], ptr [[Y:%.*]], i32 16)
561 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
562 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
563 ; X32-NEXT: ret i32 [[CONV]]
565 %call = tail call i32 @memcmp(ptr %x, ptr %y, i32 16)
566 %cmp = icmp eq i32 %call, 0
567 %conv = zext i1 %cmp to i32