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: 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
16 %0 = load i8, i8* @var_char, align 1, !tbaa !4
20 define dso_local void @test_char_two(i32 signext %a) {
21 ; CHECK-LABEL: test_char_two:
22 ; CHECK: # %bb.0: # %entry
23 ; CHECK: addis 4, 2, var_char@got@tprel@ha
24 ; CHECK-NEXT: ld 4, var_char@got@tprel@l(4)
25 ; CHECK-NEXT: stbx 3, 4, var_char@tls
27 %conv = trunc i32 %a to i8
28 store i8 %conv, i8* @var_char, align 1, !tbaa !4
32 define dso_local zeroext i8 @test_char_three(i8 zeroext %a) {
33 ; CHECK-LABEL: test_char_three:
34 ; CHECK: # %bb.0: # %entry
35 ; CHECK: addis 4, 2, var_char@got@tprel@ha
36 ; CHECK-NEXT: ld 4, var_char@got@tprel@l(4)
37 ; CHECK-NEXT: lbzx 5, 4, var_char@tls
38 ; CHECK: stbx {{[0-9]+}}, 4, var_char@tls
40 %0 = load i8, i8* @var_char, align 1, !tbaa !4
42 store i8 %add, i8* @var_char, align 1, !tbaa !4
46 define dso_local signext i16 @test_short_one() {
47 ; CHECK-LABEL: test_short_one:
48 ; CHECK: # %bb.0: # %entry
49 ; CHECK: addis 3, 2, var_short@got@tprel@ha
50 ; CHECK-NEXT: ld 3, var_short@got@tprel@l(3)
51 ; CHECK-NEXT: lhzx 3, 3, var_short@tls
53 %0 = load i16, i16* @var_short, align 2, !tbaa !7
57 define dso_local void @test_short_two(i32 signext %a) {
58 ; CHECK-LABEL: test_short_two:
59 ; CHECK: # %bb.0: # %entry
60 ; CHECK: addis 4, 2, var_short@got@tprel@ha
61 ; CHECK-NEXT: ld 4, var_short@got@tprel@l(4)
62 ; CHECK-NEXT: sthx 3, 4, var_short@tls
64 %conv = trunc i32 %a to i16
65 store i16 %conv, i16* @var_short, align 2, !tbaa !7
69 define dso_local signext i16 @test_short_three(i16 signext %a) {
70 ; CHECK-LABEL: test_short_three:
71 ; CHECK: # %bb.0: # %entry
72 ; CHECK: addis 4, 2, var_short@got@tprel@ha
73 ; CHECK-NEXT: ld 4, var_short@got@tprel@l(4)
74 ; CHECK-NEXT: lhzx 5, 4, var_short@tls
75 ; CHECK: sthx {{[0-9]+}}, 4, var_short@tls
77 %0 = load i16, i16* @var_short, align 2, !tbaa !7
79 store i16 %add, i16* @var_short, align 2, !tbaa !7
83 define dso_local signext i32 @test_int_one() {
84 ; CHECK-LABEL: test_int_one:
85 ; CHECK: # %bb.0: # %entry
86 ; CHECK: addis 3, 2, var_int@got@tprel@ha
87 ; CHECK-NEXT: ld 3, var_int@got@tprel@l(3)
88 ; CHECK-NEXT: lwzx 3, 3, var_int@tls
90 %0 = load i32, i32* @var_int, align 4, !tbaa !9
94 define dso_local void @test_int_two(i32 signext %a) {
95 ; CHECK-LABEL: test_int_two:
96 ; CHECK: # %bb.0: # %entry
97 ; CHECK: addis 4, 2, var_int@got@tprel@ha
98 ; CHECK-NEXT: ld 4, var_int@got@tprel@l(4)
99 ; CHECK-NEXT: stwx 3, 4, var_int@tls
101 store i32 %a, i32* @var_int, align 4, !tbaa !9
105 define dso_local signext i32 @test_int_three(i32 signext %a) {
106 ; CHECK-LABEL: test_int_three:
107 ; CHECK: # %bb.0: # %entry
108 ; CHECK: addis 4, 2, var_int@got@tprel@ha
109 ; CHECK-NEXT: ld 4, var_int@got@tprel@l(4)
110 ; CHECK-NEXT: lwzx 5, 4, var_int@tls
111 ; CHECK: stwx {{[0-9]+}}, 4, var_int@tls
113 %0 = load i32, i32* @var_int, align 4, !tbaa !9
114 %add = add nsw i32 %0, %a
115 store i32 %add, i32* @var_int, align 4, !tbaa !9
119 define dso_local i64 @test_longlong_one() {
120 ; CHECK-LABEL: test_longlong_one:
121 ; CHECK: # %bb.0: # %entry
122 ; CHECK: addis 3, 2, var_long_long@got@tprel@ha
123 ; CHECK-NEXT: ld 3, var_long_long@got@tprel@l(3)
124 ; CHECK-NEXT: ldx 3, 3, var_long_long@tls
126 %0 = load i64, i64* @var_long_long, align 8, !tbaa !11
130 define dso_local void @test_longlong_two(i32 signext %a) {
131 ; CHECK-LABEL: test_longlong_two:
132 ; CHECK: # %bb.0: # %entry
133 ; CHECK: addis 4, 2, var_long_long@got@tprel@ha
134 ; CHECK-NEXT: ld 4, var_long_long@got@tprel@l(4)
135 ; CHECK-NEXT: stdx 3, 4, var_long_long@tls
137 %conv = sext i32 %a to i64
138 store i64 %conv, i64* @var_long_long, align 8, !tbaa !11
142 define dso_local i64 @test_longlong_three(i64 %a) {
143 ; CHECK-LABEL: test_longlong_three:
144 ; CHECK: # %bb.0: # %entry
145 ; CHECK: addis 4, 2, var_long_long@got@tprel@ha
146 ; CHECK-NEXT: ld 4, var_long_long@got@tprel@l(4)
147 ; CHECK-NEXT: ldx 5, 4, var_long_long@tls
148 ; CHECK: stdx {{[0-9]+}}, 4, var_long_long@tls
150 %0 = load i64, i64* @var_long_long, align 8, !tbaa !11
151 %add = add nsw i64 %0, %a
152 store i64 %add, i64* @var_long_long, align 8, !tbaa !11
156 !llvm.module.flags = !{!0, !1, !2}
158 !0 = !{i32 1, !"wchar_size", i32 4}
159 !1 = !{i32 7, !"PIC Level", i32 1}
160 !2 = !{i32 7, !"PIE Level", i32 1}
161 !4 = !{!5, !5, i64 0}
162 !5 = !{!"omnipotent char", !6, i64 0}
163 !6 = !{!"Simple C/C++ TBAA"}
164 !7 = !{!8, !8, i64 0}
165 !8 = !{!"short", !5, i64 0}
166 !9 = !{!10, !10, i64 0}
167 !10 = !{!"int", !5, i64 0}
168 !11 = !{!12, !12, i64 0}
169 !12 = !{!"long long", !5, i64 0}