1 ; FIXME: FastISel currently returns false if it hits code that uses VSX
2 ; registers and with -fast-isel-abort=1 turned on the test case will then fail.
3 ; When fastisel better supports VSX fix up this test case.
5 ; 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
6 ; 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
8 ; This test verifies that load/store instructions are properly generated,
9 ; and that they pass MI verification.
11 @a = global i8 1, align 1
12 @b = global i16 2, align 2
13 @c = global i32 4, align 4
14 @d = global i64 8, align 8
15 @e = global float 1.25, align 4
16 @f = global double 3.5, align 8
18 %struct.s = type<{ i8, i32 }>
19 %struct.t = type<{ i8, i64 }>
21 @g = global %struct.s <{ i8 1, i32 2 }>, align 1
22 @h = global %struct.t <{ i8 1, i64 2 }>, align 1
24 @i = common global [8192 x i64] zeroinitializer, align 8
28 define i8 @t1() nounwind {
30 %1 = load i8, i8* @a, align 1
37 define i16 @t2() nounwind {
39 %1 = load i16, i16* @b, align 2
41 %2 = add nsw i16 %1, 1
46 define i32 @t3() nounwind {
48 %1 = load i32, i32* @c, align 4
50 %2 = add nsw i32 %1, 1
55 define i64 @t4() nounwind {
57 %1 = load i64, i64* @d, align 4
59 %2 = add nsw i64 %1, 1
64 define float @t5() nounwind {
67 %1 = load float, float* @e, align 4
70 %2 = fadd float %1, 1.0
76 define double @t6() nounwind {
79 %1 = load double, double* @f, align 8
82 %2 = fadd double %1, 1.0
90 define void @t7(i8 %v) nounwind {
93 store i8 %1, i8* @a, align 1
101 define void @t8(i16 %v) nounwind {
103 %1 = add nsw i16 %v, 1
104 store i16 %1, i16* @b, align 2
112 define void @t9(i32 %v) nounwind {
114 %1 = add nsw i32 %v, 1
115 store i32 %1, i32* @c, align 4
123 define void @t10(i64 %v) nounwind {
125 %1 = add nsw i64 %v, 1
126 store i64 %1, i64* @d, align 4
134 define void @t11(float %v) nounwind {
137 %1 = fadd float %v, 1.0
138 store float %1, float* @e, align 4
146 define void @t12(double %v) nounwind {
149 %1 = fadd double %v, 1.0
150 store double %1, double* @f, align 8
158 ;; lwa requires an offset divisible by 4, so we need lwax here.
159 define i64 @t13() nounwind {
161 %1 = load i32, i32* getelementptr inbounds (%struct.s, %struct.s* @g, i32 0, i32 1), align 1
162 %2 = sext i32 %1 to i64
165 %3 = add nsw i64 %2, 1
170 ;; ld requires an offset divisible by 4, so we need ldx here.
171 define i64 @t14() nounwind {
173 %1 = load i64, i64* getelementptr inbounds (%struct.t, %struct.t* @h, i32 0, i32 1), align 1
176 %2 = add nsw i64 %1, 1
181 ;; std requires an offset divisible by 4, so we need stdx here.
182 define void @t15(i64 %v) nounwind {
184 %1 = add nsw i64 %v, 1
185 store i64 %1, i64* getelementptr inbounds (%struct.t, %struct.t* @h, i32 0, i32 1), align 1
194 ;; ld requires an offset that fits in 16 bits, so we need ldx here.
195 define i64 @t16() nounwind {
197 %1 = load i64, i64* getelementptr inbounds ([8192 x i64], [8192 x i64]* @i, i32 0, i64 5000), align 8
201 %2 = add nsw i64 %1, 1
206 ;; std requires an offset that fits in 16 bits, so we need stdx here.
207 define void @t17(i64 %v) nounwind {
209 %1 = add nsw i64 %v, 1
210 store i64 %1, i64* getelementptr inbounds ([8192 x i64], [8192 x i64]* @i, i32 0, i64 5000), align 8