blob: 08bd6e72ae77da0d830252fd1fd8302eacc2037d [file] [log] [blame]
Akira Hatanaka44b6c712012-02-28 02:55:02 +00001; RUN: llc -march=mipsel -mcpu=mips32r2 < %s | FileCheck %s
2
3%struct.S = type <{ [4 x float] }>
Akira Hatanakadfa27ae2012-03-01 22:12:30 +00004%struct.S2 = type <{ [4 x double] }>
5%struct.S3 = type <{ i8, float }>
Akira Hatanaka44b6c712012-02-28 02:55:02 +00006
7@s = external global [4 x %struct.S]
8@gf = external global float
9@gd = external global double
Akira Hatanakadfa27ae2012-03-01 22:12:30 +000010@s2 = external global [4 x %struct.S2]
11@s3 = external global %struct.S3
Akira Hatanaka44b6c712012-02-28 02:55:02 +000012
13define float @foo0(float* nocapture %b, i32 %o) nounwind readonly {
14entry:
15; CHECK: lwxc1
16 %arrayidx = getelementptr inbounds float* %b, i32 %o
17 %0 = load float* %arrayidx, align 4
18 ret float %0
19}
20
21define double @foo1(double* nocapture %b, i32 %o) nounwind readonly {
22entry:
23; CHECK: ldxc1
24 %arrayidx = getelementptr inbounds double* %b, i32 %o
25 %0 = load double* %arrayidx, align 8
26 ret double %0
27}
28
29define float @foo2(i32 %b, i32 %c) nounwind readonly {
30entry:
31; CHECK: luxc1
32 %arrayidx1 = getelementptr inbounds [4 x %struct.S]* @s, i32 0, i32 %b, i32 0, i32 %c
33 %0 = load float* %arrayidx1, align 1
34 ret float %0
35}
36
37define void @foo3(float* nocapture %b, i32 %o) nounwind {
38entry:
39; CHECK: swxc1
40 %0 = load float* @gf, align 4
41 %arrayidx = getelementptr inbounds float* %b, i32 %o
42 store float %0, float* %arrayidx, align 4
43 ret void
44}
45
46define void @foo4(double* nocapture %b, i32 %o) nounwind {
47entry:
48; CHECK: sdxc1
49 %0 = load double* @gd, align 8
50 %arrayidx = getelementptr inbounds double* %b, i32 %o
51 store double %0, double* %arrayidx, align 8
52 ret void
53}
54
55define void @foo5(i32 %b, i32 %c) nounwind {
56entry:
57; CHECK: suxc1
58 %0 = load float* @gf, align 4
59 %arrayidx1 = getelementptr inbounds [4 x %struct.S]* @s, i32 0, i32 %b, i32 0, i32 %c
60 store float %0, float* %arrayidx1, align 1
61 ret void
62}
63
Akira Hatanakadfa27ae2012-03-01 22:12:30 +000064define double @foo6(i32 %b, i32 %c) nounwind readonly {
65entry:
66; CHECK: foo6
67; CHECK-NOT: ldxc1
68 %arrayidx1 = getelementptr inbounds [4 x %struct.S2]* @s2, i32 0, i32 %b, i32 0, i32 %c
69 %0 = load double* %arrayidx1, align 1
70 ret double %0
71}
72
73define void @foo7(i32 %b, i32 %c) nounwind {
74entry:
75; CHECK: foo7
76; CHECK-NOT: sdxc1
77 %0 = load double* @gd, align 8
78 %arrayidx1 = getelementptr inbounds [4 x %struct.S2]* @s2, i32 0, i32 %b, i32 0, i32 %c
79 store double %0, double* %arrayidx1, align 1
80 ret void
81}
82
83define float @foo8() nounwind readonly {
84entry:
85; CHECK: foo8
86; CHECK: luxc1
87 %0 = load float* getelementptr inbounds (%struct.S3* @s3, i32 0, i32 1), align 1
88 ret float %0
89}
90
91define void @foo9(float %f) nounwind {
92entry:
93; CHECK: foo9
94; CHECK: suxc1
95 store float %f, float* getelementptr inbounds (%struct.S3* @s3, i32 0, i32 1), align 1
96 ret void
97}
98