1 |
349 |
julius |
|
2 |
|
|
/*
|
3 |
|
|
===============================================================================
|
4 |
|
|
|
5 |
|
|
This GNU assembler source file is part of TestFloat, Release 2a, a package
|
6 |
|
|
of programs for testing the correctness of floating-point arithmetic
|
7 |
|
|
complying to the IEC/IEEE Standard for Floating-Point.
|
8 |
|
|
|
9 |
|
|
Written by John R. Hauser. More information is available through the Web
|
10 |
|
|
page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
|
11 |
|
|
|
12 |
|
|
THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
|
13 |
|
|
has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
|
14 |
|
|
TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
|
15 |
|
|
PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
|
16 |
|
|
AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
|
17 |
|
|
|
18 |
|
|
Derivative works are acceptable, even for commercial purposes, so long as
|
19 |
|
|
(1) they include prominent notice that the work is derivative, and (2) they
|
20 |
|
|
include prominent notice akin to these four paragraphs for those parts of
|
21 |
|
|
this code that are retained.
|
22 |
|
|
|
23 |
|
|
Modified for use with or1ksim's testsuite.
|
24 |
|
|
|
25 |
|
|
Contributor Julius Baxter
|
26 |
|
|
|
27 |
|
|
===============================================================================
|
28 |
|
|
*/
|
29 |
|
|
|
30 |
|
|
.text
|
31 |
|
|
|
32 |
|
|
/*
|
33 |
|
|
-------------------------------------------------------------------------------
|
34 |
|
|
-------------------------------------------------------------------------------
|
35 |
|
|
*/
|
36 |
|
|
.align 4
|
37 |
|
|
.global _syst_int32_to_float32
|
38 |
|
|
_syst_int32_to_float32:
|
39 |
|
|
lf.itof.s r11, r3
|
40 |
|
|
l.jr r9
|
41 |
|
|
l.nop
|
42 |
|
|
|
43 |
|
|
|
44 |
|
|
|
45 |
|
|
|
46 |
|
|
/*
|
47 |
|
|
-------------------------------------------------------------------------------
|
48 |
|
|
-------------------------------------------------------------------------------
|
49 |
|
|
*/
|
50 |
|
|
.align 4
|
51 |
|
|
.global _syst_float32_to_int32_round_to_zero
|
52 |
|
|
_syst_float32_to_int32_round_to_zero:
|
53 |
|
|
lf.ftoi.s r11, r3
|
54 |
|
|
l.jr r9
|
55 |
|
|
l.nop
|
56 |
|
|
|
57 |
|
|
/*
|
58 |
|
|
-------------------------------------------------------------------------------
|
59 |
|
|
-------------------------------------------------------------------------------
|
60 |
|
|
*/
|
61 |
|
|
.align 4
|
62 |
|
|
.global _syst_float32_to_int32
|
63 |
|
|
_syst_float32_to_int32:
|
64 |
|
|
lf.ftoi.s r11, r3
|
65 |
|
|
l.jr r9
|
66 |
|
|
l.nop
|
67 |
|
|
|
68 |
|
|
/*
|
69 |
|
|
-------------------------------------------------------------------------------
|
70 |
|
|
-------------------------------------------------------------------------------
|
71 |
|
|
*/
|
72 |
|
|
.align 4
|
73 |
|
|
.global _syst_float32_round_to_int
|
74 |
|
|
_syst_float32_round_to_int:
|
75 |
|
|
lf.ftoi.s r11, r3
|
76 |
|
|
l.jr r9
|
77 |
|
|
l.nop
|
78 |
|
|
|
79 |
|
|
/*
|
80 |
|
|
-------------------------------------------------------------------------------
|
81 |
|
|
-------------------------------------------------------------------------------
|
82 |
|
|
*/
|
83 |
|
|
.align 4
|
84 |
|
|
.global _syst_float32_add
|
85 |
|
|
_syst_float32_add:
|
86 |
|
|
lf.add.s r11, r3, r4
|
87 |
|
|
l.jr r9
|
88 |
|
|
l.nop
|
89 |
|
|
|
90 |
|
|
/*
|
91 |
|
|
-------------------------------------------------------------------------------
|
92 |
|
|
-------------------------------------------------------------------------------
|
93 |
|
|
*/
|
94 |
|
|
.align 4
|
95 |
|
|
.global _syst_float32_sub
|
96 |
|
|
_syst_float32_sub:
|
97 |
|
|
lf.sub.s r11, r3, r4
|
98 |
|
|
l.jr r9
|
99 |
|
|
l.nop
|
100 |
|
|
|
101 |
|
|
/*
|
102 |
|
|
-------------------------------------------------------------------------------
|
103 |
|
|
-------------------------------------------------------------------------------
|
104 |
|
|
*/
|
105 |
|
|
.align 4
|
106 |
|
|
.global _syst_float32_mul
|
107 |
|
|
_syst_float32_mul:
|
108 |
|
|
lf.mul.s r11, r3, r4
|
109 |
|
|
l.jr r9
|
110 |
|
|
l.nop
|
111 |
|
|
|
112 |
|
|
/*
|
113 |
|
|
-------------------------------------------------------------------------------
|
114 |
|
|
-------------------------------------------------------------------------------
|
115 |
|
|
*/
|
116 |
|
|
.align 4
|
117 |
|
|
.global _syst_float32_div
|
118 |
|
|
_syst_float32_div:
|
119 |
|
|
lf.div.s r11, r3, r4
|
120 |
|
|
l.jr r9
|
121 |
|
|
l.nop
|
122 |
|
|
|
123 |
|
|
/*
|
124 |
|
|
-------------------------------------------------------------------------------
|
125 |
|
|
-------------------------------------------------------------------------------
|
126 |
|
|
*/
|
127 |
|
|
.align 4
|
128 |
|
|
.global _syst_float32_eq
|
129 |
|
|
_syst_float32_eq:
|
130 |
|
|
lf.sfeq.s r3, r4
|
131 |
|
|
l.bnf 1f
|
132 |
|
|
l.addi r11, r0, 0
|
133 |
|
|
l.addi r11, r0, 1
|
134 |
|
|
1: l.jr r9
|
135 |
|
|
l.nop
|
136 |
|
|
|
137 |
|
|
/*
|
138 |
|
|
-------------------------------------------------------------------------------
|
139 |
|
|
-------------------------------------------------------------------------------
|
140 |
|
|
*/
|
141 |
|
|
.align 4
|
142 |
|
|
.global _syst_float32_le
|
143 |
|
|
_syst_float32_le:
|
144 |
|
|
lf.sfle.s r3, r4
|
145 |
|
|
l.bnf 1f
|
146 |
|
|
l.addi r11, r0, 0
|
147 |
|
|
l.addi r11, r0, 1
|
148 |
|
|
1: l.jr r9
|
149 |
|
|
l.nop
|
150 |
|
|
|
151 |
|
|
/*
|
152 |
|
|
-------------------------------------------------------------------------------
|
153 |
|
|
-------------------------------------------------------------------------------
|
154 |
|
|
*/
|
155 |
|
|
.align 4
|
156 |
|
|
.global _syst_float32_lt
|
157 |
|
|
_syst_float32_lt:
|
158 |
|
|
lf.sflt.s r3, r4
|
159 |
|
|
l.bnf 1f
|
160 |
|
|
l.addi r11, r0, 0
|
161 |
|
|
l.addi r11, r0, 1
|
162 |
|
|
1: l.jr r9
|
163 |
|
|
l.nop
|