1 # RUN: llc -start-after ppc-mi-peepholes -ppc-late-peephole %s -o - | FileCheck %s
4 source_filename = "a.c"
5 target datalayout = "e-m:e-i64:64-n32:64"
6 target triple = "powerpc64le-unknown-linux-gnu"
8 ; Function Attrs: norecurse nounwind readnone
9 define signext i32 @unsafeAddR0R3(i32 signext %a, i32 signext %b) local_unnamed_addr #0 {
11 %add = add nsw i32 %b, %a
15 ; Function Attrs: norecurse nounwind readnone
16 define signext i32 @unsafeAddR3R0(i32 signext %a, i32 signext %b) local_unnamed_addr #0 {
18 %add = add nsw i32 %b, %a
22 ; Function Attrs: norecurse nounwind readnone
23 define signext i32 @safeAddR0R3(i32 signext %a, i32 signext %b) local_unnamed_addr #0 {
25 %add = add nsw i32 %b, %a
29 ; Function Attrs: norecurse nounwind readnone
30 define signext i32 @safeAddR3R0(i32 signext %a, i32 signext %b) local_unnamed_addr #0 {
32 %add = add nsw i32 %b, %a
36 ; Function Attrs: norecurse nounwind readonly
37 define i64 @unsafeLDXR3R0(ptr nocapture readonly %ptr, i64 %off) local_unnamed_addr #1 {
39 %0 = bitcast ptr %ptr to ptr
40 %add.ptr = getelementptr inbounds i8, ptr %0, i64 %off
41 %1 = bitcast ptr %add.ptr to ptr
42 %2 = load i64, ptr %1, align 8, !tbaa !3
46 ; Function Attrs: norecurse nounwind readonly
47 define i64 @safeLDXZeroR3(ptr nocapture readonly %ptr, i64 %off) local_unnamed_addr #1 {
49 %0 = bitcast ptr %ptr to ptr
50 %add.ptr = getelementptr inbounds i8, ptr %0, i64 %off
51 %1 = bitcast ptr %add.ptr to ptr
52 %2 = load i64, ptr %1, align 8, !tbaa !3
56 ; Function Attrs: norecurse nounwind readonly
57 define i64 @safeLDXR3R0(ptr nocapture readonly %ptr, i64 %off) local_unnamed_addr #1 {
59 %0 = bitcast ptr %ptr to ptr
60 %add.ptr = getelementptr inbounds i8, ptr %0, i64 %off
61 %1 = bitcast ptr %add.ptr to ptr
62 %2 = load i64, ptr %1, align 8, !tbaa !3
66 attributes #0 = { norecurse nounwind readnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="ppc64le" "target-features"="+altivec,+bpermd,+crypto,+direct-move,+extdiv,+htm,+power8-vector,+vsx,-power9-vector" "unsafe-fp-math"="false" "use-soft-float"="false" }
67 attributes #1 = { norecurse nounwind readonly "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="ppc64le" "target-features"="+altivec,+bpermd,+crypto,+direct-move,+extdiv,+htm,+power8-vector,+vsx,-power9-vector" "unsafe-fp-math"="false" "use-soft-float"="false" }
69 !llvm.module.flags = !{!0, !1}
72 !0 = !{i32 1, !"wchar_size", i32 4}
73 !1 = !{i32 7, !"PIC Level", i32 2}
74 !2 = !{!"clang version 6.0.0 (trunk 318832)"}
76 !4 = !{!"long long", !5, i64 0}
77 !5 = !{!"omnipotent char", !6, i64 0}
78 !6 = !{!"Simple C/C++ TBAA"}
84 exposesReturnsTwice: false
86 regBankSelected: false
88 tracksRegLiveness: true
90 - { id: 0, class: g8rc, preferred-register: '' }
91 - { id: 1, class: g8rc, preferred-register: '' }
92 - { id: 2, class: gprc, preferred-register: '' }
93 - { id: 3, class: gprc, preferred-register: '' }
94 - { id: 4, class: gprc, preferred-register: '' }
95 - { id: 5, class: g8rc, preferred-register: '' }
97 - { reg: '$x3', virtual-reg: '%0' }
98 - { reg: '$x4', virtual-reg: '%1' }
100 isFrameAddressTaken: false
101 isReturnAddressTaken: false
110 maxCallFrameSize: 4294967295
111 hasOpaqueSPAdjustment: false
113 hasMustTailInVarArgFunc: false
126 %3:gprc = COPY %1.sub_32
127 %4:gprc = ADD4 killed $r0, killed %2
130 %5:g8rc = EXTSW_32_64 killed %4
132 BLR8 implicit $lr8, implicit $rm, implicit $x3
138 exposesReturnsTwice: false
140 regBankSelected: false
142 tracksRegLiveness: true
144 - { id: 0, class: g8rc, preferred-register: '' }
145 - { id: 1, class: g8rc, preferred-register: '' }
146 - { id: 2, class: gprc, preferred-register: '' }
147 - { id: 3, class: gprc, preferred-register: '' }
148 - { id: 4, class: gprc, preferred-register: '' }
149 - { id: 5, class: g8rc, preferred-register: '' }
151 - { reg: '$x3', virtual-reg: '%0' }
152 - { reg: '$x4', virtual-reg: '%1' }
154 isFrameAddressTaken: false
155 isReturnAddressTaken: false
164 maxCallFrameSize: 4294967295
165 hasOpaqueSPAdjustment: false
167 hasMustTailInVarArgFunc: false
179 %2:gprc = COPY %0.sub_32
181 %4:gprc = ADD4 killed %3, killed $r0
184 %5:g8rc = EXTSW_32_64 killed %4
186 BLR8 implicit $lr8, implicit $rm, implicit $x3
192 exposesReturnsTwice: false
194 regBankSelected: false
196 tracksRegLiveness: true
198 - { id: 0, class: g8rc, preferred-register: '' }
199 - { id: 1, class: g8rc, preferred-register: '' }
200 - { id: 2, class: gprc, preferred-register: '' }
201 - { id: 3, class: gprc, preferred-register: '' }
202 - { id: 4, class: gprc, preferred-register: '' }
203 - { id: 5, class: g8rc, preferred-register: '' }
205 - { reg: '$x3', virtual-reg: '%0' }
206 - { reg: '$x4', virtual-reg: '%1' }
208 isFrameAddressTaken: false
209 isReturnAddressTaken: false
218 maxCallFrameSize: 4294967295
219 hasOpaqueSPAdjustment: false
221 hasMustTailInVarArgFunc: false
233 %2:gprc = COPY %0.sub_32
235 %4:gprc = ADD4 killed $r0, killed %2
236 ; CHECK: addi 3, 3, 44
237 %5:g8rc = EXTSW_32_64 killed %4
239 BLR8 implicit $lr8, implicit $rm, implicit $x3
245 exposesReturnsTwice: false
247 regBankSelected: false
249 tracksRegLiveness: true
251 - { id: 0, class: g8rc, preferred-register: '' }
252 - { id: 1, class: g8rc, preferred-register: '' }
253 - { id: 2, class: gprc, preferred-register: '' }
254 - { id: 3, class: gprc, preferred-register: '' }
255 - { id: 4, class: gprc, preferred-register: '' }
256 - { id: 5, class: g8rc, preferred-register: '' }
258 - { reg: '$x3', virtual-reg: '%0' }
259 - { reg: '$x4', virtual-reg: '%1' }
261 isFrameAddressTaken: false
262 isReturnAddressTaken: false
271 maxCallFrameSize: 4294967295
272 hasOpaqueSPAdjustment: false
274 hasMustTailInVarArgFunc: false
286 %2:gprc = COPY %0.sub_32
288 %4:gprc = ADD4 killed %2, killed $r0
289 ; CHECK: addi 3, 3, 44
290 %5:g8rc = EXTSW_32_64 killed %4
292 BLR8 implicit $lr8, implicit $rm, implicit $x3
298 exposesReturnsTwice: false
300 regBankSelected: false
302 tracksRegLiveness: true
304 - { id: 0, class: g8rc_and_g8rc_nox0, preferred-register: '' }
305 - { id: 1, class: g8rc, preferred-register: '' }
306 - { id: 2, class: g8rc, preferred-register: '' }
308 - { reg: '$x0', virtual-reg: '%0' }
309 - { reg: '$x4', virtual-reg: '%1' }
311 isFrameAddressTaken: false
312 isReturnAddressTaken: false
321 maxCallFrameSize: 4294967295
322 hasOpaqueSPAdjustment: false
324 hasMustTailInVarArgFunc: false
335 %0:g8rc_and_g8rc_nox0 = LI8 44
336 %2:g8rc = LDX %0, $x0 :: (load (s64) from %ir.1, !tbaa !3)
340 BLR8 implicit $lr8, implicit $rm, implicit $x3
346 exposesReturnsTwice: false
348 regBankSelected: false
350 tracksRegLiveness: true
352 - { id: 0, class: g8rc_and_g8rc_nox0, preferred-register: '' }
353 - { id: 1, class: g8rc, preferred-register: '' }
354 - { id: 2, class: g8rc, preferred-register: '' }
356 - { reg: '$x3', virtual-reg: '%0' }
357 - { reg: '$x4', virtual-reg: '%1' }
359 isFrameAddressTaken: false
360 isReturnAddressTaken: false
369 maxCallFrameSize: 4294967295
370 hasOpaqueSPAdjustment: false
372 hasMustTailInVarArgFunc: false
383 %0:g8rc_and_g8rc_nox0 = LI8 44
384 %2:g8rc = LDX $zero8, %1 :: (load (s64) from %ir.1, !tbaa !3)
387 BLR8 implicit $lr8, implicit $rm, implicit $x3
393 exposesReturnsTwice: false
395 regBankSelected: false
397 tracksRegLiveness: true
399 - { id: 0, class: g8rc_and_g8rc_nox0, preferred-register: '' }
400 - { id: 1, class: g8rc, preferred-register: '' }
401 - { id: 2, class: g8rc, preferred-register: '' }
403 - { reg: '$x3', virtual-reg: '%0' }
404 - { reg: '$x4', virtual-reg: '%1' }
406 isFrameAddressTaken: false
407 isReturnAddressTaken: false
416 maxCallFrameSize: 4294967295
417 hasOpaqueSPAdjustment: false
419 hasMustTailInVarArgFunc: false
430 %0:g8rc_and_g8rc_nox0 = COPY $x3
431 %2:g8rc = LDX %0, $x0 :: (load (s64) from %ir.1, !tbaa !3)
434 BLR8 implicit $lr8, implicit $rm, implicit $x3