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: lbz r4, 0(r3)
23 ; 32BIT-NEXT: lbz r3, 1(r3)
24 ; 32BIT-NEXT: xor r4, r3, r4
25 ; 32BIT-NEXT: li r3, 0
28 %0 = load i8, ptr %inp, align 1
29 %arrayidx1 = getelementptr inbounds i8, ptr %inp, i64 1
30 %1 = load i8, ptr %arrayidx1, align 1
32 %conv3 = zext i8 %xor5 to i64
36 define dso_local i64 @test_xor2(ptr nocapture noundef readonly %inp) local_unnamed_addr #0 {
37 ; 64BIT-LABEL: test_xor2:
38 ; 64BIT: # %bb.0: # %entry
39 ; 64BIT-NEXT: lbz r4, 0(r3)
40 ; 64BIT-NEXT: lbz r5, 1(r3)
41 ; 64BIT-NEXT: lbz r3, 2(r3)
42 ; 64BIT-NEXT: xor r4, r5, r4
43 ; 64BIT-NEXT: xor r3, r4, r3
46 ; 32BIT-LABEL: test_xor2:
47 ; 32BIT: # %bb.0: # %entry
48 ; 32BIT-NEXT: lbz r4, 0(r3)
49 ; 32BIT-NEXT: lbz r5, 1(r3)
50 ; 32BIT-NEXT: lbz r3, 2(r3)
51 ; 32BIT-NEXT: xor r4, r5, r4
52 ; 32BIT-NEXT: xor r4, r4, r3
53 ; 32BIT-NEXT: li r3, 0
56 %0 = load i8, ptr %inp, align 1
57 %arrayidx1 = getelementptr inbounds i8, ptr %inp, i64 1
58 %1 = load i8, ptr %arrayidx1, align 1
60 %arrayidx3 = getelementptr inbounds i8, ptr %inp, i64 2
61 %2 = load i8, ptr %arrayidx3, align 1
62 %xor510 = xor i8 %xor9, %2
63 %conv6 = zext i8 %xor510 to i64
67 define dso_local i64 @test_or(ptr nocapture noundef readonly %inp) local_unnamed_addr #0 {
68 ; 64BIT-LABEL: test_or:
69 ; 64BIT: # %bb.0: # %entry
70 ; 64BIT-NEXT: lbz r4, 0(r3)
71 ; 64BIT-NEXT: lbz r3, 1(r3)
72 ; 64BIT-NEXT: or r3, r3, r4
75 ; 32BIT-LABEL: test_or:
76 ; 32BIT: # %bb.0: # %entry
77 ; 32BIT-NEXT: lbz r4, 0(r3)
78 ; 32BIT-NEXT: lbz r3, 1(r3)
79 ; 32BIT-NEXT: or r4, r3, r4
80 ; 32BIT-NEXT: li r3, 0
83 %0 = load i8, ptr %inp, align 1
84 %arrayidx1 = getelementptr inbounds i8, ptr %inp, i64 1
85 %1 = load i8, ptr %arrayidx1, align 1
87 %conv3 = zext i8 %or5 to i64
91 define dso_local i64 @test_or2(ptr nocapture noundef readonly %inp) local_unnamed_addr #0 {
92 ; 64BIT-LABEL: test_or2:
93 ; 64BIT: # %bb.0: # %entry
94 ; 64BIT-NEXT: lbz r4, 0(r3)
95 ; 64BIT-NEXT: lbz r5, 1(r3)
96 ; 64BIT-NEXT: lbz r3, 2(r3)
97 ; 64BIT-NEXT: or r4, r5, r4
98 ; 64BIT-NEXT: or r3, r4, r3
101 ; 32BIT-LABEL: test_or2:
102 ; 32BIT: # %bb.0: # %entry
103 ; 32BIT-NEXT: lbz r4, 0(r3)
104 ; 32BIT-NEXT: lbz r5, 1(r3)
105 ; 32BIT-NEXT: lbz r3, 2(r3)
106 ; 32BIT-NEXT: or r4, r5, r4
107 ; 32BIT-NEXT: or r4, r4, r3
108 ; 32BIT-NEXT: li r3, 0
111 %0 = load i8, ptr %inp, align 1
112 %arrayidx1 = getelementptr inbounds i8, ptr %inp, i64 1
113 %1 = load i8, ptr %arrayidx1, align 1
115 %arrayidx3 = getelementptr inbounds i8, ptr %inp, i64 2
116 %2 = load i8, ptr %arrayidx3, align 1
117 %or510 = or i8 %or9, %2
118 %conv6 = zext i8 %or510 to i64
122 define dso_local i64 @test_and(ptr nocapture noundef readonly %inp) local_unnamed_addr #0 {
123 ; 64BIT-LABEL: test_and:
124 ; 64BIT: # %bb.0: # %entry
125 ; 64BIT-NEXT: lbz r4, 0(r3)
126 ; 64BIT-NEXT: lbz r3, 1(r3)
127 ; 64BIT-NEXT: and r3, r3, r4
130 ; 32BIT-LABEL: test_and:
131 ; 32BIT: # %bb.0: # %entry
132 ; 32BIT-NEXT: lbz r4, 0(r3)
133 ; 32BIT-NEXT: lbz r3, 1(r3)
134 ; 32BIT-NEXT: and r4, r3, r4
135 ; 32BIT-NEXT: li r3, 0
138 %0 = load i8, ptr %inp, align 1
139 %arrayidx1 = getelementptr inbounds i8, ptr %inp, i64 1
140 %1 = load i8, ptr %arrayidx1, align 1
141 %and5 = and i8 %1, %0
142 %conv3 = zext i8 %and5 to i64
146 define dso_local i64 @test_and2(ptr nocapture noundef readonly %inp) local_unnamed_addr #0 {
147 ; 64BIT-LABEL: test_and2:
148 ; 64BIT: # %bb.0: # %entry
149 ; 64BIT-NEXT: lbz r4, 0(r3)
150 ; 64BIT-NEXT: lbz r5, 1(r3)
151 ; 64BIT-NEXT: lbz r3, 2(r3)
152 ; 64BIT-NEXT: and r4, r5, r4
153 ; 64BIT-NEXT: and r3, r4, r3
156 ; 32BIT-LABEL: test_and2:
157 ; 32BIT: # %bb.0: # %entry
158 ; 32BIT-NEXT: lbz r4, 0(r3)
159 ; 32BIT-NEXT: lbz r5, 1(r3)
160 ; 32BIT-NEXT: lbz r3, 2(r3)
161 ; 32BIT-NEXT: and r4, r5, r4
162 ; 32BIT-NEXT: and r4, r4, r3
163 ; 32BIT-NEXT: li r3, 0
166 %0 = load i8, ptr %inp, align 1
167 %arrayidx1 = getelementptr inbounds i8, ptr %inp, i64 1
168 %1 = load i8, ptr %arrayidx1, align 1
169 %and9 = and i8 %1, %0
170 %arrayidx3 = getelementptr inbounds i8, ptr %inp, i64 2
171 %2 = load i8, ptr %arrayidx3, align 1
172 %and510 = and i8 %and9, %2
173 %conv6 = zext i8 %and510 to i64
177 define dso_local i64 @test_mixed(ptr nocapture noundef readonly %inp) local_unnamed_addr #0 {
178 ; 64BIT-LABEL: test_mixed:
179 ; 64BIT: # %bb.0: # %entry
180 ; 64BIT-NEXT: lbz r4, 0(r3)
181 ; 64BIT-NEXT: lbz r5, 1(r3)
182 ; 64BIT-NEXT: and r4, r5, r4
183 ; 64BIT-NEXT: lbz r5, 2(r3)
184 ; 64BIT-NEXT: lbz r3, 3(r3)
185 ; 64BIT-NEXT: xor r4, r4, r5
186 ; 64BIT-NEXT: or r3, r4, r3
189 ; 32BIT-LABEL: test_mixed:
190 ; 32BIT: # %bb.0: # %entry
191 ; 32BIT-NEXT: lbz r4, 0(r3)
192 ; 32BIT-NEXT: lbz r5, 1(r3)
193 ; 32BIT-NEXT: and r4, r5, r4
194 ; 32BIT-NEXT: lbz r5, 2(r3)
195 ; 32BIT-NEXT: lbz r3, 3(r3)
196 ; 32BIT-NEXT: xor r4, r4, r5
197 ; 32BIT-NEXT: or r4, r4, r3
198 ; 32BIT-NEXT: li r3, 0
201 %0 = load i8, ptr %inp, align 1
202 %arrayidx1 = getelementptr inbounds i8, ptr %inp, i64 1
203 %1 = load i8, ptr %arrayidx1, align 1
204 %and11 = and i8 %1, %0
205 %arrayidx3 = getelementptr inbounds i8, ptr %inp, i64 2
206 %2 = load i8, ptr %arrayidx3, align 1
207 %xor12 = xor i8 %and11, %2
208 %arrayidx5 = getelementptr inbounds i8, ptr %inp, i64 3
209 %3 = load i8, ptr %arrayidx5, align 1
210 %or13 = or i8 %xor12, %3
211 %conv7 = zext i8 %or13 to i64
215 define dso_local i64 @test_mixedtype(ptr nocapture noundef readonly %inp, ptr nocapture noundef readonly %inp2) local_unnamed_addr #0 {
216 ; 64BIT-LABEL: test_mixedtype:
217 ; 64BIT: # %bb.0: # %entry
218 ; 64BIT-NEXT: lbz r5, 0(r3)
219 ; 64BIT-NEXT: lhz r6, 2(r4)
220 ; 64BIT-NEXT: lbz r3, 2(r3)
221 ; 64BIT-NEXT: lhz r4, 6(r4)
222 ; 64BIT-NEXT: and r5, r6, r5
223 ; 64BIT-NEXT: xor r3, r5, r3
224 ; 64BIT-NEXT: or r3, r3, r4
227 ; 32BIT-LABEL: test_mixedtype:
228 ; 32BIT: # %bb.0: # %entry
229 ; 32BIT-NEXT: lbz r5, 0(r3)
230 ; 32BIT-NEXT: lhz r6, 2(r4)
231 ; 32BIT-NEXT: lbz r3, 2(r3)
232 ; 32BIT-NEXT: lhz r4, 6(r4)
233 ; 32BIT-NEXT: and r5, r6, r5
234 ; 32BIT-NEXT: xor r3, r5, r3
235 ; 32BIT-NEXT: or r3, r3, r4
236 ; 32BIT-NEXT: clrlwi r4, r3, 16
237 ; 32BIT-NEXT: li r3, 0
240 %0 = load i8, ptr %inp, align 1
241 %arrayidx1 = getelementptr inbounds i16, ptr %inp2, i64 1
242 %1 = load i16, ptr %arrayidx1, align 2
243 %2 = zext i8 %0 to i16
245 %arrayidx3 = getelementptr inbounds i8, ptr %inp, i64 2
246 %4 = load i8, ptr %arrayidx3, align 1
247 %5 = zext i8 %4 to i16
249 %arrayidx5 = getelementptr inbounds i16, ptr %inp2, i64 3
250 %7 = load i16, ptr %arrayidx5, align 2
251 %or10 = or i16 %6, %7
252 %conv7 = zext i16 %or10 to i64
256 define dso_local i64 @test_load(ptr nocapture noundef readonly %inp) local_unnamed_addr #0 {
257 ; 64BIT-LABEL: test_load:
258 ; 64BIT: # %bb.0: # %entry
259 ; 64BIT-NEXT: lbz r3, 0(r3)
262 ; 32BIT-LABEL: test_load:
263 ; 32BIT: # %bb.0: # %entry
264 ; 32BIT-NEXT: lbz r4, 0(r3)
265 ; 32BIT-NEXT: li r3, 0
268 %0 = load i8, ptr %inp, align 1
269 %conv = zext i8 %0 to i64
273 define dso_local i64 @test_and32(ptr nocapture noundef readonly %inp) local_unnamed_addr #0 {
274 ; 64BIT-LABEL: test_and32:
275 ; 64BIT: # %bb.0: # %entry
276 ; 64BIT-NEXT: lwz r4, 0(r3)
277 ; 64BIT-NEXT: lwz r3, 4(r3)
278 ; 64BIT-NEXT: and r3, r3, r4
281 ; 32BIT-LABEL: test_and32:
282 ; 32BIT: # %bb.0: # %entry
283 ; 32BIT-NEXT: lwz r4, 0(r3)
284 ; 32BIT-NEXT: lwz r3, 4(r3)
285 ; 32BIT-NEXT: and r4, r3, r4
286 ; 32BIT-NEXT: li r3, 0
289 %0 = load i32, ptr %inp, align 4
290 %arrayidx1 = getelementptr inbounds i32, ptr %inp, i64 1
291 %1 = load i32, ptr %arrayidx1, align 4
292 %and = and i32 %1, %0
293 %conv = zext i32 %and to i64
297 define dso_local zeroext i8 @test_needsclear(ptr nocapture noundef readonly %inp) local_unnamed_addr #0 {
298 ; 64BIT-LABEL: test_needsclear:
299 ; 64BIT: # %bb.0: # %entry
300 ; 64BIT-NEXT: lwz r4, 0(r3)
301 ; 64BIT-NEXT: lwz r3, 4(r3)
302 ; 64BIT-NEXT: and r3, r3, r4
303 ; 64BIT-NEXT: clrldi r3, r3, 56
306 ; 32BIT-LABEL: test_needsclear:
307 ; 32BIT: # %bb.0: # %entry
308 ; 32BIT-NEXT: lbz r4, 3(r3)
309 ; 32BIT-NEXT: lbz r3, 7(r3)
310 ; 32BIT-NEXT: and r3, r3, r4
313 %0 = load i32, ptr %inp, align 4
314 %arrayidx1 = getelementptr inbounds i32, ptr %inp, i64 1
315 %1 = load i32, ptr %arrayidx1, align 4
316 %and = and i32 %1, %0
317 %conv = trunc i32 %and to i8
321 attributes #0 = { nounwind }