1 ; RUN: llc -O0 < %s -march=ppc64 -mcpu=ppc64 | FileCheck -check-prefix=OPT0 %s
2 ; RUN: llc -O1 < %s -march=ppc64 -mcpu=ppc64 | FileCheck -check-prefix=OPT1 %s
4 @a = thread_local global i32 0, align 4
6 ;OPT0-LABEL: localexec:
7 ;OPT1-LABEL: localexec:
8 define i32 @localexec() nounwind {
10 ;OPT0: addis [[REG1:[0-9]+]], 13, a@tprel@ha
11 ;OPT0-NEXT: li [[REG2:[0-9]+]], 42
12 ;OPT0-NEXT: addi [[REG1]], [[REG1]], a@tprel@l
13 ;OPT0: stw [[REG2]], 0([[REG1]])
14 ;OPT1: addis [[REG1:[0-9]+]], 13, a@tprel@ha
15 ;OPT1-NEXT: li [[REG2:[0-9]+]], 42
16 ;OPT1-NEXT: stw [[REG2]], a@tprel@l([[REG1]])
17 store i32 42, i32* @a, align 4
21 ; Test correct assembly code generation for thread-local storage
22 ; using the initial-exec model.
24 @a2 = external thread_local global i32
26 define signext i32 @main2() nounwind {
28 %retval = alloca i32, align 4
29 store i32 0, i32* %retval
30 %0 = load i32* @a2, align 4
35 ; OPT1: addis [[REG1:[0-9]+]], 2, a2@got@tprel@ha
36 ; OPT1: ld [[REG2:[0-9]+]], a2@got@tprel@l([[REG1]])
37 ; OPT1: add {{[0-9]+}}, [[REG2]], a2@tls