xref: /aosp_15_r20/external/llvm/test/CodeGen/SystemZ/tls-05.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; Test general-dynamic TLS access optimizations.
2*9880d681SAndroid Build Coastguard Worker;
3*9880d681SAndroid Build Coastguard Worker; If we access the same TLS variable twice, there should only be
4*9880d681SAndroid Build Coastguard Worker; a single call to __tls_get_offset.
5*9880d681SAndroid Build Coastguard Worker;
6*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mcpu=z10 -mtriple=s390x-linux-gnu -relocation-model=pic | grep "__tls_get_offset" | count 1
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker@x = thread_local global i32 0
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Workerdefine i32 @foo() {
11*9880d681SAndroid Build Coastguard Worker  %val = load i32, i32* @x
12*9880d681SAndroid Build Coastguard Worker  %inc = add nsw i32 %val, 1
13*9880d681SAndroid Build Coastguard Worker  store i32 %inc, i32* @x
14*9880d681SAndroid Build Coastguard Worker  ret i32 %val
15*9880d681SAndroid Build Coastguard Worker}
16