summaryrefslogtreecommitdiff
path: root/test/CodeGen/Mips/mips16fpe.ll
blob: b8f1d945f3564c3acc94df8681b58ee5b7be3df3 (plain)
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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
; RUN: llc -march=mipsel -mattr=mips16 -relocation-model=pic -O3 \
; RUN:     -verify-machineinstrs < %s | FileCheck %s -check-prefix=16hf

@x = global float 5.000000e+00, align 4
@y = global float 1.500000e+01, align 4
@xd = global double 6.000000e+00, align 8
@yd = global double 1.800000e+01, align 8
@two = global i32 2, align 4
@addsf3_result = common global float 0.000000e+00, align 4
@adddf3_result = common global double 0.000000e+00, align 8
@subsf3_result = common global float 0.000000e+00, align 4
@subdf3_result = common global double 0.000000e+00, align 8
@mulsf3_result = common global float 0.000000e+00, align 4
@muldf3_result = common global double 0.000000e+00, align 8
@divsf3_result = common global float 0.000000e+00, align 4
@divdf3_result = common global double 0.000000e+00, align 8
@extendsfdf2_result = common global double 0.000000e+00, align 8
@xd2 = global double 0x40147E6B74B4CF6A, align 8
@truncdfsf2_result = common global float 0.000000e+00, align 4
@fix_truncsfsi_result = common global i32 0, align 4
@fix_truncdfsi_result = common global i32 0, align 4
@si = global i32 -9, align 4
@ui = global i32 9, align 4
@floatsisf_result = common global float 0.000000e+00, align 4
@floatsidf_result = common global double 0.000000e+00, align 8
@floatunsisf_result = common global float 0.000000e+00, align 4
@floatunsidf_result = common global double 0.000000e+00, align 8
@xx = global float 5.000000e+00, align 4
@eqsf2_result = common global i32 0, align 4
@xxd = global double 6.000000e+00, align 8
@eqdf2_result = common global i32 0, align 4
@nesf2_result = common global i32 0, align 4
@nedf2_result = common global i32 0, align 4
@gesf2_result = common global i32 0, align 4
@gedf2_result = common global i32 0, align 4
@ltsf2_result = common global i32 0, align 4
@ltdf2_result = common global i32 0, align 4
@lesf2_result = common global i32 0, align 4
@ledf2_result = common global i32 0, align 4
@gtsf2_result = common global i32 0, align 4
@gtdf2_result = common global i32 0, align 4

define void @test_addsf3() nounwind {
entry:
;16hf-LABEL: test_addsf3:
  %0 = load float, float* @x, align 4
  %1 = load float, float* @y, align 4
  %add = fadd float %0, %1
  store float %add, float* @addsf3_result, align 4
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_addsf3)(${{[0-9]+}})
  ret void
}

define void @test_adddf3() nounwind {
entry:
;16hf-LABEL: test_adddf3:
  %0 = load double, double* @xd, align 8
  %1 = load double, double* @yd, align 8
  %add = fadd double %0, %1
  store double %add, double* @adddf3_result, align 8
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_adddf3)(${{[0-9]+}})
  ret void
}

define void @test_subsf3() nounwind {
entry:
;16hf-LABEL: test_subsf3:
  %0 = load float, float* @x, align 4
  %1 = load float, float* @y, align 4
  %sub = fsub float %0, %1
  store float %sub, float* @subsf3_result, align 4
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_subsf3)(${{[0-9]+}})
  ret void
}

define void @test_subdf3() nounwind {
entry:
;16hf-LABEL: test_subdf3:
  %0 = load double, double* @xd, align 8
  %1 = load double, double* @yd, align 8
  %sub = fsub double %0, %1
  store double %sub, double* @subdf3_result, align 8
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_subdf3)(${{[0-9]+}})
  ret void
}

define void @test_mulsf3() nounwind {
entry:
;16hf-LABEL: test_mulsf3:
  %0 = load float, float* @x, align 4
  %1 = load float, float* @y, align 4
  %mul = fmul float %0, %1
  store float %mul, float* @mulsf3_result, align 4
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_mulsf3)(${{[0-9]+}})
  ret void
}

define void @test_muldf3() nounwind {
entry:
;16hf-LABEL: test_muldf3:
  %0 = load double, double* @xd, align 8
  %1 = load double, double* @yd, align 8
  %mul = fmul double %0, %1
  store double %mul, double* @muldf3_result, align 8
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_muldf3)(${{[0-9]+}})
  ret void
}

define void @test_divsf3() nounwind {
entry:
;16hf-LABEL: test_divsf3:
  %0 = load float, float* @y, align 4
  %1 = load float, float* @x, align 4
  %div = fdiv float %0, %1
  store float %div, float* @divsf3_result, align 4
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_divsf3)(${{[0-9]+}})
  ret void
}

define void @test_divdf3() nounwind {
entry:
;16hf-LABEL: test_divdf3:
  %0 = load double, double* @yd, align 8
  %mul = fmul double %0, 2.000000e+00
  %1 = load double, double* @xd, align 8
  %div = fdiv double %mul, %1
  store double %div, double* @divdf3_result, align 8
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_divdf3)(${{[0-9]+}})
  ret void
}

define void @test_extendsfdf2() nounwind {
entry:
;16hf-LABEL: test_extendsfdf2:
  %0 = load float, float* @x, align 4
  %conv = fpext float %0 to double
  store double %conv, double* @extendsfdf2_result, align 8
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_extendsfdf2)(${{[0-9]+}})
  ret void
}

define void @test_truncdfsf2() nounwind {
entry:
;16hf-LABEL: test_truncdfsf2:
  %0 = load double, double* @xd2, align 8
  %conv = fptrunc double %0 to float
  store float %conv, float* @truncdfsf2_result, align 4
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_truncdfsf2)(${{[0-9]+}})
  ret void
}

define void @test_fix_truncsfsi() nounwind {
entry:
;16hf-LABEL: test_fix_truncsfsi:
  %0 = load float, float* @x, align 4
  %conv = fptosi float %0 to i32
  store i32 %conv, i32* @fix_truncsfsi_result, align 4
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_fix_truncsfsi)(${{[0-9]+}})
  ret void
}

define void @test_fix_truncdfsi() nounwind {
entry:
;16hf-LABEL: test_fix_truncdfsi:
  %0 = load double, double* @xd, align 8
  %conv = fptosi double %0 to i32
  store i32 %conv, i32* @fix_truncdfsi_result, align 4
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_fix_truncdfsi)(${{[0-9]+}})
  ret void
}

define void @test_floatsisf() nounwind {
entry:
;16hf-LABEL: test_floatsisf:
  %0 = load i32, i32* @si, align 4
  %conv = sitofp i32 %0 to float
  store float %conv, float* @floatsisf_result, align 4
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_floatsisf)(${{[0-9]+}})
  ret void
}

define void @test_floatsidf() nounwind {
entry:
;16hf-LABEL: test_floatsidf:
  %0 = load i32, i32* @si, align 4
  %conv = sitofp i32 %0 to double
  store double %conv, double* @floatsidf_result, align 8
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_floatsidf)(${{[0-9]+}})
  ret void
}

define void @test_floatunsisf() nounwind {
entry:
;16hf-LABEL: test_floatunsisf:
  %0 = load i32, i32* @ui, align 4
  %conv = uitofp i32 %0 to float
  store float %conv, float* @floatunsisf_result, align 4
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_floatunsisf)(${{[0-9]+}})
  ret void
}

define void @test_floatunsidf() nounwind {
entry:
;16hf-LABEL: test_floatunsidf:
  %0 = load i32, i32* @ui, align 4
  %conv = uitofp i32 %0 to double
  store double %conv, double* @floatunsidf_result, align 8
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_floatunsidf)(${{[0-9]+}})
  ret void
}

define void @test_eqsf2() nounwind {
entry:
;16hf-LABEL: test_eqsf2:
  %0 = load float, float* @x, align 4
  %1 = load float, float* @xx, align 4
  %cmp = fcmp oeq float %0, %1
  %conv = zext i1 %cmp to i32
  store i32 %conv, i32* @eqsf2_result, align 4
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_eqsf2)(${{[0-9]+}})
  ret void
}

define void @test_eqdf2() nounwind {
entry:
;16hf-LABEL: test_eqdf2:
  %0 = load double, double* @xd, align 8
  %1 = load double, double* @xxd, align 8
  %cmp = fcmp oeq double %0, %1
  %conv = zext i1 %cmp to i32
  store i32 %conv, i32* @eqdf2_result, align 4
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_eqdf2)(${{[0-9]+}})
  ret void
}

define void @test_nesf2() nounwind {
entry:
;16hf-LABEL: test_nesf2:
  %0 = load float, float* @x, align 4
  %1 = load float, float* @y, align 4
  %cmp = fcmp une float %0, %1
  %conv = zext i1 %cmp to i32
  store i32 %conv, i32* @nesf2_result, align 4
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_nesf2)(${{[0-9]+}})
  ret void
}

define void @test_nedf2() nounwind {
entry:
;16hf-LABEL: test_nedf2:
  %0 = load double, double* @xd, align 8
  %1 = load double, double* @yd, align 8
  %cmp = fcmp une double %0, %1
  %conv = zext i1 %cmp to i32
  store i32 %conv, i32* @nedf2_result, align 4
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_nedf2)(${{[0-9]+}})
  ret void
}

define void @test_gesf2() nounwind {
entry:
;16hf-LABEL: test_gesf2:
  %0 = load float, float* @x, align 4
  %1 = load float, float* @xx, align 4
  %cmp = fcmp oge float %0, %1
  %2 = load float, float* @y, align 4
  %cmp1 = fcmp oge float %2, %0
  %and3 = and i1 %cmp, %cmp1
  %and = zext i1 %and3 to i32
  store i32 %and, i32* @gesf2_result, align 4
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_gesf2)(${{[0-9]+}})
  ret void
}

define void @test_gedf2() nounwind {
entry:
;16hf-LABEL: test_gedf2:
  %0 = load double, double* @xd, align 8
  %1 = load double, double* @xxd, align 8
  %cmp = fcmp oge double %0, %1
  %2 = load double, double* @yd, align 8
  %cmp1 = fcmp oge double %2, %0
  %and3 = and i1 %cmp, %cmp1
  %and = zext i1 %and3 to i32
  store i32 %and, i32* @gedf2_result, align 4
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_gedf2)(${{[0-9]+}})
  ret void
}

define void @test_ltsf2() nounwind {
entry:
;16hf-LABEL: test_ltsf2:
  %0 = load float, float* @x, align 4
  %1 = load float, float* @xx, align 4
  %lnot = fcmp uge float %0, %1
  %2 = load float, float* @y, align 4
  %cmp1 = fcmp olt float %0, %2
  %and2 = and i1 %lnot, %cmp1
  %and = zext i1 %and2 to i32
  store i32 %and, i32* @ltsf2_result, align 4
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_ltsf2)(${{[0-9]+}})
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_ltsf2)(${{[0-9]+}})
  ret void
}

define void @test_ltdf2() nounwind {
entry:
;16hf-LABEL: test_ltdf2:
  %0 = load double, double* @xd, align 8
  %1 = load double, double* @xxd, align 8
  %lnot = fcmp uge double %0, %1
  %2 = load double, double* @yd, align 8
  %cmp1 = fcmp olt double %0, %2
  %and2 = and i1 %lnot, %cmp1
  %and = zext i1 %and2 to i32
  store i32 %and, i32* @ltdf2_result, align 4
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_ltdf2)(${{[0-9]+}})
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_ltdf2)(${{[0-9]+}})
  ret void
}

define void @test_lesf2() nounwind {
entry:
;16hf-LABEL: test_lesf2:
  %0 = load float, float* @x, align 4
  %1 = load float, float* @xx, align 4
  %cmp = fcmp ole float %0, %1
  %2 = load float, float* @y, align 4
  %cmp1 = fcmp ole float %0, %2
  %and3 = and i1 %cmp, %cmp1
  %and = zext i1 %and3 to i32
  store i32 %and, i32* @lesf2_result, align 4
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_lesf2)(${{[0-9]+}})
  ret void
}

define void @test_ledf2() nounwind {
entry:
;16hf-LABEL: test_ledf2:
  %0 = load double, double* @xd, align 8
  %1 = load double, double* @xxd, align 8
  %cmp = fcmp ole double %0, %1
  %2 = load double, double* @yd, align 8
  %cmp1 = fcmp ole double %0, %2
  %and3 = and i1 %cmp, %cmp1
  %and = zext i1 %and3 to i32
  store i32 %and, i32* @ledf2_result, align 4
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_ledf2)(${{[0-9]+}})
  ret void
}

define void @test_gtsf2() nounwind {
entry:
;16hf-LABEL: test_gtsf2:
  %0 = load float, float* @x, align 4
  %1 = load float, float* @xx, align 4
  %lnot = fcmp ule float %0, %1
  %2 = load float, float* @y, align 4
  %cmp1 = fcmp ogt float %2, %0
  %and2 = and i1 %lnot, %cmp1
  %and = zext i1 %and2 to i32
  store i32 %and, i32* @gtsf2_result, align 4
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_gtsf2)(${{[0-9]+}})
  ret void
}

define void @test_gtdf2() nounwind {
entry:
;16hf-LABEL: test_gtdf2:
  %0 = load double, double* @xd, align 8
  %1 = load double, double* @xxd, align 8
  %lnot = fcmp ule double %0, %1
  %2 = load double, double* @yd, align 8
  %cmp1 = fcmp ogt double %2, %0
  %and2 = and i1 %lnot, %cmp1
  %and = zext i1 %and2 to i32
  store i32 %and, i32* @gtdf2_result, align 4
;16hf:  lw	${{[0-9]+}}, %call16(__mips16_gtdf2)(${{[0-9]+}})
  ret void
}