1; Test loads of symbolic addresses when generating medium- and
2; large-model non-PIC.
3;
4; RUN: llc < %s -mtriple=s390x-linux-gnu -code-model=medium | FileCheck %s
5; RUN: llc < %s -mtriple=s390x-linux-gnu -code-model=large | FileCheck %s
6
7@ev = external global i32
8@dv = global i32 0
9@pv = protected global i32 0
10@hv = hidden global i32 0
11
12declare void @ef()
13define void @df() {
14  ret void
15}
16define protected void @pf() {
17  ret void
18}
19define hidden void @hf() {
20  ret void
21}
22
23; Test loads of external variables.  There is no guarantee that the
24; variable will be in range of LARL.
25define i32 *@f1() {
26; CHECK-LABEL: f1:
27; CHECK: lgrl %r2, ev@GOT
28; CHECK: br %r14
29  ret i32 *@ev
30}
31
32; ...likewise locally-defined normal-visibility variables.
33define i32 *@f2() {
34; CHECK-LABEL: f2:
35; CHECK: lgrl %r2, dv@GOT
36; CHECK: br %r14
37  ret i32 *@dv
38}
39
40; ...likewise protected variables.
41define i32 *@f3() {
42; CHECK-LABEL: f3:
43; CHECK: lgrl %r2, pv@GOT
44; CHECK: br %r14
45  ret i32 *@pv
46}
47
48; ...likewise hidden variables.
49define i32 *@f4() {
50; CHECK-LABEL: f4:
51; CHECK: lgrl %r2, hv@GOT
52; CHECK: br %r14
53  ret i32 *@hv
54}
55
56; Check loads of external functions.  This could use LARL, but we don't have
57; code to detect that yet.
58define void() *@f5() {
59; CHECK-LABEL: f5:
60; CHECK: lgrl %r2, ef@GOT
61; CHECK: br %r14
62  ret void() *@ef
63}
64
65; ...likewise locally-defined normal-visibility functions.
66define void() *@f6() {
67; CHECK-LABEL: f6:
68; CHECK: lgrl %r2, df@GOT
69; CHECK: br %r14
70  ret void() *@df
71}
72
73; ...likewise protected functions.
74define void() *@f7() {
75; CHECK-LABEL: f7:
76; CHECK: lgrl %r2, pf@GOT
77; CHECK: br %r14
78  ret void() *@pf
79}
80
81; ...likewise hidden functions.
82define void() *@f8() {
83; CHECK-LABEL: f8:
84; CHECK: lgrl %r2, hf@GOT
85; CHECK: br %r14
86  ret void() *@hf
87}
88