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 = global i8 1, align 1
9 @b = global i16 2, align 2
10 @c = global i32 4, align 4
11 @d = global i64 8, align 8
12 @e = global float 1.25, align 4
13 @f = global double 3.5, align 8
15 %struct.s = type<{ i8, i32 }>
16 %struct.t = type<{ i8, i64 }>
18 @g = global %struct.s <{ i8 1, i32 2 }>, align 1
19 @h = global %struct.t <{ i8 1, i64 2 }>, align 1
21 @i = common global [8192 x i64] zeroinitializer, align 8
25 define i8 @t1() nounwind {
27 %1 = load i8, i8* @a, align 1
34 define i16 @t2() nounwind {
36 %1 = load i16, i16* @b, align 2
38 %2 = add nsw i16 %1, 1
43 define i32 @t3() nounwind {
45 %1 = load i32, i32* @c, align 4
47 %2 = add nsw i32 %1, 1
52 define i64 @t4() nounwind {
54 %1 = load i64, i64* @d, align 4
56 %2 = add nsw i64 %1, 1
61 define float @t5() nounwind {
64 %1 = load float, float* @e, align 4
67 %2 = fadd float %1, 1.0
73 define double @t6() nounwind {
76 %1 = load double, double* @f, align 8
80 %2 = fadd double %1, 1.0
89 define void @t7(i8 %v) nounwind {
92 store i8 %1, i8* @a, align 1
100 define void @t8(i16 %v) nounwind {
102 %1 = add nsw i16 %v, 1
103 store i16 %1, i16* @b, align 2
111 define void @t9(i32 %v) nounwind {
113 %1 = add nsw i32 %v, 1
114 store i32 %1, i32* @c, align 4
122 define void @t10(i64 %v) nounwind {
124 %1 = add nsw i64 %v, 1
125 store i64 %1, i64* @d, align 4
133 define void @t11(float %v) nounwind {
136 %1 = fadd float %v, 1.0
137 store float %1, float* @e, align 4
145 define void @t12(double %v) nounwind {
148 %1 = fadd double %v, 1.0
149 store double %1, double* @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, i32* getelementptr inbounds (%struct.s, %struct.s* @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, i64* getelementptr inbounds (%struct.t, %struct.t* @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 void @t15(i64 %v) nounwind {
185 %1 = add nsw i64 %v, 1
186 store i64 %1, i64* getelementptr inbounds (%struct.t, %struct.t* @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, i64* getelementptr inbounds ([8192 x i64], [8192 x i64]* @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 void @t17(i64 %v) nounwind {
210 %1 = add nsw i64 %v, 1
211 store i64 %1, i64* getelementptr inbounds ([8192 x i64], [8192 x i64]* @i, i32 0, i64 5000), align 8