997aa9dc83c2f327b193d5ef2eb5da6aff2090fc
[oota-llvm.git] / test / CodeGen / Mips / fp-indexed-ls.ll
1 ; RUN: llc -march=mipsel -mcpu=mips32r2 < %s | FileCheck %s
2
3 %struct.S = type <{ [4 x float] }>
4
5 @s = external global [4 x %struct.S]
6 @gf = external global float
7 @gd = external global double
8
9 define float @foo0(float* nocapture %b, i32 %o) nounwind readonly {
10 entry:
11 ; CHECK: lwxc1
12   %arrayidx = getelementptr inbounds float* %b, i32 %o
13   %0 = load float* %arrayidx, align 4
14   ret float %0
15 }
16
17 define double @foo1(double* nocapture %b, i32 %o) nounwind readonly {
18 entry:
19 ; CHECK: ldxc1
20   %arrayidx = getelementptr inbounds double* %b, i32 %o
21   %0 = load double* %arrayidx, align 8
22   ret double %0
23 }
24
25 define float @foo2(i32 %b, i32 %c) nounwind readonly {
26 entry:
27 ; CHECK: luxc1
28   %arrayidx1 = getelementptr inbounds [4 x %struct.S]* @s, i32 0, i32 %b, i32 0, i32 %c
29   %0 = load float* %arrayidx1, align 1
30   ret float %0
31 }
32
33 define void @foo3(float* nocapture %b, i32 %o) nounwind {
34 entry:
35 ; CHECK: swxc1
36   %0 = load float* @gf, align 4
37   %arrayidx = getelementptr inbounds float* %b, i32 %o
38   store float %0, float* %arrayidx, align 4
39   ret void
40 }
41
42 define void @foo4(double* nocapture %b, i32 %o) nounwind {
43 entry:
44 ; CHECK: sdxc1
45   %0 = load double* @gd, align 8
46   %arrayidx = getelementptr inbounds double* %b, i32 %o
47   store double %0, double* %arrayidx, align 8
48   ret void
49 }
50
51 define void @foo5(i32 %b, i32 %c) nounwind {
52 entry:
53 ; CHECK: suxc1
54   %0 = load float* @gf, align 4
55   %arrayidx1 = getelementptr inbounds [4 x %struct.S]* @s, i32 0, i32 %b, i32 0, i32 %c
56   store float %0, float* %arrayidx1, align 1
57   ret void
58 }
59