blob: d8c37e7d90fc8cb8abe72ddccd3162dacce782cd [file] [log] [blame]
Akira Hatanaka330d9012012-02-28 02:55:02 +00001; RUN: llc -march=mipsel -mcpu=mips32r2 < %s | FileCheck %s
Petar Jovanovic97250162014-02-05 17:19:30 +00002; RUN: llc -mtriple=mipsel-none-nacl-gnu -mcpu=mips32r2 < %s \
3; RUN: | FileCheck %s -check-prefix=CHECK-NACL
Akira Hatanaka330d9012012-02-28 02:55:02 +00004
5%struct.S = type <{ [4 x float] }>
Akira Hatanaka6bbe1f02012-03-01 22:12:30 +00006%struct.S2 = type <{ [4 x double] }>
7%struct.S3 = type <{ i8, float }>
Akira Hatanaka330d9012012-02-28 02:55:02 +00008
9@s = external global [4 x %struct.S]
10@gf = external global float
11@gd = external global double
Akira Hatanaka6bbe1f02012-03-01 22:12:30 +000012@s2 = external global [4 x %struct.S2]
13@s3 = external global %struct.S3
Akira Hatanaka330d9012012-02-28 02:55:02 +000014
15define float @foo0(float* nocapture %b, i32 %o) nounwind readonly {
16entry:
17; CHECK: lwxc1
Petar Jovanovic97250162014-02-05 17:19:30 +000018; CHECK-NACL-NOT: lwxc1
Akira Hatanaka330d9012012-02-28 02:55:02 +000019 %arrayidx = getelementptr inbounds float* %b, i32 %o
20 %0 = load float* %arrayidx, align 4
21 ret float %0
22}
23
24define double @foo1(double* nocapture %b, i32 %o) nounwind readonly {
25entry:
26; CHECK: ldxc1
Petar Jovanovic97250162014-02-05 17:19:30 +000027; CHECK-NACL-NOT: ldxc1
Akira Hatanaka330d9012012-02-28 02:55:02 +000028 %arrayidx = getelementptr inbounds double* %b, i32 %o
29 %0 = load double* %arrayidx, align 8
30 ret double %0
31}
32
33define float @foo2(i32 %b, i32 %c) nounwind readonly {
34entry:
Akira Hatanaka4ce7c402012-07-31 18:16:49 +000035; CHECK-NOT: luxc1
Akira Hatanaka330d9012012-02-28 02:55:02 +000036 %arrayidx1 = getelementptr inbounds [4 x %struct.S]* @s, i32 0, i32 %b, i32 0, i32 %c
37 %0 = load float* %arrayidx1, align 1
38 ret float %0
39}
40
41define void @foo3(float* nocapture %b, i32 %o) nounwind {
42entry:
43; CHECK: swxc1
Petar Jovanovic97250162014-02-05 17:19:30 +000044; CHECK-NACL-NOT: swxc1
Akira Hatanaka330d9012012-02-28 02:55:02 +000045 %0 = load float* @gf, align 4
46 %arrayidx = getelementptr inbounds float* %b, i32 %o
47 store float %0, float* %arrayidx, align 4
48 ret void
49}
50
51define void @foo4(double* nocapture %b, i32 %o) nounwind {
52entry:
53; CHECK: sdxc1
Petar Jovanovic97250162014-02-05 17:19:30 +000054; CHECK-NACL-NOT: sdxc1
Akira Hatanaka330d9012012-02-28 02:55:02 +000055 %0 = load double* @gd, align 8
56 %arrayidx = getelementptr inbounds double* %b, i32 %o
57 store double %0, double* %arrayidx, align 8
58 ret void
59}
60
61define void @foo5(i32 %b, i32 %c) nounwind {
62entry:
Akira Hatanaka4ce7c402012-07-31 18:16:49 +000063; CHECK-NOT: suxc1
Akira Hatanaka330d9012012-02-28 02:55:02 +000064 %0 = load float* @gf, align 4
65 %arrayidx1 = getelementptr inbounds [4 x %struct.S]* @s, i32 0, i32 %b, i32 0, i32 %c
66 store float %0, float* %arrayidx1, align 1
67 ret void
68}
69
Akira Hatanaka6bbe1f02012-03-01 22:12:30 +000070define double @foo6(i32 %b, i32 %c) nounwind readonly {
71entry:
72; CHECK: foo6
Akira Hatanaka4ce7c402012-07-31 18:16:49 +000073; CHECK-NOT: luxc1
Akira Hatanaka6bbe1f02012-03-01 22:12:30 +000074 %arrayidx1 = getelementptr inbounds [4 x %struct.S2]* @s2, i32 0, i32 %b, i32 0, i32 %c
75 %0 = load double* %arrayidx1, align 1
76 ret double %0
77}
78
79define void @foo7(i32 %b, i32 %c) nounwind {
80entry:
81; CHECK: foo7
Akira Hatanaka4ce7c402012-07-31 18:16:49 +000082; CHECK-NOT: suxc1
Akira Hatanaka6bbe1f02012-03-01 22:12:30 +000083 %0 = load double* @gd, align 8
84 %arrayidx1 = getelementptr inbounds [4 x %struct.S2]* @s2, i32 0, i32 %b, i32 0, i32 %c
85 store double %0, double* %arrayidx1, align 1
86 ret void
87}
88
89define float @foo8() nounwind readonly {
90entry:
91; CHECK: foo8
Akira Hatanaka4ce7c402012-07-31 18:16:49 +000092; CHECK-NOT: luxc1
Akira Hatanaka6bbe1f02012-03-01 22:12:30 +000093 %0 = load float* getelementptr inbounds (%struct.S3* @s3, i32 0, i32 1), align 1
94 ret float %0
95}
96
97define void @foo9(float %f) nounwind {
98entry:
99; CHECK: foo9
Akira Hatanaka4ce7c402012-07-31 18:16:49 +0000100; CHECK-NOT: suxc1
Akira Hatanaka6bbe1f02012-03-01 22:12:30 +0000101 store float %f, float* getelementptr inbounds (%struct.S3* @s3, i32 0, i32 1), align 1
102 ret void
103}
104