1 ; RUN: llc -relocation-model=static < %s -O0 -verify-machineinstrs -fast-isel -fast-isel-abort=1 -mattr=-vsx -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 | FileCheck %s --check-prefix=ELF64
2 ; RUN: llc -relocation-model=static < %s -O0 -verify-machineinstrs -fast-isel -fast-isel-abort=1 -mattr=+vsx -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 | FileCheck %s --check-prefix=VSX
3 ; RUN: llc -relocation-model=static < %s -O0 -verify-machineinstrs -fast-isel -fast-isel-abort=1 -mattr=spe -mtriple=powerpc-unknown-linux-gnu -mcpu=e500 | FileCheck %s --check-prefix=SPE
5 ; This test verifies that load/store instructions are properly generated,
6 ; and that they pass MI verification.
8 @a = dso_local global i8 1, align 1
9 @b = dso_local global i16 2, align 2
10 @c = dso_local global i32 4, align 4
11 @d = dso_local global i64 8, align 8
12 @e = dso_local global float 1.25, align 4
13 @f = dso_local global double 3.5, align 8
15 %struct.s = type<{ i8, i32 }>
16 %struct.t = type<{ i8, i64 }>
18 @g = dso_local global %struct.s <{ i8 1, i32 2 }>, align 1
19 @h = dso_local global %struct.t <{ i8 1, i64 2 }>, align 1
21 @i = common dso_local global [8192 x i64] zeroinitializer, align 8
25 define i8 @t1() nounwind {
27 %1 = load i8, ptr @a, align 1
34 define i16 @t2() nounwind {
36 %1 = load i16, ptr @b, align 2
38 %2 = add nsw i16 %1, 1
43 define dso_local i32 @t3() nounwind {
45 %1 = load i32, ptr @c, align 4
47 %2 = add nsw i32 %1, 1
52 define i64 @t4() nounwind {
54 %1 = load i64, ptr @d, align 4
56 %2 = add nsw i64 %1, 1
61 define dso_local float @t5() nounwind {
64 %1 = load float, ptr @e, align 4
67 %2 = fadd float %1, 1.0
73 define dso_local double @t6() nounwind {
76 %1 = load double, ptr @f, align 8
80 %2 = fadd double %1, 1.0
89 define dso_local void @t7(i8 %v) nounwind {
92 store i8 %1, ptr @a, align 1
100 define dso_local void @t8(i16 %v) nounwind {
102 %1 = add nsw i16 %v, 1
103 store i16 %1, ptr @b, align 2
111 define dso_local void @t9(i32 %v) nounwind {
113 %1 = add nsw i32 %v, 1
114 store i32 %1, ptr @c, align 4
122 define dso_local void @t10(i64 %v) nounwind {
124 %1 = add nsw i64 %v, 1
125 store i64 %1, ptr @d, align 4
133 define dso_local void @t11(float %v) nounwind {
136 %1 = fadd float %v, 1.0
137 store float %1, ptr @e, align 4
145 define dso_local void @t12(double %v) nounwind {
148 %1 = fadd double %v, 1.0
149 store double %1, ptr @f, align 8
159 ;; lwa requires an offset divisible by 4, so we need lwax here.
160 define i64 @t13() nounwind {
162 %1 = load i32, ptr getelementptr inbounds (%struct.s, ptr @g, i32 0, i32 1), align 1
163 %2 = sext i32 %1 to i64
166 %3 = add nsw i64 %2, 1
171 ;; ld requires an offset divisible by 4, so we need ldx here.
172 define i64 @t14() nounwind {
174 %1 = load i64, ptr getelementptr inbounds (%struct.t, ptr @h, i32 0, i32 1), align 1
177 %2 = add nsw i64 %1, 1
182 ;; std requires an offset divisible by 4, so we need stdx here.
183 define dso_local void @t15(i64 %v) nounwind {
185 %1 = add nsw i64 %v, 1
186 store i64 %1, ptr getelementptr inbounds (%struct.t, ptr @h, i32 0, i32 1), align 1
195 ;; ld requires an offset that fits in 16 bits, so we need ldx here.
196 define i64 @t16() nounwind {
198 %1 = load i64, ptr getelementptr inbounds ([8192 x i64], ptr @i, i32 0, i64 5000), align 8
202 %2 = add nsw i64 %1, 1
207 ;; std requires an offset that fits in 16 bits, so we need stdx here.
208 define dso_local void @t17(i64 %v) nounwind {
210 %1 = add nsw i64 %v, 1
211 store i64 %1, ptr getelementptr inbounds ([8192 x i64], ptr @i, i32 0, i64 5000), align 8