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
|
/*
* m68k FPU helpers
*
* Copyright (c) 2006-2007 CodeSourcery
* Written by Paul Brook
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include "qemu/osdep.h"
#include "cpu.h"
#include "exec/helper-proto.h"
#include "exec/exec-all.h"
int32_t HELPER(reds32)(CPUM68KState *env, FPReg *val)
{
return floatx80_to_int32(val->d, &env->fp_status);
}
float32 HELPER(redf32)(CPUM68KState *env, FPReg *val)
{
return floatx80_to_float32(val->d, &env->fp_status);
}
void HELPER(exts32)(CPUM68KState *env, FPReg *res, int32_t val)
{
res->d = int32_to_floatx80(val, &env->fp_status);
}
void HELPER(extf32)(CPUM68KState *env, FPReg *res, float32 val)
{
res->d = float32_to_floatx80(val, &env->fp_status);
}
void HELPER(extf64)(CPUM68KState *env, FPReg *res, float64 val)
{
res->d = float64_to_floatx80(val, &env->fp_status);
}
float64 HELPER(redf64)(CPUM68KState *env, FPReg *val)
{
return floatx80_to_float64(val->d, &env->fp_status);
}
void HELPER(firound)(CPUM68KState *env, FPReg *res, FPReg *val)
{
res->d = floatx80_round_to_int(val->d, &env->fp_status);
}
void HELPER(fitrunc)(CPUM68KState *env, FPReg *res, FPReg *val)
{
res->d = floatx80_round_to_int(val->d, &env->fp_status);
}
void HELPER(fsqrt)(CPUM68KState *env, FPReg *res, FPReg *val)
{
res->d = floatx80_sqrt(val->d, &env->fp_status);
}
void HELPER(fabs)(CPUM68KState *env, FPReg *res, FPReg *val)
{
res->d = floatx80_abs(val->d);
}
void HELPER(fchs)(CPUM68KState *env, FPReg *res, FPReg *val)
{
res->d = floatx80_chs(val->d);
}
void HELPER(fadd)(CPUM68KState *env, FPReg *res, FPReg *val0, FPReg *val1)
{
res->d = floatx80_add(val0->d, val1->d, &env->fp_status);
}
void HELPER(fsub)(CPUM68KState *env, FPReg *res, FPReg *val0, FPReg *val1)
{
res->d = floatx80_sub(val1->d, val0->d, &env->fp_status);
}
void HELPER(fmul)(CPUM68KState *env, FPReg *res, FPReg *val0, FPReg *val1)
{
res->d = floatx80_mul(val0->d, val1->d, &env->fp_status);
}
void HELPER(fdiv)(CPUM68KState *env, FPReg *res, FPReg *val0, FPReg *val1)
{
res->d = floatx80_div(val1->d, val0->d, &env->fp_status);
}
void HELPER(fsub_cmp)(CPUM68KState *env, FPReg *res, FPReg *val0, FPReg *val1)
{
/* ??? This may incorrectly raise exceptions. */
/* ??? Should flush denormals to zero. */
res->d = floatx80_sub(val0->d, val1->d, &env->fp_status);
if (floatx80_is_quiet_nan(res->d, &env->fp_status)) {
/* +/-inf compares equal against itself, but sub returns nan. */
if (!floatx80_is_quiet_nan(val0->d, &env->fp_status)
&& !floatx80_is_quiet_nan(val1->d, &env->fp_status)) {
res->d = floatx80_zero;
if (floatx80_lt_quiet(val0->d, res->d, &env->fp_status)) {
res->d = floatx80_chs(res->d);
}
}
}
}
uint32_t HELPER(fcompare)(CPUM68KState *env, FPReg *val)
{
return floatx80_compare_quiet(val->d, floatx80_zero, &env->fp_status);
}
|