blob: 2274edf8e176936ebe1066b537f876bc18474530 [file] [log] [blame]
Hal Finkel2b655bb2013-11-30 19:39:27 +00001; 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
Roman Divackye3f15c982012-06-04 17:36:38 +00003
4@a = thread_local global i32 0, align 4
5
Stephen Lind24ab202013-07-14 06:24:09 +00006;OPT0-LABEL: localexec:
7;OPT1-LABEL: localexec:
Roman Divackye3f15c982012-06-04 17:36:38 +00008define i32 @localexec() nounwind {
9entry:
Bill Schmidtb4548292013-02-25 16:44:35 +000010;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
Bill Schmidta1b72d02013-03-27 02:40:14 +000013;OPT0: stw [[REG2]], 0([[REG1]])
Bill Schmidtb4548292013-02-25 16:44:35 +000014;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]])
Roman Divackye3f15c982012-06-04 17:36:38 +000017 store i32 42, i32* @a, align 4
18 ret i32 0
19}
Roman Divacky1bab7052013-12-11 22:25:39 +000020
21; Test correct assembly code generation for thread-local storage
22; using the initial-exec model.
23
24@a2 = external thread_local global i32
25
26define signext i32 @main2() nounwind {
27entry:
28 %retval = alloca i32, align 4
29 store i32 0, i32* %retval
30 %0 = load i32* @a2, align 4
31 ret i32 %0
32}
33
34; OPT1-LABEL: main2:
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
38