1
2
3
4
5
6
7
8
9
10
11
12
13#include "fpu_system.h"
14#include "fpu_emu.h"
15#include "control_w.h"
16#include "status_w.h"
17
18void fadd__(void)
19{
20
21 int i = FPU_rm;
22 clear_C1();
23 FPU_add(&st(i), FPU_gettagi(i), 0, control_word);
24}
25
26void fmul__(void)
27{
28
29 int i = FPU_rm;
30 clear_C1();
31 FPU_mul(&st(i), FPU_gettagi(i), 0, control_word);
32}
33
34void fsub__(void)
35{
36
37 clear_C1();
38 FPU_sub(0, FPU_rm, control_word);
39}
40
41void fsubr_(void)
42{
43
44 clear_C1();
45 FPU_sub(REV, FPU_rm, control_word);
46}
47
48void fdiv__(void)
49{
50
51 clear_C1();
52 FPU_div(0, FPU_rm, control_word);
53}
54
55void fdivr_(void)
56{
57
58 clear_C1();
59 FPU_div(REV, FPU_rm, control_word);
60}
61
62void fadd_i(void)
63{
64
65 int i = FPU_rm;
66 clear_C1();
67 FPU_add(&st(i), FPU_gettagi(i), i, control_word);
68}
69
70void fmul_i(void)
71{
72
73 clear_C1();
74 FPU_mul(&st(0), FPU_gettag0(), FPU_rm, control_word);
75}
76
77void fsubri(void)
78{
79
80 clear_C1();
81 FPU_sub(DEST_RM, FPU_rm, control_word);
82}
83
84void fsub_i(void)
85{
86
87 clear_C1();
88 FPU_sub(REV | DEST_RM, FPU_rm, control_word);
89}
90
91void fdivri(void)
92{
93
94 clear_C1();
95 FPU_div(DEST_RM, FPU_rm, control_word);
96}
97
98void fdiv_i(void)
99{
100
101 clear_C1();
102 FPU_div(REV | DEST_RM, FPU_rm, control_word);
103}
104
105void faddp_(void)
106{
107
108 int i = FPU_rm;
109 clear_C1();
110 if (FPU_add(&st(i), FPU_gettagi(i), i, control_word) >= 0)
111 FPU_pop();
112}
113
114void fmulp_(void)
115{
116
117 clear_C1();
118 if (FPU_mul(&st(0), FPU_gettag0(), FPU_rm, control_word) >= 0)
119 FPU_pop();
120}
121
122void fsubrp(void)
123{
124
125 clear_C1();
126 if (FPU_sub(DEST_RM, FPU_rm, control_word) >= 0)
127 FPU_pop();
128}
129
130void fsubp_(void)
131{
132
133 clear_C1();
134 if (FPU_sub(REV | DEST_RM, FPU_rm, control_word) >= 0)
135 FPU_pop();
136}
137
138void fdivrp(void)
139{
140
141 clear_C1();
142 if (FPU_div(DEST_RM, FPU_rm, control_word) >= 0)
143 FPU_pop();
144}
145
146void fdivp_(void)
147{
148
149 clear_C1();
150 if (FPU_div(REV | DEST_RM, FPU_rm, control_word) >= 0)
151 FPU_pop();
152}
153