1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
2 ; RUN: llc -mtriple=aarch64-apple-ios %s -o - -aarch64-macho-enable-nonlazybind | FileCheck %s --check-prefix=MACHO
3 ; RUN: llc -mtriple=aarch64-apple-ios %s -o - | FileCheck %s --check-prefix=MACHO-NORMAL
4 ; RUN: llc -mtriple=aarch64 -fast-isel %s -o - | FileCheck %s --check-prefixes=ELF,ELF-FI
5 ; RUN: llc -mtriple=aarch64 -global-isel %s -o - | FileCheck %s --check-prefixes=ELF,ELF-GI
6 ; RUN: llc -mtriple=aarch64 %s -o - | FileCheck %s --check-prefixes=ELF,ELF-SDAG
8 declare void @external() nonlazybind
10 define void @test_laziness(ptr %a) nounwind {
12 ; MACHO-LABEL: test_laziness:
14 ; MACHO-NEXT: stp x20, x19, [sp, #-32]! ; 16-byte Folded Spill
15 ; MACHO-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
17 ; MACHO-NEXT: adrp x8, _external@GOTPAGE
18 ; MACHO-NEXT: mov x19, x0
20 ; MACHO-NEXT: ldr x8, [x8, _external@GOTPAGEOFF]
23 ; MACHO-NEXT: adrp x8, _memset@GOTPAGE
24 ; MACHO-NEXT: mov x0, x19
25 ; MACHO-NEXT: mov w1, #1 ; =0x1
27 ; MACHO-NEXT: ldr x8, [x8, _memset@GOTPAGEOFF]
28 ; MACHO-NEXT: mov w2, #1000 ; =0x3e8
30 ; MACHO-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
31 ; MACHO-NEXT: ldp x20, x19, [sp], #32 ; 16-byte Folded Reload
33 ; MACHO-NEXT: .loh AdrpLdrGot Lloh2, Lloh3
34 ; MACHO-NEXT: .loh AdrpLdrGot Lloh0, Lloh1
36 ; MACHO-NORMAL-LABEL: test_laziness:
37 ; MACHO-NORMAL: ; %bb.0:
38 ; MACHO-NORMAL-NEXT: stp x20, x19, [sp, #-32]! ; 16-byte Folded Spill
39 ; MACHO-NORMAL-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
40 ; MACHO-NORMAL-NEXT: mov x19, x0
41 ; MACHO-NORMAL-NEXT: bl _external
42 ; MACHO-NORMAL-NEXT: Lloh0:
43 ; MACHO-NORMAL-NEXT: adrp x8, _memset@GOTPAGE
44 ; MACHO-NORMAL-NEXT: mov x0, x19
45 ; MACHO-NORMAL-NEXT: mov w1, #1 ; =0x1
46 ; MACHO-NORMAL-NEXT: Lloh1:
47 ; MACHO-NORMAL-NEXT: ldr x8, [x8, _memset@GOTPAGEOFF]
48 ; MACHO-NORMAL-NEXT: mov w2, #1000 ; =0x3e8
49 ; MACHO-NORMAL-NEXT: blr x8
50 ; MACHO-NORMAL-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
51 ; MACHO-NORMAL-NEXT: ldp x20, x19, [sp], #32 ; 16-byte Folded Reload
52 ; MACHO-NORMAL-NEXT: ret
53 ; MACHO-NORMAL-NEXT: .loh AdrpLdrGot Lloh0, Lloh1
55 ; ELF-LABEL: test_laziness:
57 ; ELF-NEXT: stp x30, x19, [sp, #-16]! // 16-byte Folded Spill
58 ; ELF-NEXT: adrp x8, :got:external
59 ; ELF-NEXT: mov x19, x0
60 ; ELF-NEXT: ldr x8, [x8, :got_lo12:external]
62 ; ELF-NEXT: adrp x8, :got:memset
63 ; ELF-NEXT: mov x0, x19
64 ; ELF-NEXT: mov w1, #1 // =0x1
65 ; ELF-NEXT: ldr x8, [x8, :got_lo12:memset]
66 ; ELF-NEXT: mov w2, #1000 // =0x3e8
68 ; ELF-NEXT: ldp x30, x19, [sp], #16 // 16-byte Folded Reload
71 call void @llvm.memset.p0.i64(ptr align 1 %a, i8 1, i64 1000, i1 false)
75 define void @test_laziness_tail() nounwind {
76 ; MACHO-LABEL: test_laziness_tail:
79 ; MACHO-NEXT: adrp x0, _external@GOTPAGE
81 ; MACHO-NEXT: ldr x0, [x0, _external@GOTPAGEOFF]
83 ; MACHO-NEXT: .loh AdrpLdrGot Lloh4, Lloh5
85 ; MACHO-NORMAL-LABEL: test_laziness_tail:
86 ; MACHO-NORMAL: ; %bb.0:
87 ; MACHO-NORMAL-NEXT: b _external
89 ; ELF-LABEL: test_laziness_tail:
91 ; ELF-NEXT: adrp x0, :got:external
92 ; ELF-NEXT: ldr x0, [x0, :got_lo12:external]
94 tail call void @external()
98 declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg)
100 !llvm.module.flags = !{!0}
101 !0 = !{i32 7, !"RtLibUseGOT", i32 1}
102 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: