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
7 ; This test verifies that load/store instructions are properly generated,
8 ; and that they pass MI verification.
10 @a = global i8 1, align 1
11 @b = global i16 2, align 2
12 @c = global i32 4, align 4
13 @d = global i64 8, align 8
14 @e = global float 1.25, align 4
15 @f = global double 3.5, align 8
17 %struct.s = type<{ i8, i32 }>
18 %struct.t = type<{ i8, i64 }>
20 @g = global %struct.s <{ i8 1, i32 2 }>, align 1
21 @h = global %struct.t <{ i8 1, i64 2 }>, align 1
23 @i = common global [8192 x i64] zeroinitializer, align 8
27 define i8 @t1() nounwind {
29 %1 = load i8, i8* @a, align 1
36 define i16 @t2() nounwind {
38 %1 = load i16, i16* @b, align 2
40 %2 = add nsw i16 %1, 1
45 define i32 @t3() nounwind {
47 %1 = load i32, i32* @c, align 4
49 %2 = add nsw i32 %1, 1
54 define i64 @t4() nounwind {
56 %1 = load i64, i64* @d, align 4
58 %2 = add nsw i64 %1, 1
63 define float @t5() nounwind {
65 %1 = load float, float* @e, align 4
67 %2 = fadd float %1, 1.0
72 define double @t6() nounwind {
74 %1 = load double, double* @f, align 8
76 %2 = fadd double %1, 1.0
83 define void @t7(i8 %v) nounwind {
86 store i8 %1, i8* @a, align 1
94 define void @t8(i16 %v) nounwind {
96 %1 = add nsw i16 %v, 1
97 store i16 %1, i16* @b, align 2
105 define void @t9(i32 %v) nounwind {
107 %1 = add nsw i32 %v, 1
108 store i32 %1, i32* @c, align 4
116 define void @t10(i64 %v) nounwind {
118 %1 = add nsw i64 %v, 1
119 store i64 %1, i64* @d, align 4
127 define void @t11(float %v) nounwind {
129 %1 = fadd float %v, 1.0
130 store float %1, float* @e, align 4
136 define void @t12(double %v) nounwind {
138 %1 = fadd double %v, 1.0
139 store double %1, double* @f, align 8
145 ;; lwa requires an offset divisible by 4, so we need lwax here.
146 define i64 @t13() nounwind {
148 %1 = load i32, i32* getelementptr inbounds (%struct.s, %struct.s* @g, i32 0, i32 1), align 1
149 %2 = sext i32 %1 to i64
152 %3 = add nsw i64 %2, 1
157 ;; ld requires an offset divisible by 4, so we need ldx here.
158 define i64 @t14() nounwind {
160 %1 = load i64, i64* getelementptr inbounds (%struct.t, %struct.t* @h, i32 0, i32 1), align 1
163 %2 = add nsw i64 %1, 1
168 ;; std requires an offset divisible by 4, so we need stdx here.
169 define void @t15(i64 %v) nounwind {
171 %1 = add nsw i64 %v, 1
172 store i64 %1, i64* getelementptr inbounds (%struct.t, %struct.t* @h, i32 0, i32 1), align 1
181 ;; ld requires an offset that fits in 16 bits, so we need ldx here.
182 define i64 @t16() nounwind {
184 %1 = load i64, i64* getelementptr inbounds ([8192 x i64], [8192 x i64]* @i, i32 0, i64 5000), align 8
188 %2 = add nsw i64 %1, 1
193 ;; std requires an offset that fits in 16 bits, so we need stdx here.
194 define void @t17(i64 %v) nounwind {
196 %1 = add nsw i64 %v, 1
197 store i64 %1, i64* getelementptr inbounds ([8192 x i64], [8192 x i64]* @i, i32 0, i64 5000), align 8