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(i8* nocapture, i8* nocapture, i32)
6 define i32 @cmp2(i8* nocapture readonly %x, i8* nocapture readonly %y) {
8 ; X32-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i16*
9 ; X32-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i16*
10 ; X32-NEXT: [[TMP3:%.*]] = load i16, i16* [[TMP1]], align 1
11 ; X32-NEXT: [[TMP4:%.*]] = load i16, i16* [[TMP2]], align 1
12 ; X32-NEXT: [[TMP5:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP3]])
13 ; X32-NEXT: [[TMP6:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP4]])
14 ; X32-NEXT: [[TMP7:%.*]] = zext i16 [[TMP5]] to i32
15 ; X32-NEXT: [[TMP8:%.*]] = zext i16 [[TMP6]] to i32
16 ; X32-NEXT: [[TMP9:%.*]] = sub i32 [[TMP7]], [[TMP8]]
17 ; X32-NEXT: ret i32 [[TMP9]]
19 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 2)
23 define i32 @cmp2_align2(i8* nocapture readonly align 2 %x, i8* nocapture readonly align 2 %y) {
24 ; X32-LABEL: @cmp2_align2(
25 ; X32-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i16*
26 ; X32-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i16*
27 ; X32-NEXT: [[TMP3:%.*]] = load i16, i16* [[TMP1]], align 2
28 ; X32-NEXT: [[TMP4:%.*]] = load i16, i16* [[TMP2]], align 2
29 ; X32-NEXT: [[TMP5:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP3]])
30 ; X32-NEXT: [[TMP6:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP4]])
31 ; X32-NEXT: [[TMP7:%.*]] = zext i16 [[TMP5]] to i32
32 ; X32-NEXT: [[TMP8:%.*]] = zext i16 [[TMP6]] to i32
33 ; X32-NEXT: [[TMP9:%.*]] = sub i32 [[TMP7]], [[TMP8]]
34 ; X32-NEXT: ret i32 [[TMP9]]
36 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 2)
40 define i32 @cmp3(i8* nocapture readonly %x, i8* nocapture readonly %y) {
42 ; X32-NEXT: br label [[LOADBB:%.*]]
44 ; X32-NEXT: [[TMP1:%.*]] = icmp ult i16 [[TMP7:%.*]], [[TMP8:%.*]]
45 ; X32-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
46 ; X32-NEXT: br label [[ENDBLOCK:%.*]]
48 ; X32-NEXT: [[TMP3:%.*]] = bitcast i8* [[X:%.*]] to i16*
49 ; X32-NEXT: [[TMP4:%.*]] = bitcast i8* [[Y:%.*]] to i16*
50 ; X32-NEXT: [[TMP5:%.*]] = load i16, i16* [[TMP3]], align 1
51 ; X32-NEXT: [[TMP6:%.*]] = load i16, i16* [[TMP4]], align 1
52 ; X32-NEXT: [[TMP7]] = call i16 @llvm.bswap.i16(i16 [[TMP5]])
53 ; X32-NEXT: [[TMP8]] = call i16 @llvm.bswap.i16(i16 [[TMP6]])
54 ; X32-NEXT: [[TMP9:%.*]] = icmp eq i16 [[TMP7]], [[TMP8]]
55 ; X32-NEXT: br i1 [[TMP9]], label [[LOADBB1:%.*]], label [[RES_BLOCK:%.*]]
57 ; X32-NEXT: [[TMP10:%.*]] = getelementptr i8, i8* [[X]], i64 2
58 ; X32-NEXT: [[TMP11:%.*]] = getelementptr i8, i8* [[Y]], i64 2
59 ; X32-NEXT: [[TMP12:%.*]] = load i8, i8* [[TMP10]], align 1
60 ; X32-NEXT: [[TMP13:%.*]] = load i8, i8* [[TMP11]], align 1
61 ; X32-NEXT: [[TMP14:%.*]] = zext i8 [[TMP12]] to i32
62 ; X32-NEXT: [[TMP15:%.*]] = zext i8 [[TMP13]] to i32
63 ; X32-NEXT: [[TMP16:%.*]] = sub i32 [[TMP14]], [[TMP15]]
64 ; X32-NEXT: br label [[ENDBLOCK]]
66 ; X32-NEXT: [[PHI_RES:%.*]] = phi i32 [ [[TMP16]], [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
67 ; X32-NEXT: ret i32 [[PHI_RES]]
69 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 3)
73 define i32 @cmp4(i8* nocapture readonly %x, i8* nocapture readonly %y) {
75 ; X32-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
76 ; X32-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
77 ; X32-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]], align 1
78 ; X32-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]], align 1
79 ; X32-NEXT: [[TMP5:%.*]] = call i32 @llvm.bswap.i32(i32 [[TMP3]])
80 ; X32-NEXT: [[TMP6:%.*]] = call i32 @llvm.bswap.i32(i32 [[TMP4]])
81 ; X32-NEXT: [[TMP7:%.*]] = icmp ugt i32 [[TMP5]], [[TMP6]]
82 ; X32-NEXT: [[TMP8:%.*]] = icmp ult i32 [[TMP5]], [[TMP6]]
83 ; X32-NEXT: [[TMP9:%.*]] = zext i1 [[TMP7]] to i32
84 ; X32-NEXT: [[TMP10:%.*]] = zext i1 [[TMP8]] to i32
85 ; X32-NEXT: [[TMP11:%.*]] = sub i32 [[TMP9]], [[TMP10]]
86 ; X32-NEXT: ret i32 [[TMP11]]
88 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 4)
92 define i32 @cmp5(i8* nocapture readonly %x, i8* nocapture readonly %y) {
94 ; X32-NEXT: br label [[LOADBB:%.*]]
96 ; X32-NEXT: [[TMP1:%.*]] = icmp ult i32 [[TMP7:%.*]], [[TMP8:%.*]]
97 ; X32-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
98 ; X32-NEXT: br label [[ENDBLOCK:%.*]]
100 ; X32-NEXT: [[TMP3:%.*]] = bitcast i8* [[X:%.*]] to i32*
101 ; X32-NEXT: [[TMP4:%.*]] = bitcast i8* [[Y:%.*]] to i32*
102 ; X32-NEXT: [[TMP5:%.*]] = load i32, i32* [[TMP3]], align 1
103 ; X32-NEXT: [[TMP6:%.*]] = load i32, i32* [[TMP4]], align 1
104 ; X32-NEXT: [[TMP7]] = call i32 @llvm.bswap.i32(i32 [[TMP5]])
105 ; X32-NEXT: [[TMP8]] = call i32 @llvm.bswap.i32(i32 [[TMP6]])
106 ; X32-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP7]], [[TMP8]]
107 ; X32-NEXT: br i1 [[TMP9]], label [[LOADBB1:%.*]], label [[RES_BLOCK:%.*]]
109 ; X32-NEXT: [[TMP10:%.*]] = getelementptr i8, i8* [[X]], i64 4
110 ; X32-NEXT: [[TMP11:%.*]] = getelementptr i8, i8* [[Y]], i64 4
111 ; X32-NEXT: [[TMP12:%.*]] = load i8, i8* [[TMP10]], align 1
112 ; X32-NEXT: [[TMP13:%.*]] = load i8, i8* [[TMP11]], align 1
113 ; X32-NEXT: [[TMP14:%.*]] = zext i8 [[TMP12]] to i32
114 ; X32-NEXT: [[TMP15:%.*]] = zext i8 [[TMP13]] to i32
115 ; X32-NEXT: [[TMP16:%.*]] = sub i32 [[TMP14]], [[TMP15]]
116 ; X32-NEXT: br label [[ENDBLOCK]]
118 ; X32-NEXT: [[PHI_RES:%.*]] = phi i32 [ [[TMP16]], [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
119 ; X32-NEXT: ret i32 [[PHI_RES]]
121 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 5)
125 define i32 @cmp6(i8* nocapture readonly %x, i8* nocapture readonly %y) {
127 ; X32-NEXT: br label [[LOADBB:%.*]]
129 ; X32-NEXT: [[PHI_SRC1:%.*]] = phi i32 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP18:%.*]], [[LOADBB1:%.*]] ]
130 ; X32-NEXT: [[PHI_SRC2:%.*]] = phi i32 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP19:%.*]], [[LOADBB1]] ]
131 ; X32-NEXT: [[TMP1:%.*]] = icmp ult i32 [[PHI_SRC1]], [[PHI_SRC2]]
132 ; X32-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
133 ; X32-NEXT: br label [[ENDBLOCK:%.*]]
135 ; X32-NEXT: [[TMP3:%.*]] = bitcast i8* [[X:%.*]] to i32*
136 ; X32-NEXT: [[TMP4:%.*]] = bitcast i8* [[Y:%.*]] to i32*
137 ; X32-NEXT: [[TMP5:%.*]] = load i32, i32* [[TMP3]], align 1
138 ; X32-NEXT: [[TMP6:%.*]] = load i32, i32* [[TMP4]], align 1
139 ; X32-NEXT: [[TMP7]] = call i32 @llvm.bswap.i32(i32 [[TMP5]])
140 ; X32-NEXT: [[TMP8]] = call i32 @llvm.bswap.i32(i32 [[TMP6]])
141 ; X32-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP7]], [[TMP8]]
142 ; X32-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
144 ; X32-NEXT: [[TMP10:%.*]] = getelementptr i8, i8* [[X]], i64 4
145 ; X32-NEXT: [[TMP11:%.*]] = getelementptr i8, i8* [[Y]], i64 4
146 ; X32-NEXT: [[TMP12:%.*]] = bitcast i8* [[TMP10]] to i16*
147 ; X32-NEXT: [[TMP13:%.*]] = bitcast i8* [[TMP11]] to i16*
148 ; X32-NEXT: [[TMP14:%.*]] = load i16, i16* [[TMP12]], align 1
149 ; X32-NEXT: [[TMP15:%.*]] = load i16, i16* [[TMP13]], align 1
150 ; X32-NEXT: [[TMP16:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP14]])
151 ; X32-NEXT: [[TMP17:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP15]])
152 ; X32-NEXT: [[TMP18]] = zext i16 [[TMP16]] to i32
153 ; X32-NEXT: [[TMP19]] = zext i16 [[TMP17]] to i32
154 ; X32-NEXT: [[TMP20:%.*]] = icmp eq i32 [[TMP18]], [[TMP19]]
155 ; X32-NEXT: br i1 [[TMP20]], label [[ENDBLOCK]], label [[RES_BLOCK]]
157 ; X32-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
158 ; X32-NEXT: ret i32 [[PHI_RES]]
160 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 6)
164 define i32 @cmp7(i8* nocapture readonly %x, i8* nocapture readonly %y) {
166 ; X32-NEXT: br label [[LOADBB:%.*]]
168 ; X32-NEXT: [[PHI_SRC1:%.*]] = phi i32 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP16:%.*]], [[LOADBB1:%.*]] ]
169 ; X32-NEXT: [[PHI_SRC2:%.*]] = phi i32 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP17:%.*]], [[LOADBB1]] ]
170 ; X32-NEXT: [[TMP1:%.*]] = icmp ult i32 [[PHI_SRC1]], [[PHI_SRC2]]
171 ; X32-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
172 ; X32-NEXT: br label [[ENDBLOCK:%.*]]
174 ; X32-NEXT: [[TMP3:%.*]] = bitcast i8* [[X:%.*]] to i32*
175 ; X32-NEXT: [[TMP4:%.*]] = bitcast i8* [[Y:%.*]] to i32*
176 ; X32-NEXT: [[TMP5:%.*]] = load i32, i32* [[TMP3]], align 1
177 ; X32-NEXT: [[TMP6:%.*]] = load i32, i32* [[TMP4]], align 1
178 ; X32-NEXT: [[TMP7]] = call i32 @llvm.bswap.i32(i32 [[TMP5]])
179 ; X32-NEXT: [[TMP8]] = call i32 @llvm.bswap.i32(i32 [[TMP6]])
180 ; X32-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP7]], [[TMP8]]
181 ; X32-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
183 ; X32-NEXT: [[TMP10:%.*]] = getelementptr i8, i8* [[X]], i64 3
184 ; X32-NEXT: [[TMP11:%.*]] = getelementptr i8, i8* [[Y]], i64 3
185 ; X32-NEXT: [[TMP12:%.*]] = bitcast i8* [[TMP10]] to i32*
186 ; X32-NEXT: [[TMP13:%.*]] = bitcast i8* [[TMP11]] to i32*
187 ; X32-NEXT: [[TMP14:%.*]] = load i32, i32* [[TMP12]], align 1
188 ; X32-NEXT: [[TMP15:%.*]] = load i32, i32* [[TMP13]], align 1
189 ; X32-NEXT: [[TMP16]] = call i32 @llvm.bswap.i32(i32 [[TMP14]])
190 ; X32-NEXT: [[TMP17]] = call i32 @llvm.bswap.i32(i32 [[TMP15]])
191 ; X32-NEXT: [[TMP18:%.*]] = icmp eq i32 [[TMP16]], [[TMP17]]
192 ; X32-NEXT: br i1 [[TMP18]], label [[ENDBLOCK]], label [[RES_BLOCK]]
194 ; X32-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
195 ; X32-NEXT: ret i32 [[PHI_RES]]
197 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 7)
201 define i32 @cmp8(i8* nocapture readonly %x, i8* nocapture readonly %y) {
203 ; X32-NEXT: br label [[LOADBB:%.*]]
205 ; X32-NEXT: [[PHI_SRC1:%.*]] = phi i32 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP16:%.*]], [[LOADBB1:%.*]] ]
206 ; X32-NEXT: [[PHI_SRC2:%.*]] = phi i32 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP17:%.*]], [[LOADBB1]] ]
207 ; X32-NEXT: [[TMP1:%.*]] = icmp ult i32 [[PHI_SRC1]], [[PHI_SRC2]]
208 ; X32-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
209 ; X32-NEXT: br label [[ENDBLOCK:%.*]]
211 ; X32-NEXT: [[TMP3:%.*]] = bitcast i8* [[X:%.*]] to i32*
212 ; X32-NEXT: [[TMP4:%.*]] = bitcast i8* [[Y:%.*]] to i32*
213 ; X32-NEXT: [[TMP5:%.*]] = load i32, i32* [[TMP3]], align 1
214 ; X32-NEXT: [[TMP6:%.*]] = load i32, i32* [[TMP4]], align 1
215 ; X32-NEXT: [[TMP7]] = call i32 @llvm.bswap.i32(i32 [[TMP5]])
216 ; X32-NEXT: [[TMP8]] = call i32 @llvm.bswap.i32(i32 [[TMP6]])
217 ; X32-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP7]], [[TMP8]]
218 ; X32-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
220 ; X32-NEXT: [[TMP10:%.*]] = getelementptr i8, i8* [[X]], i64 4
221 ; X32-NEXT: [[TMP11:%.*]] = getelementptr i8, i8* [[Y]], i64 4
222 ; X32-NEXT: [[TMP12:%.*]] = bitcast i8* [[TMP10]] to i32*
223 ; X32-NEXT: [[TMP13:%.*]] = bitcast i8* [[TMP11]] to i32*
224 ; X32-NEXT: [[TMP14:%.*]] = load i32, i32* [[TMP12]], align 1
225 ; X32-NEXT: [[TMP15:%.*]] = load i32, i32* [[TMP13]], align 1
226 ; X32-NEXT: [[TMP16]] = call i32 @llvm.bswap.i32(i32 [[TMP14]])
227 ; X32-NEXT: [[TMP17]] = call i32 @llvm.bswap.i32(i32 [[TMP15]])
228 ; X32-NEXT: [[TMP18:%.*]] = icmp eq i32 [[TMP16]], [[TMP17]]
229 ; X32-NEXT: br i1 [[TMP18]], label [[ENDBLOCK]], label [[RES_BLOCK]]
231 ; X32-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
232 ; X32-NEXT: ret i32 [[PHI_RES]]
234 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 8)
238 define i32 @cmp9(i8* nocapture readonly %x, i8* nocapture readonly %y) {
240 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i32 9)
241 ; X32-NEXT: ret i32 [[CALL]]
243 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 9)
247 define i32 @cmp10(i8* nocapture readonly %x, i8* nocapture readonly %y) {
249 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i32 10)
250 ; X32-NEXT: ret i32 [[CALL]]
252 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 10)
256 define i32 @cmp11(i8* nocapture readonly %x, i8* nocapture readonly %y) {
258 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i32 11)
259 ; X32-NEXT: ret i32 [[CALL]]
261 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 11)
265 define i32 @cmp12(i8* nocapture readonly %x, i8* nocapture readonly %y) {
267 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i32 12)
268 ; X32-NEXT: ret i32 [[CALL]]
270 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 12)
274 define i32 @cmp13(i8* nocapture readonly %x, i8* nocapture readonly %y) {
276 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i32 13)
277 ; X32-NEXT: ret i32 [[CALL]]
279 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 13)
283 define i32 @cmp14(i8* nocapture readonly %x, i8* nocapture readonly %y) {
285 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i32 14)
286 ; X32-NEXT: ret i32 [[CALL]]
288 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 14)
292 define i32 @cmp15(i8* nocapture readonly %x, i8* nocapture readonly %y) {
294 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i32 15)
295 ; X32-NEXT: ret i32 [[CALL]]
297 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 15)
301 define i32 @cmp16(i8* nocapture readonly %x, i8* nocapture readonly %y) {
303 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i32 16)
304 ; X32-NEXT: ret i32 [[CALL]]
306 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 16)
310 define i32 @cmp_eq2(i8* nocapture readonly %x, i8* nocapture readonly %y) {
311 ; X32-LABEL: @cmp_eq2(
312 ; X32-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i16*
313 ; X32-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i16*
314 ; X32-NEXT: [[TMP3:%.*]] = load i16, i16* [[TMP1]], align 1
315 ; X32-NEXT: [[TMP4:%.*]] = load i16, i16* [[TMP2]], align 1
316 ; X32-NEXT: [[TMP5:%.*]] = icmp ne i16 [[TMP3]], [[TMP4]]
317 ; X32-NEXT: [[TMP6:%.*]] = zext i1 [[TMP5]] to i32
318 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP6]], 0
319 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
320 ; X32-NEXT: ret i32 [[CONV]]
322 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 2)
323 %cmp = icmp eq i32 %call, 0
324 %conv = zext i1 %cmp to i32
328 define i32 @cmp_eq3(i8* nocapture readonly %x, i8* nocapture readonly %y) {
329 ; X32-LABEL: @cmp_eq3(
330 ; X32-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i16*
331 ; X32-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i16*
332 ; X32-NEXT: [[TMP3:%.*]] = load i16, i16* [[TMP1]], align 1
333 ; X32-NEXT: [[TMP4:%.*]] = load i16, i16* [[TMP2]], align 1
334 ; X32-NEXT: [[TMP5:%.*]] = xor i16 [[TMP3]], [[TMP4]]
335 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 2
336 ; X32-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 2
337 ; X32-NEXT: [[TMP8:%.*]] = load i8, i8* [[TMP6]], align 1
338 ; X32-NEXT: [[TMP9:%.*]] = load i8, i8* [[TMP7]], align 1
339 ; X32-NEXT: [[TMP10:%.*]] = zext i8 [[TMP8]] to i16
340 ; X32-NEXT: [[TMP11:%.*]] = zext i8 [[TMP9]] to i16
341 ; X32-NEXT: [[TMP12:%.*]] = xor i16 [[TMP10]], [[TMP11]]
342 ; X32-NEXT: [[TMP13:%.*]] = or i16 [[TMP5]], [[TMP12]]
343 ; X32-NEXT: [[TMP14:%.*]] = icmp ne i16 [[TMP13]], 0
344 ; X32-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
345 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
346 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
347 ; X32-NEXT: ret i32 [[CONV]]
349 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 3)
350 %cmp = icmp eq i32 %call, 0
351 %conv = zext i1 %cmp to i32
355 define i32 @cmp_eq4(i8* nocapture readonly %x, i8* nocapture readonly %y) {
356 ; X32-LABEL: @cmp_eq4(
357 ; X32-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
358 ; X32-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
359 ; X32-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]], align 1
360 ; X32-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]], align 1
361 ; X32-NEXT: [[TMP5:%.*]] = icmp ne i32 [[TMP3]], [[TMP4]]
362 ; X32-NEXT: [[TMP6:%.*]] = zext i1 [[TMP5]] to i32
363 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP6]], 0
364 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
365 ; X32-NEXT: ret i32 [[CONV]]
367 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 4)
368 %cmp = icmp eq i32 %call, 0
369 %conv = zext i1 %cmp to i32
373 define i32 @cmp_eq5(i8* nocapture readonly %x, i8* nocapture readonly %y) {
374 ; X32-LABEL: @cmp_eq5(
375 ; X32-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
376 ; X32-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
377 ; X32-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]], align 1
378 ; X32-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]], align 1
379 ; X32-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
380 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 4
381 ; X32-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 4
382 ; X32-NEXT: [[TMP8:%.*]] = load i8, i8* [[TMP6]], align 1
383 ; X32-NEXT: [[TMP9:%.*]] = load i8, i8* [[TMP7]], align 1
384 ; X32-NEXT: [[TMP10:%.*]] = zext i8 [[TMP8]] to i32
385 ; X32-NEXT: [[TMP11:%.*]] = zext i8 [[TMP9]] to i32
386 ; X32-NEXT: [[TMP12:%.*]] = xor i32 [[TMP10]], [[TMP11]]
387 ; X32-NEXT: [[TMP13:%.*]] = or i32 [[TMP5]], [[TMP12]]
388 ; X32-NEXT: [[TMP14:%.*]] = icmp ne i32 [[TMP13]], 0
389 ; X32-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
390 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
391 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
392 ; X32-NEXT: ret i32 [[CONV]]
394 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 5)
395 %cmp = icmp eq i32 %call, 0
396 %conv = zext i1 %cmp to i32
400 define i32 @cmp_eq6(i8* nocapture readonly %x, i8* nocapture readonly %y) {
401 ; X32-LABEL: @cmp_eq6(
402 ; X32-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
403 ; X32-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
404 ; X32-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]], align 1
405 ; X32-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]], align 1
406 ; X32-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
407 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 4
408 ; X32-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 4
409 ; X32-NEXT: [[TMP8:%.*]] = bitcast i8* [[TMP6]] to i16*
410 ; X32-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP7]] to i16*
411 ; X32-NEXT: [[TMP10:%.*]] = load i16, i16* [[TMP8]], align 1
412 ; X32-NEXT: [[TMP11:%.*]] = load i16, i16* [[TMP9]], align 1
413 ; X32-NEXT: [[TMP12:%.*]] = zext i16 [[TMP10]] to i32
414 ; X32-NEXT: [[TMP13:%.*]] = zext i16 [[TMP11]] to i32
415 ; X32-NEXT: [[TMP14:%.*]] = xor i32 [[TMP12]], [[TMP13]]
416 ; X32-NEXT: [[TMP15:%.*]] = or i32 [[TMP5]], [[TMP14]]
417 ; X32-NEXT: [[TMP16:%.*]] = icmp ne i32 [[TMP15]], 0
418 ; X32-NEXT: [[TMP17:%.*]] = zext i1 [[TMP16]] to i32
419 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP17]], 0
420 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
421 ; X32-NEXT: ret i32 [[CONV]]
423 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 6)
424 %cmp = icmp eq i32 %call, 0
425 %conv = zext i1 %cmp to i32
429 define i32 @cmp_eq6_align4(i8* nocapture readonly align 4 %x, i8* nocapture readonly align 4 %y) {
430 ; X32-LABEL: @cmp_eq6_align4(
431 ; X32-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
432 ; X32-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
433 ; X32-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]], align 4
434 ; X32-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]], align 4
435 ; X32-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
436 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 4
437 ; X32-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 4
438 ; X32-NEXT: [[TMP8:%.*]] = bitcast i8* [[TMP6]] to i16*
439 ; X32-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP7]] to i16*
440 ; X32-NEXT: [[TMP10:%.*]] = load i16, i16* [[TMP8]], align 4
441 ; X32-NEXT: [[TMP11:%.*]] = load i16, i16* [[TMP9]], align 4
442 ; X32-NEXT: [[TMP12:%.*]] = zext i16 [[TMP10]] to i32
443 ; X32-NEXT: [[TMP13:%.*]] = zext i16 [[TMP11]] to i32
444 ; X32-NEXT: [[TMP14:%.*]] = xor i32 [[TMP12]], [[TMP13]]
445 ; X32-NEXT: [[TMP15:%.*]] = or i32 [[TMP5]], [[TMP14]]
446 ; X32-NEXT: [[TMP16:%.*]] = icmp ne i32 [[TMP15]], 0
447 ; X32-NEXT: [[TMP17:%.*]] = zext i1 [[TMP16]] to i32
448 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP17]], 0
449 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
450 ; X32-NEXT: ret i32 [[CONV]]
452 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 6)
453 %cmp = icmp eq i32 %call, 0
454 %conv = zext i1 %cmp to i32
458 define i32 @cmp_eq7(i8* nocapture readonly %x, i8* nocapture readonly %y) {
459 ; X32-LABEL: @cmp_eq7(
460 ; X32-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
461 ; X32-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
462 ; X32-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]], align 1
463 ; X32-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]], align 1
464 ; X32-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
465 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 3
466 ; X32-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 3
467 ; X32-NEXT: [[TMP8:%.*]] = bitcast i8* [[TMP6]] to i32*
468 ; X32-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP7]] to i32*
469 ; X32-NEXT: [[TMP10:%.*]] = load i32, i32* [[TMP8]], align 1
470 ; X32-NEXT: [[TMP11:%.*]] = load i32, i32* [[TMP9]], align 1
471 ; X32-NEXT: [[TMP12:%.*]] = xor i32 [[TMP10]], [[TMP11]]
472 ; X32-NEXT: [[TMP13:%.*]] = or i32 [[TMP5]], [[TMP12]]
473 ; X32-NEXT: [[TMP14:%.*]] = icmp ne i32 [[TMP13]], 0
474 ; X32-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
475 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
476 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
477 ; X32-NEXT: ret i32 [[CONV]]
479 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 7)
480 %cmp = icmp eq i32 %call, 0
481 %conv = zext i1 %cmp to i32
485 define i32 @cmp_eq8(i8* nocapture readonly %x, i8* nocapture readonly %y) {
486 ; X32-LABEL: @cmp_eq8(
487 ; X32-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
488 ; X32-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
489 ; X32-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]], align 1
490 ; X32-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]], align 1
491 ; X32-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
492 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 4
493 ; X32-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 4
494 ; X32-NEXT: [[TMP8:%.*]] = bitcast i8* [[TMP6]] to i32*
495 ; X32-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP7]] to i32*
496 ; X32-NEXT: [[TMP10:%.*]] = load i32, i32* [[TMP8]], align 1
497 ; X32-NEXT: [[TMP11:%.*]] = load i32, i32* [[TMP9]], align 1
498 ; X32-NEXT: [[TMP12:%.*]] = xor i32 [[TMP10]], [[TMP11]]
499 ; X32-NEXT: [[TMP13:%.*]] = or i32 [[TMP5]], [[TMP12]]
500 ; X32-NEXT: [[TMP14:%.*]] = icmp ne i32 [[TMP13]], 0
501 ; X32-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
502 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
503 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
504 ; X32-NEXT: ret i32 [[CONV]]
506 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 8)
507 %cmp = icmp eq i32 %call, 0
508 %conv = zext i1 %cmp to i32
512 define i32 @cmp_eq9(i8* nocapture readonly %x, i8* nocapture readonly %y) {
513 ; X32-LABEL: @cmp_eq9(
514 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i32 9)
515 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
516 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
517 ; X32-NEXT: ret i32 [[CONV]]
519 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 9)
520 %cmp = icmp eq i32 %call, 0
521 %conv = zext i1 %cmp to i32
525 define i32 @cmp_eq10(i8* nocapture readonly %x, i8* nocapture readonly %y) {
526 ; X32-LABEL: @cmp_eq10(
527 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i32 10)
528 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
529 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
530 ; X32-NEXT: ret i32 [[CONV]]
532 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 10)
533 %cmp = icmp eq i32 %call, 0
534 %conv = zext i1 %cmp to i32
538 define i32 @cmp_eq11(i8* nocapture readonly %x, i8* nocapture readonly %y) {
539 ; X32-LABEL: @cmp_eq11(
540 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i32 11)
541 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
542 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
543 ; X32-NEXT: ret i32 [[CONV]]
545 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 11)
546 %cmp = icmp eq i32 %call, 0
547 %conv = zext i1 %cmp to i32
551 define i32 @cmp_eq12(i8* nocapture readonly %x, i8* nocapture readonly %y) {
552 ; X32-LABEL: @cmp_eq12(
553 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i32 12)
554 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
555 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
556 ; X32-NEXT: ret i32 [[CONV]]
558 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 12)
559 %cmp = icmp eq i32 %call, 0
560 %conv = zext i1 %cmp to i32
564 define i32 @cmp_eq13(i8* nocapture readonly %x, i8* nocapture readonly %y) {
565 ; X32-LABEL: @cmp_eq13(
566 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i32 13)
567 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
568 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
569 ; X32-NEXT: ret i32 [[CONV]]
571 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 13)
572 %cmp = icmp eq i32 %call, 0
573 %conv = zext i1 %cmp to i32
577 define i32 @cmp_eq14(i8* nocapture readonly %x, i8* nocapture readonly %y) {
578 ; X32-LABEL: @cmp_eq14(
579 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i32 14)
580 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
581 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
582 ; X32-NEXT: ret i32 [[CONV]]
584 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 14)
585 %cmp = icmp eq i32 %call, 0
586 %conv = zext i1 %cmp to i32
590 define i32 @cmp_eq15(i8* nocapture readonly %x, i8* nocapture readonly %y) {
591 ; X32-LABEL: @cmp_eq15(
592 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i32 15)
593 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
594 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
595 ; X32-NEXT: ret i32 [[CONV]]
597 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 15)
598 %cmp = icmp eq i32 %call, 0
599 %conv = zext i1 %cmp to i32
603 define i32 @cmp_eq16(i8* nocapture readonly %x, i8* nocapture readonly %y) {
604 ; X32-LABEL: @cmp_eq16(
605 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i32 16)
606 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
607 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
608 ; X32-NEXT: ret i32 [[CONV]]
610 %call = tail call i32 @memcmp(i8* %x, i8* %y, i32 16)
611 %cmp = icmp eq i32 %call, 0
612 %conv = zext i1 %cmp to i32