Revert "r227976 - [PowerPC] Yet another approach to __tls_get_addr" and related fixups
[oota-llvm.git] / test / CodeGen / PowerPC / tls-store2.ll
1 ; RUN: llc -march=ppc64 -mcpu=pwr7 -O2 -relocation-model=pic < %s | FileCheck %s
2
3 target datalayout = "e-m:e-i64:64-n32:64"
4 target triple = "powerpc64le-unknown-linux-gnu"
5
6 ; Test back-to-back stores of TLS variables to ensure call sequences no
7 ; longer overlap.
8
9 @__once_callable = external thread_local global i8**
10 @__once_call = external thread_local global void ()*
11
12 define i64 @call_once(i64 %flag, i8* %ptr) {
13 entry:
14   %var = alloca i8*, align 8
15   store i8* %ptr, i8** %var, align 8
16   store i8** %var, i8*** @__once_callable, align 8
17   store void ()* @__once_call_impl, void ()** @__once_call, align 8
18   ret i64 %flag
19 }
20
21 ; CHECK-LABEL: call_once:
22 ; CHECK: addis 3, 2, __once_callable@got@tlsgd@ha
23 ; CHECK: addi 3, 3, __once_callable@got@tlsgd@l
24 ; CHECK: bl __tls_get_addr(__once_callable@tlsgd)
25 ; CHECK-NEXT: nop
26 ; CHECK: std {{[0-9]+}}, 0(3)
27 ; CHECK: addis 3, 2, __once_call@got@tlsgd@ha
28 ; CHECK: addi 3, 3, __once_call@got@tlsgd@l
29 ; CHECK: bl __tls_get_addr(__once_call@tlsgd)
30 ; CHECK-NEXT: nop
31 ; CHECK: std {{[0-9]+}}, 0(3)
32
33 declare void @__once_call_impl()