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=ALL --check-prefix=X32
3 ; RUN: opt -S -expandmemcmp -memcmp-num-loads-per-block=1 -mtriple=x86_64-unknown-unknown -data-layout=e-m:o-i64:64-f80:128-n8:16:32:64-S128 < %s | FileCheck %s --check-prefix=ALL --check-prefix=X64 --check-prefix=X64_1LD
4 ; RUN: opt -S -expandmemcmp -memcmp-num-loads-per-block=2 -mtriple=x86_64-unknown-unknown -data-layout=e-m:o-i64:64-f80:128-n8:16:32:64-S128 < %s | FileCheck %s --check-prefix=ALL --check-prefix=X64 --check-prefix=X64_2LD
6 declare i32 @memcmp(i8* nocapture, i8* nocapture, i64)
8 define i32 @cmp2(i8* nocapture readonly %x, i8* nocapture readonly %y) {
10 ; ALL-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i16*
11 ; ALL-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i16*
12 ; ALL-NEXT: [[TMP3:%.*]] = load i16, i16* [[TMP1]]
13 ; ALL-NEXT: [[TMP4:%.*]] = load i16, i16* [[TMP2]]
14 ; ALL-NEXT: [[TMP5:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP3]])
15 ; ALL-NEXT: [[TMP6:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP4]])
16 ; ALL-NEXT: [[TMP7:%.*]] = zext i16 [[TMP5]] to i32
17 ; ALL-NEXT: [[TMP8:%.*]] = zext i16 [[TMP6]] to i32
18 ; ALL-NEXT: [[TMP9:%.*]] = sub i32 [[TMP7]], [[TMP8]]
19 ; ALL-NEXT: ret i32 [[TMP9]]
21 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 2)
25 define i32 @cmp3(i8* nocapture readonly %x, i8* nocapture readonly %y) {
27 ; ALL-NEXT: br label [[LOADBB:%.*]]
29 ; ALL-NEXT: [[PHI_SRC1:%.*]] = phi i16 [ [[TMP7:%.*]], [[LOADBB]] ]
30 ; ALL-NEXT: [[PHI_SRC2:%.*]] = phi i16 [ [[TMP8:%.*]], [[LOADBB]] ]
31 ; ALL-NEXT: [[TMP1:%.*]] = icmp ult i16 [[PHI_SRC1]], [[PHI_SRC2]]
32 ; ALL-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
33 ; ALL-NEXT: br label [[ENDBLOCK:%.*]]
35 ; ALL-NEXT: [[TMP3:%.*]] = bitcast i8* [[X:%.*]] to i16*
36 ; ALL-NEXT: [[TMP4:%.*]] = bitcast i8* [[Y:%.*]] to i16*
37 ; ALL-NEXT: [[TMP5:%.*]] = load i16, i16* [[TMP3]]
38 ; ALL-NEXT: [[TMP6:%.*]] = load i16, i16* [[TMP4]]
39 ; ALL-NEXT: [[TMP7]] = call i16 @llvm.bswap.i16(i16 [[TMP5]])
40 ; ALL-NEXT: [[TMP8]] = call i16 @llvm.bswap.i16(i16 [[TMP6]])
41 ; ALL-NEXT: [[TMP9:%.*]] = icmp eq i16 [[TMP7]], [[TMP8]]
42 ; ALL-NEXT: br i1 [[TMP9]], label [[LOADBB1:%.*]], label [[RES_BLOCK:%.*]]
44 ; ALL-NEXT: [[TMP10:%.*]] = getelementptr i8, i8* [[X]], i8 2
45 ; ALL-NEXT: [[TMP11:%.*]] = getelementptr i8, i8* [[Y]], i8 2
46 ; ALL-NEXT: [[TMP12:%.*]] = load i8, i8* [[TMP10]]
47 ; ALL-NEXT: [[TMP13:%.*]] = load i8, i8* [[TMP11]]
48 ; ALL-NEXT: [[TMP14:%.*]] = zext i8 [[TMP12]] to i32
49 ; ALL-NEXT: [[TMP15:%.*]] = zext i8 [[TMP13]] to i32
50 ; ALL-NEXT: [[TMP16:%.*]] = sub i32 [[TMP14]], [[TMP15]]
51 ; ALL-NEXT: br label [[ENDBLOCK]]
53 ; ALL-NEXT: [[PHI_RES:%.*]] = phi i32 [ [[TMP16]], [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
54 ; ALL-NEXT: ret i32 [[PHI_RES]]
56 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 3)
60 define i32 @cmp4(i8* nocapture readonly %x, i8* nocapture readonly %y) {
62 ; ALL-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
63 ; ALL-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
64 ; ALL-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]]
65 ; ALL-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]]
66 ; ALL-NEXT: [[TMP5:%.*]] = call i32 @llvm.bswap.i32(i32 [[TMP3]])
67 ; ALL-NEXT: [[TMP6:%.*]] = call i32 @llvm.bswap.i32(i32 [[TMP4]])
68 ; ALL-NEXT: [[TMP7:%.*]] = icmp ugt i32 [[TMP5]], [[TMP6]]
69 ; ALL-NEXT: [[TMP8:%.*]] = icmp ult i32 [[TMP5]], [[TMP6]]
70 ; ALL-NEXT: [[TMP9:%.*]] = zext i1 [[TMP7]] to i32
71 ; ALL-NEXT: [[TMP10:%.*]] = zext i1 [[TMP8]] to i32
72 ; ALL-NEXT: [[TMP11:%.*]] = sub i32 [[TMP9]], [[TMP10]]
73 ; ALL-NEXT: ret i32 [[TMP11]]
75 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 4)
79 define i32 @cmp5(i8* nocapture readonly %x, i8* nocapture readonly %y) {
81 ; ALL-NEXT: br label [[LOADBB:%.*]]
83 ; ALL-NEXT: [[PHI_SRC1:%.*]] = phi i32 [ [[TMP7:%.*]], [[LOADBB]] ]
84 ; ALL-NEXT: [[PHI_SRC2:%.*]] = phi i32 [ [[TMP8:%.*]], [[LOADBB]] ]
85 ; ALL-NEXT: [[TMP1:%.*]] = icmp ult i32 [[PHI_SRC1]], [[PHI_SRC2]]
86 ; ALL-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
87 ; ALL-NEXT: br label [[ENDBLOCK:%.*]]
89 ; ALL-NEXT: [[TMP3:%.*]] = bitcast i8* [[X:%.*]] to i32*
90 ; ALL-NEXT: [[TMP4:%.*]] = bitcast i8* [[Y:%.*]] to i32*
91 ; ALL-NEXT: [[TMP5:%.*]] = load i32, i32* [[TMP3]]
92 ; ALL-NEXT: [[TMP6:%.*]] = load i32, i32* [[TMP4]]
93 ; ALL-NEXT: [[TMP7]] = call i32 @llvm.bswap.i32(i32 [[TMP5]])
94 ; ALL-NEXT: [[TMP8]] = call i32 @llvm.bswap.i32(i32 [[TMP6]])
95 ; ALL-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP7]], [[TMP8]]
96 ; ALL-NEXT: br i1 [[TMP9]], label [[LOADBB1:%.*]], label [[RES_BLOCK:%.*]]
98 ; ALL-NEXT: [[TMP10:%.*]] = getelementptr i8, i8* [[X]], i8 4
99 ; ALL-NEXT: [[TMP11:%.*]] = getelementptr i8, i8* [[Y]], i8 4
100 ; ALL-NEXT: [[TMP12:%.*]] = load i8, i8* [[TMP10]]
101 ; ALL-NEXT: [[TMP13:%.*]] = load i8, i8* [[TMP11]]
102 ; ALL-NEXT: [[TMP14:%.*]] = zext i8 [[TMP12]] to i32
103 ; ALL-NEXT: [[TMP15:%.*]] = zext i8 [[TMP13]] to i32
104 ; ALL-NEXT: [[TMP16:%.*]] = sub i32 [[TMP14]], [[TMP15]]
105 ; ALL-NEXT: br label [[ENDBLOCK]]
107 ; ALL-NEXT: [[PHI_RES:%.*]] = phi i32 [ [[TMP16]], [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
108 ; ALL-NEXT: ret i32 [[PHI_RES]]
110 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 5)
114 define i32 @cmp6(i8* nocapture readonly %x, i8* nocapture readonly %y) {
116 ; ALL-NEXT: br label [[LOADBB:%.*]]
118 ; ALL-NEXT: [[PHI_SRC1:%.*]] = phi i32 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP18:%.*]], [[LOADBB1:%.*]] ]
119 ; ALL-NEXT: [[PHI_SRC2:%.*]] = phi i32 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP19:%.*]], [[LOADBB1]] ]
120 ; ALL-NEXT: [[TMP1:%.*]] = icmp ult i32 [[PHI_SRC1]], [[PHI_SRC2]]
121 ; ALL-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
122 ; ALL-NEXT: br label [[ENDBLOCK:%.*]]
124 ; ALL-NEXT: [[TMP3:%.*]] = bitcast i8* [[X:%.*]] to i32*
125 ; ALL-NEXT: [[TMP4:%.*]] = bitcast i8* [[Y:%.*]] to i32*
126 ; ALL-NEXT: [[TMP5:%.*]] = load i32, i32* [[TMP3]]
127 ; ALL-NEXT: [[TMP6:%.*]] = load i32, i32* [[TMP4]]
128 ; ALL-NEXT: [[TMP7]] = call i32 @llvm.bswap.i32(i32 [[TMP5]])
129 ; ALL-NEXT: [[TMP8]] = call i32 @llvm.bswap.i32(i32 [[TMP6]])
130 ; ALL-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP7]], [[TMP8]]
131 ; ALL-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
133 ; ALL-NEXT: [[TMP10:%.*]] = getelementptr i8, i8* [[X]], i8 4
134 ; ALL-NEXT: [[TMP11:%.*]] = bitcast i8* [[TMP10]] to i16*
135 ; ALL-NEXT: [[TMP12:%.*]] = getelementptr i8, i8* [[Y]], i8 4
136 ; ALL-NEXT: [[TMP13:%.*]] = bitcast i8* [[TMP12]] to i16*
137 ; ALL-NEXT: [[TMP14:%.*]] = load i16, i16* [[TMP11]]
138 ; ALL-NEXT: [[TMP15:%.*]] = load i16, i16* [[TMP13]]
139 ; ALL-NEXT: [[TMP16:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP14]])
140 ; ALL-NEXT: [[TMP17:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP15]])
141 ; ALL-NEXT: [[TMP18]] = zext i16 [[TMP16]] to i32
142 ; ALL-NEXT: [[TMP19]] = zext i16 [[TMP17]] to i32
143 ; ALL-NEXT: [[TMP20:%.*]] = icmp eq i32 [[TMP18]], [[TMP19]]
144 ; ALL-NEXT: br i1 [[TMP20]], label [[ENDBLOCK]], label [[RES_BLOCK]]
146 ; ALL-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
147 ; ALL-NEXT: ret i32 [[PHI_RES]]
149 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 6)
153 define i32 @cmp7(i8* nocapture readonly %x, i8* nocapture readonly %y) {
155 ; ALL-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i64 7)
156 ; ALL-NEXT: ret i32 [[CALL]]
158 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 7)
162 define i32 @cmp8(i8* nocapture readonly %x, i8* nocapture readonly %y) {
164 ; X32-NEXT: br label [[LOADBB:%.*]]
166 ; X32-NEXT: [[PHI_SRC1:%.*]] = phi i32 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP16:%.*]], [[LOADBB1:%.*]] ]
167 ; X32-NEXT: [[PHI_SRC2:%.*]] = phi i32 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP17:%.*]], [[LOADBB1]] ]
168 ; X32-NEXT: [[TMP1:%.*]] = icmp ult i32 [[PHI_SRC1]], [[PHI_SRC2]]
169 ; X32-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
170 ; X32-NEXT: br label [[ENDBLOCK:%.*]]
172 ; X32-NEXT: [[TMP3:%.*]] = bitcast i8* [[X:%.*]] to i32*
173 ; X32-NEXT: [[TMP4:%.*]] = bitcast i8* [[Y:%.*]] to i32*
174 ; X32-NEXT: [[TMP5:%.*]] = load i32, i32* [[TMP3]]
175 ; X32-NEXT: [[TMP6:%.*]] = load i32, i32* [[TMP4]]
176 ; X32-NEXT: [[TMP7]] = call i32 @llvm.bswap.i32(i32 [[TMP5]])
177 ; X32-NEXT: [[TMP8]] = call i32 @llvm.bswap.i32(i32 [[TMP6]])
178 ; X32-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP7]], [[TMP8]]
179 ; X32-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
181 ; X32-NEXT: [[TMP10:%.*]] = getelementptr i8, i8* [[X]], i8 4
182 ; X32-NEXT: [[TMP11:%.*]] = bitcast i8* [[TMP10]] to i32*
183 ; X32-NEXT: [[TMP12:%.*]] = getelementptr i8, i8* [[Y]], i8 4
184 ; X32-NEXT: [[TMP13:%.*]] = bitcast i8* [[TMP12]] to i32*
185 ; X32-NEXT: [[TMP14:%.*]] = load i32, i32* [[TMP11]]
186 ; X32-NEXT: [[TMP15:%.*]] = load i32, i32* [[TMP13]]
187 ; X32-NEXT: [[TMP16]] = call i32 @llvm.bswap.i32(i32 [[TMP14]])
188 ; X32-NEXT: [[TMP17]] = call i32 @llvm.bswap.i32(i32 [[TMP15]])
189 ; X32-NEXT: [[TMP18:%.*]] = icmp eq i32 [[TMP16]], [[TMP17]]
190 ; X32-NEXT: br i1 [[TMP18]], label [[ENDBLOCK]], label [[RES_BLOCK]]
192 ; X32-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
193 ; X32-NEXT: ret i32 [[PHI_RES]]
196 ; X64-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
197 ; X64-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
198 ; X64-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]]
199 ; X64-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]]
200 ; X64-NEXT: [[TMP5:%.*]] = call i64 @llvm.bswap.i64(i64 [[TMP3]])
201 ; X64-NEXT: [[TMP6:%.*]] = call i64 @llvm.bswap.i64(i64 [[TMP4]])
202 ; X64-NEXT: [[TMP7:%.*]] = icmp ugt i64 [[TMP5]], [[TMP6]]
203 ; X64-NEXT: [[TMP8:%.*]] = icmp ult i64 [[TMP5]], [[TMP6]]
204 ; X64-NEXT: [[TMP9:%.*]] = zext i1 [[TMP7]] to i32
205 ; X64-NEXT: [[TMP10:%.*]] = zext i1 [[TMP8]] to i32
206 ; X64-NEXT: [[TMP11:%.*]] = sub i32 [[TMP9]], [[TMP10]]
207 ; X64-NEXT: ret i32 [[TMP11]]
209 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 8)
213 define i32 @cmp9(i8* nocapture readonly %x, i8* nocapture readonly %y) {
215 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i64 9)
216 ; X32-NEXT: ret i32 [[CALL]]
219 ; X64-NEXT: br label [[LOADBB:%.*]]
221 ; X64-NEXT: [[PHI_SRC1:%.*]] = phi i64 [ [[TMP7:%.*]], [[LOADBB]] ]
222 ; X64-NEXT: [[PHI_SRC2:%.*]] = phi i64 [ [[TMP8:%.*]], [[LOADBB]] ]
223 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i64 [[PHI_SRC1]], [[PHI_SRC2]]
224 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
225 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
227 ; X64-NEXT: [[TMP3:%.*]] = bitcast i8* [[X:%.*]] to i64*
228 ; X64-NEXT: [[TMP4:%.*]] = bitcast i8* [[Y:%.*]] to i64*
229 ; X64-NEXT: [[TMP5:%.*]] = load i64, i64* [[TMP3]]
230 ; X64-NEXT: [[TMP6:%.*]] = load i64, i64* [[TMP4]]
231 ; X64-NEXT: [[TMP7]] = call i64 @llvm.bswap.i64(i64 [[TMP5]])
232 ; X64-NEXT: [[TMP8]] = call i64 @llvm.bswap.i64(i64 [[TMP6]])
233 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i64 [[TMP7]], [[TMP8]]
234 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1:%.*]], label [[RES_BLOCK:%.*]]
236 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, i8* [[X]], i8 8
237 ; X64-NEXT: [[TMP11:%.*]] = getelementptr i8, i8* [[Y]], i8 8
238 ; X64-NEXT: [[TMP12:%.*]] = load i8, i8* [[TMP10]]
239 ; X64-NEXT: [[TMP13:%.*]] = load i8, i8* [[TMP11]]
240 ; X64-NEXT: [[TMP14:%.*]] = zext i8 [[TMP12]] to i32
241 ; X64-NEXT: [[TMP15:%.*]] = zext i8 [[TMP13]] to i32
242 ; X64-NEXT: [[TMP16:%.*]] = sub i32 [[TMP14]], [[TMP15]]
243 ; X64-NEXT: br label [[ENDBLOCK]]
245 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ [[TMP16]], [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
246 ; X64-NEXT: ret i32 [[PHI_RES]]
248 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 9)
252 define i32 @cmp10(i8* nocapture readonly %x, i8* nocapture readonly %y) {
254 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i64 10)
255 ; X32-NEXT: ret i32 [[CALL]]
258 ; X64-NEXT: br label [[LOADBB:%.*]]
260 ; X64-NEXT: [[PHI_SRC1:%.*]] = phi i64 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP18:%.*]], [[LOADBB1:%.*]] ]
261 ; X64-NEXT: [[PHI_SRC2:%.*]] = phi i64 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP19:%.*]], [[LOADBB1]] ]
262 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i64 [[PHI_SRC1]], [[PHI_SRC2]]
263 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
264 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
266 ; X64-NEXT: [[TMP3:%.*]] = bitcast i8* [[X:%.*]] to i64*
267 ; X64-NEXT: [[TMP4:%.*]] = bitcast i8* [[Y:%.*]] to i64*
268 ; X64-NEXT: [[TMP5:%.*]] = load i64, i64* [[TMP3]]
269 ; X64-NEXT: [[TMP6:%.*]] = load i64, i64* [[TMP4]]
270 ; X64-NEXT: [[TMP7]] = call i64 @llvm.bswap.i64(i64 [[TMP5]])
271 ; X64-NEXT: [[TMP8]] = call i64 @llvm.bswap.i64(i64 [[TMP6]])
272 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i64 [[TMP7]], [[TMP8]]
273 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
275 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, i8* [[X]], i8 8
276 ; X64-NEXT: [[TMP11:%.*]] = bitcast i8* [[TMP10]] to i16*
277 ; X64-NEXT: [[TMP12:%.*]] = getelementptr i8, i8* [[Y]], i8 8
278 ; X64-NEXT: [[TMP13:%.*]] = bitcast i8* [[TMP12]] to i16*
279 ; X64-NEXT: [[TMP14:%.*]] = load i16, i16* [[TMP11]]
280 ; X64-NEXT: [[TMP15:%.*]] = load i16, i16* [[TMP13]]
281 ; X64-NEXT: [[TMP16:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP14]])
282 ; X64-NEXT: [[TMP17:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP15]])
283 ; X64-NEXT: [[TMP18]] = zext i16 [[TMP16]] to i64
284 ; X64-NEXT: [[TMP19]] = zext i16 [[TMP17]] to i64
285 ; X64-NEXT: [[TMP20:%.*]] = icmp eq i64 [[TMP18]], [[TMP19]]
286 ; X64-NEXT: br i1 [[TMP20]], label [[ENDBLOCK]], label [[RES_BLOCK]]
288 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
289 ; X64-NEXT: ret i32 [[PHI_RES]]
291 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 10)
295 define i32 @cmp11(i8* nocapture readonly %x, i8* nocapture readonly %y) {
297 ; ALL-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i64 11)
298 ; ALL-NEXT: ret i32 [[CALL]]
300 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 11)
304 define i32 @cmp12(i8* nocapture readonly %x, i8* nocapture readonly %y) {
306 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i64 12)
307 ; X32-NEXT: ret i32 [[CALL]]
310 ; X64-NEXT: br label [[LOADBB:%.*]]
312 ; X64-NEXT: [[PHI_SRC1:%.*]] = phi i64 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP18:%.*]], [[LOADBB1:%.*]] ]
313 ; X64-NEXT: [[PHI_SRC2:%.*]] = phi i64 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP19:%.*]], [[LOADBB1]] ]
314 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i64 [[PHI_SRC1]], [[PHI_SRC2]]
315 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
316 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
318 ; X64-NEXT: [[TMP3:%.*]] = bitcast i8* [[X:%.*]] to i64*
319 ; X64-NEXT: [[TMP4:%.*]] = bitcast i8* [[Y:%.*]] to i64*
320 ; X64-NEXT: [[TMP5:%.*]] = load i64, i64* [[TMP3]]
321 ; X64-NEXT: [[TMP6:%.*]] = load i64, i64* [[TMP4]]
322 ; X64-NEXT: [[TMP7]] = call i64 @llvm.bswap.i64(i64 [[TMP5]])
323 ; X64-NEXT: [[TMP8]] = call i64 @llvm.bswap.i64(i64 [[TMP6]])
324 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i64 [[TMP7]], [[TMP8]]
325 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
327 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, i8* [[X]], i8 8
328 ; X64-NEXT: [[TMP11:%.*]] = bitcast i8* [[TMP10]] to i32*
329 ; X64-NEXT: [[TMP12:%.*]] = getelementptr i8, i8* [[Y]], i8 8
330 ; X64-NEXT: [[TMP13:%.*]] = bitcast i8* [[TMP12]] to i32*
331 ; X64-NEXT: [[TMP14:%.*]] = load i32, i32* [[TMP11]]
332 ; X64-NEXT: [[TMP15:%.*]] = load i32, i32* [[TMP13]]
333 ; X64-NEXT: [[TMP16:%.*]] = call i32 @llvm.bswap.i32(i32 [[TMP14]])
334 ; X64-NEXT: [[TMP17:%.*]] = call i32 @llvm.bswap.i32(i32 [[TMP15]])
335 ; X64-NEXT: [[TMP18]] = zext i32 [[TMP16]] to i64
336 ; X64-NEXT: [[TMP19]] = zext i32 [[TMP17]] to i64
337 ; X64-NEXT: [[TMP20:%.*]] = icmp eq i64 [[TMP18]], [[TMP19]]
338 ; X64-NEXT: br i1 [[TMP20]], label [[ENDBLOCK]], label [[RES_BLOCK]]
340 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
341 ; X64-NEXT: ret i32 [[PHI_RES]]
343 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 12)
347 define i32 @cmp13(i8* nocapture readonly %x, i8* nocapture readonly %y) {
349 ; ALL-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i64 13)
350 ; ALL-NEXT: ret i32 [[CALL]]
352 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 13)
356 define i32 @cmp14(i8* nocapture readonly %x, i8* nocapture readonly %y) {
358 ; ALL-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i64 14)
359 ; ALL-NEXT: ret i32 [[CALL]]
361 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 14)
365 define i32 @cmp15(i8* nocapture readonly %x, i8* nocapture readonly %y) {
367 ; ALL-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i64 15)
368 ; ALL-NEXT: ret i32 [[CALL]]
370 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 15)
374 define i32 @cmp16(i8* nocapture readonly %x, i8* nocapture readonly %y) {
376 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i64 16)
377 ; X32-NEXT: ret i32 [[CALL]]
380 ; X64-NEXT: br label [[LOADBB:%.*]]
382 ; X64-NEXT: [[PHI_SRC1:%.*]] = phi i64 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP16:%.*]], [[LOADBB1:%.*]] ]
383 ; X64-NEXT: [[PHI_SRC2:%.*]] = phi i64 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP17:%.*]], [[LOADBB1]] ]
384 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i64 [[PHI_SRC1]], [[PHI_SRC2]]
385 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
386 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
388 ; X64-NEXT: [[TMP3:%.*]] = bitcast i8* [[X:%.*]] to i64*
389 ; X64-NEXT: [[TMP4:%.*]] = bitcast i8* [[Y:%.*]] to i64*
390 ; X64-NEXT: [[TMP5:%.*]] = load i64, i64* [[TMP3]]
391 ; X64-NEXT: [[TMP6:%.*]] = load i64, i64* [[TMP4]]
392 ; X64-NEXT: [[TMP7]] = call i64 @llvm.bswap.i64(i64 [[TMP5]])
393 ; X64-NEXT: [[TMP8]] = call i64 @llvm.bswap.i64(i64 [[TMP6]])
394 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i64 [[TMP7]], [[TMP8]]
395 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
397 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, i8* [[X]], i8 8
398 ; X64-NEXT: [[TMP11:%.*]] = bitcast i8* [[TMP10]] to i64*
399 ; X64-NEXT: [[TMP12:%.*]] = getelementptr i8, i8* [[Y]], i8 8
400 ; X64-NEXT: [[TMP13:%.*]] = bitcast i8* [[TMP12]] to i64*
401 ; X64-NEXT: [[TMP14:%.*]] = load i64, i64* [[TMP11]]
402 ; X64-NEXT: [[TMP15:%.*]] = load i64, i64* [[TMP13]]
403 ; X64-NEXT: [[TMP16]] = call i64 @llvm.bswap.i64(i64 [[TMP14]])
404 ; X64-NEXT: [[TMP17]] = call i64 @llvm.bswap.i64(i64 [[TMP15]])
405 ; X64-NEXT: [[TMP18:%.*]] = icmp eq i64 [[TMP16]], [[TMP17]]
406 ; X64-NEXT: br i1 [[TMP18]], label [[ENDBLOCK]], label [[RES_BLOCK]]
408 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
409 ; X64-NEXT: ret i32 [[PHI_RES]]
411 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 16)
415 define i32 @cmp_eq2(i8* nocapture readonly %x, i8* nocapture readonly %y) {
416 ; ALL-LABEL: @cmp_eq2(
417 ; ALL-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i16*
418 ; ALL-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i16*
419 ; ALL-NEXT: [[TMP3:%.*]] = load i16, i16* [[TMP1]]
420 ; ALL-NEXT: [[TMP4:%.*]] = load i16, i16* [[TMP2]]
421 ; ALL-NEXT: [[TMP5:%.*]] = icmp ne i16 [[TMP3]], [[TMP4]]
422 ; ALL-NEXT: [[TMP6:%.*]] = zext i1 [[TMP5]] to i32
423 ; ALL-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP6]], 0
424 ; ALL-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
425 ; ALL-NEXT: ret i32 [[CONV]]
427 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 2)
428 %cmp = icmp eq i32 %call, 0
429 %conv = zext i1 %cmp to i32
433 define i32 @cmp_eq3(i8* nocapture readonly %x, i8* nocapture readonly %y) {
434 ; X32-LABEL: @cmp_eq3(
435 ; X32-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i16*
436 ; X32-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i16*
437 ; X32-NEXT: [[TMP3:%.*]] = load i16, i16* [[TMP1]]
438 ; X32-NEXT: [[TMP4:%.*]] = load i16, i16* [[TMP2]]
439 ; X32-NEXT: [[TMP5:%.*]] = xor i16 [[TMP3]], [[TMP4]]
440 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 2
441 ; X32-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i8 2
442 ; X32-NEXT: [[TMP8:%.*]] = load i8, i8* [[TMP6]]
443 ; X32-NEXT: [[TMP9:%.*]] = load i8, i8* [[TMP7]]
444 ; X32-NEXT: [[TMP10:%.*]] = zext i8 [[TMP8]] to i16
445 ; X32-NEXT: [[TMP11:%.*]] = zext i8 [[TMP9]] to i16
446 ; X32-NEXT: [[TMP12:%.*]] = xor i16 [[TMP10]], [[TMP11]]
447 ; X32-NEXT: [[TMP13:%.*]] = or i16 [[TMP5]], [[TMP12]]
448 ; X32-NEXT: [[TMP14:%.*]] = icmp ne i16 [[TMP13]], 0
449 ; X32-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
450 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
451 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
452 ; X32-NEXT: ret i32 [[CONV]]
454 ; X64_1LD-LABEL: @cmp_eq3(
455 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
456 ; X64_1LD: res_block:
457 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
459 ; X64_1LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i16*
460 ; X64_1LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i16*
461 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i16, i16* [[TMP1]]
462 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i16, i16* [[TMP2]]
463 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i16 [[TMP3]], [[TMP4]]
464 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
466 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 2
467 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i8 2
468 ; X64_1LD-NEXT: [[TMP8:%.*]] = load i8, i8* [[TMP6]]
469 ; X64_1LD-NEXT: [[TMP9:%.*]] = load i8, i8* [[TMP7]]
470 ; X64_1LD-NEXT: [[TMP10:%.*]] = icmp ne i8 [[TMP8]], [[TMP9]]
471 ; X64_1LD-NEXT: br i1 [[TMP10]], label [[RES_BLOCK]], label [[ENDBLOCK]]
473 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
474 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
475 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
476 ; X64_1LD-NEXT: ret i32 [[CONV]]
478 ; X64_2LD-LABEL: @cmp_eq3(
479 ; X64_2LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i16*
480 ; X64_2LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i16*
481 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i16, i16* [[TMP1]]
482 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i16, i16* [[TMP2]]
483 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i16 [[TMP3]], [[TMP4]]
484 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 2
485 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i8 2
486 ; X64_2LD-NEXT: [[TMP8:%.*]] = load i8, i8* [[TMP6]]
487 ; X64_2LD-NEXT: [[TMP9:%.*]] = load i8, i8* [[TMP7]]
488 ; X64_2LD-NEXT: [[TMP10:%.*]] = zext i8 [[TMP8]] to i16
489 ; X64_2LD-NEXT: [[TMP11:%.*]] = zext i8 [[TMP9]] to i16
490 ; X64_2LD-NEXT: [[TMP12:%.*]] = xor i16 [[TMP10]], [[TMP11]]
491 ; X64_2LD-NEXT: [[TMP13:%.*]] = or i16 [[TMP5]], [[TMP12]]
492 ; X64_2LD-NEXT: [[TMP14:%.*]] = icmp ne i16 [[TMP13]], 0
493 ; X64_2LD-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
494 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
495 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
496 ; X64_2LD-NEXT: ret i32 [[CONV]]
498 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 3)
499 %cmp = icmp eq i32 %call, 0
500 %conv = zext i1 %cmp to i32
504 define i32 @cmp_eq4(i8* nocapture readonly %x, i8* nocapture readonly %y) {
505 ; ALL-LABEL: @cmp_eq4(
506 ; ALL-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
507 ; ALL-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
508 ; ALL-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]]
509 ; ALL-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]]
510 ; ALL-NEXT: [[TMP5:%.*]] = icmp ne i32 [[TMP3]], [[TMP4]]
511 ; ALL-NEXT: [[TMP6:%.*]] = zext i1 [[TMP5]] to i32
512 ; ALL-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP6]], 0
513 ; ALL-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
514 ; ALL-NEXT: ret i32 [[CONV]]
516 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 4)
517 %cmp = icmp eq i32 %call, 0
518 %conv = zext i1 %cmp to i32
522 define i32 @cmp_eq5(i8* nocapture readonly %x, i8* nocapture readonly %y) {
523 ; X32-LABEL: @cmp_eq5(
524 ; X32-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
525 ; X32-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
526 ; X32-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]]
527 ; X32-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]]
528 ; X32-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
529 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 4
530 ; X32-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i8 4
531 ; X32-NEXT: [[TMP8:%.*]] = load i8, i8* [[TMP6]]
532 ; X32-NEXT: [[TMP9:%.*]] = load i8, i8* [[TMP7]]
533 ; X32-NEXT: [[TMP10:%.*]] = zext i8 [[TMP8]] to i32
534 ; X32-NEXT: [[TMP11:%.*]] = zext i8 [[TMP9]] to i32
535 ; X32-NEXT: [[TMP12:%.*]] = xor i32 [[TMP10]], [[TMP11]]
536 ; X32-NEXT: [[TMP13:%.*]] = or i32 [[TMP5]], [[TMP12]]
537 ; X32-NEXT: [[TMP14:%.*]] = icmp ne i32 [[TMP13]], 0
538 ; X32-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
539 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
540 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
541 ; X32-NEXT: ret i32 [[CONV]]
543 ; X64_1LD-LABEL: @cmp_eq5(
544 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
545 ; X64_1LD: res_block:
546 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
548 ; X64_1LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
549 ; X64_1LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
550 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]]
551 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]]
552 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i32 [[TMP3]], [[TMP4]]
553 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
555 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 4
556 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i8 4
557 ; X64_1LD-NEXT: [[TMP8:%.*]] = load i8, i8* [[TMP6]]
558 ; X64_1LD-NEXT: [[TMP9:%.*]] = load i8, i8* [[TMP7]]
559 ; X64_1LD-NEXT: [[TMP10:%.*]] = icmp ne i8 [[TMP8]], [[TMP9]]
560 ; X64_1LD-NEXT: br i1 [[TMP10]], label [[RES_BLOCK]], label [[ENDBLOCK]]
562 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
563 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
564 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
565 ; X64_1LD-NEXT: ret i32 [[CONV]]
567 ; X64_2LD-LABEL: @cmp_eq5(
568 ; X64_2LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
569 ; X64_2LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
570 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]]
571 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]]
572 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
573 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 4
574 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i8 4
575 ; X64_2LD-NEXT: [[TMP8:%.*]] = load i8, i8* [[TMP6]]
576 ; X64_2LD-NEXT: [[TMP9:%.*]] = load i8, i8* [[TMP7]]
577 ; X64_2LD-NEXT: [[TMP10:%.*]] = zext i8 [[TMP8]] to i32
578 ; X64_2LD-NEXT: [[TMP11:%.*]] = zext i8 [[TMP9]] to i32
579 ; X64_2LD-NEXT: [[TMP12:%.*]] = xor i32 [[TMP10]], [[TMP11]]
580 ; X64_2LD-NEXT: [[TMP13:%.*]] = or i32 [[TMP5]], [[TMP12]]
581 ; X64_2LD-NEXT: [[TMP14:%.*]] = icmp ne i32 [[TMP13]], 0
582 ; X64_2LD-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
583 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
584 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
585 ; X64_2LD-NEXT: ret i32 [[CONV]]
587 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 5)
588 %cmp = icmp eq i32 %call, 0
589 %conv = zext i1 %cmp to i32
593 define i32 @cmp_eq6(i8* nocapture readonly %x, i8* nocapture readonly %y) {
594 ; X32-LABEL: @cmp_eq6(
595 ; X32-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
596 ; X32-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
597 ; X32-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]]
598 ; X32-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]]
599 ; X32-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
600 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 4
601 ; X32-NEXT: [[TMP7:%.*]] = bitcast i8* [[TMP6]] to i16*
602 ; X32-NEXT: [[TMP8:%.*]] = getelementptr i8, i8* [[Y]], i8 4
603 ; X32-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP8]] to i16*
604 ; X32-NEXT: [[TMP10:%.*]] = load i16, i16* [[TMP7]]
605 ; X32-NEXT: [[TMP11:%.*]] = load i16, i16* [[TMP9]]
606 ; X32-NEXT: [[TMP12:%.*]] = zext i16 [[TMP10]] to i32
607 ; X32-NEXT: [[TMP13:%.*]] = zext i16 [[TMP11]] to i32
608 ; X32-NEXT: [[TMP14:%.*]] = xor i32 [[TMP12]], [[TMP13]]
609 ; X32-NEXT: [[TMP15:%.*]] = or i32 [[TMP5]], [[TMP14]]
610 ; X32-NEXT: [[TMP16:%.*]] = icmp ne i32 [[TMP15]], 0
611 ; X32-NEXT: [[TMP17:%.*]] = zext i1 [[TMP16]] to i32
612 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP17]], 0
613 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
614 ; X32-NEXT: ret i32 [[CONV]]
616 ; X64_1LD-LABEL: @cmp_eq6(
617 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
618 ; X64_1LD: res_block:
619 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
621 ; X64_1LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
622 ; X64_1LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
623 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]]
624 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]]
625 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i32 [[TMP3]], [[TMP4]]
626 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
628 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 4
629 ; X64_1LD-NEXT: [[TMP7:%.*]] = bitcast i8* [[TMP6]] to i16*
630 ; X64_1LD-NEXT: [[TMP8:%.*]] = getelementptr i8, i8* [[Y]], i8 4
631 ; X64_1LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP8]] to i16*
632 ; X64_1LD-NEXT: [[TMP10:%.*]] = load i16, i16* [[TMP7]]
633 ; X64_1LD-NEXT: [[TMP11:%.*]] = load i16, i16* [[TMP9]]
634 ; X64_1LD-NEXT: [[TMP12:%.*]] = icmp ne i16 [[TMP10]], [[TMP11]]
635 ; X64_1LD-NEXT: br i1 [[TMP12]], label [[RES_BLOCK]], label [[ENDBLOCK]]
637 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
638 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
639 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
640 ; X64_1LD-NEXT: ret i32 [[CONV]]
642 ; X64_2LD-LABEL: @cmp_eq6(
643 ; X64_2LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
644 ; X64_2LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
645 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]]
646 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]]
647 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
648 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 4
649 ; X64_2LD-NEXT: [[TMP7:%.*]] = bitcast i8* [[TMP6]] to i16*
650 ; X64_2LD-NEXT: [[TMP8:%.*]] = getelementptr i8, i8* [[Y]], i8 4
651 ; X64_2LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP8]] to i16*
652 ; X64_2LD-NEXT: [[TMP10:%.*]] = load i16, i16* [[TMP7]]
653 ; X64_2LD-NEXT: [[TMP11:%.*]] = load i16, i16* [[TMP9]]
654 ; X64_2LD-NEXT: [[TMP12:%.*]] = zext i16 [[TMP10]] to i32
655 ; X64_2LD-NEXT: [[TMP13:%.*]] = zext i16 [[TMP11]] to i32
656 ; X64_2LD-NEXT: [[TMP14:%.*]] = xor i32 [[TMP12]], [[TMP13]]
657 ; X64_2LD-NEXT: [[TMP15:%.*]] = or i32 [[TMP5]], [[TMP14]]
658 ; X64_2LD-NEXT: [[TMP16:%.*]] = icmp ne i32 [[TMP15]], 0
659 ; X64_2LD-NEXT: [[TMP17:%.*]] = zext i1 [[TMP16]] to i32
660 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP17]], 0
661 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
662 ; X64_2LD-NEXT: ret i32 [[CONV]]
664 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 6)
665 %cmp = icmp eq i32 %call, 0
666 %conv = zext i1 %cmp to i32
670 define i32 @cmp_eq7(i8* nocapture readonly %x, i8* nocapture readonly %y) {
671 ; X32-LABEL: @cmp_eq7(
672 ; X32-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
673 ; X32-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
674 ; X32-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]]
675 ; X32-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]]
676 ; X32-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
677 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 3
678 ; X32-NEXT: [[TMP7:%.*]] = bitcast i8* [[TMP6]] to i32*
679 ; X32-NEXT: [[TMP8:%.*]] = getelementptr i8, i8* [[Y]], i8 3
680 ; X32-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP8]] to i32*
681 ; X32-NEXT: [[TMP10:%.*]] = load i32, i32* [[TMP7]]
682 ; X32-NEXT: [[TMP11:%.*]] = load i32, i32* [[TMP9]]
683 ; X32-NEXT: [[TMP12:%.*]] = xor i32 [[TMP10]], [[TMP11]]
684 ; X32-NEXT: [[TMP13:%.*]] = or i32 [[TMP5]], [[TMP12]]
685 ; X32-NEXT: [[TMP14:%.*]] = icmp ne i32 [[TMP13]], 0
686 ; X32-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
687 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
688 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
689 ; X32-NEXT: ret i32 [[CONV]]
691 ; X64_1LD-LABEL: @cmp_eq7(
692 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
693 ; X64_1LD: res_block:
694 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
696 ; X64_1LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
697 ; X64_1LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
698 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]]
699 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]]
700 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i32 [[TMP3]], [[TMP4]]
701 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
703 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 3
704 ; X64_1LD-NEXT: [[TMP7:%.*]] = bitcast i8* [[TMP6]] to i32*
705 ; X64_1LD-NEXT: [[TMP8:%.*]] = getelementptr i8, i8* [[Y]], i8 3
706 ; X64_1LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP8]] to i32*
707 ; X64_1LD-NEXT: [[TMP10:%.*]] = load i32, i32* [[TMP7]]
708 ; X64_1LD-NEXT: [[TMP11:%.*]] = load i32, i32* [[TMP9]]
709 ; X64_1LD-NEXT: [[TMP12:%.*]] = icmp ne i32 [[TMP10]], [[TMP11]]
710 ; X64_1LD-NEXT: br i1 [[TMP12]], label [[RES_BLOCK]], label [[ENDBLOCK]]
712 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
713 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
714 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
715 ; X64_1LD-NEXT: ret i32 [[CONV]]
717 ; X64_2LD-LABEL: @cmp_eq7(
718 ; X64_2LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
719 ; X64_2LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
720 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]]
721 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]]
722 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
723 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 3
724 ; X64_2LD-NEXT: [[TMP7:%.*]] = bitcast i8* [[TMP6]] to i32*
725 ; X64_2LD-NEXT: [[TMP8:%.*]] = getelementptr i8, i8* [[Y]], i8 3
726 ; X64_2LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP8]] to i32*
727 ; X64_2LD-NEXT: [[TMP10:%.*]] = load i32, i32* [[TMP7]]
728 ; X64_2LD-NEXT: [[TMP11:%.*]] = load i32, i32* [[TMP9]]
729 ; X64_2LD-NEXT: [[TMP12:%.*]] = xor i32 [[TMP10]], [[TMP11]]
730 ; X64_2LD-NEXT: [[TMP13:%.*]] = or i32 [[TMP5]], [[TMP12]]
731 ; X64_2LD-NEXT: [[TMP14:%.*]] = icmp ne i32 [[TMP13]], 0
732 ; X64_2LD-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
733 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
734 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
735 ; X64_2LD-NEXT: ret i32 [[CONV]]
737 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 7)
738 %cmp = icmp eq i32 %call, 0
739 %conv = zext i1 %cmp to i32
743 define i32 @cmp_eq8(i8* nocapture readonly %x, i8* nocapture readonly %y) {
744 ; X32-LABEL: @cmp_eq8(
745 ; X32-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
746 ; X32-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
747 ; X32-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]]
748 ; X32-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]]
749 ; X32-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
750 ; X32-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 4
751 ; X32-NEXT: [[TMP7:%.*]] = bitcast i8* [[TMP6]] to i32*
752 ; X32-NEXT: [[TMP8:%.*]] = getelementptr i8, i8* [[Y]], i8 4
753 ; X32-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP8]] to i32*
754 ; X32-NEXT: [[TMP10:%.*]] = load i32, i32* [[TMP7]]
755 ; X32-NEXT: [[TMP11:%.*]] = load i32, i32* [[TMP9]]
756 ; X32-NEXT: [[TMP12:%.*]] = xor i32 [[TMP10]], [[TMP11]]
757 ; X32-NEXT: [[TMP13:%.*]] = or i32 [[TMP5]], [[TMP12]]
758 ; X32-NEXT: [[TMP14:%.*]] = icmp ne i32 [[TMP13]], 0
759 ; X32-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
760 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
761 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
762 ; X32-NEXT: ret i32 [[CONV]]
764 ; X64-LABEL: @cmp_eq8(
765 ; X64-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
766 ; X64-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
767 ; X64-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]]
768 ; X64-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]]
769 ; X64-NEXT: [[TMP5:%.*]] = icmp ne i64 [[TMP3]], [[TMP4]]
770 ; X64-NEXT: [[TMP6:%.*]] = zext i1 [[TMP5]] to i32
771 ; X64-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP6]], 0
772 ; X64-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
773 ; X64-NEXT: ret i32 [[CONV]]
775 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 8)
776 %cmp = icmp eq i32 %call, 0
777 %conv = zext i1 %cmp to i32
781 define i32 @cmp_eq9(i8* nocapture readonly %x, i8* nocapture readonly %y) {
782 ; X32-LABEL: @cmp_eq9(
783 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i64 9)
784 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
785 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
786 ; X32-NEXT: ret i32 [[CONV]]
788 ; X64_1LD-LABEL: @cmp_eq9(
789 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
790 ; X64_1LD: res_block:
791 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
793 ; X64_1LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
794 ; X64_1LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
795 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]]
796 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]]
797 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i64 [[TMP3]], [[TMP4]]
798 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
800 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 8
801 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i8 8
802 ; X64_1LD-NEXT: [[TMP8:%.*]] = load i8, i8* [[TMP6]]
803 ; X64_1LD-NEXT: [[TMP9:%.*]] = load i8, i8* [[TMP7]]
804 ; X64_1LD-NEXT: [[TMP10:%.*]] = icmp ne i8 [[TMP8]], [[TMP9]]
805 ; X64_1LD-NEXT: br i1 [[TMP10]], label [[RES_BLOCK]], label [[ENDBLOCK]]
807 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
808 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
809 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
810 ; X64_1LD-NEXT: ret i32 [[CONV]]
812 ; X64_2LD-LABEL: @cmp_eq9(
813 ; X64_2LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
814 ; X64_2LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
815 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]]
816 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]]
817 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i64 [[TMP3]], [[TMP4]]
818 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 8
819 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i8 8
820 ; X64_2LD-NEXT: [[TMP8:%.*]] = load i8, i8* [[TMP6]]
821 ; X64_2LD-NEXT: [[TMP9:%.*]] = load i8, i8* [[TMP7]]
822 ; X64_2LD-NEXT: [[TMP10:%.*]] = zext i8 [[TMP8]] to i64
823 ; X64_2LD-NEXT: [[TMP11:%.*]] = zext i8 [[TMP9]] to i64
824 ; X64_2LD-NEXT: [[TMP12:%.*]] = xor i64 [[TMP10]], [[TMP11]]
825 ; X64_2LD-NEXT: [[TMP13:%.*]] = or i64 [[TMP5]], [[TMP12]]
826 ; X64_2LD-NEXT: [[TMP14:%.*]] = icmp ne i64 [[TMP13]], 0
827 ; X64_2LD-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
828 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
829 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
830 ; X64_2LD-NEXT: ret i32 [[CONV]]
832 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 9)
833 %cmp = icmp eq i32 %call, 0
834 %conv = zext i1 %cmp to i32
838 define i32 @cmp_eq10(i8* nocapture readonly %x, i8* nocapture readonly %y) {
839 ; X32-LABEL: @cmp_eq10(
840 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i64 10)
841 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
842 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
843 ; X32-NEXT: ret i32 [[CONV]]
845 ; X64_1LD-LABEL: @cmp_eq10(
846 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
847 ; X64_1LD: res_block:
848 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
850 ; X64_1LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
851 ; X64_1LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
852 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]]
853 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]]
854 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i64 [[TMP3]], [[TMP4]]
855 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
857 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 8
858 ; X64_1LD-NEXT: [[TMP7:%.*]] = bitcast i8* [[TMP6]] to i16*
859 ; X64_1LD-NEXT: [[TMP8:%.*]] = getelementptr i8, i8* [[Y]], i8 8
860 ; X64_1LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP8]] to i16*
861 ; X64_1LD-NEXT: [[TMP10:%.*]] = load i16, i16* [[TMP7]]
862 ; X64_1LD-NEXT: [[TMP11:%.*]] = load i16, i16* [[TMP9]]
863 ; X64_1LD-NEXT: [[TMP12:%.*]] = icmp ne i16 [[TMP10]], [[TMP11]]
864 ; X64_1LD-NEXT: br i1 [[TMP12]], label [[RES_BLOCK]], label [[ENDBLOCK]]
866 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
867 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
868 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
869 ; X64_1LD-NEXT: ret i32 [[CONV]]
871 ; X64_2LD-LABEL: @cmp_eq10(
872 ; X64_2LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
873 ; X64_2LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
874 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]]
875 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]]
876 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i64 [[TMP3]], [[TMP4]]
877 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 8
878 ; X64_2LD-NEXT: [[TMP7:%.*]] = bitcast i8* [[TMP6]] to i16*
879 ; X64_2LD-NEXT: [[TMP8:%.*]] = getelementptr i8, i8* [[Y]], i8 8
880 ; X64_2LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP8]] to i16*
881 ; X64_2LD-NEXT: [[TMP10:%.*]] = load i16, i16* [[TMP7]]
882 ; X64_2LD-NEXT: [[TMP11:%.*]] = load i16, i16* [[TMP9]]
883 ; X64_2LD-NEXT: [[TMP12:%.*]] = zext i16 [[TMP10]] to i64
884 ; X64_2LD-NEXT: [[TMP13:%.*]] = zext i16 [[TMP11]] to i64
885 ; X64_2LD-NEXT: [[TMP14:%.*]] = xor i64 [[TMP12]], [[TMP13]]
886 ; X64_2LD-NEXT: [[TMP15:%.*]] = or i64 [[TMP5]], [[TMP14]]
887 ; X64_2LD-NEXT: [[TMP16:%.*]] = icmp ne i64 [[TMP15]], 0
888 ; X64_2LD-NEXT: [[TMP17:%.*]] = zext i1 [[TMP16]] to i32
889 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP17]], 0
890 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
891 ; X64_2LD-NEXT: ret i32 [[CONV]]
893 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 10)
894 %cmp = icmp eq i32 %call, 0
895 %conv = zext i1 %cmp to i32
899 define i32 @cmp_eq11(i8* nocapture readonly %x, i8* nocapture readonly %y) {
900 ; X32-LABEL: @cmp_eq11(
901 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i64 11)
902 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
903 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
904 ; X32-NEXT: ret i32 [[CONV]]
906 ; X64_1LD-LABEL: @cmp_eq11(
907 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
908 ; X64_1LD: res_block:
909 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
911 ; X64_1LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
912 ; X64_1LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
913 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]]
914 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]]
915 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i64 [[TMP3]], [[TMP4]]
916 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
918 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 3
919 ; X64_1LD-NEXT: [[TMP7:%.*]] = bitcast i8* [[TMP6]] to i64*
920 ; X64_1LD-NEXT: [[TMP8:%.*]] = getelementptr i8, i8* [[Y]], i8 3
921 ; X64_1LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP8]] to i64*
922 ; X64_1LD-NEXT: [[TMP10:%.*]] = load i64, i64* [[TMP7]]
923 ; X64_1LD-NEXT: [[TMP11:%.*]] = load i64, i64* [[TMP9]]
924 ; X64_1LD-NEXT: [[TMP12:%.*]] = icmp ne i64 [[TMP10]], [[TMP11]]
925 ; X64_1LD-NEXT: br i1 [[TMP12]], label [[RES_BLOCK]], label [[ENDBLOCK]]
927 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
928 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
929 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
930 ; X64_1LD-NEXT: ret i32 [[CONV]]
932 ; X64_2LD-LABEL: @cmp_eq11(
933 ; X64_2LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
934 ; X64_2LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
935 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]]
936 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]]
937 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i64 [[TMP3]], [[TMP4]]
938 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 3
939 ; X64_2LD-NEXT: [[TMP7:%.*]] = bitcast i8* [[TMP6]] to i64*
940 ; X64_2LD-NEXT: [[TMP8:%.*]] = getelementptr i8, i8* [[Y]], i8 3
941 ; X64_2LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP8]] to i64*
942 ; X64_2LD-NEXT: [[TMP10:%.*]] = load i64, i64* [[TMP7]]
943 ; X64_2LD-NEXT: [[TMP11:%.*]] = load i64, i64* [[TMP9]]
944 ; X64_2LD-NEXT: [[TMP12:%.*]] = xor i64 [[TMP10]], [[TMP11]]
945 ; X64_2LD-NEXT: [[TMP13:%.*]] = or i64 [[TMP5]], [[TMP12]]
946 ; X64_2LD-NEXT: [[TMP14:%.*]] = icmp ne i64 [[TMP13]], 0
947 ; X64_2LD-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
948 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
949 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
950 ; X64_2LD-NEXT: ret i32 [[CONV]]
952 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 11)
953 %cmp = icmp eq i32 %call, 0
954 %conv = zext i1 %cmp to i32
958 define i32 @cmp_eq12(i8* nocapture readonly %x, i8* nocapture readonly %y) {
959 ; X32-LABEL: @cmp_eq12(
960 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i64 12)
961 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
962 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
963 ; X32-NEXT: ret i32 [[CONV]]
965 ; X64_1LD-LABEL: @cmp_eq12(
966 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
967 ; X64_1LD: res_block:
968 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
970 ; X64_1LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
971 ; X64_1LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
972 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]]
973 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]]
974 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i64 [[TMP3]], [[TMP4]]
975 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
977 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 8
978 ; X64_1LD-NEXT: [[TMP7:%.*]] = bitcast i8* [[TMP6]] to i32*
979 ; X64_1LD-NEXT: [[TMP8:%.*]] = getelementptr i8, i8* [[Y]], i8 8
980 ; X64_1LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP8]] to i32*
981 ; X64_1LD-NEXT: [[TMP10:%.*]] = load i32, i32* [[TMP7]]
982 ; X64_1LD-NEXT: [[TMP11:%.*]] = load i32, i32* [[TMP9]]
983 ; X64_1LD-NEXT: [[TMP12:%.*]] = icmp ne i32 [[TMP10]], [[TMP11]]
984 ; X64_1LD-NEXT: br i1 [[TMP12]], label [[RES_BLOCK]], label [[ENDBLOCK]]
986 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
987 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
988 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
989 ; X64_1LD-NEXT: ret i32 [[CONV]]
991 ; X64_2LD-LABEL: @cmp_eq12(
992 ; X64_2LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
993 ; X64_2LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
994 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]]
995 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]]
996 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i64 [[TMP3]], [[TMP4]]
997 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 8
998 ; X64_2LD-NEXT: [[TMP7:%.*]] = bitcast i8* [[TMP6]] to i32*
999 ; X64_2LD-NEXT: [[TMP8:%.*]] = getelementptr i8, i8* [[Y]], i8 8
1000 ; X64_2LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP8]] to i32*
1001 ; X64_2LD-NEXT: [[TMP10:%.*]] = load i32, i32* [[TMP7]]
1002 ; X64_2LD-NEXT: [[TMP11:%.*]] = load i32, i32* [[TMP9]]
1003 ; X64_2LD-NEXT: [[TMP12:%.*]] = zext i32 [[TMP10]] to i64
1004 ; X64_2LD-NEXT: [[TMP13:%.*]] = zext i32 [[TMP11]] to i64
1005 ; X64_2LD-NEXT: [[TMP14:%.*]] = xor i64 [[TMP12]], [[TMP13]]
1006 ; X64_2LD-NEXT: [[TMP15:%.*]] = or i64 [[TMP5]], [[TMP14]]
1007 ; X64_2LD-NEXT: [[TMP16:%.*]] = icmp ne i64 [[TMP15]], 0
1008 ; X64_2LD-NEXT: [[TMP17:%.*]] = zext i1 [[TMP16]] to i32
1009 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP17]], 0
1010 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
1011 ; X64_2LD-NEXT: ret i32 [[CONV]]
1013 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 12)
1014 %cmp = icmp eq i32 %call, 0
1015 %conv = zext i1 %cmp to i32
1019 define i32 @cmp_eq13(i8* nocapture readonly %x, i8* nocapture readonly %y) {
1020 ; X32-LABEL: @cmp_eq13(
1021 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i64 13)
1022 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
1023 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
1024 ; X32-NEXT: ret i32 [[CONV]]
1026 ; X64_1LD-LABEL: @cmp_eq13(
1027 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
1028 ; X64_1LD: res_block:
1029 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
1031 ; X64_1LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
1032 ; X64_1LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
1033 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]]
1034 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]]
1035 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i64 [[TMP3]], [[TMP4]]
1036 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
1038 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 5
1039 ; X64_1LD-NEXT: [[TMP7:%.*]] = bitcast i8* [[TMP6]] to i64*
1040 ; X64_1LD-NEXT: [[TMP8:%.*]] = getelementptr i8, i8* [[Y]], i8 5
1041 ; X64_1LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP8]] to i64*
1042 ; X64_1LD-NEXT: [[TMP10:%.*]] = load i64, i64* [[TMP7]]
1043 ; X64_1LD-NEXT: [[TMP11:%.*]] = load i64, i64* [[TMP9]]
1044 ; X64_1LD-NEXT: [[TMP12:%.*]] = icmp ne i64 [[TMP10]], [[TMP11]]
1045 ; X64_1LD-NEXT: br i1 [[TMP12]], label [[RES_BLOCK]], label [[ENDBLOCK]]
1046 ; X64_1LD: endblock:
1047 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
1048 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
1049 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
1050 ; X64_1LD-NEXT: ret i32 [[CONV]]
1052 ; X64_2LD-LABEL: @cmp_eq13(
1053 ; X64_2LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
1054 ; X64_2LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
1055 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]]
1056 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]]
1057 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i64 [[TMP3]], [[TMP4]]
1058 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 5
1059 ; X64_2LD-NEXT: [[TMP7:%.*]] = bitcast i8* [[TMP6]] to i64*
1060 ; X64_2LD-NEXT: [[TMP8:%.*]] = getelementptr i8, i8* [[Y]], i8 5
1061 ; X64_2LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP8]] to i64*
1062 ; X64_2LD-NEXT: [[TMP10:%.*]] = load i64, i64* [[TMP7]]
1063 ; X64_2LD-NEXT: [[TMP11:%.*]] = load i64, i64* [[TMP9]]
1064 ; X64_2LD-NEXT: [[TMP12:%.*]] = xor i64 [[TMP10]], [[TMP11]]
1065 ; X64_2LD-NEXT: [[TMP13:%.*]] = or i64 [[TMP5]], [[TMP12]]
1066 ; X64_2LD-NEXT: [[TMP14:%.*]] = icmp ne i64 [[TMP13]], 0
1067 ; X64_2LD-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
1068 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
1069 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
1070 ; X64_2LD-NEXT: ret i32 [[CONV]]
1072 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 13)
1073 %cmp = icmp eq i32 %call, 0
1074 %conv = zext i1 %cmp to i32
1078 define i32 @cmp_eq14(i8* nocapture readonly %x, i8* nocapture readonly %y) {
1079 ; X32-LABEL: @cmp_eq14(
1080 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i64 14)
1081 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
1082 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
1083 ; X32-NEXT: ret i32 [[CONV]]
1085 ; X64_1LD-LABEL: @cmp_eq14(
1086 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
1087 ; X64_1LD: res_block:
1088 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
1090 ; X64_1LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
1091 ; X64_1LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
1092 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]]
1093 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]]
1094 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i64 [[TMP3]], [[TMP4]]
1095 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
1097 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 6
1098 ; X64_1LD-NEXT: [[TMP7:%.*]] = bitcast i8* [[TMP6]] to i64*
1099 ; X64_1LD-NEXT: [[TMP8:%.*]] = getelementptr i8, i8* [[Y]], i8 6
1100 ; X64_1LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP8]] to i64*
1101 ; X64_1LD-NEXT: [[TMP10:%.*]] = load i64, i64* [[TMP7]]
1102 ; X64_1LD-NEXT: [[TMP11:%.*]] = load i64, i64* [[TMP9]]
1103 ; X64_1LD-NEXT: [[TMP12:%.*]] = icmp ne i64 [[TMP10]], [[TMP11]]
1104 ; X64_1LD-NEXT: br i1 [[TMP12]], label [[RES_BLOCK]], label [[ENDBLOCK]]
1105 ; X64_1LD: endblock:
1106 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
1107 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
1108 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
1109 ; X64_1LD-NEXT: ret i32 [[CONV]]
1111 ; X64_2LD-LABEL: @cmp_eq14(
1112 ; X64_2LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
1113 ; X64_2LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
1114 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]]
1115 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]]
1116 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i64 [[TMP3]], [[TMP4]]
1117 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 6
1118 ; X64_2LD-NEXT: [[TMP7:%.*]] = bitcast i8* [[TMP6]] to i64*
1119 ; X64_2LD-NEXT: [[TMP8:%.*]] = getelementptr i8, i8* [[Y]], i8 6
1120 ; X64_2LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP8]] to i64*
1121 ; X64_2LD-NEXT: [[TMP10:%.*]] = load i64, i64* [[TMP7]]
1122 ; X64_2LD-NEXT: [[TMP11:%.*]] = load i64, i64* [[TMP9]]
1123 ; X64_2LD-NEXT: [[TMP12:%.*]] = xor i64 [[TMP10]], [[TMP11]]
1124 ; X64_2LD-NEXT: [[TMP13:%.*]] = or i64 [[TMP5]], [[TMP12]]
1125 ; X64_2LD-NEXT: [[TMP14:%.*]] = icmp ne i64 [[TMP13]], 0
1126 ; X64_2LD-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
1127 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
1128 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
1129 ; X64_2LD-NEXT: ret i32 [[CONV]]
1131 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 14)
1132 %cmp = icmp eq i32 %call, 0
1133 %conv = zext i1 %cmp to i32
1137 define i32 @cmp_eq15(i8* nocapture readonly %x, i8* nocapture readonly %y) {
1138 ; X32-LABEL: @cmp_eq15(
1139 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i64 15)
1140 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
1141 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
1142 ; X32-NEXT: ret i32 [[CONV]]
1144 ; X64_1LD-LABEL: @cmp_eq15(
1145 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
1146 ; X64_1LD: res_block:
1147 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
1149 ; X64_1LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
1150 ; X64_1LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
1151 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]]
1152 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]]
1153 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i64 [[TMP3]], [[TMP4]]
1154 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
1156 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 7
1157 ; X64_1LD-NEXT: [[TMP7:%.*]] = bitcast i8* [[TMP6]] to i64*
1158 ; X64_1LD-NEXT: [[TMP8:%.*]] = getelementptr i8, i8* [[Y]], i8 7
1159 ; X64_1LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP8]] to i64*
1160 ; X64_1LD-NEXT: [[TMP10:%.*]] = load i64, i64* [[TMP7]]
1161 ; X64_1LD-NEXT: [[TMP11:%.*]] = load i64, i64* [[TMP9]]
1162 ; X64_1LD-NEXT: [[TMP12:%.*]] = icmp ne i64 [[TMP10]], [[TMP11]]
1163 ; X64_1LD-NEXT: br i1 [[TMP12]], label [[RES_BLOCK]], label [[ENDBLOCK]]
1164 ; X64_1LD: endblock:
1165 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
1166 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
1167 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
1168 ; X64_1LD-NEXT: ret i32 [[CONV]]
1170 ; X64_2LD-LABEL: @cmp_eq15(
1171 ; X64_2LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
1172 ; X64_2LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
1173 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]]
1174 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]]
1175 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i64 [[TMP3]], [[TMP4]]
1176 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i8 7
1177 ; X64_2LD-NEXT: [[TMP7:%.*]] = bitcast i8* [[TMP6]] to i64*
1178 ; X64_2LD-NEXT: [[TMP8:%.*]] = getelementptr i8, i8* [[Y]], i8 7
1179 ; X64_2LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP8]] to i64*
1180 ; X64_2LD-NEXT: [[TMP10:%.*]] = load i64, i64* [[TMP7]]
1181 ; X64_2LD-NEXT: [[TMP11:%.*]] = load i64, i64* [[TMP9]]
1182 ; X64_2LD-NEXT: [[TMP12:%.*]] = xor i64 [[TMP10]], [[TMP11]]
1183 ; X64_2LD-NEXT: [[TMP13:%.*]] = or i64 [[TMP5]], [[TMP12]]
1184 ; X64_2LD-NEXT: [[TMP14:%.*]] = icmp ne i64 [[TMP13]], 0
1185 ; X64_2LD-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
1186 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
1187 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
1188 ; X64_2LD-NEXT: ret i32 [[CONV]]
1190 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 15)
1191 %cmp = icmp eq i32 %call, 0
1192 %conv = zext i1 %cmp to i32
1196 define i32 @cmp_eq16(i8* nocapture readonly %x, i8* nocapture readonly %y) {
1197 ; X32-LABEL: @cmp_eq16(
1198 ; X32-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(i8* [[X:%.*]], i8* [[Y:%.*]], i64 16)
1199 ; X32-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
1200 ; X32-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
1201 ; X32-NEXT: ret i32 [[CONV]]
1203 ; X64-LABEL: @cmp_eq16(
1204 ; X64-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i128*
1205 ; X64-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i128*
1206 ; X64-NEXT: [[TMP3:%.*]] = load i128, i128* [[TMP1]]
1207 ; X64-NEXT: [[TMP4:%.*]] = load i128, i128* [[TMP2]]
1208 ; X64-NEXT: [[TMP5:%.*]] = icmp ne i128 [[TMP3]], [[TMP4]]
1209 ; X64-NEXT: [[TMP6:%.*]] = zext i1 [[TMP5]] to i32
1210 ; X64-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP6]], 0
1211 ; X64-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
1212 ; X64-NEXT: ret i32 [[CONV]]
1214 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 16)
1215 %cmp = icmp eq i32 %call, 0
1216 %conv = zext i1 %cmp to i32