1 ; RUN: llc -mtriple powerpc-ibm-aix-xcoff -verify-machineinstrs < %s \
2 ; RUN: -stop-before=ppc-vsx-copy | FileCheck %s --check-prefix CHECK32
3 ; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -verify-machineinstrs < %s \
4 ; RUN: -stop-before=ppc-vsx-copy | FileCheck %s --check-prefix CHECK64
5 ; RUN: llc -mtriple powerpc-ibm-aix-xcoff -verify-machineinstrs < %s | FileCheck %s --check-prefix TEST32
6 ; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -verify-machineinstrs < %s | FileCheck %s --check-prefix TEST64
8 ; RUN: llc -mtriple powerpc-ibm-aix-xcoff -verify-machineinstrs < %s \
9 ; RUN: -stop-before=ppc-vsx-copy -O0 | FileCheck %s --check-prefix CHECK32
10 ; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -verify-machineinstrs < %s \
11 ; RUN: -stop-before=ppc-vsx-copy -O0 | FileCheck %s --check-prefix CHECK64-NOOPT
12 ; RUN: llc -mtriple powerpc-ibm-aix-xcoff -verify-machineinstrs -O0 < %s | FileCheck %s --check-prefix TEST32
13 ; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -verify-machineinstrs -O0 < %s | FileCheck %s --check-prefix TEST64
15 @i = dso_local global i32 0, align 4 #0
16 @d = dso_local local_unnamed_addr global double 3.141590e+00, align 8
17 @f = dso_local local_unnamed_addr global float 0x4005BE76C0000000, align 4 #0
18 @ll = dso_local local_unnamed_addr global i64 55, align 8
19 @ilocal = internal global i32 0, align 4
21 define dso_local void @write_int(i32 signext %in) {
23 store i32 %in, ptr @i, align 4
26 ; CHECK32: name: write_int
27 ; CHECK32: %[[SCRATCH:[0-9]+]]:gprc_and_gprc_nor0 = ADDItoc @i, $r2
28 ; CHECK32-NEXT: STW %{{[0-9]+}}, 0, killed %[[SCRATCH]] :: (store (s32) into @i)
31 ; TEST32: la 4, i[TD](2)
32 ; TEST32-NEXT: stw 3, 0(4)
34 ; CHECK64: name: write_int
35 ; CHECK64: %[[SCRATCH:[0-9]+]]:g8rc_and_g8rc_nox0 = ADDItoc8 @i, $x2
36 ; CHECK64-NEXT: STW8 %{{[0-9]+}}, 0, killed %[[SCRATCH]] :: (store (s32) into @i)
38 ; CHECK64-NOOPT: name: write_int
39 ; CHECK64-NOOPT: %[[SUBREG:[0-9]+]]:gprc = COPY %{{[0-9]}}.sub_32
40 ; CHECK64-NOOPT: %[[ADDR:[0-9]+]]:g8rc_and_g8rc_nox0 = ADDItoc8 @i, $x2 :: (load (s64) from got)
41 ; CHECK64-NOOPT: STW %[[SUBREG]], 0, killed %[[ADDR]] :: (store (s32) into @i)
44 ; TEST64: la 4, i[TD](2)
45 ; TEST64-NEXT: stw 3, 0(4)
48 define dso_local i64 @read_ll() {
50 %0 = load i64, ptr @ll, align 8
53 ; CHECK32: name: read_ll
54 ; CHECK32: LWZtoc @ll, $r2 :: (load (s32) from got)
57 ; TEST32: lwz 4, L..C0(2)
58 ; TEST32-NEXT: lwz 3, 0(4)
59 ; TEST32-NEXT: lwz 4, 4(4)
61 ; CHECK64: name: read_ll
62 ; CHECK64: %[[SCRATCH:[0-9]+]]:g8rc_and_g8rc_nox0 = LDtoc @ll, $x2 :: (load (s64) from got)
63 ; CHECK64: LD 0, killed %[[SCRATCH]]
65 ; CHECK64-NOOPT: name: read_ll
66 ; CHECK64-NOOPT: %[[SCRATCH:[0-9]+]]:g8rc_and_g8rc_nox0 = LDtoc @ll, $x2
67 ; CHECK64-NOOPT: LD 0, %[[SCRATCH]]
70 ; TEST64: ld 3, L..C0(2)
71 ; TEST64-NEXT: ld 3, 0(3)
74 define dso_local float @read_float() {
76 %0 = load float, ptr @f, align 4
79 ; CHECK32: name: read_float
80 ; CHECK32: %[[SCRATCH:[0-9]+]]:gprc_and_gprc_nor0 = ADDItoc @f, $r2
81 ; CHECK32: %{{[0-9]+}}:f4rc = LFS 0, killed %[[SCRATCH]] :: (dereferenceable load (s32) from @f)
83 ; TEST32: .read_float:
84 ; TEST32: la 3, f[TD](2)
85 ; TEST32-NEXT: lfs 1, 0(3)
87 ; CHECK64: name: read_float
88 ; CHECK64: %[[SCRATCH:[0-9]+]]:g8rc_and_g8rc_nox0 = ADDItoc8 @f, $x2
89 ; CHECK64: %{{[0-9]+}}:f4rc = LFS 0, killed %[[SCRATCH]] :: (dereferenceable load (s32) from @f)
91 ; CHECK64-NOOPT: name: read_float
92 ; CHECK64-NOOPT: %[[SCRATCH:[0-9]+]]:g8rc_and_g8rc_nox0 = ADDItoc8 @f, $x2
93 ; CHECK64-NOOPT: %{{[0-9]+}}:f4rc = LFS 0, killed %[[SCRATCH]]
95 ; TEST64: .read_float:
96 ; TEST64: la 3, f[TD](2)
97 ; TEST64-NEXT: lfs 1, 0(3)
100 define dso_local void @write_double(double %in) {
102 store double %in, ptr @d, align 8
105 ; CHECK32: name: write_double
106 ; CHECK32: LWZtoc @d, $r2 :: (load (s32) from got)
108 ; TEST32: .write_double
109 ; TEST32: lwz 3, L..C1(2)
110 ; TEST32-NEXT: stfd 1, 0(3)
112 ; CHECK64: name: write_double
113 ; CHECK64: %[[SCRATCH:[0-9]+]]:g8rc_and_g8rc_nox0 = LDtoc @d, $x2 :: (load (s64) from got)
114 ; CHECK64: STFD %{{[0-9]+}}, 0, killed %[[SCRATCH]]
116 ; CHECK64-NOOPT: name: write_double
117 ; CHECK64-NOOPT: %[[SCRATCH:[0-9]+]]:g8rc_and_g8rc_nox0 = LDtoc @d, $x2
118 ; CHECK64-NOOPT STFD %{{[0-9]+}}, 0 %[[SCRATCH]]
120 ; TEST64: .write_double
121 ; TEST64: ld 3, L..C1(2)
122 ; TEST64-NEXT: stfd 1, 0(3)
125 define dso_local nonnull ptr @addr() {
129 ; CHECK32: name: addr
130 ; CHECK32: %[[SCRATCH:[0-9]+]]:gprc = ADDItoc @i, $r2
131 ; CHECK32-NEXT: $r3 = COPY %[[SCRATCH]]
134 ; TEST32: la 3, i[TD](2)
136 ; CHECK64: name: addr
137 ; CHECK64: %[[SCRATCH:[0-9]+]]:g8rc = ADDItoc8 @i, $x2
138 ; CHECK64-NEXT: $x3 = COPY %[[SCRATCH]]
140 ; CHECK64-NOOPT: name: addr
141 ; CHECK64-NOOPT: %[[SCRATCH:[0-9]+]]:g8rc = ADDItoc8 @i, $x2
142 ; CHECK64-NOOPT: $x3 = COPY %[[SCRATCH]]
145 ; TEST64: la 3, i[TD](2)
148 ; TEST32: .tc ll[TC],ll[RW]
149 ; TEST32-NOT: .csect ll[TD]
150 ; TEST32: .tc d[TC],d[RW]
151 ; TEST32-NOT: .csect d[TD],2
152 ; TEST32: .csect i[TD],2
153 ; TEST32-NEXT: .globl i[TD]
154 ; TEST32-NEXT: .align 2
155 ; TEST32-NOT: .tc i[TC],i[RW]
156 ; TEST32: .csect f[TD],2
157 ; TEST32-NEXT: .globl f[TD]
158 ; TEST32-NOT: .tc f[TD],f[RW]
161 ; TEST64: .tc ll[TC],ll[RW]
162 ; TEST64-NOT: .csect ll[TD]
163 ; TEST64: .tc d[TC],d[RW]
164 ; TEST64-NOT: .csect d[TD],2
165 ; TEST64: .csect i[TD],2
166 ; TEST64-NEXT: .globl i[TD]
167 ; TEST64-NEXT: .align 2
168 ; TEST64-NOT: .tc i[TC],i[RW]
169 ; TEST64: .csect f[TD],2
170 ; TEST64-NEXT: .globl f[TD]
171 ; TEST64-NOT: .tc f[TD],f[RW]
173 attributes #0 = { "toc-data" }