1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; RUN: llc -verify-machineinstrs -mcpu=pwr8 -mtriple=powerpc64le-unknown-unknown \
3 ; RUN: -ppc-asm-full-reg-names < %s | FileCheck %s --check-prefix=64BIT
4 ; RUN: llc -verify-machineinstrs -mcpu=pwr8 -mtriple=powerpc64-unknown-unknown \
5 ; RUN: -ppc-asm-full-reg-names < %s | FileCheck %s --check-prefix=64BIT
6 ; RUN: llc -O3 -mcpu=pwr8 -mtriple powerpc-ibm-aix -verify-machineinstrs \
7 ; RUN: -ppc-asm-full-reg-names < %s | FileCheck --check-prefix=32BIT %s
8 ; RUN: llc -O3 -mcpu=pwr8 -mtriple powerpc64-ibm-aix -verify-machineinstrs \
9 ; RUN: -ppc-asm-full-reg-names < %s | FileCheck --check-prefix=64BIT %s
12 define dso_local i64 @test_xor(ptr nocapture noundef readonly %inp) local_unnamed_addr #0 {
13 ; 64BIT-LABEL: test_xor:
14 ; 64BIT: # %bb.0: # %entry
15 ; 64BIT-NEXT: lbz r4, 0(r3)
16 ; 64BIT-NEXT: lbz r3, 1(r3)
17 ; 64BIT-NEXT: xor r3, r3, r4
20 ; 32BIT-LABEL: test_xor:
21 ; 32BIT: # %bb.0: # %entry
22 ; 32BIT-NEXT: mr r4, r3
23 ; 32BIT-NEXT: li r3, 0
24 ; 32BIT-NEXT: lbz r5, 0(r4)
25 ; 32BIT-NEXT: lbz r4, 1(r4)
26 ; 32BIT-NEXT: xor r4, r4, r5
29 %0 = load i8, ptr %inp, align 1
30 %arrayidx1 = getelementptr inbounds i8, ptr %inp, i64 1
31 %1 = load i8, ptr %arrayidx1, align 1
33 %conv3 = zext i8 %xor5 to i64
37 define dso_local i64 @test_xor2(ptr nocapture noundef readonly %inp) local_unnamed_addr #0 {
38 ; 64BIT-LABEL: test_xor2:
39 ; 64BIT: # %bb.0: # %entry
40 ; 64BIT-NEXT: lbz r4, 0(r3)
41 ; 64BIT-NEXT: lbz r5, 1(r3)
42 ; 64BIT-NEXT: lbz r3, 2(r3)
43 ; 64BIT-NEXT: xor r4, r5, r4
44 ; 64BIT-NEXT: xor r3, r4, r3
47 ; 32BIT-LABEL: test_xor2:
48 ; 32BIT: # %bb.0: # %entry
49 ; 32BIT-NEXT: mr r4, r3
50 ; 32BIT-NEXT: li r3, 0
51 ; 32BIT-NEXT: lbz r5, 0(r4)
52 ; 32BIT-NEXT: lbz r6, 1(r4)
53 ; 32BIT-NEXT: lbz r4, 2(r4)
54 ; 32BIT-NEXT: xor r5, r6, r5
55 ; 32BIT-NEXT: xor r4, r5, r4
58 %0 = load i8, ptr %inp, align 1
59 %arrayidx1 = getelementptr inbounds i8, ptr %inp, i64 1
60 %1 = load i8, ptr %arrayidx1, align 1
62 %arrayidx3 = getelementptr inbounds i8, ptr %inp, i64 2
63 %2 = load i8, ptr %arrayidx3, align 1
64 %xor510 = xor i8 %xor9, %2
65 %conv6 = zext i8 %xor510 to i64
69 define dso_local i64 @test_or(ptr nocapture noundef readonly %inp) local_unnamed_addr #0 {
70 ; 64BIT-LABEL: test_or:
71 ; 64BIT: # %bb.0: # %entry
72 ; 64BIT-NEXT: lbz r4, 0(r3)
73 ; 64BIT-NEXT: lbz r3, 1(r3)
74 ; 64BIT-NEXT: or r3, r3, r4
77 ; 32BIT-LABEL: test_or:
78 ; 32BIT: # %bb.0: # %entry
79 ; 32BIT-NEXT: mr r4, r3
80 ; 32BIT-NEXT: li r3, 0
81 ; 32BIT-NEXT: lbz r5, 0(r4)
82 ; 32BIT-NEXT: lbz r4, 1(r4)
83 ; 32BIT-NEXT: or r4, r4, r5
86 %0 = load i8, ptr %inp, align 1
87 %arrayidx1 = getelementptr inbounds i8, ptr %inp, i64 1
88 %1 = load i8, ptr %arrayidx1, align 1
90 %conv3 = zext i8 %or5 to i64
94 define dso_local i64 @test_or2(ptr nocapture noundef readonly %inp) local_unnamed_addr #0 {
95 ; 64BIT-LABEL: test_or2:
96 ; 64BIT: # %bb.0: # %entry
97 ; 64BIT-NEXT: lbz r4, 0(r3)
98 ; 64BIT-NEXT: lbz r5, 1(r3)
99 ; 64BIT-NEXT: lbz r3, 2(r3)
100 ; 64BIT-NEXT: or r4, r5, r4
101 ; 64BIT-NEXT: or r3, r4, r3
104 ; 32BIT-LABEL: test_or2:
105 ; 32BIT: # %bb.0: # %entry
106 ; 32BIT-NEXT: mr r4, r3
107 ; 32BIT-NEXT: li r3, 0
108 ; 32BIT-NEXT: lbz r5, 0(r4)
109 ; 32BIT-NEXT: lbz r6, 1(r4)
110 ; 32BIT-NEXT: lbz r4, 2(r4)
111 ; 32BIT-NEXT: or r5, r6, r5
112 ; 32BIT-NEXT: or r4, r5, r4
115 %0 = load i8, ptr %inp, align 1
116 %arrayidx1 = getelementptr inbounds i8, ptr %inp, i64 1
117 %1 = load i8, ptr %arrayidx1, align 1
119 %arrayidx3 = getelementptr inbounds i8, ptr %inp, i64 2
120 %2 = load i8, ptr %arrayidx3, align 1
121 %or510 = or i8 %or9, %2
122 %conv6 = zext i8 %or510 to i64
126 define dso_local i64 @test_and(ptr nocapture noundef readonly %inp) local_unnamed_addr #0 {
127 ; 64BIT-LABEL: test_and:
128 ; 64BIT: # %bb.0: # %entry
129 ; 64BIT-NEXT: lbz r4, 0(r3)
130 ; 64BIT-NEXT: lbz r3, 1(r3)
131 ; 64BIT-NEXT: and r3, r3, r4
134 ; 32BIT-LABEL: test_and:
135 ; 32BIT: # %bb.0: # %entry
136 ; 32BIT-NEXT: mr r4, r3
137 ; 32BIT-NEXT: li r3, 0
138 ; 32BIT-NEXT: lbz r5, 0(r4)
139 ; 32BIT-NEXT: lbz r4, 1(r4)
140 ; 32BIT-NEXT: and r4, r4, r5
143 %0 = load i8, ptr %inp, align 1
144 %arrayidx1 = getelementptr inbounds i8, ptr %inp, i64 1
145 %1 = load i8, ptr %arrayidx1, align 1
146 %and5 = and i8 %1, %0
147 %conv3 = zext i8 %and5 to i64
151 define dso_local i64 @test_and2(ptr nocapture noundef readonly %inp) local_unnamed_addr #0 {
152 ; 64BIT-LABEL: test_and2:
153 ; 64BIT: # %bb.0: # %entry
154 ; 64BIT-NEXT: lbz r4, 0(r3)
155 ; 64BIT-NEXT: lbz r5, 1(r3)
156 ; 64BIT-NEXT: lbz r3, 2(r3)
157 ; 64BIT-NEXT: and r4, r5, r4
158 ; 64BIT-NEXT: and r3, r4, r3
161 ; 32BIT-LABEL: test_and2:
162 ; 32BIT: # %bb.0: # %entry
163 ; 32BIT-NEXT: mr r4, r3
164 ; 32BIT-NEXT: li r3, 0
165 ; 32BIT-NEXT: lbz r5, 0(r4)
166 ; 32BIT-NEXT: lbz r6, 1(r4)
167 ; 32BIT-NEXT: lbz r4, 2(r4)
168 ; 32BIT-NEXT: and r5, r6, r5
169 ; 32BIT-NEXT: and r4, r5, r4
172 %0 = load i8, ptr %inp, align 1
173 %arrayidx1 = getelementptr inbounds i8, ptr %inp, i64 1
174 %1 = load i8, ptr %arrayidx1, align 1
175 %and9 = and i8 %1, %0
176 %arrayidx3 = getelementptr inbounds i8, ptr %inp, i64 2
177 %2 = load i8, ptr %arrayidx3, align 1
178 %and510 = and i8 %and9, %2
179 %conv6 = zext i8 %and510 to i64
183 define dso_local i64 @test_mixed(ptr nocapture noundef readonly %inp) local_unnamed_addr #0 {
184 ; 64BIT-LABEL: test_mixed:
185 ; 64BIT: # %bb.0: # %entry
186 ; 64BIT-NEXT: lbz r4, 0(r3)
187 ; 64BIT-NEXT: lbz r5, 1(r3)
188 ; 64BIT-NEXT: lbz r6, 2(r3)
189 ; 64BIT-NEXT: lbz r3, 3(r3)
190 ; 64BIT-NEXT: and r4, r5, r4
191 ; 64BIT-NEXT: xor r4, r4, r6
192 ; 64BIT-NEXT: or r3, r4, r3
195 ; 32BIT-LABEL: test_mixed:
196 ; 32BIT: # %bb.0: # %entry
197 ; 32BIT-NEXT: mr r4, r3
198 ; 32BIT-NEXT: li r3, 0
199 ; 32BIT-NEXT: lbz r5, 0(r4)
200 ; 32BIT-NEXT: lbz r6, 1(r4)
201 ; 32BIT-NEXT: lbz r7, 2(r4)
202 ; 32BIT-NEXT: lbz r4, 3(r4)
203 ; 32BIT-NEXT: and r5, r6, r5
204 ; 32BIT-NEXT: xor r5, r5, r7
205 ; 32BIT-NEXT: or r4, r5, r4
208 %0 = load i8, ptr %inp, align 1
209 %arrayidx1 = getelementptr inbounds i8, ptr %inp, i64 1
210 %1 = load i8, ptr %arrayidx1, align 1
211 %and11 = and i8 %1, %0
212 %arrayidx3 = getelementptr inbounds i8, ptr %inp, i64 2
213 %2 = load i8, ptr %arrayidx3, align 1
214 %xor12 = xor i8 %and11, %2
215 %arrayidx5 = getelementptr inbounds i8, ptr %inp, i64 3
216 %3 = load i8, ptr %arrayidx5, align 1
217 %or13 = or i8 %xor12, %3
218 %conv7 = zext i8 %or13 to i64
222 define dso_local i64 @test_mixedtype(ptr nocapture noundef readonly %inp, ptr nocapture noundef readonly %inp2) local_unnamed_addr #0 {
223 ; 64BIT-LABEL: test_mixedtype:
224 ; 64BIT: # %bb.0: # %entry
225 ; 64BIT-NEXT: lbz r5, 0(r3)
226 ; 64BIT-NEXT: lhz r6, 2(r4)
227 ; 64BIT-NEXT: lbz r3, 2(r3)
228 ; 64BIT-NEXT: lhz r4, 6(r4)
229 ; 64BIT-NEXT: and r5, r6, r5
230 ; 64BIT-NEXT: xor r3, r5, r3
231 ; 64BIT-NEXT: or r3, r3, r4
234 ; 32BIT-LABEL: test_mixedtype:
235 ; 32BIT: # %bb.0: # %entry
236 ; 32BIT-NEXT: lbz r5, 0(r3)
237 ; 32BIT-NEXT: lhz r6, 2(r4)
238 ; 32BIT-NEXT: lbz r3, 2(r3)
239 ; 32BIT-NEXT: lhz r4, 6(r4)
240 ; 32BIT-NEXT: and r5, r6, r5
241 ; 32BIT-NEXT: xor r3, r5, r3
242 ; 32BIT-NEXT: or r3, r3, r4
243 ; 32BIT-NEXT: clrlwi r4, r3, 16
244 ; 32BIT-NEXT: li r3, 0
247 %0 = load i8, ptr %inp, align 1
248 %arrayidx1 = getelementptr inbounds i16, ptr %inp2, i64 1
249 %1 = load i16, ptr %arrayidx1, align 2
250 %2 = zext i8 %0 to i16
252 %arrayidx3 = getelementptr inbounds i8, ptr %inp, i64 2
253 %4 = load i8, ptr %arrayidx3, align 1
254 %5 = zext i8 %4 to i16
256 %arrayidx5 = getelementptr inbounds i16, ptr %inp2, i64 3
257 %7 = load i16, ptr %arrayidx5, align 2
258 %or10 = or i16 %6, %7
259 %conv7 = zext i16 %or10 to i64
263 define dso_local i64 @test_load(ptr nocapture noundef readonly %inp) local_unnamed_addr #0 {
264 ; 64BIT-LABEL: test_load:
265 ; 64BIT: # %bb.0: # %entry
266 ; 64BIT-NEXT: lbz r3, 0(r3)
269 ; 32BIT-LABEL: test_load:
270 ; 32BIT: # %bb.0: # %entry
271 ; 32BIT-NEXT: mr r4, r3
272 ; 32BIT-NEXT: li r3, 0
273 ; 32BIT-NEXT: lbz r4, 0(r4)
276 %0 = load i8, ptr %inp, align 1
277 %conv = zext i8 %0 to i64
281 define dso_local i64 @test_and32(ptr nocapture noundef readonly %inp) local_unnamed_addr #0 {
282 ; 64BIT-LABEL: test_and32:
283 ; 64BIT: # %bb.0: # %entry
284 ; 64BIT-NEXT: lwz r4, 0(r3)
285 ; 64BIT-NEXT: lwz r3, 4(r3)
286 ; 64BIT-NEXT: and r3, r3, r4
289 ; 32BIT-LABEL: test_and32:
290 ; 32BIT: # %bb.0: # %entry
291 ; 32BIT-NEXT: mr r4, r3
292 ; 32BIT-NEXT: li r3, 0
293 ; 32BIT-NEXT: lwz r5, 0(r4)
294 ; 32BIT-NEXT: lwz r4, 4(r4)
295 ; 32BIT-NEXT: and r4, r4, r5
298 %0 = load i32, ptr %inp, align 4
299 %arrayidx1 = getelementptr inbounds i32, ptr %inp, i64 1
300 %1 = load i32, ptr %arrayidx1, align 4
301 %and = and i32 %1, %0
302 %conv = zext i32 %and to i64
306 define dso_local zeroext i8 @test_needsclear(ptr nocapture noundef readonly %inp) local_unnamed_addr #0 {
307 ; 64BIT-LABEL: test_needsclear:
308 ; 64BIT: # %bb.0: # %entry
309 ; 64BIT-NEXT: lwz r4, 0(r3)
310 ; 64BIT-NEXT: lwz r3, 4(r3)
311 ; 64BIT-NEXT: and r3, r3, r4
312 ; 64BIT-NEXT: clrldi r3, r3, 56
315 ; 32BIT-LABEL: test_needsclear:
316 ; 32BIT: # %bb.0: # %entry
317 ; 32BIT-NEXT: lbz r4, 3(r3)
318 ; 32BIT-NEXT: lbz r3, 7(r3)
319 ; 32BIT-NEXT: and r3, r3, r4
322 %0 = load i32, ptr %inp, align 4
323 %arrayidx1 = getelementptr inbounds i32, ptr %inp, i64 1
324 %1 = load i32, ptr %arrayidx1, align 4
325 %and = and i32 %1, %0
326 %conv = trunc i32 %and to i8
330 attributes #0 = { nounwind }