1; Test loads of symbolic addresses when generating small-model non-PIC. 2; All addresses can be treated as PC 3; 4; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s 5 6@e4 = external dso_local global i32 7@d4 = global i32 1 8@e2 = external dso_local global i32, align 2 9@d2 = global i32 1, align 2 10@e1 = external dso_local global i32, align 1 11@d1 = global i32 1, align 1 12 13declare dso_local void @ef() 14define void @df() { 15 ret void 16} 17 18declare dso_local void @foo(i32 *) 19 20; Test a load of a fully-aligned external variable. 21define i32 *@f1() { 22; CHECK-LABEL: f1: 23; CHECK: larl %r2, e4 24; CHECK-NEXT: br %r14 25 ret i32 *@e4 26} 27 28; Test a load of a fully-aligned local variable. 29define i32 *@f2() { 30; CHECK-LABEL: f2: 31; CHECK: larl %r2, d4 32; CHECK-NEXT: br %r14 33 ret i32 *@d4 34} 35 36; Test a load of a 2-byte-aligned external variable. 37define i32 *@f3() { 38; CHECK-LABEL: f3: 39; CHECK: larl %r2, e2 40; CHECK-NEXT: br %r14 41 ret i32 *@e2 42} 43 44; Test a load of a 2-byte-aligned local variable. 45define i32 *@f4() { 46; CHECK-LABEL: f4: 47; CHECK: larl %r2, d2 48; CHECK-NEXT: br %r14 49 ret i32 *@d2 50} 51 52; Test a load of an unaligned external variable, which must go via the GOT. 53define i32 *@f5() { 54; CHECK-LABEL: f5: 55; CHECK: lgrl %r2, e1@GOT 56; CHECK-NEXT: br %r14 57 ret i32 *@e1 58} 59 60; Test a load of an unaligned local variable, which must go via the GOT. 61define i32 *@f6() { 62; CHECK-LABEL: f6: 63; CHECK: lgrl %r2, d1@GOT 64; CHECK-NEXT: br %r14 65 ret i32 *@d1 66} 67 68; Test a load of an external function. 69define void() *@f7() { 70; CHECK-LABEL: f7: 71; CHECK: larl %r2, ef 72; CHECK-NEXT: br %r14 73 ret void() *@ef 74} 75 76; Test a load of a local function. 77define void() *@f8() { 78; CHECK-LABEL: f8: 79; CHECK: larl %r2, df 80; CHECK-NEXT: br %r14 81 ret void() *@df 82} 83 84; Test that LARL can be rematerialized. 85define i32 @f9() { 86; CHECK-LABEL: f9: 87; CHECK: larl %r2, d2 88; CHECK: brasl %r14, foo@PLT 89; CHECK: larl %r2, d2 90; CHECK: brasl %r14, foo@PLT 91; CHECK: br %r14 92 call void @foo(i32 *@d2) 93 call void @foo(i32 *@d2) 94 ret i32 0 95} 96