xref: /aosp_15_r20/external/llvm/test/CodeGen/SystemZ/tls-02.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; Test initial-exec TLS accesses.
2*9880d681SAndroid Build Coastguard Worker;
3*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mcpu=z10 -mtriple=s390x-linux-gnu -relocation-model=pic | FileCheck %s -check-prefix=CHECK-MAIN
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker@x = thread_local(initialexec) global i32 0
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Worker; The offset must be loaded from the GOT.  This TLS access model does
8*9880d681SAndroid Build Coastguard Worker; not use literal pool constants.
9*9880d681SAndroid Build Coastguard Workerdefine i32 *@foo() {
10*9880d681SAndroid Build Coastguard Worker; CHECK-MAIN-LABEL: foo:
11*9880d681SAndroid Build Coastguard Worker; CHECK-MAIN: ear [[HIGH:%r[0-5]]], %a0
12*9880d681SAndroid Build Coastguard Worker; CHECK-MAIN: sllg %r2, [[HIGH]], 32
13*9880d681SAndroid Build Coastguard Worker; CHECK-MAIN: ear %r2, %a1
14*9880d681SAndroid Build Coastguard Worker; CHECK-MAIN: larl %r1, x@INDNTPOFF
15*9880d681SAndroid Build Coastguard Worker; CHECK-MAIN: ag %r2, 0(%r1)
16*9880d681SAndroid Build Coastguard Worker; CHECK-MAIN: br %r14
17*9880d681SAndroid Build Coastguard Worker  ret i32 *@x
18*9880d681SAndroid Build Coastguard Worker}
19