1; RUN: llc -mtriple=aarch64-apple-ios %s -o - -aarch64-enable-nonlazybind | FileCheck %s
2; RUN: llc -mtriple=aarch64-apple-ios %s -o - | FileCheck %s --check-prefix=CHECK-NORMAL
3
4define void @local() nonlazybind {
5  ret void
6}
7
8declare void @nonlocal() nonlazybind
9
10define void @test_laziness() {
11; CHECK-LABEL: test_laziness:
12
13; CHECK: bl _local
14
15; CHECK: adrp x[[TMP:[0-9]+]], _nonlocal@GOTPAGE
16; CHECK: ldr [[FUNC:x[0-9]+]], [x[[TMP]], _nonlocal@GOTPAGEOFF]
17; CHECK: blr [[FUNC]]
18
19; CHECK-NORMAL-LABEL: test_laziness:
20; CHECK-NORMAL: bl _local
21; CHEKC-NORMAL: bl _nonlocal
22
23  call void @local()
24  call void @nonlocal()
25  ret void
26}
27
28define void @test_laziness_tail() {
29; CHECK-LABEL: test_laziness_tail:
30
31; CHECK: adrp x[[TMP:[0-9]+]], _nonlocal@GOTPAGE
32; CHECK: ldr [[FUNC:x[0-9]+]], [x[[TMP]], _nonlocal@GOTPAGEOFF]
33; CHECK: br [[FUNC]]
34
35; CHECK-NORMAL-LABEL: test_laziness_tail:
36; CHECK-NORMAL: b _nonlocal
37
38  tail call void @nonlocal()
39  ret void
40}
41