1 #if defined(__mips_hard_float)
18 const char *flt_art_op_names
[] = {
31 TO_NEAREST
=0, TO_ZERO
, TO_PLUS_INFINITY
, TO_MINUS_INFINITY
} round_mode_t
;
32 char *round_mode_name
[] = { "near", "zero", "+inf", "-inf" };
34 const double fs_d
[] = {
36 1384.5, -7.25, 1000000000, -5786.5,
37 1752, 0.015625, 0.03125, -248562.75,
38 456, -45786.5, 34.03125, 45786.75,
39 1752065, 107, -45667.25, -7,
40 -347856.5, 356047.5, -1.0, 23.0625
43 const double ft_d
[] = {
44 -456.25, -45786.5, 34.03125, 45786.75,
45 1752065, 107, -45667.25, -7.25,
46 -347856.5, 356047.5, -1.0, 23.0625,
48 1384.5, -7, 1000000000, -5786.5,
49 1752, 0.015625, 0.03125, -248562.75
52 const float fs_f
[] = {
54 1384.5, -7.25, 1000000000, -5786.5,
55 1752, 0.015625, 0.03125, -248562.75,
56 456, -45786.5, 34.03125, 45786.75,
57 1752065, 107, -45667.25, -7,
58 -347856.5, 356047.5, -1.0, 23.0625
61 const float ft_f
[] = {
62 -456.25, -4578.5, 34.03125, 4578.75,
63 175, 107, -456.25, -7.25,
64 -3478.5, 356.5, -1.0, 23.0625,
66 1384.5, -7, 100, -5786.5,
67 1752, 0.015625, 0.03125, -248562.75
74 : "=f"(fd_d) : "f"(fs_d[i]));
80 : "=f"(fd_f) : "f"(fs_f[i]));
86 : "=f"(fd_f) : "f"(fs_f[i]) , "f"(ft_f[i]));
92 : "=f"(fd_d) : "f"(fs_d[i]) , "f"(ft_d[i]));
94 void set_rounding_mode(round_mode_t mode
)
98 __asm__
volatile("cfc1 $t0, $31\n\t"
101 "ctc1 $t0, $31\n\t");
104 __asm__
volatile("cfc1 $t0, $31\n\t"
108 "ctc1 $t0, $31\n\t");
110 case TO_PLUS_INFINITY
:
111 __asm__
volatile("cfc1 $t0, $31\n\t"
115 "ctc1 $t0, $31\n\t");
117 case TO_MINUS_INFINITY
:
118 __asm__
volatile("cfc1 $t0, $31\n\t"
122 "ctc1 $t0, $31\n\t");
127 int arithmeticOperations(flt_art_op_t op
)
133 for (rm
= TO_NEAREST
; rm
<= TO_MINUS_INFINITY
; rm
++) {
134 set_rounding_mode(rm
);
135 printf("rounding mode: %s\n", round_mode_name
[rm
]);
136 for (i
= 0; i
< 24; i
++)
141 printf("%s %f %f\n", flt_art_op_names
[op
], fd_f
, fs_f
[i
]);
145 printf("%s %lf %lf\n", flt_art_op_names
[op
], fd_d
, fs_d
[i
]);
149 printf("%s %f %f %f\n", flt_art_op_names
[op
], fd_f
, fs_f
[i
], ft_f
[i
]);
153 printf("%s %lf %lf %lf\n", flt_art_op_names
[op
], fd_d
, fs_d
[i
], ft_d
[i
]);
157 printf("%s %f %f %f\n", flt_art_op_names
[op
], fd_f
, fs_f
[i
], ft_f
[i
]);
161 printf("%s %lf %lf %lf\n", flt_art_op_names
[op
], fd_d
, fs_d
[i
], ft_d
[i
]);
165 printf("%s %f %f %f\n", flt_art_op_names
[op
], fd_f
, fs_f
[i
], ft_f
[i
]);
169 printf("%s %lf %lf %lf\n", flt_art_op_names
[op
], fd_d
, fs_d
[i
], ft_d
[i
]);
173 printf("%s %f %f\n", flt_art_op_names
[op
], fd_f
, fs_f
[i
]);
177 printf("%s %lf %lf\n", flt_art_op_names
[op
], fd_d
, fs_d
[i
]);
181 printf("%s %f %f\n", flt_art_op_names
[op
], fd_f
, fs_f
[i
]);
185 printf("%s %lf %lf\n", flt_art_op_names
[op
], fd_d
, fs_d
[i
]);
189 printf("%s %f %f %f\n", flt_art_op_names
[op
], fd_f
, fs_f
[i
], ft_f
[i
]);
193 printf("%s %lf %lf %lf\n", flt_art_op_names
[op
], fd_d
, fs_d
[i
], ft_d
[i
]);
196 #if (__mips==32) && (__mips_isa_rev>=2)
198 printf("%s %f %f\n", flt_art_op_names
[op
], fd_f
, fs_f
[i
]);
202 #if (__mips==32) && (__mips_isa_rev>=2)
204 printf("%s %lf %lf\n", flt_art_op_names
[op
], fd_d
, fs_d
[i
]);
208 #if (__mips==32) && (__mips_isa_rev>=2)
210 printf("%s %f %f\n", flt_art_op_names
[op
], fd_f
, fs_f
[i
]);
214 #if (__mips==32) && (__mips_isa_rev>=2)
216 printf("%s %lf %lf\n", flt_art_op_names
[op
], fd_d
, fs_d
[i
]);
232 printf("-------------------------- %s --------------------------\n",
233 "test FPU Arithmetic Operations");
234 for (op
= ABSS
; op
<= RECIPD
; op
++) {
235 arithmeticOperations(op
);