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(i8* nocapture, i8* nocapture, i64)
7 define i32 @cmp2(i8* nocapture readonly %x, i8* nocapture readonly %y) {
9 ; X64-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i16*
10 ; X64-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i16*
11 ; X64-NEXT: [[TMP3:%.*]] = load i16, i16* [[TMP1]], align 1
12 ; X64-NEXT: [[TMP4:%.*]] = load i16, i16* [[TMP2]], align 1
13 ; X64-NEXT: [[TMP5:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP3]])
14 ; X64-NEXT: [[TMP6:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP4]])
15 ; X64-NEXT: [[TMP7:%.*]] = zext i16 [[TMP5]] to i32
16 ; X64-NEXT: [[TMP8:%.*]] = zext i16 [[TMP6]] to i32
17 ; X64-NEXT: [[TMP9:%.*]] = sub i32 [[TMP7]], [[TMP8]]
18 ; X64-NEXT: ret i32 [[TMP9]]
20 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 2)
24 define i32 @cmp2_align2(i8* nocapture readonly align 2 %x, i8* nocapture readonly align 2 %y) {
25 ; X64-LABEL: @cmp2_align2(
26 ; X64-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i16*
27 ; X64-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i16*
28 ; X64-NEXT: [[TMP3:%.*]] = load i16, i16* [[TMP1]], align 2
29 ; X64-NEXT: [[TMP4:%.*]] = load i16, i16* [[TMP2]], align 2
30 ; X64-NEXT: [[TMP5:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP3]])
31 ; X64-NEXT: [[TMP6:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP4]])
32 ; X64-NEXT: [[TMP7:%.*]] = zext i16 [[TMP5]] to i32
33 ; X64-NEXT: [[TMP8:%.*]] = zext i16 [[TMP6]] to i32
34 ; X64-NEXT: [[TMP9:%.*]] = sub i32 [[TMP7]], [[TMP8]]
35 ; X64-NEXT: ret i32 [[TMP9]]
37 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 2)
41 define i32 @cmp3(i8* nocapture readonly %x, i8* nocapture readonly %y) {
43 ; X64-NEXT: br label [[LOADBB:%.*]]
45 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i16 [[TMP7:%.*]], [[TMP8:%.*]]
46 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
47 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
49 ; X64-NEXT: [[TMP3:%.*]] = bitcast i8* [[X:%.*]] to i16*
50 ; X64-NEXT: [[TMP4:%.*]] = bitcast i8* [[Y:%.*]] to i16*
51 ; X64-NEXT: [[TMP5:%.*]] = load i16, i16* [[TMP3]], align 1
52 ; X64-NEXT: [[TMP6:%.*]] = load i16, i16* [[TMP4]], align 1
53 ; X64-NEXT: [[TMP7]] = call i16 @llvm.bswap.i16(i16 [[TMP5]])
54 ; X64-NEXT: [[TMP8]] = call i16 @llvm.bswap.i16(i16 [[TMP6]])
55 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i16 [[TMP7]], [[TMP8]]
56 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1:%.*]], label [[RES_BLOCK:%.*]]
58 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, i8* [[X]], i64 2
59 ; X64-NEXT: [[TMP11:%.*]] = getelementptr i8, i8* [[Y]], i64 2
60 ; X64-NEXT: [[TMP12:%.*]] = load i8, i8* [[TMP10]], align 1
61 ; X64-NEXT: [[TMP13:%.*]] = load i8, i8* [[TMP11]], align 1
62 ; X64-NEXT: [[TMP14:%.*]] = zext i8 [[TMP12]] to i32
63 ; X64-NEXT: [[TMP15:%.*]] = zext i8 [[TMP13]] to i32
64 ; X64-NEXT: [[TMP16:%.*]] = sub i32 [[TMP14]], [[TMP15]]
65 ; X64-NEXT: br label [[ENDBLOCK]]
67 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ [[TMP16]], [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
68 ; X64-NEXT: ret i32 [[PHI_RES]]
70 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 3)
74 define i32 @cmp4(i8* nocapture readonly %x, i8* nocapture readonly %y) {
76 ; X64-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
77 ; X64-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
78 ; X64-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]], align 1
79 ; X64-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]], align 1
80 ; X64-NEXT: [[TMP5:%.*]] = call i32 @llvm.bswap.i32(i32 [[TMP3]])
81 ; X64-NEXT: [[TMP6:%.*]] = call i32 @llvm.bswap.i32(i32 [[TMP4]])
82 ; X64-NEXT: [[TMP7:%.*]] = icmp ugt i32 [[TMP5]], [[TMP6]]
83 ; X64-NEXT: [[TMP8:%.*]] = icmp ult i32 [[TMP5]], [[TMP6]]
84 ; X64-NEXT: [[TMP9:%.*]] = zext i1 [[TMP7]] to i32
85 ; X64-NEXT: [[TMP10:%.*]] = zext i1 [[TMP8]] to i32
86 ; X64-NEXT: [[TMP11:%.*]] = sub i32 [[TMP9]], [[TMP10]]
87 ; X64-NEXT: ret i32 [[TMP11]]
89 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 4)
93 define i32 @cmp5(i8* nocapture readonly %x, i8* nocapture readonly %y) {
95 ; X64-NEXT: br label [[LOADBB:%.*]]
97 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i32 [[TMP7:%.*]], [[TMP8:%.*]]
98 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
99 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
101 ; X64-NEXT: [[TMP3:%.*]] = bitcast i8* [[X:%.*]] to i32*
102 ; X64-NEXT: [[TMP4:%.*]] = bitcast i8* [[Y:%.*]] to i32*
103 ; X64-NEXT: [[TMP5:%.*]] = load i32, i32* [[TMP3]], align 1
104 ; X64-NEXT: [[TMP6:%.*]] = load i32, i32* [[TMP4]], align 1
105 ; X64-NEXT: [[TMP7]] = call i32 @llvm.bswap.i32(i32 [[TMP5]])
106 ; X64-NEXT: [[TMP8]] = call i32 @llvm.bswap.i32(i32 [[TMP6]])
107 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP7]], [[TMP8]]
108 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1:%.*]], label [[RES_BLOCK:%.*]]
110 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, i8* [[X]], i64 4
111 ; X64-NEXT: [[TMP11:%.*]] = getelementptr i8, i8* [[Y]], i64 4
112 ; X64-NEXT: [[TMP12:%.*]] = load i8, i8* [[TMP10]], align 1
113 ; X64-NEXT: [[TMP13:%.*]] = load i8, i8* [[TMP11]], align 1
114 ; X64-NEXT: [[TMP14:%.*]] = zext i8 [[TMP12]] to i32
115 ; X64-NEXT: [[TMP15:%.*]] = zext i8 [[TMP13]] to i32
116 ; X64-NEXT: [[TMP16:%.*]] = sub i32 [[TMP14]], [[TMP15]]
117 ; X64-NEXT: br label [[ENDBLOCK]]
119 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ [[TMP16]], [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
120 ; X64-NEXT: ret i32 [[PHI_RES]]
122 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 5)
126 define i32 @cmp6(i8* nocapture readonly %x, i8* nocapture readonly %y) {
128 ; X64-NEXT: br label [[LOADBB:%.*]]
130 ; X64-NEXT: [[PHI_SRC1:%.*]] = phi i32 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP18:%.*]], [[LOADBB1:%.*]] ]
131 ; X64-NEXT: [[PHI_SRC2:%.*]] = phi i32 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP19:%.*]], [[LOADBB1]] ]
132 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i32 [[PHI_SRC1]], [[PHI_SRC2]]
133 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
134 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
136 ; X64-NEXT: [[TMP3:%.*]] = bitcast i8* [[X:%.*]] to i32*
137 ; X64-NEXT: [[TMP4:%.*]] = bitcast i8* [[Y:%.*]] to i32*
138 ; X64-NEXT: [[TMP5:%.*]] = load i32, i32* [[TMP3]], align 1
139 ; X64-NEXT: [[TMP6:%.*]] = load i32, i32* [[TMP4]], align 1
140 ; X64-NEXT: [[TMP7]] = call i32 @llvm.bswap.i32(i32 [[TMP5]])
141 ; X64-NEXT: [[TMP8]] = call i32 @llvm.bswap.i32(i32 [[TMP6]])
142 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP7]], [[TMP8]]
143 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
145 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, i8* [[X]], i64 4
146 ; X64-NEXT: [[TMP11:%.*]] = getelementptr i8, i8* [[Y]], i64 4
147 ; X64-NEXT: [[TMP12:%.*]] = bitcast i8* [[TMP10]] to i16*
148 ; X64-NEXT: [[TMP13:%.*]] = bitcast i8* [[TMP11]] to i16*
149 ; X64-NEXT: [[TMP14:%.*]] = load i16, i16* [[TMP12]], align 1
150 ; X64-NEXT: [[TMP15:%.*]] = load i16, i16* [[TMP13]], align 1
151 ; X64-NEXT: [[TMP16:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP14]])
152 ; X64-NEXT: [[TMP17:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP15]])
153 ; X64-NEXT: [[TMP18]] = zext i16 [[TMP16]] to i32
154 ; X64-NEXT: [[TMP19]] = zext i16 [[TMP17]] to i32
155 ; X64-NEXT: [[TMP20:%.*]] = icmp eq i32 [[TMP18]], [[TMP19]]
156 ; X64-NEXT: br i1 [[TMP20]], label [[ENDBLOCK]], label [[RES_BLOCK]]
158 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
159 ; X64-NEXT: ret i32 [[PHI_RES]]
161 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 6)
165 define i32 @cmp7(i8* nocapture readonly %x, i8* nocapture readonly %y) {
167 ; X64-NEXT: br label [[LOADBB:%.*]]
169 ; X64-NEXT: [[PHI_SRC1:%.*]] = phi i32 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP16:%.*]], [[LOADBB1:%.*]] ]
170 ; X64-NEXT: [[PHI_SRC2:%.*]] = phi i32 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP17:%.*]], [[LOADBB1]] ]
171 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i32 [[PHI_SRC1]], [[PHI_SRC2]]
172 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
173 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
175 ; X64-NEXT: [[TMP3:%.*]] = bitcast i8* [[X:%.*]] to i32*
176 ; X64-NEXT: [[TMP4:%.*]] = bitcast i8* [[Y:%.*]] to i32*
177 ; X64-NEXT: [[TMP5:%.*]] = load i32, i32* [[TMP3]], align 1
178 ; X64-NEXT: [[TMP6:%.*]] = load i32, i32* [[TMP4]], align 1
179 ; X64-NEXT: [[TMP7]] = call i32 @llvm.bswap.i32(i32 [[TMP5]])
180 ; X64-NEXT: [[TMP8]] = call i32 @llvm.bswap.i32(i32 [[TMP6]])
181 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP7]], [[TMP8]]
182 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
184 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, i8* [[X]], i64 3
185 ; X64-NEXT: [[TMP11:%.*]] = getelementptr i8, i8* [[Y]], i64 3
186 ; X64-NEXT: [[TMP12:%.*]] = bitcast i8* [[TMP10]] to i32*
187 ; X64-NEXT: [[TMP13:%.*]] = bitcast i8* [[TMP11]] to i32*
188 ; X64-NEXT: [[TMP14:%.*]] = load i32, i32* [[TMP12]], align 1
189 ; X64-NEXT: [[TMP15:%.*]] = load i32, i32* [[TMP13]], align 1
190 ; X64-NEXT: [[TMP16]] = call i32 @llvm.bswap.i32(i32 [[TMP14]])
191 ; X64-NEXT: [[TMP17]] = call i32 @llvm.bswap.i32(i32 [[TMP15]])
192 ; X64-NEXT: [[TMP18:%.*]] = icmp eq i32 [[TMP16]], [[TMP17]]
193 ; X64-NEXT: br i1 [[TMP18]], label [[ENDBLOCK]], label [[RES_BLOCK]]
195 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
196 ; X64-NEXT: ret i32 [[PHI_RES]]
198 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 7)
202 define i32 @cmp8(i8* nocapture readonly %x, i8* nocapture readonly %y) {
204 ; X64-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
205 ; X64-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
206 ; X64-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]], align 1
207 ; X64-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]], align 1
208 ; X64-NEXT: [[TMP5:%.*]] = call i64 @llvm.bswap.i64(i64 [[TMP3]])
209 ; X64-NEXT: [[TMP6:%.*]] = call i64 @llvm.bswap.i64(i64 [[TMP4]])
210 ; X64-NEXT: [[TMP7:%.*]] = icmp ugt i64 [[TMP5]], [[TMP6]]
211 ; X64-NEXT: [[TMP8:%.*]] = icmp ult i64 [[TMP5]], [[TMP6]]
212 ; X64-NEXT: [[TMP9:%.*]] = zext i1 [[TMP7]] to i32
213 ; X64-NEXT: [[TMP10:%.*]] = zext i1 [[TMP8]] to i32
214 ; X64-NEXT: [[TMP11:%.*]] = sub i32 [[TMP9]], [[TMP10]]
215 ; X64-NEXT: ret i32 [[TMP11]]
217 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 8)
221 define i32 @cmp9(i8* nocapture readonly %x, i8* nocapture readonly %y) {
223 ; X64-NEXT: br label [[LOADBB:%.*]]
225 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i64 [[TMP7:%.*]], [[TMP8:%.*]]
226 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
227 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
229 ; X64-NEXT: [[TMP3:%.*]] = bitcast i8* [[X:%.*]] to i64*
230 ; X64-NEXT: [[TMP4:%.*]] = bitcast i8* [[Y:%.*]] to i64*
231 ; X64-NEXT: [[TMP5:%.*]] = load i64, i64* [[TMP3]], align 1
232 ; X64-NEXT: [[TMP6:%.*]] = load i64, i64* [[TMP4]], align 1
233 ; X64-NEXT: [[TMP7]] = call i64 @llvm.bswap.i64(i64 [[TMP5]])
234 ; X64-NEXT: [[TMP8]] = call i64 @llvm.bswap.i64(i64 [[TMP6]])
235 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i64 [[TMP7]], [[TMP8]]
236 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1:%.*]], label [[RES_BLOCK:%.*]]
238 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, i8* [[X]], i64 8
239 ; X64-NEXT: [[TMP11:%.*]] = getelementptr i8, i8* [[Y]], i64 8
240 ; X64-NEXT: [[TMP12:%.*]] = load i8, i8* [[TMP10]], align 1
241 ; X64-NEXT: [[TMP13:%.*]] = load i8, i8* [[TMP11]], align 1
242 ; X64-NEXT: [[TMP14:%.*]] = zext i8 [[TMP12]] to i32
243 ; X64-NEXT: [[TMP15:%.*]] = zext i8 [[TMP13]] to i32
244 ; X64-NEXT: [[TMP16:%.*]] = sub i32 [[TMP14]], [[TMP15]]
245 ; X64-NEXT: br label [[ENDBLOCK]]
247 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ [[TMP16]], [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
248 ; X64-NEXT: ret i32 [[PHI_RES]]
250 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 9)
254 define i32 @cmp10(i8* nocapture readonly %x, i8* nocapture readonly %y) {
256 ; X64-NEXT: br label [[LOADBB:%.*]]
258 ; X64-NEXT: [[PHI_SRC1:%.*]] = phi i64 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP18:%.*]], [[LOADBB1:%.*]] ]
259 ; X64-NEXT: [[PHI_SRC2:%.*]] = phi i64 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP19:%.*]], [[LOADBB1]] ]
260 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i64 [[PHI_SRC1]], [[PHI_SRC2]]
261 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
262 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
264 ; X64-NEXT: [[TMP3:%.*]] = bitcast i8* [[X:%.*]] to i64*
265 ; X64-NEXT: [[TMP4:%.*]] = bitcast i8* [[Y:%.*]] to i64*
266 ; X64-NEXT: [[TMP5:%.*]] = load i64, i64* [[TMP3]], align 1
267 ; X64-NEXT: [[TMP6:%.*]] = load i64, i64* [[TMP4]], align 1
268 ; X64-NEXT: [[TMP7]] = call i64 @llvm.bswap.i64(i64 [[TMP5]])
269 ; X64-NEXT: [[TMP8]] = call i64 @llvm.bswap.i64(i64 [[TMP6]])
270 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i64 [[TMP7]], [[TMP8]]
271 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
273 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, i8* [[X]], i64 8
274 ; X64-NEXT: [[TMP11:%.*]] = getelementptr i8, i8* [[Y]], i64 8
275 ; X64-NEXT: [[TMP12:%.*]] = bitcast i8* [[TMP10]] to i16*
276 ; X64-NEXT: [[TMP13:%.*]] = bitcast i8* [[TMP11]] to i16*
277 ; X64-NEXT: [[TMP14:%.*]] = load i16, i16* [[TMP12]], align 1
278 ; X64-NEXT: [[TMP15:%.*]] = load i16, i16* [[TMP13]], align 1
279 ; X64-NEXT: [[TMP16:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP14]])
280 ; X64-NEXT: [[TMP17:%.*]] = call i16 @llvm.bswap.i16(i16 [[TMP15]])
281 ; X64-NEXT: [[TMP18]] = zext i16 [[TMP16]] to i64
282 ; X64-NEXT: [[TMP19]] = zext i16 [[TMP17]] to i64
283 ; X64-NEXT: [[TMP20:%.*]] = icmp eq i64 [[TMP18]], [[TMP19]]
284 ; X64-NEXT: br i1 [[TMP20]], label [[ENDBLOCK]], label [[RES_BLOCK]]
286 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
287 ; X64-NEXT: ret i32 [[PHI_RES]]
289 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 10)
293 define i32 @cmp11(i8* nocapture readonly %x, i8* nocapture readonly %y) {
295 ; X64-NEXT: br label [[LOADBB:%.*]]
297 ; X64-NEXT: [[PHI_SRC1:%.*]] = phi i64 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP16:%.*]], [[LOADBB1:%.*]] ]
298 ; X64-NEXT: [[PHI_SRC2:%.*]] = phi i64 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP17:%.*]], [[LOADBB1]] ]
299 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i64 [[PHI_SRC1]], [[PHI_SRC2]]
300 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
301 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
303 ; X64-NEXT: [[TMP3:%.*]] = bitcast i8* [[X:%.*]] to i64*
304 ; X64-NEXT: [[TMP4:%.*]] = bitcast i8* [[Y:%.*]] to i64*
305 ; X64-NEXT: [[TMP5:%.*]] = load i64, i64* [[TMP3]], align 1
306 ; X64-NEXT: [[TMP6:%.*]] = load i64, i64* [[TMP4]], align 1
307 ; X64-NEXT: [[TMP7]] = call i64 @llvm.bswap.i64(i64 [[TMP5]])
308 ; X64-NEXT: [[TMP8]] = call i64 @llvm.bswap.i64(i64 [[TMP6]])
309 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i64 [[TMP7]], [[TMP8]]
310 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
312 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, i8* [[X]], i64 3
313 ; X64-NEXT: [[TMP11:%.*]] = getelementptr i8, i8* [[Y]], i64 3
314 ; X64-NEXT: [[TMP12:%.*]] = bitcast i8* [[TMP10]] to i64*
315 ; X64-NEXT: [[TMP13:%.*]] = bitcast i8* [[TMP11]] to i64*
316 ; X64-NEXT: [[TMP14:%.*]] = load i64, i64* [[TMP12]], align 1
317 ; X64-NEXT: [[TMP15:%.*]] = load i64, i64* [[TMP13]], align 1
318 ; X64-NEXT: [[TMP16]] = call i64 @llvm.bswap.i64(i64 [[TMP14]])
319 ; X64-NEXT: [[TMP17]] = call i64 @llvm.bswap.i64(i64 [[TMP15]])
320 ; X64-NEXT: [[TMP18:%.*]] = icmp eq i64 [[TMP16]], [[TMP17]]
321 ; X64-NEXT: br i1 [[TMP18]], label [[ENDBLOCK]], label [[RES_BLOCK]]
323 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
324 ; X64-NEXT: ret i32 [[PHI_RES]]
326 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 11)
330 define i32 @cmp12(i8* nocapture readonly %x, i8* nocapture readonly %y) {
332 ; X64-NEXT: br label [[LOADBB:%.*]]
334 ; X64-NEXT: [[PHI_SRC1:%.*]] = phi i64 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP18:%.*]], [[LOADBB1:%.*]] ]
335 ; X64-NEXT: [[PHI_SRC2:%.*]] = phi i64 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP19:%.*]], [[LOADBB1]] ]
336 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i64 [[PHI_SRC1]], [[PHI_SRC2]]
337 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
338 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
340 ; X64-NEXT: [[TMP3:%.*]] = bitcast i8* [[X:%.*]] to i64*
341 ; X64-NEXT: [[TMP4:%.*]] = bitcast i8* [[Y:%.*]] to i64*
342 ; X64-NEXT: [[TMP5:%.*]] = load i64, i64* [[TMP3]], align 1
343 ; X64-NEXT: [[TMP6:%.*]] = load i64, i64* [[TMP4]], align 1
344 ; X64-NEXT: [[TMP7]] = call i64 @llvm.bswap.i64(i64 [[TMP5]])
345 ; X64-NEXT: [[TMP8]] = call i64 @llvm.bswap.i64(i64 [[TMP6]])
346 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i64 [[TMP7]], [[TMP8]]
347 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
349 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, i8* [[X]], i64 8
350 ; X64-NEXT: [[TMP11:%.*]] = getelementptr i8, i8* [[Y]], i64 8
351 ; X64-NEXT: [[TMP12:%.*]] = bitcast i8* [[TMP10]] to i32*
352 ; X64-NEXT: [[TMP13:%.*]] = bitcast i8* [[TMP11]] to i32*
353 ; X64-NEXT: [[TMP14:%.*]] = load i32, i32* [[TMP12]], align 1
354 ; X64-NEXT: [[TMP15:%.*]] = load i32, i32* [[TMP13]], align 1
355 ; X64-NEXT: [[TMP16:%.*]] = call i32 @llvm.bswap.i32(i32 [[TMP14]])
356 ; X64-NEXT: [[TMP17:%.*]] = call i32 @llvm.bswap.i32(i32 [[TMP15]])
357 ; X64-NEXT: [[TMP18]] = zext i32 [[TMP16]] to i64
358 ; X64-NEXT: [[TMP19]] = zext i32 [[TMP17]] to i64
359 ; X64-NEXT: [[TMP20:%.*]] = icmp eq i64 [[TMP18]], [[TMP19]]
360 ; X64-NEXT: br i1 [[TMP20]], label [[ENDBLOCK]], label [[RES_BLOCK]]
362 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
363 ; X64-NEXT: ret i32 [[PHI_RES]]
365 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 12)
369 define i32 @cmp13(i8* nocapture readonly %x, i8* nocapture readonly %y) {
371 ; X64-NEXT: br label [[LOADBB:%.*]]
373 ; X64-NEXT: [[PHI_SRC1:%.*]] = phi i64 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP16:%.*]], [[LOADBB1:%.*]] ]
374 ; X64-NEXT: [[PHI_SRC2:%.*]] = phi i64 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP17:%.*]], [[LOADBB1]] ]
375 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i64 [[PHI_SRC1]], [[PHI_SRC2]]
376 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
377 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
379 ; X64-NEXT: [[TMP3:%.*]] = bitcast i8* [[X:%.*]] to i64*
380 ; X64-NEXT: [[TMP4:%.*]] = bitcast i8* [[Y:%.*]] to i64*
381 ; X64-NEXT: [[TMP5:%.*]] = load i64, i64* [[TMP3]], align 1
382 ; X64-NEXT: [[TMP6:%.*]] = load i64, i64* [[TMP4]], align 1
383 ; X64-NEXT: [[TMP7]] = call i64 @llvm.bswap.i64(i64 [[TMP5]])
384 ; X64-NEXT: [[TMP8]] = call i64 @llvm.bswap.i64(i64 [[TMP6]])
385 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i64 [[TMP7]], [[TMP8]]
386 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
388 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, i8* [[X]], i64 5
389 ; X64-NEXT: [[TMP11:%.*]] = getelementptr i8, i8* [[Y]], i64 5
390 ; X64-NEXT: [[TMP12:%.*]] = bitcast i8* [[TMP10]] to i64*
391 ; X64-NEXT: [[TMP13:%.*]] = bitcast i8* [[TMP11]] to i64*
392 ; X64-NEXT: [[TMP14:%.*]] = load i64, i64* [[TMP12]], align 1
393 ; X64-NEXT: [[TMP15:%.*]] = load i64, i64* [[TMP13]], align 1
394 ; X64-NEXT: [[TMP16]] = call i64 @llvm.bswap.i64(i64 [[TMP14]])
395 ; X64-NEXT: [[TMP17]] = call i64 @llvm.bswap.i64(i64 [[TMP15]])
396 ; X64-NEXT: [[TMP18:%.*]] = icmp eq i64 [[TMP16]], [[TMP17]]
397 ; X64-NEXT: br i1 [[TMP18]], label [[ENDBLOCK]], label [[RES_BLOCK]]
399 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
400 ; X64-NEXT: ret i32 [[PHI_RES]]
402 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 13)
406 define i32 @cmp14(i8* nocapture readonly %x, i8* nocapture readonly %y) {
408 ; X64-NEXT: br label [[LOADBB:%.*]]
410 ; X64-NEXT: [[PHI_SRC1:%.*]] = phi i64 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP16:%.*]], [[LOADBB1:%.*]] ]
411 ; X64-NEXT: [[PHI_SRC2:%.*]] = phi i64 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP17:%.*]], [[LOADBB1]] ]
412 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i64 [[PHI_SRC1]], [[PHI_SRC2]]
413 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
414 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
416 ; X64-NEXT: [[TMP3:%.*]] = bitcast i8* [[X:%.*]] to i64*
417 ; X64-NEXT: [[TMP4:%.*]] = bitcast i8* [[Y:%.*]] to i64*
418 ; X64-NEXT: [[TMP5:%.*]] = load i64, i64* [[TMP3]], align 1
419 ; X64-NEXT: [[TMP6:%.*]] = load i64, i64* [[TMP4]], align 1
420 ; X64-NEXT: [[TMP7]] = call i64 @llvm.bswap.i64(i64 [[TMP5]])
421 ; X64-NEXT: [[TMP8]] = call i64 @llvm.bswap.i64(i64 [[TMP6]])
422 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i64 [[TMP7]], [[TMP8]]
423 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
425 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, i8* [[X]], i64 6
426 ; X64-NEXT: [[TMP11:%.*]] = getelementptr i8, i8* [[Y]], i64 6
427 ; X64-NEXT: [[TMP12:%.*]] = bitcast i8* [[TMP10]] to i64*
428 ; X64-NEXT: [[TMP13:%.*]] = bitcast i8* [[TMP11]] to i64*
429 ; X64-NEXT: [[TMP14:%.*]] = load i64, i64* [[TMP12]], align 1
430 ; X64-NEXT: [[TMP15:%.*]] = load i64, i64* [[TMP13]], align 1
431 ; X64-NEXT: [[TMP16]] = call i64 @llvm.bswap.i64(i64 [[TMP14]])
432 ; X64-NEXT: [[TMP17]] = call i64 @llvm.bswap.i64(i64 [[TMP15]])
433 ; X64-NEXT: [[TMP18:%.*]] = icmp eq i64 [[TMP16]], [[TMP17]]
434 ; X64-NEXT: br i1 [[TMP18]], label [[ENDBLOCK]], label [[RES_BLOCK]]
436 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
437 ; X64-NEXT: ret i32 [[PHI_RES]]
439 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 14)
443 define i32 @cmp15(i8* nocapture readonly %x, i8* nocapture readonly %y) {
445 ; X64-NEXT: br label [[LOADBB:%.*]]
447 ; X64-NEXT: [[PHI_SRC1:%.*]] = phi i64 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP16:%.*]], [[LOADBB1:%.*]] ]
448 ; X64-NEXT: [[PHI_SRC2:%.*]] = phi i64 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP17:%.*]], [[LOADBB1]] ]
449 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i64 [[PHI_SRC1]], [[PHI_SRC2]]
450 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
451 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
453 ; X64-NEXT: [[TMP3:%.*]] = bitcast i8* [[X:%.*]] to i64*
454 ; X64-NEXT: [[TMP4:%.*]] = bitcast i8* [[Y:%.*]] to i64*
455 ; X64-NEXT: [[TMP5:%.*]] = load i64, i64* [[TMP3]], align 1
456 ; X64-NEXT: [[TMP6:%.*]] = load i64, i64* [[TMP4]], align 1
457 ; X64-NEXT: [[TMP7]] = call i64 @llvm.bswap.i64(i64 [[TMP5]])
458 ; X64-NEXT: [[TMP8]] = call i64 @llvm.bswap.i64(i64 [[TMP6]])
459 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i64 [[TMP7]], [[TMP8]]
460 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
462 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, i8* [[X]], i64 7
463 ; X64-NEXT: [[TMP11:%.*]] = getelementptr i8, i8* [[Y]], i64 7
464 ; X64-NEXT: [[TMP12:%.*]] = bitcast i8* [[TMP10]] to i64*
465 ; X64-NEXT: [[TMP13:%.*]] = bitcast i8* [[TMP11]] to i64*
466 ; X64-NEXT: [[TMP14:%.*]] = load i64, i64* [[TMP12]], align 1
467 ; X64-NEXT: [[TMP15:%.*]] = load i64, i64* [[TMP13]], align 1
468 ; X64-NEXT: [[TMP16]] = call i64 @llvm.bswap.i64(i64 [[TMP14]])
469 ; X64-NEXT: [[TMP17]] = call i64 @llvm.bswap.i64(i64 [[TMP15]])
470 ; X64-NEXT: [[TMP18:%.*]] = icmp eq i64 [[TMP16]], [[TMP17]]
471 ; X64-NEXT: br i1 [[TMP18]], label [[ENDBLOCK]], label [[RES_BLOCK]]
473 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
474 ; X64-NEXT: ret i32 [[PHI_RES]]
476 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 15)
480 define i32 @cmp16(i8* nocapture readonly %x, i8* nocapture readonly %y) {
482 ; X64-NEXT: br label [[LOADBB:%.*]]
484 ; X64-NEXT: [[PHI_SRC1:%.*]] = phi i64 [ [[TMP7:%.*]], [[LOADBB]] ], [ [[TMP16:%.*]], [[LOADBB1:%.*]] ]
485 ; X64-NEXT: [[PHI_SRC2:%.*]] = phi i64 [ [[TMP8:%.*]], [[LOADBB]] ], [ [[TMP17:%.*]], [[LOADBB1]] ]
486 ; X64-NEXT: [[TMP1:%.*]] = icmp ult i64 [[PHI_SRC1]], [[PHI_SRC2]]
487 ; X64-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 1
488 ; X64-NEXT: br label [[ENDBLOCK:%.*]]
490 ; X64-NEXT: [[TMP3:%.*]] = bitcast i8* [[X:%.*]] to i64*
491 ; X64-NEXT: [[TMP4:%.*]] = bitcast i8* [[Y:%.*]] to i64*
492 ; X64-NEXT: [[TMP5:%.*]] = load i64, i64* [[TMP3]], align 1
493 ; X64-NEXT: [[TMP6:%.*]] = load i64, i64* [[TMP4]], align 1
494 ; X64-NEXT: [[TMP7]] = call i64 @llvm.bswap.i64(i64 [[TMP5]])
495 ; X64-NEXT: [[TMP8]] = call i64 @llvm.bswap.i64(i64 [[TMP6]])
496 ; X64-NEXT: [[TMP9:%.*]] = icmp eq i64 [[TMP7]], [[TMP8]]
497 ; X64-NEXT: br i1 [[TMP9]], label [[LOADBB1]], label [[RES_BLOCK:%.*]]
499 ; X64-NEXT: [[TMP10:%.*]] = getelementptr i8, i8* [[X]], i64 8
500 ; X64-NEXT: [[TMP11:%.*]] = getelementptr i8, i8* [[Y]], i64 8
501 ; X64-NEXT: [[TMP12:%.*]] = bitcast i8* [[TMP10]] to i64*
502 ; X64-NEXT: [[TMP13:%.*]] = bitcast i8* [[TMP11]] to i64*
503 ; X64-NEXT: [[TMP14:%.*]] = load i64, i64* [[TMP12]], align 1
504 ; X64-NEXT: [[TMP15:%.*]] = load i64, i64* [[TMP13]], align 1
505 ; X64-NEXT: [[TMP16]] = call i64 @llvm.bswap.i64(i64 [[TMP14]])
506 ; X64-NEXT: [[TMP17]] = call i64 @llvm.bswap.i64(i64 [[TMP15]])
507 ; X64-NEXT: [[TMP18:%.*]] = icmp eq i64 [[TMP16]], [[TMP17]]
508 ; X64-NEXT: br i1 [[TMP18]], label [[ENDBLOCK]], label [[RES_BLOCK]]
510 ; X64-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ [[TMP2]], [[RES_BLOCK]] ]
511 ; X64-NEXT: ret i32 [[PHI_RES]]
513 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 16)
517 define i32 @cmp_eq2(i8* nocapture readonly %x, i8* nocapture readonly %y) {
518 ; X64-LABEL: @cmp_eq2(
519 ; X64-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i16*
520 ; X64-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i16*
521 ; X64-NEXT: [[TMP3:%.*]] = load i16, i16* [[TMP1]], align 1
522 ; X64-NEXT: [[TMP4:%.*]] = load i16, i16* [[TMP2]], align 1
523 ; X64-NEXT: [[TMP5:%.*]] = icmp ne i16 [[TMP3]], [[TMP4]]
524 ; X64-NEXT: [[TMP6:%.*]] = zext i1 [[TMP5]] to i32
525 ; X64-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP6]], 0
526 ; X64-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
527 ; X64-NEXT: ret i32 [[CONV]]
529 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 2)
530 %cmp = icmp eq i32 %call, 0
531 %conv = zext i1 %cmp to i32
535 define i32 @cmp_eq3(i8* nocapture readonly %x, i8* nocapture readonly %y) {
536 ; X64_1LD-LABEL: @cmp_eq3(
537 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
538 ; X64_1LD: res_block:
539 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
541 ; X64_1LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i16*
542 ; X64_1LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i16*
543 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i16, i16* [[TMP1]], align 1
544 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i16, i16* [[TMP2]], align 1
545 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i16 [[TMP3]], [[TMP4]]
546 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
548 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 2
549 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 2
550 ; X64_1LD-NEXT: [[TMP8:%.*]] = load i8, i8* [[TMP6]], align 1
551 ; X64_1LD-NEXT: [[TMP9:%.*]] = load i8, i8* [[TMP7]], align 1
552 ; X64_1LD-NEXT: [[TMP10:%.*]] = icmp ne i8 [[TMP8]], [[TMP9]]
553 ; X64_1LD-NEXT: br i1 [[TMP10]], label [[RES_BLOCK]], label [[ENDBLOCK]]
555 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
556 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
557 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
558 ; X64_1LD-NEXT: ret i32 [[CONV]]
560 ; X64_2LD-LABEL: @cmp_eq3(
561 ; X64_2LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i16*
562 ; X64_2LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i16*
563 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i16, i16* [[TMP1]], align 1
564 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i16, i16* [[TMP2]], align 1
565 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i16 [[TMP3]], [[TMP4]]
566 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 2
567 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 2
568 ; X64_2LD-NEXT: [[TMP8:%.*]] = load i8, i8* [[TMP6]], align 1
569 ; X64_2LD-NEXT: [[TMP9:%.*]] = load i8, i8* [[TMP7]], align 1
570 ; X64_2LD-NEXT: [[TMP10:%.*]] = zext i8 [[TMP8]] to i16
571 ; X64_2LD-NEXT: [[TMP11:%.*]] = zext i8 [[TMP9]] to i16
572 ; X64_2LD-NEXT: [[TMP12:%.*]] = xor i16 [[TMP10]], [[TMP11]]
573 ; X64_2LD-NEXT: [[TMP13:%.*]] = or i16 [[TMP5]], [[TMP12]]
574 ; X64_2LD-NEXT: [[TMP14:%.*]] = icmp ne i16 [[TMP13]], 0
575 ; X64_2LD-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
576 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
577 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
578 ; X64_2LD-NEXT: ret i32 [[CONV]]
580 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 3)
581 %cmp = icmp eq i32 %call, 0
582 %conv = zext i1 %cmp to i32
586 define i32 @cmp_eq4(i8* nocapture readonly %x, i8* nocapture readonly %y) {
587 ; X64-LABEL: @cmp_eq4(
588 ; X64-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
589 ; X64-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
590 ; X64-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]], align 1
591 ; X64-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]], align 1
592 ; X64-NEXT: [[TMP5:%.*]] = icmp ne i32 [[TMP3]], [[TMP4]]
593 ; X64-NEXT: [[TMP6:%.*]] = zext i1 [[TMP5]] to i32
594 ; X64-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP6]], 0
595 ; X64-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
596 ; X64-NEXT: ret i32 [[CONV]]
598 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 4)
599 %cmp = icmp eq i32 %call, 0
600 %conv = zext i1 %cmp to i32
604 define i32 @cmp_eq5(i8* nocapture readonly %x, i8* nocapture readonly %y) {
605 ; X64_1LD-LABEL: @cmp_eq5(
606 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
607 ; X64_1LD: res_block:
608 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
610 ; X64_1LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
611 ; X64_1LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
612 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]], align 1
613 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]], align 1
614 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i32 [[TMP3]], [[TMP4]]
615 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
617 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 4
618 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 4
619 ; X64_1LD-NEXT: [[TMP8:%.*]] = load i8, i8* [[TMP6]], align 1
620 ; X64_1LD-NEXT: [[TMP9:%.*]] = load i8, i8* [[TMP7]], align 1
621 ; X64_1LD-NEXT: [[TMP10:%.*]] = icmp ne i8 [[TMP8]], [[TMP9]]
622 ; X64_1LD-NEXT: br i1 [[TMP10]], label [[RES_BLOCK]], label [[ENDBLOCK]]
624 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
625 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
626 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
627 ; X64_1LD-NEXT: ret i32 [[CONV]]
629 ; X64_2LD-LABEL: @cmp_eq5(
630 ; X64_2LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
631 ; X64_2LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
632 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]], align 1
633 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]], align 1
634 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
635 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 4
636 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 4
637 ; X64_2LD-NEXT: [[TMP8:%.*]] = load i8, i8* [[TMP6]], align 1
638 ; X64_2LD-NEXT: [[TMP9:%.*]] = load i8, i8* [[TMP7]], align 1
639 ; X64_2LD-NEXT: [[TMP10:%.*]] = zext i8 [[TMP8]] to i32
640 ; X64_2LD-NEXT: [[TMP11:%.*]] = zext i8 [[TMP9]] to i32
641 ; X64_2LD-NEXT: [[TMP12:%.*]] = xor i32 [[TMP10]], [[TMP11]]
642 ; X64_2LD-NEXT: [[TMP13:%.*]] = or i32 [[TMP5]], [[TMP12]]
643 ; X64_2LD-NEXT: [[TMP14:%.*]] = icmp ne i32 [[TMP13]], 0
644 ; X64_2LD-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
645 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
646 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
647 ; X64_2LD-NEXT: ret i32 [[CONV]]
649 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 5)
650 %cmp = icmp eq i32 %call, 0
651 %conv = zext i1 %cmp to i32
655 define i32 @cmp_eq6(i8* nocapture readonly %x, i8* nocapture readonly %y) {
656 ; X64_1LD-LABEL: @cmp_eq6(
657 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
658 ; X64_1LD: res_block:
659 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
661 ; X64_1LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
662 ; X64_1LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
663 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]], align 1
664 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]], align 1
665 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i32 [[TMP3]], [[TMP4]]
666 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
668 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 4
669 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 4
670 ; X64_1LD-NEXT: [[TMP8:%.*]] = bitcast i8* [[TMP6]] to i16*
671 ; X64_1LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP7]] to i16*
672 ; X64_1LD-NEXT: [[TMP10:%.*]] = load i16, i16* [[TMP8]], align 1
673 ; X64_1LD-NEXT: [[TMP11:%.*]] = load i16, i16* [[TMP9]], align 1
674 ; X64_1LD-NEXT: [[TMP12:%.*]] = icmp ne i16 [[TMP10]], [[TMP11]]
675 ; X64_1LD-NEXT: br i1 [[TMP12]], label [[RES_BLOCK]], label [[ENDBLOCK]]
677 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
678 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
679 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
680 ; X64_1LD-NEXT: ret i32 [[CONV]]
682 ; X64_2LD-LABEL: @cmp_eq6(
683 ; X64_2LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
684 ; X64_2LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
685 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]], align 1
686 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]], align 1
687 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
688 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 4
689 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 4
690 ; X64_2LD-NEXT: [[TMP8:%.*]] = bitcast i8* [[TMP6]] to i16*
691 ; X64_2LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP7]] to i16*
692 ; X64_2LD-NEXT: [[TMP10:%.*]] = load i16, i16* [[TMP8]], align 1
693 ; X64_2LD-NEXT: [[TMP11:%.*]] = load i16, i16* [[TMP9]], align 1
694 ; X64_2LD-NEXT: [[TMP12:%.*]] = zext i16 [[TMP10]] to i32
695 ; X64_2LD-NEXT: [[TMP13:%.*]] = zext i16 [[TMP11]] to i32
696 ; X64_2LD-NEXT: [[TMP14:%.*]] = xor i32 [[TMP12]], [[TMP13]]
697 ; X64_2LD-NEXT: [[TMP15:%.*]] = or i32 [[TMP5]], [[TMP14]]
698 ; X64_2LD-NEXT: [[TMP16:%.*]] = icmp ne i32 [[TMP15]], 0
699 ; X64_2LD-NEXT: [[TMP17:%.*]] = zext i1 [[TMP16]] to i32
700 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP17]], 0
701 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
702 ; X64_2LD-NEXT: ret i32 [[CONV]]
704 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 6)
705 %cmp = icmp eq i32 %call, 0
706 %conv = zext i1 %cmp to i32
710 define i32 @cmp_eq6_align4(i8* nocapture readonly align 4 %x, i8* nocapture readonly align 4 %y) {
711 ; X64_1LD-LABEL: @cmp_eq6_align4(
712 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
713 ; X64_1LD: res_block:
714 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
716 ; X64_1LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
717 ; X64_1LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
718 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]], align 4
719 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]], align 4
720 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i32 [[TMP3]], [[TMP4]]
721 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
723 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 4
724 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 4
725 ; X64_1LD-NEXT: [[TMP8:%.*]] = bitcast i8* [[TMP6]] to i16*
726 ; X64_1LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP7]] to i16*
727 ; X64_1LD-NEXT: [[TMP10:%.*]] = load i16, i16* [[TMP8]], align 4
728 ; X64_1LD-NEXT: [[TMP11:%.*]] = load i16, i16* [[TMP9]], align 4
729 ; X64_1LD-NEXT: [[TMP12:%.*]] = icmp ne i16 [[TMP10]], [[TMP11]]
730 ; X64_1LD-NEXT: br i1 [[TMP12]], label [[RES_BLOCK]], label [[ENDBLOCK]]
732 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
733 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
734 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
735 ; X64_1LD-NEXT: ret i32 [[CONV]]
737 ; X64_2LD-LABEL: @cmp_eq6_align4(
738 ; X64_2LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
739 ; X64_2LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
740 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]], align 4
741 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]], align 4
742 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
743 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 4
744 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 4
745 ; X64_2LD-NEXT: [[TMP8:%.*]] = bitcast i8* [[TMP6]] to i16*
746 ; X64_2LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP7]] to i16*
747 ; X64_2LD-NEXT: [[TMP10:%.*]] = load i16, i16* [[TMP8]], align 4
748 ; X64_2LD-NEXT: [[TMP11:%.*]] = load i16, i16* [[TMP9]], align 4
749 ; X64_2LD-NEXT: [[TMP12:%.*]] = zext i16 [[TMP10]] to i32
750 ; X64_2LD-NEXT: [[TMP13:%.*]] = zext i16 [[TMP11]] to i32
751 ; X64_2LD-NEXT: [[TMP14:%.*]] = xor i32 [[TMP12]], [[TMP13]]
752 ; X64_2LD-NEXT: [[TMP15:%.*]] = or i32 [[TMP5]], [[TMP14]]
753 ; X64_2LD-NEXT: [[TMP16:%.*]] = icmp ne i32 [[TMP15]], 0
754 ; X64_2LD-NEXT: [[TMP17:%.*]] = zext i1 [[TMP16]] to i32
755 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP17]], 0
756 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
757 ; X64_2LD-NEXT: ret i32 [[CONV]]
759 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 6)
760 %cmp = icmp eq i32 %call, 0
761 %conv = zext i1 %cmp to i32
765 define i32 @cmp_eq7(i8* nocapture readonly %x, i8* nocapture readonly %y) {
766 ; X64_1LD-LABEL: @cmp_eq7(
767 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
768 ; X64_1LD: res_block:
769 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
771 ; X64_1LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
772 ; X64_1LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
773 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]], align 1
774 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]], align 1
775 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i32 [[TMP3]], [[TMP4]]
776 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
778 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 3
779 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 3
780 ; X64_1LD-NEXT: [[TMP8:%.*]] = bitcast i8* [[TMP6]] to i32*
781 ; X64_1LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP7]] to i32*
782 ; X64_1LD-NEXT: [[TMP10:%.*]] = load i32, i32* [[TMP8]], align 1
783 ; X64_1LD-NEXT: [[TMP11:%.*]] = load i32, i32* [[TMP9]], align 1
784 ; X64_1LD-NEXT: [[TMP12:%.*]] = icmp ne i32 [[TMP10]], [[TMP11]]
785 ; X64_1LD-NEXT: br i1 [[TMP12]], label [[RES_BLOCK]], label [[ENDBLOCK]]
787 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
788 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
789 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
790 ; X64_1LD-NEXT: ret i32 [[CONV]]
792 ; X64_2LD-LABEL: @cmp_eq7(
793 ; X64_2LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i32*
794 ; X64_2LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i32*
795 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP1]], align 1
796 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i32, i32* [[TMP2]], align 1
797 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i32 [[TMP3]], [[TMP4]]
798 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 3
799 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 3
800 ; X64_2LD-NEXT: [[TMP8:%.*]] = bitcast i8* [[TMP6]] to i32*
801 ; X64_2LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP7]] to i32*
802 ; X64_2LD-NEXT: [[TMP10:%.*]] = load i32, i32* [[TMP8]], align 1
803 ; X64_2LD-NEXT: [[TMP11:%.*]] = load i32, i32* [[TMP9]], align 1
804 ; X64_2LD-NEXT: [[TMP12:%.*]] = xor i32 [[TMP10]], [[TMP11]]
805 ; X64_2LD-NEXT: [[TMP13:%.*]] = or i32 [[TMP5]], [[TMP12]]
806 ; X64_2LD-NEXT: [[TMP14:%.*]] = icmp ne i32 [[TMP13]], 0
807 ; X64_2LD-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
808 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
809 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
810 ; X64_2LD-NEXT: ret i32 [[CONV]]
812 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 7)
813 %cmp = icmp eq i32 %call, 0
814 %conv = zext i1 %cmp to i32
818 define i32 @cmp_eq8(i8* nocapture readonly %x, i8* nocapture readonly %y) {
819 ; X64-LABEL: @cmp_eq8(
820 ; X64-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
821 ; X64-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
822 ; X64-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]], align 1
823 ; X64-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]], align 1
824 ; X64-NEXT: [[TMP5:%.*]] = icmp ne i64 [[TMP3]], [[TMP4]]
825 ; X64-NEXT: [[TMP6:%.*]] = zext i1 [[TMP5]] to i32
826 ; X64-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP6]], 0
827 ; X64-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
828 ; X64-NEXT: ret i32 [[CONV]]
830 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 8)
831 %cmp = icmp eq i32 %call, 0
832 %conv = zext i1 %cmp to i32
836 define i32 @cmp_eq9(i8* nocapture readonly %x, i8* nocapture readonly %y) {
837 ; X64_1LD-LABEL: @cmp_eq9(
838 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
839 ; X64_1LD: res_block:
840 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
842 ; X64_1LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
843 ; X64_1LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
844 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]], align 1
845 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]], align 1
846 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i64 [[TMP3]], [[TMP4]]
847 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
849 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 8
850 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 8
851 ; X64_1LD-NEXT: [[TMP8:%.*]] = load i8, i8* [[TMP6]], align 1
852 ; X64_1LD-NEXT: [[TMP9:%.*]] = load i8, i8* [[TMP7]], align 1
853 ; X64_1LD-NEXT: [[TMP10:%.*]] = icmp ne i8 [[TMP8]], [[TMP9]]
854 ; X64_1LD-NEXT: br i1 [[TMP10]], label [[RES_BLOCK]], label [[ENDBLOCK]]
856 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
857 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
858 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
859 ; X64_1LD-NEXT: ret i32 [[CONV]]
861 ; X64_2LD-LABEL: @cmp_eq9(
862 ; X64_2LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
863 ; X64_2LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
864 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]], align 1
865 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]], align 1
866 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i64 [[TMP3]], [[TMP4]]
867 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 8
868 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 8
869 ; X64_2LD-NEXT: [[TMP8:%.*]] = load i8, i8* [[TMP6]], align 1
870 ; X64_2LD-NEXT: [[TMP9:%.*]] = load i8, i8* [[TMP7]], align 1
871 ; X64_2LD-NEXT: [[TMP10:%.*]] = zext i8 [[TMP8]] to i64
872 ; X64_2LD-NEXT: [[TMP11:%.*]] = zext i8 [[TMP9]] to i64
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(i8* %x, i8* %y, i64 9)
882 %cmp = icmp eq i32 %call, 0
883 %conv = zext i1 %cmp to i32
887 define i32 @cmp_eq10(i8* nocapture readonly %x, i8* nocapture readonly %y) {
888 ; X64_1LD-LABEL: @cmp_eq10(
889 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
890 ; X64_1LD: res_block:
891 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
893 ; X64_1LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
894 ; X64_1LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
895 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]], align 1
896 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]], align 1
897 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i64 [[TMP3]], [[TMP4]]
898 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
900 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 8
901 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 8
902 ; X64_1LD-NEXT: [[TMP8:%.*]] = bitcast i8* [[TMP6]] to i16*
903 ; X64_1LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP7]] to i16*
904 ; X64_1LD-NEXT: [[TMP10:%.*]] = load i16, i16* [[TMP8]], align 1
905 ; X64_1LD-NEXT: [[TMP11:%.*]] = load i16, i16* [[TMP9]], align 1
906 ; X64_1LD-NEXT: [[TMP12:%.*]] = icmp ne i16 [[TMP10]], [[TMP11]]
907 ; X64_1LD-NEXT: br i1 [[TMP12]], label [[RES_BLOCK]], label [[ENDBLOCK]]
909 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
910 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
911 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
912 ; X64_1LD-NEXT: ret i32 [[CONV]]
914 ; X64_2LD-LABEL: @cmp_eq10(
915 ; X64_2LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
916 ; X64_2LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
917 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]], align 1
918 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]], align 1
919 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i64 [[TMP3]], [[TMP4]]
920 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 8
921 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 8
922 ; X64_2LD-NEXT: [[TMP8:%.*]] = bitcast i8* [[TMP6]] to i16*
923 ; X64_2LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP7]] to i16*
924 ; X64_2LD-NEXT: [[TMP10:%.*]] = load i16, i16* [[TMP8]], align 1
925 ; X64_2LD-NEXT: [[TMP11:%.*]] = load i16, i16* [[TMP9]], align 1
926 ; X64_2LD-NEXT: [[TMP12:%.*]] = zext i16 [[TMP10]] to i64
927 ; X64_2LD-NEXT: [[TMP13:%.*]] = zext i16 [[TMP11]] to i64
928 ; X64_2LD-NEXT: [[TMP14:%.*]] = xor i64 [[TMP12]], [[TMP13]]
929 ; X64_2LD-NEXT: [[TMP15:%.*]] = or i64 [[TMP5]], [[TMP14]]
930 ; X64_2LD-NEXT: [[TMP16:%.*]] = icmp ne i64 [[TMP15]], 0
931 ; X64_2LD-NEXT: [[TMP17:%.*]] = zext i1 [[TMP16]] to i32
932 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP17]], 0
933 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
934 ; X64_2LD-NEXT: ret i32 [[CONV]]
936 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 10)
937 %cmp = icmp eq i32 %call, 0
938 %conv = zext i1 %cmp to i32
942 define i32 @cmp_eq11(i8* nocapture readonly %x, i8* nocapture readonly %y) {
943 ; X64_1LD-LABEL: @cmp_eq11(
944 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
945 ; X64_1LD: res_block:
946 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
948 ; X64_1LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
949 ; X64_1LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
950 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]], align 1
951 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]], align 1
952 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i64 [[TMP3]], [[TMP4]]
953 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
955 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 3
956 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 3
957 ; X64_1LD-NEXT: [[TMP8:%.*]] = bitcast i8* [[TMP6]] to i64*
958 ; X64_1LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP7]] to i64*
959 ; X64_1LD-NEXT: [[TMP10:%.*]] = load i64, i64* [[TMP8]], align 1
960 ; X64_1LD-NEXT: [[TMP11:%.*]] = load i64, i64* [[TMP9]], align 1
961 ; X64_1LD-NEXT: [[TMP12:%.*]] = icmp ne i64 [[TMP10]], [[TMP11]]
962 ; X64_1LD-NEXT: br i1 [[TMP12]], label [[RES_BLOCK]], label [[ENDBLOCK]]
964 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
965 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
966 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
967 ; X64_1LD-NEXT: ret i32 [[CONV]]
969 ; X64_2LD-LABEL: @cmp_eq11(
970 ; X64_2LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
971 ; X64_2LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
972 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]], align 1
973 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]], align 1
974 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i64 [[TMP3]], [[TMP4]]
975 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 3
976 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 3
977 ; X64_2LD-NEXT: [[TMP8:%.*]] = bitcast i8* [[TMP6]] to i64*
978 ; X64_2LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP7]] to i64*
979 ; X64_2LD-NEXT: [[TMP10:%.*]] = load i64, i64* [[TMP8]], align 1
980 ; X64_2LD-NEXT: [[TMP11:%.*]] = load i64, i64* [[TMP9]], align 1
981 ; X64_2LD-NEXT: [[TMP12:%.*]] = xor i64 [[TMP10]], [[TMP11]]
982 ; X64_2LD-NEXT: [[TMP13:%.*]] = or i64 [[TMP5]], [[TMP12]]
983 ; X64_2LD-NEXT: [[TMP14:%.*]] = icmp ne i64 [[TMP13]], 0
984 ; X64_2LD-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
985 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
986 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
987 ; X64_2LD-NEXT: ret i32 [[CONV]]
989 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 11)
990 %cmp = icmp eq i32 %call, 0
991 %conv = zext i1 %cmp to i32
995 define i32 @cmp_eq12(i8* nocapture readonly %x, i8* nocapture readonly %y) {
996 ; X64_1LD-LABEL: @cmp_eq12(
997 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
998 ; X64_1LD: res_block:
999 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
1001 ; X64_1LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
1002 ; X64_1LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
1003 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]], align 1
1004 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]], align 1
1005 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i64 [[TMP3]], [[TMP4]]
1006 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
1008 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 8
1009 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 8
1010 ; X64_1LD-NEXT: [[TMP8:%.*]] = bitcast i8* [[TMP6]] to i32*
1011 ; X64_1LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP7]] to i32*
1012 ; X64_1LD-NEXT: [[TMP10:%.*]] = load i32, i32* [[TMP8]], align 1
1013 ; X64_1LD-NEXT: [[TMP11:%.*]] = load i32, i32* [[TMP9]], align 1
1014 ; X64_1LD-NEXT: [[TMP12:%.*]] = icmp ne i32 [[TMP10]], [[TMP11]]
1015 ; X64_1LD-NEXT: br i1 [[TMP12]], label [[RES_BLOCK]], label [[ENDBLOCK]]
1016 ; X64_1LD: endblock:
1017 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
1018 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
1019 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
1020 ; X64_1LD-NEXT: ret i32 [[CONV]]
1022 ; X64_2LD-LABEL: @cmp_eq12(
1023 ; X64_2LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
1024 ; X64_2LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
1025 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]], align 1
1026 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]], align 1
1027 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i64 [[TMP3]], [[TMP4]]
1028 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 8
1029 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 8
1030 ; X64_2LD-NEXT: [[TMP8:%.*]] = bitcast i8* [[TMP6]] to i32*
1031 ; X64_2LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP7]] to i32*
1032 ; X64_2LD-NEXT: [[TMP10:%.*]] = load i32, i32* [[TMP8]], align 1
1033 ; X64_2LD-NEXT: [[TMP11:%.*]] = load i32, i32* [[TMP9]], align 1
1034 ; X64_2LD-NEXT: [[TMP12:%.*]] = zext i32 [[TMP10]] to i64
1035 ; X64_2LD-NEXT: [[TMP13:%.*]] = zext i32 [[TMP11]] to i64
1036 ; X64_2LD-NEXT: [[TMP14:%.*]] = xor i64 [[TMP12]], [[TMP13]]
1037 ; X64_2LD-NEXT: [[TMP15:%.*]] = or i64 [[TMP5]], [[TMP14]]
1038 ; X64_2LD-NEXT: [[TMP16:%.*]] = icmp ne i64 [[TMP15]], 0
1039 ; X64_2LD-NEXT: [[TMP17:%.*]] = zext i1 [[TMP16]] to i32
1040 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP17]], 0
1041 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
1042 ; X64_2LD-NEXT: ret i32 [[CONV]]
1044 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 12)
1045 %cmp = icmp eq i32 %call, 0
1046 %conv = zext i1 %cmp to i32
1050 define i32 @cmp_eq13(i8* nocapture readonly %x, i8* nocapture readonly %y) {
1051 ; X64_1LD-LABEL: @cmp_eq13(
1052 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
1053 ; X64_1LD: res_block:
1054 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
1056 ; X64_1LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
1057 ; X64_1LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
1058 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]], align 1
1059 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]], align 1
1060 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i64 [[TMP3]], [[TMP4]]
1061 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
1063 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 5
1064 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 5
1065 ; X64_1LD-NEXT: [[TMP8:%.*]] = bitcast i8* [[TMP6]] to i64*
1066 ; X64_1LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP7]] to i64*
1067 ; X64_1LD-NEXT: [[TMP10:%.*]] = load i64, i64* [[TMP8]], align 1
1068 ; X64_1LD-NEXT: [[TMP11:%.*]] = load i64, i64* [[TMP9]], align 1
1069 ; X64_1LD-NEXT: [[TMP12:%.*]] = icmp ne i64 [[TMP10]], [[TMP11]]
1070 ; X64_1LD-NEXT: br i1 [[TMP12]], label [[RES_BLOCK]], label [[ENDBLOCK]]
1071 ; X64_1LD: endblock:
1072 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
1073 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
1074 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
1075 ; X64_1LD-NEXT: ret i32 [[CONV]]
1077 ; X64_2LD-LABEL: @cmp_eq13(
1078 ; X64_2LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
1079 ; X64_2LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
1080 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]], align 1
1081 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]], align 1
1082 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i64 [[TMP3]], [[TMP4]]
1083 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 5
1084 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 5
1085 ; X64_2LD-NEXT: [[TMP8:%.*]] = bitcast i8* [[TMP6]] to i64*
1086 ; X64_2LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP7]] to i64*
1087 ; X64_2LD-NEXT: [[TMP10:%.*]] = load i64, i64* [[TMP8]], align 1
1088 ; X64_2LD-NEXT: [[TMP11:%.*]] = load i64, i64* [[TMP9]], align 1
1089 ; X64_2LD-NEXT: [[TMP12:%.*]] = xor i64 [[TMP10]], [[TMP11]]
1090 ; X64_2LD-NEXT: [[TMP13:%.*]] = or i64 [[TMP5]], [[TMP12]]
1091 ; X64_2LD-NEXT: [[TMP14:%.*]] = icmp ne i64 [[TMP13]], 0
1092 ; X64_2LD-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
1093 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
1094 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
1095 ; X64_2LD-NEXT: ret i32 [[CONV]]
1097 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 13)
1098 %cmp = icmp eq i32 %call, 0
1099 %conv = zext i1 %cmp to i32
1103 define i32 @cmp_eq14(i8* nocapture readonly %x, i8* nocapture readonly %y) {
1104 ; X64_1LD-LABEL: @cmp_eq14(
1105 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
1106 ; X64_1LD: res_block:
1107 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
1109 ; X64_1LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
1110 ; X64_1LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
1111 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]], align 1
1112 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]], align 1
1113 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i64 [[TMP3]], [[TMP4]]
1114 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
1116 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 6
1117 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 6
1118 ; X64_1LD-NEXT: [[TMP8:%.*]] = bitcast i8* [[TMP6]] to i64*
1119 ; X64_1LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP7]] to i64*
1120 ; X64_1LD-NEXT: [[TMP10:%.*]] = load i64, i64* [[TMP8]], align 1
1121 ; X64_1LD-NEXT: [[TMP11:%.*]] = load i64, i64* [[TMP9]], align 1
1122 ; X64_1LD-NEXT: [[TMP12:%.*]] = icmp ne i64 [[TMP10]], [[TMP11]]
1123 ; X64_1LD-NEXT: br i1 [[TMP12]], label [[RES_BLOCK]], label [[ENDBLOCK]]
1124 ; X64_1LD: endblock:
1125 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
1126 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
1127 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
1128 ; X64_1LD-NEXT: ret i32 [[CONV]]
1130 ; X64_2LD-LABEL: @cmp_eq14(
1131 ; X64_2LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
1132 ; X64_2LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
1133 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]], align 1
1134 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]], align 1
1135 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i64 [[TMP3]], [[TMP4]]
1136 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 6
1137 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 6
1138 ; X64_2LD-NEXT: [[TMP8:%.*]] = bitcast i8* [[TMP6]] to i64*
1139 ; X64_2LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP7]] to i64*
1140 ; X64_2LD-NEXT: [[TMP10:%.*]] = load i64, i64* [[TMP8]], align 1
1141 ; X64_2LD-NEXT: [[TMP11:%.*]] = load i64, i64* [[TMP9]], align 1
1142 ; X64_2LD-NEXT: [[TMP12:%.*]] = xor i64 [[TMP10]], [[TMP11]]
1143 ; X64_2LD-NEXT: [[TMP13:%.*]] = or i64 [[TMP5]], [[TMP12]]
1144 ; X64_2LD-NEXT: [[TMP14:%.*]] = icmp ne i64 [[TMP13]], 0
1145 ; X64_2LD-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
1146 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
1147 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
1148 ; X64_2LD-NEXT: ret i32 [[CONV]]
1150 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 14)
1151 %cmp = icmp eq i32 %call, 0
1152 %conv = zext i1 %cmp to i32
1156 define i32 @cmp_eq15(i8* nocapture readonly %x, i8* nocapture readonly %y) {
1157 ; X64_1LD-LABEL: @cmp_eq15(
1158 ; X64_1LD-NEXT: br label [[LOADBB:%.*]]
1159 ; X64_1LD: res_block:
1160 ; X64_1LD-NEXT: br label [[ENDBLOCK:%.*]]
1162 ; X64_1LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
1163 ; X64_1LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
1164 ; X64_1LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]], align 1
1165 ; X64_1LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]], align 1
1166 ; X64_1LD-NEXT: [[TMP5:%.*]] = icmp ne i64 [[TMP3]], [[TMP4]]
1167 ; X64_1LD-NEXT: br i1 [[TMP5]], label [[RES_BLOCK:%.*]], label [[LOADBB1:%.*]]
1169 ; X64_1LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 7
1170 ; X64_1LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 7
1171 ; X64_1LD-NEXT: [[TMP8:%.*]] = bitcast i8* [[TMP6]] to i64*
1172 ; X64_1LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP7]] to i64*
1173 ; X64_1LD-NEXT: [[TMP10:%.*]] = load i64, i64* [[TMP8]], align 1
1174 ; X64_1LD-NEXT: [[TMP11:%.*]] = load i64, i64* [[TMP9]], align 1
1175 ; X64_1LD-NEXT: [[TMP12:%.*]] = icmp ne i64 [[TMP10]], [[TMP11]]
1176 ; X64_1LD-NEXT: br i1 [[TMP12]], label [[RES_BLOCK]], label [[ENDBLOCK]]
1177 ; X64_1LD: endblock:
1178 ; X64_1LD-NEXT: [[PHI_RES:%.*]] = phi i32 [ 0, [[LOADBB1]] ], [ 1, [[RES_BLOCK]] ]
1179 ; X64_1LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[PHI_RES]], 0
1180 ; X64_1LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
1181 ; X64_1LD-NEXT: ret i32 [[CONV]]
1183 ; X64_2LD-LABEL: @cmp_eq15(
1184 ; X64_2LD-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i64*
1185 ; X64_2LD-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i64*
1186 ; X64_2LD-NEXT: [[TMP3:%.*]] = load i64, i64* [[TMP1]], align 1
1187 ; X64_2LD-NEXT: [[TMP4:%.*]] = load i64, i64* [[TMP2]], align 1
1188 ; X64_2LD-NEXT: [[TMP5:%.*]] = xor i64 [[TMP3]], [[TMP4]]
1189 ; X64_2LD-NEXT: [[TMP6:%.*]] = getelementptr i8, i8* [[X]], i64 7
1190 ; X64_2LD-NEXT: [[TMP7:%.*]] = getelementptr i8, i8* [[Y]], i64 7
1191 ; X64_2LD-NEXT: [[TMP8:%.*]] = bitcast i8* [[TMP6]] to i64*
1192 ; X64_2LD-NEXT: [[TMP9:%.*]] = bitcast i8* [[TMP7]] to i64*
1193 ; X64_2LD-NEXT: [[TMP10:%.*]] = load i64, i64* [[TMP8]], align 1
1194 ; X64_2LD-NEXT: [[TMP11:%.*]] = load i64, i64* [[TMP9]], align 1
1195 ; X64_2LD-NEXT: [[TMP12:%.*]] = xor i64 [[TMP10]], [[TMP11]]
1196 ; X64_2LD-NEXT: [[TMP13:%.*]] = or i64 [[TMP5]], [[TMP12]]
1197 ; X64_2LD-NEXT: [[TMP14:%.*]] = icmp ne i64 [[TMP13]], 0
1198 ; X64_2LD-NEXT: [[TMP15:%.*]] = zext i1 [[TMP14]] to i32
1199 ; X64_2LD-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP15]], 0
1200 ; X64_2LD-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
1201 ; X64_2LD-NEXT: ret i32 [[CONV]]
1203 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 15)
1204 %cmp = icmp eq i32 %call, 0
1205 %conv = zext i1 %cmp to i32
1209 define i32 @cmp_eq16(i8* nocapture readonly %x, i8* nocapture readonly %y) {
1210 ; X64-LABEL: @cmp_eq16(
1211 ; X64-NEXT: [[TMP1:%.*]] = bitcast i8* [[X:%.*]] to i128*
1212 ; X64-NEXT: [[TMP2:%.*]] = bitcast i8* [[Y:%.*]] to i128*
1213 ; X64-NEXT: [[TMP3:%.*]] = load i128, i128* [[TMP1]], align 1
1214 ; X64-NEXT: [[TMP4:%.*]] = load i128, i128* [[TMP2]], align 1
1215 ; X64-NEXT: [[TMP5:%.*]] = icmp ne i128 [[TMP3]], [[TMP4]]
1216 ; X64-NEXT: [[TMP6:%.*]] = zext i1 [[TMP5]] to i32
1217 ; X64-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP6]], 0
1218 ; X64-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
1219 ; X64-NEXT: ret i32 [[CONV]]
1221 %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 16)
1222 %cmp = icmp eq i32 %call, 0
1223 %conv = zext i1 %cmp to i32