1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; 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=X64 --check-prefix=X64_1LD
3 ; 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=X64 --check-prefix=X64_2LD
5 declare i32 @memcmp(ptr nocapture, ptr nocapture, i64)
7 define i32 @cmp2(ptr nocapture readonly %x, ptr nocapture readonly %y) {
9 ; X64-NEXT: [[TMP3:%.*]] = load i16, ptr [[X:%.*]], align 1
10 ; X64-NEXT: [[TMP4:%.*]] = load i16, ptr [[Y:%.*]], align 1
11 ; X64-NEXT: [[TMP5:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP3]])
12 ; X64-NEXT: [[TMP6:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP4]])
13 ; X64-NEXT: [[TMP7:%.*]] = zext i16 [[TMP5]] to i32
14 ; X64-NEXT: [[TMP8:%.*]] = zext i16 [[TMP6]] to i32
15 ; X64-NEXT: [[TMP9:%.*]] = sub i32 [[TMP7]], [[TMP8]]
16 ; X64-NEXT: ret i32 [[TMP9]]
18 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 2)
22 define i32 @cmp2_align2(ptr nocapture readonly align 2 %x, ptr nocapture readonly align 2 %y) {
23 ; X64-LABEL: @cmp2_align2(
24 ; X64-NEXT: [[TMP3:%.*]] = load i16, ptr [[X:%.*]], align 2
25 ; X64-NEXT: [[TMP4:%.*]] = load i16, ptr [[Y:%.*]], align 2
26 ; X64-NEXT: [[TMP5:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP3]])
27 ; X64-NEXT: [[TMP6:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP4]])
28 ; X64-NEXT: [[TMP7:%.*]] = zext i16 [[TMP5]] to i32
29 ; X64-NEXT: [[TMP8:%.*]] = zext i16 [[TMP6]] to i32
30 ; X64-NEXT: [[TMP9:%.*]] = sub i32 [[TMP7]], [[TMP8]]
31 ; X64-NEXT: ret i32 [[TMP9]]
33 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 2)
37 define i32 @cmp3(ptr nocapture readonly %x, ptr nocapture readonly %y) {
39 ; X64-NEXT: br label [[LOADBB:%.*]]
41 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i16 [[TMP7:%.*]], [[TMP8:%.*]]
42 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
43 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
45 ; X64-NEXT: [[TMP5:%.*]] = load i16, ptr [[X:%.*]], align 1
46 ; X64-NEXT: [[TMP6:%.*]] = load i16, ptr [[Y:%.*]], align 1
47 ; X64-NEXT: [[TMP7]] = call i16 @llvm.bswap.i16(i16 [[TMP5]])
48 ; X64-NEXT: [[TMP8]] = call i16 @llvm.bswap.i16(i16 [[TMP6]])
49 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i16 [[TMP7]], [[TMP8]]
50 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1:%.*]], label [[RES_BLOCK:%.*]]
52 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[X]], i64 2
53 ; X64-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[Y]], i64 2
54 ; X64-NEXT: [[TMP12:%.*]] = load i8, ptr [[TMP10]], align 1
55 ; X64-NEXT: [[TMP13:%.*]] = load i8, ptr [[TMP11]], align 1
56 ; X64-NEXT: [[TMP14:%.*]] = zext i8 [[TMP12]] to i32
57 ; X64-NEXT: [[TMP15:%.*]] = zext i8 [[TMP13]] to i32
58 ; X64-NEXT: [[TMP16:%.*]] = sub i32 [[TMP14]], [[TMP15]]
59 ; X64-NEXT: br label [[ENDBLOCK]]
61 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ [[TMP16]], [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
62 ; X64-NEXT: ret i32 [[PHI_RES]]
64 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 3)
68 define i32 @cmp4(ptr nocapture readonly %x, ptr nocapture readonly %y) {
70 ; X64-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 1
71 ; X64-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 1
72 ; X64-NEXT: [[TMP5:%.*]] = call i32 @llvm.bswap.i32(i32 [[TMP3]])
73 ; X64-NEXT: [[TMP6:%.*]] = call i32 @llvm.bswap.i32(i32 [[TMP4]])
74 ; X64-NEXT: [[TMP7:%.*]] = icmp ugt i32 [[TMP5]], [[TMP6]]
75 ; X64-NEXT: [[TMP8:%.*]] = icmp ult i32 [[TMP5]], [[TMP6]]
76 ; X64-NEXT: [[TMP9:%.*]] = zext i1 [[TMP7]] to i32
77 ; X64-NEXT: [[TMP10:%.*]] = zext i1 [[TMP8]] to i32
78 ; X64-NEXT: [[TMP11:%.*]] = sub i32 [[TMP9]], [[TMP10]]
79 ; X64-NEXT: ret i32 [[TMP11]]
81 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 4)
85 define i32 @cmp5(ptr nocapture readonly %x, ptr nocapture readonly %y) {
87 ; X64-NEXT: br label [[LOADBB:%.*]]
89 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i32 [[TMP7:%.*]], [[TMP8:%.*]]
90 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
91 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
93 ; X64-NEXT: [[TMP5:%.*]] = load i32, ptr [[X:%.*]], align 1
94 ; X64-NEXT: [[TMP6:%.*]] = load i32, ptr [[Y:%.*]], align 1
95 ; X64-NEXT: [[TMP7]] = call i32 @llvm.bswap.i32(i32 [[TMP5]])
96 ; X64-NEXT: [[TMP8]] = call i32 @llvm.bswap.i32(i32 [[TMP6]])
97 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP7]], [[TMP8]]
98 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1:%.*]], label [[RES_BLOCK:%.*]]
100 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[X]], i64 4
101 ; X64-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[Y]], i64 4
102 ; X64-NEXT: [[TMP12:%.*]] = load i8, ptr [[TMP10]], align 1
103 ; X64-NEXT: [[TMP13:%.*]] = load i8, ptr [[TMP11]], align 1
104 ; X64-NEXT: [[TMP14:%.*]] = zext i8 [[TMP12]] to i32
105 ; X64-NEXT: [[TMP15:%.*]] = zext i8 [[TMP13]] to i32
106 ; X64-NEXT: [[TMP16:%.*]] = sub i32 [[TMP14]], [[TMP15]]
107 ; X64-NEXT: br label [[ENDBLOCK]]
109 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ [[TMP16]], [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
110 ; X64-NEXT: ret i32 [[PHI_RES]]
112 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 5)
116 define i32 @cmp6(ptr nocapture readonly %x, ptr nocapture readonly %y) {
118 ; X64-NEXT: br label [[LOADBB:%.*]]
120 ; X64-NEXT: [[PHI_SRC1:%.*]] = phi i32 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP18:%.*]], [[LOADBB1:%.*]] ]
121 ; X64-NEXT: [[PHI_SRC2:%.*]] = phi i32 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP19:%.*]], [[LOADBB1]] ]
122 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i32 [[PHI_SRC1]], [[PHI_SRC2]]
123 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
124 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
126 ; X64-NEXT: [[TMP5:%.*]] = load i32, ptr [[X:%.*]], align 1
127 ; X64-NEXT: [[TMP6:%.*]] = load i32, ptr [[Y:%.*]], align 1
128 ; X64-NEXT: [[TMP7]] = call i32 @llvm.bswap.i32(i32 [[TMP5]])
129 ; X64-NEXT: [[TMP8]] = call i32 @llvm.bswap.i32(i32 [[TMP6]])
130 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP7]], [[TMP8]]
131 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
133 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[X]], i64 4
134 ; X64-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[Y]], i64 4
135 ; X64-NEXT: [[TMP14:%.*]] = load i16, ptr [[TMP10]], align 1
136 ; X64-NEXT: [[TMP15:%.*]] = load i16, ptr [[TMP11]], align 1
137 ; X64-NEXT: [[TMP16:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP14]])
138 ; X64-NEXT: [[TMP17:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP15]])
139 ; X64-NEXT: [[TMP18]] = zext i16 [[TMP16]] to i32
140 ; X64-NEXT: [[TMP19]] = zext i16 [[TMP17]] to i32
141 ; X64-NEXT: [[TMP20:%.*]] = icmp eq i32 [[TMP18]], [[TMP19]]
142 ; X64-NEXT: br i1 [[TMP20]], label [[ENDBLOCK]], label [[RES_BLOCK]]
144 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
145 ; X64-NEXT: ret i32 [[PHI_RES]]
147 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 6)
151 define i32 @cmp7(ptr nocapture readonly %x, ptr nocapture readonly %y) {
153 ; X64-NEXT: br label [[LOADBB:%.*]]
155 ; X64-NEXT: [[PHI_SRC1:%.*]] = phi i32 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP16:%.*]], [[LOADBB1:%.*]] ]
156 ; X64-NEXT: [[PHI_SRC2:%.*]] = phi i32 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP17:%.*]], [[LOADBB1]] ]
157 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i32 [[PHI_SRC1]], [[PHI_SRC2]]
158 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
159 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
161 ; X64-NEXT: [[TMP5:%.*]] = load i32, ptr [[X:%.*]], align 1
162 ; X64-NEXT: [[TMP6:%.*]] = load i32, ptr [[Y:%.*]], align 1
163 ; X64-NEXT: [[TMP7]] = call i32 @llvm.bswap.i32(i32 [[TMP5]])
164 ; X64-NEXT: [[TMP8]] = call i32 @llvm.bswap.i32(i32 [[TMP6]])
165 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP7]], [[TMP8]]
166 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
168 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[X]], i64 3
169 ; X64-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[Y]], i64 3
170 ; X64-NEXT: [[TMP14:%.*]] = load i32, ptr [[TMP10]], align 1
171 ; X64-NEXT: [[TMP15:%.*]] = load i32, ptr [[TMP11]], align 1
172 ; X64-NEXT: [[TMP16]] = call i32 @llvm.bswap.i32(i32 [[TMP14]])
173 ; X64-NEXT: [[TMP17]] = call i32 @llvm.bswap.i32(i32 [[TMP15]])
174 ; X64-NEXT: [[TMP18:%.*]] = icmp eq i32 [[TMP16]], [[TMP17]]
175 ; X64-NEXT: br i1 [[TMP18]], label [[ENDBLOCK]], label [[RES_BLOCK]]
177 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
178 ; X64-NEXT: ret i32 [[PHI_RES]]
180 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 7)
184 define i32 @cmp8(ptr nocapture readonly %x, ptr nocapture readonly %y) {
186 ; X64-NEXT: [[TMP3:%.*]] = load i64, ptr [[X:%.*]], align 1
187 ; X64-NEXT: [[TMP4:%.*]] = load i64, ptr [[Y:%.*]], align 1
188 ; X64-NEXT: [[TMP5:%.*]] = call i64 @llvm.bswap.i64(i64 [[TMP3]])
189 ; X64-NEXT: [[TMP6:%.*]] = call i64 @llvm.bswap.i64(i64 [[TMP4]])
190 ; X64-NEXT: [[TMP7:%.*]] = icmp ugt i64 [[TMP5]], [[TMP6]]
191 ; X64-NEXT: [[TMP8:%.*]] = icmp ult i64 [[TMP5]], [[TMP6]]
192 ; X64-NEXT: [[TMP9:%.*]] = zext i1 [[TMP7]] to i32
193 ; X64-NEXT: [[TMP10:%.*]] = zext i1 [[TMP8]] to i32
194 ; X64-NEXT: [[TMP11:%.*]] = sub i32 [[TMP9]], [[TMP10]]
195 ; X64-NEXT: ret i32 [[TMP11]]
197 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 8)
201 define i32 @cmp9(ptr nocapture readonly %x, ptr nocapture readonly %y) {
203 ; X64-NEXT: br label [[LOADBB:%.*]]
205 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i64 [[TMP7:%.*]], [[TMP8:%.*]]
206 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
207 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
209 ; X64-NEXT: [[TMP5:%.*]] = load i64, ptr [[X:%.*]], align 1
210 ; X64-NEXT: [[TMP6:%.*]] = load i64, ptr [[Y:%.*]], align 1
211 ; X64-NEXT: [[TMP7]] = call i64 @llvm.bswap.i64(i64 [[TMP5]])
212 ; X64-NEXT: [[TMP8]] = call i64 @llvm.bswap.i64(i64 [[TMP6]])
213 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i64 [[TMP7]], [[TMP8]]
214 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1:%.*]], label [[RES_BLOCK:%.*]]
216 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[X]], i64 8
217 ; X64-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[Y]], i64 8
218 ; X64-NEXT: [[TMP12:%.*]] = load i8, ptr [[TMP10]], align 1
219 ; X64-NEXT: [[TMP13:%.*]] = load i8, ptr [[TMP11]], align 1
220 ; X64-NEXT: [[TMP14:%.*]] = zext i8 [[TMP12]] to i32
221 ; X64-NEXT: [[TMP15:%.*]] = zext i8 [[TMP13]] to i32
222 ; X64-NEXT: [[TMP16:%.*]] = sub i32 [[TMP14]], [[TMP15]]
223 ; X64-NEXT: br label [[ENDBLOCK]]
225 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ [[TMP16]], [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
226 ; X64-NEXT: ret i32 [[PHI_RES]]
228 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 9)
232 define i32 @cmp10(ptr nocapture readonly %x, ptr nocapture readonly %y) {
234 ; X64-NEXT: br label [[LOADBB:%.*]]
236 ; X64-NEXT: [[PHI_SRC1:%.*]] = phi i64 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP18:%.*]], [[LOADBB1:%.*]] ]
237 ; X64-NEXT: [[PHI_SRC2:%.*]] = phi i64 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP19:%.*]], [[LOADBB1]] ]
238 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i64 [[PHI_SRC1]], [[PHI_SRC2]]
239 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
240 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
242 ; X64-NEXT: [[TMP5:%.*]] = load i64, ptr [[X:%.*]], align 1
243 ; X64-NEXT: [[TMP6:%.*]] = load i64, ptr [[Y:%.*]], align 1
244 ; X64-NEXT: [[TMP7]] = call i64 @llvm.bswap.i64(i64 [[TMP5]])
245 ; X64-NEXT: [[TMP8]] = call i64 @llvm.bswap.i64(i64 [[TMP6]])
246 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i64 [[TMP7]], [[TMP8]]
247 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
249 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[X]], i64 8
250 ; X64-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[Y]], i64 8
251 ; X64-NEXT: [[TMP14:%.*]] = load i16, ptr [[TMP10]], align 1
252 ; X64-NEXT: [[TMP15:%.*]] = load i16, ptr [[TMP11]], align 1
253 ; X64-NEXT: [[TMP16:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP14]])
254 ; X64-NEXT: [[TMP17:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP15]])
255 ; X64-NEXT: [[TMP18]] = zext i16 [[TMP16]] to i64
256 ; X64-NEXT: [[TMP19]] = zext i16 [[TMP17]] to i64
257 ; X64-NEXT: [[TMP20:%.*]] = icmp eq i64 [[TMP18]], [[TMP19]]
258 ; X64-NEXT: br i1 [[TMP20]], label [[ENDBLOCK]], label [[RES_BLOCK]]
260 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
261 ; X64-NEXT: ret i32 [[PHI_RES]]
263 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 10)
267 define i32 @cmp11(ptr nocapture readonly %x, ptr nocapture readonly %y) {
269 ; X64-NEXT: br label [[LOADBB:%.*]]
271 ; X64-NEXT: [[PHI_SRC1:%.*]] = phi i64 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP16:%.*]], [[LOADBB1:%.*]] ]
272 ; X64-NEXT: [[PHI_SRC2:%.*]] = phi i64 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP17:%.*]], [[LOADBB1]] ]
273 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i64 [[PHI_SRC1]], [[PHI_SRC2]]
274 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
275 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
277 ; X64-NEXT: [[TMP5:%.*]] = load i64, ptr [[X:%.*]], align 1
278 ; X64-NEXT: [[TMP6:%.*]] = load i64, ptr [[Y:%.*]], align 1
279 ; X64-NEXT: [[TMP7]] = call i64 @llvm.bswap.i64(i64 [[TMP5]])
280 ; X64-NEXT: [[TMP8]] = call i64 @llvm.bswap.i64(i64 [[TMP6]])
281 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i64 [[TMP7]], [[TMP8]]
282 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
284 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[X]], i64 3
285 ; X64-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[Y]], i64 3
286 ; X64-NEXT: [[TMP14:%.*]] = load i64, ptr [[TMP10]], align 1
287 ; X64-NEXT: [[TMP15:%.*]] = load i64, ptr [[TMP11]], align 1
288 ; X64-NEXT: [[TMP16]] = call i64 @llvm.bswap.i64(i64 [[TMP14]])
289 ; X64-NEXT: [[TMP17]] = call i64 @llvm.bswap.i64(i64 [[TMP15]])
290 ; X64-NEXT: [[TMP18:%.*]] = icmp eq i64 [[TMP16]], [[TMP17]]
291 ; X64-NEXT: br i1 [[TMP18]], label [[ENDBLOCK]], label [[RES_BLOCK]]
293 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
294 ; X64-NEXT: ret i32 [[PHI_RES]]
296 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 11)
300 define i32 @cmp12(ptr nocapture readonly %x, ptr nocapture readonly %y) {
302 ; X64-NEXT: br label [[LOADBB:%.*]]
304 ; X64-NEXT: [[PHI_SRC1:%.*]] = phi i64 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP18:%.*]], [[LOADBB1:%.*]] ]
305 ; X64-NEXT: [[PHI_SRC2:%.*]] = phi i64 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP19:%.*]], [[LOADBB1]] ]
306 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i64 [[PHI_SRC1]], [[PHI_SRC2]]
307 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
308 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
310 ; X64-NEXT: [[TMP5:%.*]] = load i64, ptr [[X:%.*]], align 1
311 ; X64-NEXT: [[TMP6:%.*]] = load i64, ptr [[Y:%.*]], align 1
312 ; X64-NEXT: [[TMP7]] = call i64 @llvm.bswap.i64(i64 [[TMP5]])
313 ; X64-NEXT: [[TMP8]] = call i64 @llvm.bswap.i64(i64 [[TMP6]])
314 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i64 [[TMP7]], [[TMP8]]
315 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
317 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[X]], i64 8
318 ; X64-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[Y]], i64 8
319 ; X64-NEXT: [[TMP14:%.*]] = load i32, ptr [[TMP10]], align 1
320 ; X64-NEXT: [[TMP15:%.*]] = load i32, ptr [[TMP11]], align 1
321 ; X64-NEXT: [[TMP16:%.*]] = call i32 @llvm.bswap.i32(i32 [[TMP14]])
322 ; X64-NEXT: [[TMP17:%.*]] = call i32 @llvm.bswap.i32(i32 [[TMP15]])
323 ; X64-NEXT: [[TMP18]] = zext i32 [[TMP16]] to i64
324 ; X64-NEXT: [[TMP19]] = zext i32 [[TMP17]] to i64
325 ; X64-NEXT: [[TMP20:%.*]] = icmp eq i64 [[TMP18]], [[TMP19]]
326 ; X64-NEXT: br i1 [[TMP20]], label [[ENDBLOCK]], label [[RES_BLOCK]]
328 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
329 ; X64-NEXT: ret i32 [[PHI_RES]]
331 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 12)
335 define i32 @cmp13(ptr nocapture readonly %x, ptr nocapture readonly %y) {
337 ; X64-NEXT: br label [[LOADBB:%.*]]
339 ; X64-NEXT: [[PHI_SRC1:%.*]] = phi i64 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP16:%.*]], [[LOADBB1:%.*]] ]
340 ; X64-NEXT: [[PHI_SRC2:%.*]] = phi i64 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP17:%.*]], [[LOADBB1]] ]
341 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i64 [[PHI_SRC1]], [[PHI_SRC2]]
342 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
343 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
345 ; X64-NEXT: [[TMP5:%.*]] = load i64, ptr [[X:%.*]], align 1
346 ; X64-NEXT: [[TMP6:%.*]] = load i64, ptr [[Y:%.*]], align 1
347 ; X64-NEXT: [[TMP7]] = call i64 @llvm.bswap.i64(i64 [[TMP5]])
348 ; X64-NEXT: [[TMP8]] = call i64 @llvm.bswap.i64(i64 [[TMP6]])
349 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i64 [[TMP7]], [[TMP8]]
350 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
352 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[X]], i64 5
353 ; X64-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[Y]], i64 5
354 ; X64-NEXT: [[TMP14:%.*]] = load i64, ptr [[TMP10]], align 1
355 ; X64-NEXT: [[TMP15:%.*]] = load i64, ptr [[TMP11]], align 1
356 ; X64-NEXT: [[TMP16]] = call i64 @llvm.bswap.i64(i64 [[TMP14]])
357 ; X64-NEXT: [[TMP17]] = call i64 @llvm.bswap.i64(i64 [[TMP15]])
358 ; X64-NEXT: [[TMP18:%.*]] = icmp eq i64 [[TMP16]], [[TMP17]]
359 ; X64-NEXT: br i1 [[TMP18]], label [[ENDBLOCK]], label [[RES_BLOCK]]
361 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
362 ; X64-NEXT: ret i32 [[PHI_RES]]
364 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 13)
368 define i32 @cmp14(ptr nocapture readonly %x, ptr nocapture readonly %y) {
370 ; X64-NEXT: br label [[LOADBB:%.*]]
372 ; X64-NEXT: [[PHI_SRC1:%.*]] = phi i64 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP16:%.*]], [[LOADBB1:%.*]] ]
373 ; X64-NEXT: [[PHI_SRC2:%.*]] = phi i64 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP17:%.*]], [[LOADBB1]] ]
374 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i64 [[PHI_SRC1]], [[PHI_SRC2]]
375 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
376 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
378 ; X64-NEXT: [[TMP5:%.*]] = load i64, ptr [[X:%.*]], align 1
379 ; X64-NEXT: [[TMP6:%.*]] = load i64, ptr [[Y:%.*]], align 1
380 ; X64-NEXT: [[TMP7]] = call i64 @llvm.bswap.i64(i64 [[TMP5]])
381 ; X64-NEXT: [[TMP8]] = call i64 @llvm.bswap.i64(i64 [[TMP6]])
382 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i64 [[TMP7]], [[TMP8]]
383 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
385 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[X]], i64 6
386 ; X64-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[Y]], i64 6
387 ; X64-NEXT: [[TMP14:%.*]] = load i64, ptr [[TMP10]], align 1
388 ; X64-NEXT: [[TMP15:%.*]] = load i64, ptr [[TMP11]], align 1
389 ; X64-NEXT: [[TMP16]] = call i64 @llvm.bswap.i64(i64 [[TMP14]])
390 ; X64-NEXT: [[TMP17]] = call i64 @llvm.bswap.i64(i64 [[TMP15]])
391 ; X64-NEXT: [[TMP18:%.*]] = icmp eq i64 [[TMP16]], [[TMP17]]
392 ; X64-NEXT: br i1 [[TMP18]], label [[ENDBLOCK]], label [[RES_BLOCK]]
394 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
395 ; X64-NEXT: ret i32 [[PHI_RES]]
397 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 14)
401 define i32 @cmp15(ptr nocapture readonly %x, ptr nocapture readonly %y) {
403 ; X64-NEXT: br label [[LOADBB:%.*]]
405 ; X64-NEXT: [[PHI_SRC1:%.*]] = phi i64 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP16:%.*]], [[LOADBB1:%.*]] ]
406 ; X64-NEXT: [[PHI_SRC2:%.*]] = phi i64 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP17:%.*]], [[LOADBB1]] ]
407 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i64 [[PHI_SRC1]], [[PHI_SRC2]]
408 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
409 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
411 ; X64-NEXT: [[TMP5:%.*]] = load i64, ptr [[X:%.*]], align 1
412 ; X64-NEXT: [[TMP6:%.*]] = load i64, ptr [[Y:%.*]], align 1
413 ; X64-NEXT: [[TMP7]] = call i64 @llvm.bswap.i64(i64 [[TMP5]])
414 ; X64-NEXT: [[TMP8]] = call i64 @llvm.bswap.i64(i64 [[TMP6]])
415 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i64 [[TMP7]], [[TMP8]]
416 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
418 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[X]], i64 7
419 ; X64-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[Y]], i64 7
420 ; X64-NEXT: [[TMP14:%.*]] = load i64, ptr [[TMP10]], align 1
421 ; X64-NEXT: [[TMP15:%.*]] = load i64, ptr [[TMP11]], align 1
422 ; X64-NEXT: [[TMP16]] = call i64 @llvm.bswap.i64(i64 [[TMP14]])
423 ; X64-NEXT: [[TMP17]] = call i64 @llvm.bswap.i64(i64 [[TMP15]])
424 ; X64-NEXT: [[TMP18:%.*]] = icmp eq i64 [[TMP16]], [[TMP17]]
425 ; X64-NEXT: br i1 [[TMP18]], label [[ENDBLOCK]], label [[RES_BLOCK]]
427 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
428 ; X64-NEXT: ret i32 [[PHI_RES]]
430 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 15)
434 define i32 @cmp16(ptr nocapture readonly %x, ptr nocapture readonly %y) {
436 ; X64-NEXT: br label [[LOADBB:%.*]]
438 ; X64-NEXT: [[PHI_SRC1:%.*]] = phi i64 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP16:%.*]], [[LOADBB1:%.*]] ]
439 ; X64-NEXT: [[PHI_SRC2:%.*]] = phi i64 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP17:%.*]], [[LOADBB1]] ]
440 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i64 [[PHI_SRC1]], [[PHI_SRC2]]
441 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
442 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
444 ; X64-NEXT: [[TMP5:%.*]] = load i64, ptr [[X:%.*]], align 1
445 ; X64-NEXT: [[TMP6:%.*]] = load i64, ptr [[Y:%.*]], align 1
446 ; X64-NEXT: [[TMP7]] = call i64 @llvm.bswap.i64(i64 [[TMP5]])
447 ; X64-NEXT: [[TMP8]] = call i64 @llvm.bswap.i64(i64 [[TMP6]])
448 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i64 [[TMP7]], [[TMP8]]
449 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
451 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[X]], i64 8
452 ; X64-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[Y]], i64 8
453 ; X64-NEXT: [[TMP14:%.*]] = load i64, ptr [[TMP10]], align 1
454 ; X64-NEXT: [[TMP15:%.*]] = load i64, ptr [[TMP11]], align 1
455 ; X64-NEXT: [[TMP16]] = call i64 @llvm.bswap.i64(i64 [[TMP14]])
456 ; X64-NEXT: [[TMP17]] = call i64 @llvm.bswap.i64(i64 [[TMP15]])
457 ; X64-NEXT: [[TMP18:%.*]] = icmp eq i64 [[TMP16]], [[TMP17]]
458 ; X64-NEXT: br i1 [[TMP18]], label [[ENDBLOCK]], label [[RES_BLOCK]]
460 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
461 ; X64-NEXT: ret i32 [[PHI_RES]]
463 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 16)
467 define i32 @cmp_eq2(ptr nocapture readonly %x, ptr nocapture readonly %y) {
468 ; X64-LABEL: @cmp_eq2(
469 ; X64-NEXT: [[TMP3:%.*]] = load i16, ptr [[X:%.*]], align 1
470 ; X64-NEXT: [[TMP4:%.*]] = load i16, ptr [[Y:%.*]], align 1
471 ; X64-NEXT: [[TMP5:%.*]] = icmp ne i16 [[TMP3]], [[TMP4]]
472 ; X64-NEXT: [[TMP6:%.*]] = zext i1 [[TMP5]] to i32
473 ; X64-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP6]], 0
474 ; X64-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
475 ; X64-NEXT: ret i32 [[CONV]]
477 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 2)
478 %cmp = icmp eq i32 %call, 0
479 %conv = zext i1 %cmp to i32
483 define i32 @cmp_eq3(ptr nocapture readonly %x, ptr nocapture readonly %y) {
484 ; X64_1LD-LABEL: @cmp_eq3(
485 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
486 ; X64_1LD: res_block:
487 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
489 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i16, ptr [[X:%.*]], align 1
490 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i16, ptr [[Y:%.*]], align 1
491 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i16 [[TMP3]], [[TMP4]]
492 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
494 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 2
495 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 2
496 ; X64_1LD-NEXT: [[TMP8:%.*]] = load i8, ptr [[TMP6]], align 1
497 ; X64_1LD-NEXT: [[TMP9:%.*]] = load i8, ptr [[TMP7]], align 1
498 ; X64_1LD-NEXT: [[TMP10:%.*]] = icmp ne i8 [[TMP8]], [[TMP9]]
499 ; X64_1LD-NEXT: br i1 [[TMP10]], label [[RES_BLOCK]], label [[ENDBLOCK]]
501 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
502 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
503 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
504 ; X64_1LD-NEXT: ret i32 [[CONV]]
506 ; X64_2LD-LABEL: @cmp_eq3(
507 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i16, ptr [[X:%.*]], align 1
508 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i16, ptr [[Y:%.*]], align 1
509 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i16 [[TMP3]], [[TMP4]]
510 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 2
511 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 2
512 ; X64_2LD-NEXT: [[TMP8:%.*]] = load i8, ptr [[TMP6]], align 1
513 ; X64_2LD-NEXT: [[TMP9:%.*]] = load i8, ptr [[TMP7]], align 1
514 ; X64_2LD-NEXT: [[TMP10:%.*]] = zext i8 [[TMP8]] to i16
515 ; X64_2LD-NEXT: [[TMP11:%.*]] = zext i8 [[TMP9]] to i16
516 ; X64_2LD-NEXT: [[TMP12:%.*]] = xor i16 [[TMP10]], [[TMP11]]
517 ; X64_2LD-NEXT: [[TMP13:%.*]] = or i16 [[TMP5]], [[TMP12]]
518 ; X64_2LD-NEXT: [[TMP14:%.*]] = icmp ne i16 [[TMP13]], 0
519 ; X64_2LD-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
520 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
521 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
522 ; X64_2LD-NEXT: ret i32 [[CONV]]
524 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 3)
525 %cmp = icmp eq i32 %call, 0
526 %conv = zext i1 %cmp to i32
530 define i32 @cmp_eq4(ptr nocapture readonly %x, ptr nocapture readonly %y) {
531 ; X64-LABEL: @cmp_eq4(
532 ; X64-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 1
533 ; X64-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 1
534 ; X64-NEXT: [[TMP5:%.*]] = icmp ne i32 [[TMP3]], [[TMP4]]
535 ; X64-NEXT: [[TMP6:%.*]] = zext i1 [[TMP5]] to i32
536 ; X64-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP6]], 0
537 ; X64-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
538 ; X64-NEXT: ret i32 [[CONV]]
540 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 4)
541 %cmp = icmp eq i32 %call, 0
542 %conv = zext i1 %cmp to i32
546 define i32 @cmp_eq5(ptr nocapture readonly %x, ptr nocapture readonly %y) {
547 ; X64_1LD-LABEL: @cmp_eq5(
548 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
549 ; X64_1LD: res_block:
550 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
552 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 1
553 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 1
554 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i32 [[TMP3]], [[TMP4]]
555 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
557 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 4
558 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 4
559 ; X64_1LD-NEXT: [[TMP8:%.*]] = load i8, ptr [[TMP6]], align 1
560 ; X64_1LD-NEXT: [[TMP9:%.*]] = load i8, ptr [[TMP7]], align 1
561 ; X64_1LD-NEXT: [[TMP10:%.*]] = icmp ne i8 [[TMP8]], [[TMP9]]
562 ; X64_1LD-NEXT: br i1 [[TMP10]], label [[RES_BLOCK]], label [[ENDBLOCK]]
564 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
565 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
566 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
567 ; X64_1LD-NEXT: ret i32 [[CONV]]
569 ; X64_2LD-LABEL: @cmp_eq5(
570 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 1
571 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 1
572 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
573 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 4
574 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 4
575 ; X64_2LD-NEXT: [[TMP8:%.*]] = load i8, ptr [[TMP6]], align 1
576 ; X64_2LD-NEXT: [[TMP9:%.*]] = load i8, ptr [[TMP7]], align 1
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(ptr %x, ptr %y, i64 5)
588 %cmp = icmp eq i32 %call, 0
589 %conv = zext i1 %cmp to i32
593 define i32 @cmp_eq6(ptr nocapture readonly %x, ptr nocapture readonly %y) {
594 ; X64_1LD-LABEL: @cmp_eq6(
595 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
596 ; X64_1LD: res_block:
597 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
599 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 1
600 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 1
601 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i32 [[TMP3]], [[TMP4]]
602 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
604 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 4
605 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 4
606 ; X64_1LD-NEXT: [[TMP10:%.*]] = load i16, ptr [[TMP6]], align 1
607 ; X64_1LD-NEXT: [[TMP11:%.*]] = load i16, ptr [[TMP7]], align 1
608 ; X64_1LD-NEXT: [[TMP12:%.*]] = icmp ne i16 [[TMP10]], [[TMP11]]
609 ; X64_1LD-NEXT: br i1 [[TMP12]], label [[RES_BLOCK]], label [[ENDBLOCK]]
611 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
612 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
613 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
614 ; X64_1LD-NEXT: ret i32 [[CONV]]
616 ; X64_2LD-LABEL: @cmp_eq6(
617 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 1
618 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 1
619 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
620 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 4
621 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 4
622 ; X64_2LD-NEXT: [[TMP10:%.*]] = load i16, ptr [[TMP6]], align 1
623 ; X64_2LD-NEXT: [[TMP11:%.*]] = load i16, ptr [[TMP7]], align 1
624 ; X64_2LD-NEXT: [[TMP12:%.*]] = zext i16 [[TMP10]] to i32
625 ; X64_2LD-NEXT: [[TMP13:%.*]] = zext i16 [[TMP11]] to i32
626 ; X64_2LD-NEXT: [[TMP14:%.*]] = xor i32 [[TMP12]], [[TMP13]]
627 ; X64_2LD-NEXT: [[TMP15:%.*]] = or i32 [[TMP5]], [[TMP14]]
628 ; X64_2LD-NEXT: [[TMP16:%.*]] = icmp ne i32 [[TMP15]], 0
629 ; X64_2LD-NEXT: [[TMP17:%.*]] = zext i1 [[TMP16]] to i32
630 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP17]], 0
631 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
632 ; X64_2LD-NEXT: ret i32 [[CONV]]
634 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 6)
635 %cmp = icmp eq i32 %call, 0
636 %conv = zext i1 %cmp to i32
640 define i32 @cmp_eq6_align4(ptr nocapture readonly align 4 %x, ptr nocapture readonly align 4 %y) {
641 ; X64_1LD-LABEL: @cmp_eq6_align4(
642 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
643 ; X64_1LD: res_block:
644 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
646 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 4
647 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 4
648 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i32 [[TMP3]], [[TMP4]]
649 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
651 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 4
652 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 4
653 ; X64_1LD-NEXT: [[TMP10:%.*]] = load i16, ptr [[TMP6]], align 4
654 ; X64_1LD-NEXT: [[TMP11:%.*]] = load i16, ptr [[TMP7]], align 4
655 ; X64_1LD-NEXT: [[TMP12:%.*]] = icmp ne i16 [[TMP10]], [[TMP11]]
656 ; X64_1LD-NEXT: br i1 [[TMP12]], label [[RES_BLOCK]], label [[ENDBLOCK]]
658 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
659 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
660 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
661 ; X64_1LD-NEXT: ret i32 [[CONV]]
663 ; X64_2LD-LABEL: @cmp_eq6_align4(
664 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 4
665 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 4
666 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
667 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 4
668 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 4
669 ; X64_2LD-NEXT: [[TMP10:%.*]] = load i16, ptr [[TMP6]], align 4
670 ; X64_2LD-NEXT: [[TMP11:%.*]] = load i16, ptr [[TMP7]], align 4
671 ; X64_2LD-NEXT: [[TMP12:%.*]] = zext i16 [[TMP10]] to i32
672 ; X64_2LD-NEXT: [[TMP13:%.*]] = zext i16 [[TMP11]] to i32
673 ; X64_2LD-NEXT: [[TMP14:%.*]] = xor i32 [[TMP12]], [[TMP13]]
674 ; X64_2LD-NEXT: [[TMP15:%.*]] = or i32 [[TMP5]], [[TMP14]]
675 ; X64_2LD-NEXT: [[TMP16:%.*]] = icmp ne i32 [[TMP15]], 0
676 ; X64_2LD-NEXT: [[TMP17:%.*]] = zext i1 [[TMP16]] to i32
677 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP17]], 0
678 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
679 ; X64_2LD-NEXT: ret i32 [[CONV]]
681 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 6)
682 %cmp = icmp eq i32 %call, 0
683 %conv = zext i1 %cmp to i32
687 define i32 @cmp_eq7(ptr nocapture readonly %x, ptr nocapture readonly %y) {
688 ; X64_1LD-LABEL: @cmp_eq7(
689 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
690 ; X64_1LD: res_block:
691 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
693 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 1
694 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 1
695 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i32 [[TMP3]], [[TMP4]]
696 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
698 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 3
699 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 3
700 ; X64_1LD-NEXT: [[TMP10:%.*]] = load i32, ptr [[TMP6]], align 1
701 ; X64_1LD-NEXT: [[TMP11:%.*]] = load i32, ptr [[TMP7]], align 1
702 ; X64_1LD-NEXT: [[TMP12:%.*]] = icmp ne i32 [[TMP10]], [[TMP11]]
703 ; X64_1LD-NEXT: br i1 [[TMP12]], label [[RES_BLOCK]], label [[ENDBLOCK]]
705 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
706 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
707 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
708 ; X64_1LD-NEXT: ret i32 [[CONV]]
710 ; X64_2LD-LABEL: @cmp_eq7(
711 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i32, ptr [[X:%.*]], align 1
712 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i32, ptr [[Y:%.*]], align 1
713 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
714 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 3
715 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 3
716 ; X64_2LD-NEXT: [[TMP10:%.*]] = load i32, ptr [[TMP6]], align 1
717 ; X64_2LD-NEXT: [[TMP11:%.*]] = load i32, ptr [[TMP7]], align 1
718 ; X64_2LD-NEXT: [[TMP12:%.*]] = xor i32 [[TMP10]], [[TMP11]]
719 ; X64_2LD-NEXT: [[TMP13:%.*]] = or i32 [[TMP5]], [[TMP12]]
720 ; X64_2LD-NEXT: [[TMP14:%.*]] = icmp ne i32 [[TMP13]], 0
721 ; X64_2LD-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
722 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
723 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
724 ; X64_2LD-NEXT: ret i32 [[CONV]]
726 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 7)
727 %cmp = icmp eq i32 %call, 0
728 %conv = zext i1 %cmp to i32
732 define i32 @cmp_eq8(ptr nocapture readonly %x, ptr nocapture readonly %y) {
733 ; X64-LABEL: @cmp_eq8(
734 ; X64-NEXT: [[TMP3:%.*]] = load i64, ptr [[X:%.*]], align 1
735 ; X64-NEXT: [[TMP4:%.*]] = load i64, ptr [[Y:%.*]], align 1
736 ; X64-NEXT: [[TMP5:%.*]] = icmp ne i64 [[TMP3]], [[TMP4]]
737 ; X64-NEXT: [[TMP6:%.*]] = zext i1 [[TMP5]] to i32
738 ; X64-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP6]], 0
739 ; X64-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
740 ; X64-NEXT: ret i32 [[CONV]]
742 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 8)
743 %cmp = icmp eq i32 %call, 0
744 %conv = zext i1 %cmp to i32
748 define i32 @cmp_eq9(ptr nocapture readonly %x, ptr nocapture readonly %y) {
749 ; X64_1LD-LABEL: @cmp_eq9(
750 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
751 ; X64_1LD: res_block:
752 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
754 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i64, ptr [[X:%.*]], align 1
755 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i64, ptr [[Y:%.*]], align 1
756 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i64 [[TMP3]], [[TMP4]]
757 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
759 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 8
760 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 8
761 ; X64_1LD-NEXT: [[TMP8:%.*]] = load i8, ptr [[TMP6]], align 1
762 ; X64_1LD-NEXT: [[TMP9:%.*]] = load i8, ptr [[TMP7]], align 1
763 ; X64_1LD-NEXT: [[TMP10:%.*]] = icmp ne i8 [[TMP8]], [[TMP9]]
764 ; X64_1LD-NEXT: br i1 [[TMP10]], label [[RES_BLOCK]], label [[ENDBLOCK]]
766 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
767 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
768 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
769 ; X64_1LD-NEXT: ret i32 [[CONV]]
771 ; X64_2LD-LABEL: @cmp_eq9(
772 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i64, ptr [[X:%.*]], align 1
773 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i64, ptr [[Y:%.*]], align 1
774 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i64 [[TMP3]], [[TMP4]]
775 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 8
776 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 8
777 ; X64_2LD-NEXT: [[TMP8:%.*]] = load i8, ptr [[TMP6]], align 1
778 ; X64_2LD-NEXT: [[TMP9:%.*]] = load i8, ptr [[TMP7]], align 1
779 ; X64_2LD-NEXT: [[TMP10:%.*]] = zext i8 [[TMP8]] to i64
780 ; X64_2LD-NEXT: [[TMP11:%.*]] = zext i8 [[TMP9]] to i64
781 ; X64_2LD-NEXT: [[TMP12:%.*]] = xor i64 [[TMP10]], [[TMP11]]
782 ; X64_2LD-NEXT: [[TMP13:%.*]] = or i64 [[TMP5]], [[TMP12]]
783 ; X64_2LD-NEXT: [[TMP14:%.*]] = icmp ne i64 [[TMP13]], 0
784 ; X64_2LD-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
785 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
786 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
787 ; X64_2LD-NEXT: ret i32 [[CONV]]
789 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 9)
790 %cmp = icmp eq i32 %call, 0
791 %conv = zext i1 %cmp to i32
795 define i32 @cmp_eq10(ptr nocapture readonly %x, ptr nocapture readonly %y) {
796 ; X64_1LD-LABEL: @cmp_eq10(
797 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
798 ; X64_1LD: res_block:
799 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
801 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i64, ptr [[X:%.*]], align 1
802 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i64, ptr [[Y:%.*]], align 1
803 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i64 [[TMP3]], [[TMP4]]
804 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
806 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 8
807 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 8
808 ; X64_1LD-NEXT: [[TMP10:%.*]] = load i16, ptr [[TMP6]], align 1
809 ; X64_1LD-NEXT: [[TMP11:%.*]] = load i16, ptr [[TMP7]], align 1
810 ; X64_1LD-NEXT: [[TMP12:%.*]] = icmp ne i16 [[TMP10]], [[TMP11]]
811 ; X64_1LD-NEXT: br i1 [[TMP12]], label [[RES_BLOCK]], label [[ENDBLOCK]]
813 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
814 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
815 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
816 ; X64_1LD-NEXT: ret i32 [[CONV]]
818 ; X64_2LD-LABEL: @cmp_eq10(
819 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i64, ptr [[X:%.*]], align 1
820 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i64, ptr [[Y:%.*]], align 1
821 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i64 [[TMP3]], [[TMP4]]
822 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 8
823 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 8
824 ; X64_2LD-NEXT: [[TMP10:%.*]] = load i16, ptr [[TMP6]], align 1
825 ; X64_2LD-NEXT: [[TMP11:%.*]] = load i16, ptr [[TMP7]], align 1
826 ; X64_2LD-NEXT: [[TMP12:%.*]] = zext i16 [[TMP10]] to i64
827 ; X64_2LD-NEXT: [[TMP13:%.*]] = zext i16 [[TMP11]] to i64
828 ; X64_2LD-NEXT: [[TMP14:%.*]] = xor i64 [[TMP12]], [[TMP13]]
829 ; X64_2LD-NEXT: [[TMP15:%.*]] = or i64 [[TMP5]], [[TMP14]]
830 ; X64_2LD-NEXT: [[TMP16:%.*]] = icmp ne i64 [[TMP15]], 0
831 ; X64_2LD-NEXT: [[TMP17:%.*]] = zext i1 [[TMP16]] to i32
832 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP17]], 0
833 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
834 ; X64_2LD-NEXT: ret i32 [[CONV]]
836 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 10)
837 %cmp = icmp eq i32 %call, 0
838 %conv = zext i1 %cmp to i32
842 define i32 @cmp_eq11(ptr nocapture readonly %x, ptr nocapture readonly %y) {
843 ; X64_1LD-LABEL: @cmp_eq11(
844 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
845 ; X64_1LD: res_block:
846 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
848 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i64, ptr [[X:%.*]], align 1
849 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i64, ptr [[Y:%.*]], align 1
850 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i64 [[TMP3]], [[TMP4]]
851 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
853 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 3
854 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 3
855 ; X64_1LD-NEXT: [[TMP10:%.*]] = load i64, ptr [[TMP6]], align 1
856 ; X64_1LD-NEXT: [[TMP11:%.*]] = load i64, ptr [[TMP7]], align 1
857 ; X64_1LD-NEXT: [[TMP12:%.*]] = icmp ne i64 [[TMP10]], [[TMP11]]
858 ; X64_1LD-NEXT: br i1 [[TMP12]], label [[RES_BLOCK]], label [[ENDBLOCK]]
860 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
861 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
862 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
863 ; X64_1LD-NEXT: ret i32 [[CONV]]
865 ; X64_2LD-LABEL: @cmp_eq11(
866 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i64, ptr [[X:%.*]], align 1
867 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i64, ptr [[Y:%.*]], align 1
868 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i64 [[TMP3]], [[TMP4]]
869 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 3
870 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 3
871 ; X64_2LD-NEXT: [[TMP10:%.*]] = load i64, ptr [[TMP6]], align 1
872 ; X64_2LD-NEXT: [[TMP11:%.*]] = load i64, ptr [[TMP7]], align 1
873 ; X64_2LD-NEXT: [[TMP12:%.*]] = xor i64 [[TMP10]], [[TMP11]]
874 ; X64_2LD-NEXT: [[TMP13:%.*]] = or i64 [[TMP5]], [[TMP12]]
875 ; X64_2LD-NEXT: [[TMP14:%.*]] = icmp ne i64 [[TMP13]], 0
876 ; X64_2LD-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
877 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
878 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
879 ; X64_2LD-NEXT: ret i32 [[CONV]]
881 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 11)
882 %cmp = icmp eq i32 %call, 0
883 %conv = zext i1 %cmp to i32
887 define i32 @cmp_eq12(ptr nocapture readonly %x, ptr nocapture readonly %y) {
888 ; X64_1LD-LABEL: @cmp_eq12(
889 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
890 ; X64_1LD: res_block:
891 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
893 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i64, ptr [[X:%.*]], align 1
894 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i64, ptr [[Y:%.*]], align 1
895 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i64 [[TMP3]], [[TMP4]]
896 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
898 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 8
899 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 8
900 ; X64_1LD-NEXT: [[TMP10:%.*]] = load i32, ptr [[TMP6]], align 1
901 ; X64_1LD-NEXT: [[TMP11:%.*]] = load i32, ptr [[TMP7]], align 1
902 ; X64_1LD-NEXT: [[TMP12:%.*]] = icmp ne i32 [[TMP10]], [[TMP11]]
903 ; X64_1LD-NEXT: br i1 [[TMP12]], label [[RES_BLOCK]], label [[ENDBLOCK]]
905 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
906 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
907 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
908 ; X64_1LD-NEXT: ret i32 [[CONV]]
910 ; X64_2LD-LABEL: @cmp_eq12(
911 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i64, ptr [[X:%.*]], align 1
912 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i64, ptr [[Y:%.*]], align 1
913 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i64 [[TMP3]], [[TMP4]]
914 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 8
915 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 8
916 ; X64_2LD-NEXT: [[TMP10:%.*]] = load i32, ptr [[TMP6]], align 1
917 ; X64_2LD-NEXT: [[TMP11:%.*]] = load i32, ptr [[TMP7]], align 1
918 ; X64_2LD-NEXT: [[TMP12:%.*]] = zext i32 [[TMP10]] to i64
919 ; X64_2LD-NEXT: [[TMP13:%.*]] = zext i32 [[TMP11]] to i64
920 ; X64_2LD-NEXT: [[TMP14:%.*]] = xor i64 [[TMP12]], [[TMP13]]
921 ; X64_2LD-NEXT: [[TMP15:%.*]] = or i64 [[TMP5]], [[TMP14]]
922 ; X64_2LD-NEXT: [[TMP16:%.*]] = icmp ne i64 [[TMP15]], 0
923 ; X64_2LD-NEXT: [[TMP17:%.*]] = zext i1 [[TMP16]] to i32
924 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP17]], 0
925 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
926 ; X64_2LD-NEXT: ret i32 [[CONV]]
928 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 12)
929 %cmp = icmp eq i32 %call, 0
930 %conv = zext i1 %cmp to i32
934 define i32 @cmp_eq13(ptr nocapture readonly %x, ptr nocapture readonly %y) {
935 ; X64_1LD-LABEL: @cmp_eq13(
936 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
937 ; X64_1LD: res_block:
938 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
940 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i64, ptr [[X:%.*]], align 1
941 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i64, ptr [[Y:%.*]], align 1
942 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i64 [[TMP3]], [[TMP4]]
943 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
945 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 5
946 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 5
947 ; X64_1LD-NEXT: [[TMP10:%.*]] = load i64, ptr [[TMP6]], align 1
948 ; X64_1LD-NEXT: [[TMP11:%.*]] = load i64, ptr [[TMP7]], align 1
949 ; X64_1LD-NEXT: [[TMP12:%.*]] = icmp ne i64 [[TMP10]], [[TMP11]]
950 ; X64_1LD-NEXT: br i1 [[TMP12]], label [[RES_BLOCK]], label [[ENDBLOCK]]
952 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
953 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
954 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
955 ; X64_1LD-NEXT: ret i32 [[CONV]]
957 ; X64_2LD-LABEL: @cmp_eq13(
958 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i64, ptr [[X:%.*]], align 1
959 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i64, ptr [[Y:%.*]], align 1
960 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i64 [[TMP3]], [[TMP4]]
961 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 5
962 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 5
963 ; X64_2LD-NEXT: [[TMP10:%.*]] = load i64, ptr [[TMP6]], align 1
964 ; X64_2LD-NEXT: [[TMP11:%.*]] = load i64, ptr [[TMP7]], align 1
965 ; X64_2LD-NEXT: [[TMP12:%.*]] = xor i64 [[TMP10]], [[TMP11]]
966 ; X64_2LD-NEXT: [[TMP13:%.*]] = or i64 [[TMP5]], [[TMP12]]
967 ; X64_2LD-NEXT: [[TMP14:%.*]] = icmp ne i64 [[TMP13]], 0
968 ; X64_2LD-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
969 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
970 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
971 ; X64_2LD-NEXT: ret i32 [[CONV]]
973 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 13)
974 %cmp = icmp eq i32 %call, 0
975 %conv = zext i1 %cmp to i32
979 define i32 @cmp_eq14(ptr nocapture readonly %x, ptr nocapture readonly %y) {
980 ; X64_1LD-LABEL: @cmp_eq14(
981 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
982 ; X64_1LD: res_block:
983 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
985 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i64, ptr [[X:%.*]], align 1
986 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i64, ptr [[Y:%.*]], align 1
987 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i64 [[TMP3]], [[TMP4]]
988 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
990 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 6
991 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 6
992 ; X64_1LD-NEXT: [[TMP10:%.*]] = load i64, ptr [[TMP6]], align 1
993 ; X64_1LD-NEXT: [[TMP11:%.*]] = load i64, ptr [[TMP7]], align 1
994 ; X64_1LD-NEXT: [[TMP12:%.*]] = icmp ne i64 [[TMP10]], [[TMP11]]
995 ; X64_1LD-NEXT: br i1 [[TMP12]], label [[RES_BLOCK]], label [[ENDBLOCK]]
997 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
998 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
999 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
1000 ; X64_1LD-NEXT: ret i32 [[CONV]]
1002 ; X64_2LD-LABEL: @cmp_eq14(
1003 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i64, ptr [[X:%.*]], align 1
1004 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i64, ptr [[Y:%.*]], align 1
1005 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i64 [[TMP3]], [[TMP4]]
1006 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 6
1007 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 6
1008 ; X64_2LD-NEXT: [[TMP10:%.*]] = load i64, ptr [[TMP6]], align 1
1009 ; X64_2LD-NEXT: [[TMP11:%.*]] = load i64, ptr [[TMP7]], align 1
1010 ; X64_2LD-NEXT: [[TMP12:%.*]] = xor i64 [[TMP10]], [[TMP11]]
1011 ; X64_2LD-NEXT: [[TMP13:%.*]] = or i64 [[TMP5]], [[TMP12]]
1012 ; X64_2LD-NEXT: [[TMP14:%.*]] = icmp ne i64 [[TMP13]], 0
1013 ; X64_2LD-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
1014 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
1015 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
1016 ; X64_2LD-NEXT: ret i32 [[CONV]]
1018 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 14)
1019 %cmp = icmp eq i32 %call, 0
1020 %conv = zext i1 %cmp to i32
1024 define i32 @cmp_eq15(ptr nocapture readonly %x, ptr nocapture readonly %y) {
1025 ; X64_1LD-LABEL: @cmp_eq15(
1026 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
1027 ; X64_1LD: res_block:
1028 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
1030 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i64, ptr [[X:%.*]], align 1
1031 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i64, ptr [[Y:%.*]], align 1
1032 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i64 [[TMP3]], [[TMP4]]
1033 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
1035 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 7
1036 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 7
1037 ; X64_1LD-NEXT: [[TMP10:%.*]] = load i64, ptr [[TMP6]], align 1
1038 ; X64_1LD-NEXT: [[TMP11:%.*]] = load i64, ptr [[TMP7]], align 1
1039 ; X64_1LD-NEXT: [[TMP12:%.*]] = icmp ne i64 [[TMP10]], [[TMP11]]
1040 ; X64_1LD-NEXT: br i1 [[TMP12]], label [[RES_BLOCK]], label [[ENDBLOCK]]
1041 ; X64_1LD: endblock:
1042 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
1043 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
1044 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
1045 ; X64_1LD-NEXT: ret i32 [[CONV]]
1047 ; X64_2LD-LABEL: @cmp_eq15(
1048 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i64, ptr [[X:%.*]], align 1
1049 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i64, ptr [[Y:%.*]], align 1
1050 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i64 [[TMP3]], [[TMP4]]
1051 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, ptr [[X]], i64 7
1052 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, ptr [[Y]], i64 7
1053 ; X64_2LD-NEXT: [[TMP10:%.*]] = load i64, ptr [[TMP6]], align 1
1054 ; X64_2LD-NEXT: [[TMP11:%.*]] = load i64, ptr [[TMP7]], align 1
1055 ; X64_2LD-NEXT: [[TMP12:%.*]] = xor i64 [[TMP10]], [[TMP11]]
1056 ; X64_2LD-NEXT: [[TMP13:%.*]] = or i64 [[TMP5]], [[TMP12]]
1057 ; X64_2LD-NEXT: [[TMP14:%.*]] = icmp ne i64 [[TMP13]], 0
1058 ; X64_2LD-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
1059 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
1060 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
1061 ; X64_2LD-NEXT: ret i32 [[CONV]]
1063 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 15)
1064 %cmp = icmp eq i32 %call, 0
1065 %conv = zext i1 %cmp to i32
1069 define i32 @cmp_eq16(ptr nocapture readonly %x, ptr nocapture readonly %y) {
1070 ; X64-LABEL: @cmp_eq16(
1071 ; X64-NEXT: [[TMP3:%.*]] = load i128, ptr [[X:%.*]], align 1
1072 ; X64-NEXT: [[TMP4:%.*]] = load i128, ptr [[Y:%.*]], align 1
1073 ; X64-NEXT: [[TMP5:%.*]] = icmp ne i128 [[TMP3]], [[TMP4]]
1074 ; X64-NEXT: [[TMP6:%.*]] = zext i1 [[TMP5]] to i32
1075 ; X64-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP6]], 0
1076 ; X64-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
1077 ; X64-NEXT: ret i32 [[CONV]]
1079 %call = tail call i32 @memcmp(ptr %x, ptr %y, i64 16)
1080 %cmp = icmp eq i32 %call, 0
1081 %conv = zext i1 %cmp to i32