1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
|
; RUN: llc -march=mipsel -mcpu=mips32 < %s | FileCheck %s -check-prefix=ALL -check-prefix=MIPS32R1
; RUN: llc -march=mipsel -mcpu=mips32r2 < %s | FileCheck %s -check-prefix=ALL -check-prefix=MIPS32R2
; RUN: llc -march=mipsel -mcpu=mips32r6 < %s | FileCheck %s -check-prefix=ALL -check-prefix=MIPS32R6
; RUN: llc -march=mips64el -mcpu=mips4 -target-abi=n64 < %s | FileCheck %s -check-prefix=ALL -check-prefix=MIPS4
; RUN: llc -march=mips64el -mcpu=mips64 -target-abi=n64 < %s | FileCheck %s -check-prefix=ALL -check-prefix=MIPS4
; RUN: llc -march=mips64el -mcpu=mips64r2 -target-abi=n64 < %s | FileCheck %s -check-prefix=ALL -check-prefix=MIPS4
; RUN: llc -march=mips64el -mcpu=mips64r6 -target-abi=n64 < %s | FileCheck %s -check-prefix=ALL -check-prefix=MIPS64R6
; Check that [ls][dwu]xc1 are not emitted for nacl.
; RUN: llc -mtriple=mipsel-none-nacl-gnu -mcpu=mips32r2 < %s | FileCheck %s -check-prefix=CHECK-NACL
%struct.S = type <{ [4 x float] }>
%struct.S2 = type <{ [4 x double] }>
%struct.S3 = type <{ i8, float }>
@s = external global [4 x %struct.S]
@gf = external global float
@gd = external global double
@s2 = external global [4 x %struct.S2]
@s3 = external global %struct.S3
define float @foo0(float* nocapture %b, i32 %o) nounwind readonly {
entry:
; ALL-LABEL: foo0:
; MIPS32R1: sll $[[T1:[0-9]+]], $5, 2
; MIPS32R1: addu $[[T3:[0-9]+]], $4, $[[T1]]
; MIPS32R1: lwc1 $f0, 0($[[T3]])
; MIPS32R2: sll $[[T1:[0-9]+]], $5, 2
; MIPS32R2: lwxc1 $f0, $[[T1]]($4)
; MIPS32R6: sll $[[T1:[0-9]+]], $5, 2
; MIPS32R6: addu $[[T3:[0-9]+]], $4, $[[T1]]
; MIPS32R6: lwc1 $f0, 0($[[T3]])
; MIPS4: sll $[[T0:[0-9]+]], $5, 0
; MIPS4: dsll $[[T1:[0-9]+]], $[[T0]], 2
; MIPS4: lwxc1 $f0, $[[T1]]($4)
; MIPS64R6: sll $[[T0:[0-9]+]], $5, 0
; MIPS64R6: dsll $[[T1:[0-9]+]], $[[T0]], 2
; MIPS64R6: daddu $[[T3:[0-9]+]], $4, $[[T1]]
; MIPS64R6: lwc1 $f0, 0($[[T3]])
; CHECK-NACL-NOT: lwxc1
%arrayidx = getelementptr inbounds float* %b, i32 %o
%0 = load float* %arrayidx, align 4
ret float %0
}
define double @foo1(double* nocapture %b, i32 %o) nounwind readonly {
entry:
; ALL-LABEL: foo1:
; MIPS32R1: sll $[[T1:[0-9]+]], $5, 3
; MIPS32R1: addu $[[T3:[0-9]+]], $4, $[[T1]]
; MIPS32R1: ldc1 $f0, 0($[[T3]])
; MIPS32R2: sll $[[T1:[0-9]+]], $5, 3
; MIPS32R2: ldxc1 $f0, $[[T1]]($4)
; MIPS32R6: sll $[[T1:[0-9]+]], $5, 3
; MIPS32R6: addu $[[T3:[0-9]+]], $4, $[[T1]]
; MIPS32R6: ldc1 $f0, 0($[[T3]])
; MIPS4: sll $[[T0:[0-9]+]], $5, 0
; MIPS4: dsll $[[T1:[0-9]+]], $[[T0]], 3
; MIPS4: ldxc1 $f0, $[[T1]]($4)
; MIPS64R6: sll $[[T0:[0-9]+]], $5, 0
; MIPS64R6: dsll $[[T1:[0-9]+]], $[[T0]], 3
; MIPS64R6: daddu $[[T3:[0-9]+]], $4, $[[T1]]
; MIPS64R6: ldc1 $f0, 0($[[T3]])
; CHECK-NACL-NOT: ldxc1
%arrayidx = getelementptr inbounds double* %b, i32 %o
%0 = load double* %arrayidx, align 8
ret double %0
}
define float @foo2(i32 %b, i32 %c) nounwind readonly {
entry:
; ALL-LABEL: foo2:
; luxc1 did not exist in MIPS32r1
; MIPS32R1-NOT: luxc1
; luxc1 is a misnomer since it aligns the given pointer downwards and performs
; an aligned load. We mustn't use it to handle unaligned loads.
; MIPS32R2-NOT: luxc1
; luxc1 was removed in MIPS32r6
; MIPS32R6-NOT: luxc1
; MIPS4-NOT: luxc1
; luxc1 was removed in MIPS64r6
; MIPS64R6-NOT: luxc1
%arrayidx1 = getelementptr inbounds [4 x %struct.S]* @s, i32 0, i32 %b, i32 0, i32 %c
%0 = load float* %arrayidx1, align 1
ret float %0
}
define void @foo3(float* nocapture %b, i32 %o) nounwind {
entry:
; ALL-LABEL: foo3:
; MIPS32R1-DAG: lwc1 $[[T0:f0]], 0(${{[0-9]+}})
; MIPS32R1-DAG: addu $[[T1:[0-9]+]], $4, ${{[0-9]+}}
; MIPS32R1-DAG: swc1 $[[T0]], 0($[[T1]])
; MIPS32R2: lwc1 $[[T0:f0]], 0(${{[0-9]+}})
; MIPS32R2: swxc1 $[[T0]], ${{[0-9]+}}($4)
; MIPS32R6-DAG: lwc1 $[[T0:f0]], 0(${{[0-9]+}})
; MIPS32R6-DAG: addu $[[T1:[0-9]+]], $4, ${{[0-9]+}}
; MIPS32R6-DAG: swc1 $[[T0]], 0($[[T1]])
; MIPS4: lwc1 $[[T0:f0]], 0(${{[0-9]+}})
; MIPS4: swxc1 $[[T0]], ${{[0-9]+}}($4)
; MIPS64R6-DAG: lwc1 $[[T0:f0]], 0(${{[0-9]+}})
; MIPS64R6-DAG: daddu $[[T1:[0-9]+]], $4, ${{[0-9]+}}
; MIPS64R6-DAG: swc1 $[[T0]], 0($[[T1]])
; CHECK-NACL-NOT: swxc1
%0 = load float* @gf, align 4
%arrayidx = getelementptr inbounds float* %b, i32 %o
store float %0, float* %arrayidx, align 4
ret void
}
define void @foo4(double* nocapture %b, i32 %o) nounwind {
entry:
; ALL-LABEL: foo4:
; MIPS32R1-DAG: ldc1 $[[T0:f0]], 0(${{[0-9]+}})
; MIPS32R1-DAG: addu $[[T1:[0-9]+]], $4, ${{[0-9]+}}
; MIPS32R1-DAG: sdc1 $[[T0]], 0($[[T1]])
; MIPS32R2: ldc1 $[[T0:f0]], 0(${{[0-9]+}})
; MIPS32R2: sdxc1 $[[T0]], ${{[0-9]+}}($4)
; MIPS32R6-DAG: ldc1 $[[T0:f0]], 0(${{[0-9]+}})
; MIPS32R6-DAG: addu $[[T1:[0-9]+]], $4, ${{[0-9]+}}
; MIPS32R6-DAG: sdc1 $[[T0]], 0($[[T1]])
; MIPS4: ldc1 $[[T0:f0]], 0(${{[0-9]+}})
; MIPS4: sdxc1 $[[T0]], ${{[0-9]+}}($4)
; MIPS64R6-DAG: ldc1 $[[T0:f0]], 0(${{[0-9]+}})
; MIPS64R6-DAG: daddu $[[T1:[0-9]+]], $4, ${{[0-9]+}}
; MIPS64R6-DAG: sdc1 $[[T0]], 0($[[T1]])
; CHECK-NACL-NOT: sdxc1
%0 = load double* @gd, align 8
%arrayidx = getelementptr inbounds double* %b, i32 %o
store double %0, double* %arrayidx, align 8
ret void
}
define void @foo5(i32 %b, i32 %c) nounwind {
entry:
; ALL-LABEL: foo5:
; MIPS32R1-NOT: suxc1
; MIPS32R2-NOT: suxc1
; MIPS32R6-NOT: suxc1
; MIPS4-NOT: suxc1
; MIPS64R6-NOT: suxc1
%0 = load float* @gf, align 4
%arrayidx1 = getelementptr inbounds [4 x %struct.S]* @s, i32 0, i32 %b, i32 0, i32 %c
store float %0, float* %arrayidx1, align 1
ret void
}
define double @foo6(i32 %b, i32 %c) nounwind readonly {
entry:
; ALL-LABEL: foo6:
; MIPS32R1-NOT: luxc1
; MIPS32R2-NOT: luxc1
; MIPS32R6-NOT: luxc1
; MIPS4-NOT: luxc1
; MIPS64R6-NOT: luxc1
%arrayidx1 = getelementptr inbounds [4 x %struct.S2]* @s2, i32 0, i32 %b, i32 0, i32 %c
%0 = load double* %arrayidx1, align 1
ret double %0
}
define void @foo7(i32 %b, i32 %c) nounwind {
entry:
; ALL-LABEL: foo7:
; MIPS32R1-NOT: suxc1
; MIPS32R2-NOT: suxc1
; MIPS32R6-NOT: suxc1
; MIPS4-NOT: suxc1
; MIPS64R6-NOT: suxc1
%0 = load double* @gd, align 8
%arrayidx1 = getelementptr inbounds [4 x %struct.S2]* @s2, i32 0, i32 %b, i32 0, i32 %c
store double %0, double* %arrayidx1, align 1
ret void
}
define float @foo8() nounwind readonly {
entry:
; ALL-LABEL: foo8:
; MIPS32R1-NOT: luxc1
; MIPS32R2-NOT: luxc1
; MIPS32R6-NOT: luxc1
; MIPS4-NOT: luxc1
; MIPS64R6-NOT: luxc1
%0 = load float* getelementptr inbounds (%struct.S3* @s3, i32 0, i32 1), align 1
ret float %0
}
define void @foo9(float %f) nounwind {
entry:
; ALL-LABEL: foo9:
; MIPS32R1-NOT: suxc1
; MIPS32R2-NOT: suxc1
; MIPS32R6-NOT: suxc1
; MIPS4-NOT: suxc1
; MIPS64R6-NOT: suxc1
store float %f, float* getelementptr inbounds (%struct.S3* @s3, i32 0, i32 1), align 1
ret void
}
|