1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-gnu-linux < %s | FileCheck %s -check-prefix=CHECK
4 @var_char = external thread_local local_unnamed_addr global i8, align 1
5 @var_short = external thread_local local_unnamed_addr global i16, align 2
6 @var_int = external thread_local local_unnamed_addr global i32, align 4
7 @var_long_long = external thread_local local_unnamed_addr global i64, align 8
9 define dso_local zeroext i8 @test_char_one() {
10 ; CHECK-LABEL: test_char_one:
11 ; CHECK: # %bb.0: # %entry
12 ; CHECK-NEXT: addis 3, 2, var_char@got@tprel@ha
13 ; CHECK-NEXT: ld 3, var_char@got@tprel@l(3)
14 ; CHECK-NEXT: lbzx 3, 3, var_char@tls
17 %0 = load i8, ptr @var_char, align 1, !tbaa !4
21 define dso_local void @test_char_two(i32 signext %a) {
22 ; CHECK-LABEL: test_char_two:
23 ; CHECK: # %bb.0: # %entry
24 ; CHECK-NEXT: addis 4, 2, var_char@got@tprel@ha
25 ; CHECK-NEXT: ld 4, var_char@got@tprel@l(4)
26 ; CHECK-NEXT: stbx 3, 4, var_char@tls
29 %conv = trunc i32 %a to i8
30 store i8 %conv, ptr @var_char, align 1, !tbaa !4
34 define dso_local zeroext i8 @test_char_three(i8 zeroext %a) {
35 ; CHECK-LABEL: test_char_three:
36 ; CHECK: # %bb.0: # %entry
37 ; CHECK-NEXT: addis 4, 2, var_char@got@tprel@ha
38 ; CHECK-NEXT: ld 4, var_char@got@tprel@l(4)
39 ; CHECK-NEXT: lbzx 5, 4, var_char@tls
40 ; CHECK-NEXT: add 5, 5, 3
41 ; CHECK-NEXT: clrldi 3, 5, 56
42 ; CHECK-NEXT: stbx 5, 4, var_char@tls
45 %0 = load i8, ptr @var_char, align 1, !tbaa !4
47 store i8 %add, ptr @var_char, align 1, !tbaa !4
51 define dso_local signext i16 @test_short_one() {
52 ; CHECK-LABEL: test_short_one:
53 ; CHECK: # %bb.0: # %entry
54 ; CHECK-NEXT: addis 3, 2, var_short@got@tprel@ha
55 ; CHECK-NEXT: ld 3, var_short@got@tprel@l(3)
56 ; CHECK-NEXT: lhzx 3, 3, var_short@tls
59 %0 = load i16, ptr @var_short, align 2, !tbaa !7
63 define dso_local void @test_short_two(i32 signext %a) {
64 ; CHECK-LABEL: test_short_two:
65 ; CHECK: # %bb.0: # %entry
66 ; CHECK-NEXT: addis 4, 2, var_short@got@tprel@ha
67 ; CHECK-NEXT: ld 4, var_short@got@tprel@l(4)
68 ; CHECK-NEXT: sthx 3, 4, var_short@tls
71 %conv = trunc i32 %a to i16
72 store i16 %conv, ptr @var_short, align 2, !tbaa !7
76 define dso_local signext i16 @test_short_three(i16 signext %a) {
77 ; CHECK-LABEL: test_short_three:
78 ; CHECK: # %bb.0: # %entry
79 ; CHECK-NEXT: addis 4, 2, var_short@got@tprel@ha
80 ; CHECK-NEXT: ld 4, var_short@got@tprel@l(4)
81 ; CHECK-NEXT: lhzx 5, 4, var_short@tls
82 ; CHECK-NEXT: add 5, 5, 3
83 ; CHECK-NEXT: extsh 3, 5
84 ; CHECK-NEXT: sthx 5, 4, var_short@tls
87 %0 = load i16, ptr @var_short, align 2, !tbaa !7
89 store i16 %add, ptr @var_short, align 2, !tbaa !7
93 define dso_local signext i32 @test_int_one() {
94 ; CHECK-LABEL: test_int_one:
95 ; CHECK: # %bb.0: # %entry
96 ; CHECK-NEXT: addis 3, 2, var_int@got@tprel@ha
97 ; CHECK-NEXT: ld 3, var_int@got@tprel@l(3)
98 ; CHECK-NEXT: lwzx 3, 3, var_int@tls
101 %0 = load i32, ptr @var_int, align 4, !tbaa !9
105 define dso_local void @test_int_two(i32 signext %a) {
106 ; CHECK-LABEL: test_int_two:
107 ; CHECK: # %bb.0: # %entry
108 ; CHECK-NEXT: addis 4, 2, var_int@got@tprel@ha
109 ; CHECK-NEXT: ld 4, var_int@got@tprel@l(4)
110 ; CHECK-NEXT: stwx 3, 4, var_int@tls
113 store i32 %a, ptr @var_int, align 4, !tbaa !9
117 define dso_local signext i32 @test_int_three(i32 signext %a) {
118 ; CHECK-LABEL: test_int_three:
119 ; CHECK: # %bb.0: # %entry
120 ; CHECK-NEXT: addis 4, 2, var_int@got@tprel@ha
121 ; CHECK-NEXT: ld 4, var_int@got@tprel@l(4)
122 ; CHECK-NEXT: lwzx 5, 4, var_int@tls
123 ; CHECK-NEXT: add 5, 5, 3
124 ; CHECK-NEXT: extsw 3, 5
125 ; CHECK-NEXT: stwx 5, 4, var_int@tls
128 %0 = load i32, ptr @var_int, align 4, !tbaa !9
129 %add = add nsw i32 %0, %a
130 store i32 %add, ptr @var_int, align 4, !tbaa !9
134 define dso_local i64 @test_longlong_one() {
135 ; CHECK-LABEL: test_longlong_one:
136 ; CHECK: # %bb.0: # %entry
137 ; CHECK-NEXT: addis 3, 2, var_long_long@got@tprel@ha
138 ; CHECK-NEXT: ld 3, var_long_long@got@tprel@l(3)
139 ; CHECK-NEXT: ldx 3, 3, var_long_long@tls
142 %0 = load i64, ptr @var_long_long, align 8, !tbaa !11
146 define dso_local void @test_longlong_two(i32 signext %a) {
147 ; CHECK-LABEL: test_longlong_two:
148 ; CHECK: # %bb.0: # %entry
149 ; CHECK-NEXT: addis 4, 2, var_long_long@got@tprel@ha
150 ; CHECK-NEXT: ld 4, var_long_long@got@tprel@l(4)
151 ; CHECK-NEXT: stdx 3, 4, var_long_long@tls
154 %conv = sext i32 %a to i64
155 store i64 %conv, ptr @var_long_long, align 8, !tbaa !11
159 define dso_local i64 @test_longlong_three(i64 %a) {
160 ; CHECK-LABEL: test_longlong_three:
161 ; CHECK: # %bb.0: # %entry
162 ; CHECK-NEXT: addis 4, 2, var_long_long@got@tprel@ha
163 ; CHECK-NEXT: ld 4, var_long_long@got@tprel@l(4)
164 ; CHECK-NEXT: ldx 5, 4, var_long_long@tls
165 ; CHECK-NEXT: add 3, 5, 3
166 ; CHECK-NEXT: stdx 3, 4, var_long_long@tls
169 %0 = load i64, ptr @var_long_long, align 8, !tbaa !11
170 %add = add nsw i64 %0, %a
171 store i64 %add, ptr @var_long_long, align 8, !tbaa !11
175 !llvm.module.flags = !{!0, !1, !2}
177 !0 = !{i32 1, !"wchar_size", i32 4}
178 !1 = !{i32 7, !"PIC Level", i32 1}
179 !2 = !{i32 7, !"PIE Level", i32 1}
180 !4 = !{!5, !5, i64 0}
181 !5 = !{!"omnipotent char", !6, i64 0}
182 !6 = !{!"Simple C/C++ TBAA"}
183 !7 = !{!8, !8, i64 0}
184 !8 = !{!"short", !5, i64 0}
185 !9 = !{!10, !10, i64 0}
186 !10 = !{!"int", !5, i64 0}
187 !11 = !{!12, !12, i64 0}
188 !12 = !{!"long long", !5, i64 0}