Merge branch 'clockevents/4.21' of http://git.linaro.org/people/daniel.lezcano/linux...
[linux/fpc-iii.git] / arch / x86 / math-emu / fpu_arith.c
blob09006dc474a0aff09dc87ef55bcd87657c20aa5d
1 // SPDX-License-Identifier: GPL-2.0
2 /*---------------------------------------------------------------------------+
3 | fpu_arith.c |
4 | |
5 | Code to implement the FPU register/register arithmetic instructions |
6 | |
7 | Copyright (C) 1992,1993,1997 |
8 | W. Metzenthen, 22 Parker St, Ormond, Vic 3163, Australia |
9 | E-mail billm@suburbia.net |
10 | |
11 | |
12 +---------------------------------------------------------------------------*/
14 #include "fpu_system.h"
15 #include "fpu_emu.h"
16 #include "control_w.h"
17 #include "status_w.h"
19 void fadd__(void)
21 /* fadd st,st(i) */
22 int i = FPU_rm;
23 clear_C1();
24 FPU_add(&st(i), FPU_gettagi(i), 0, control_word);
27 void fmul__(void)
29 /* fmul st,st(i) */
30 int i = FPU_rm;
31 clear_C1();
32 FPU_mul(&st(i), FPU_gettagi(i), 0, control_word);
35 void fsub__(void)
37 /* fsub st,st(i) */
38 clear_C1();
39 FPU_sub(0, FPU_rm, control_word);
42 void fsubr_(void)
44 /* fsubr st,st(i) */
45 clear_C1();
46 FPU_sub(REV, FPU_rm, control_word);
49 void fdiv__(void)
51 /* fdiv st,st(i) */
52 clear_C1();
53 FPU_div(0, FPU_rm, control_word);
56 void fdivr_(void)
58 /* fdivr st,st(i) */
59 clear_C1();
60 FPU_div(REV, FPU_rm, control_word);
63 void fadd_i(void)
65 /* fadd st(i),st */
66 int i = FPU_rm;
67 clear_C1();
68 FPU_add(&st(i), FPU_gettagi(i), i, control_word);
71 void fmul_i(void)
73 /* fmul st(i),st */
74 clear_C1();
75 FPU_mul(&st(0), FPU_gettag0(), FPU_rm, control_word);
78 void fsubri(void)
80 /* fsubr st(i),st */
81 clear_C1();
82 FPU_sub(DEST_RM, FPU_rm, control_word);
85 void fsub_i(void)
87 /* fsub st(i),st */
88 clear_C1();
89 FPU_sub(REV | DEST_RM, FPU_rm, control_word);
92 void fdivri(void)
94 /* fdivr st(i),st */
95 clear_C1();
96 FPU_div(DEST_RM, FPU_rm, control_word);
99 void fdiv_i(void)
101 /* fdiv st(i),st */
102 clear_C1();
103 FPU_div(REV | DEST_RM, FPU_rm, control_word);
106 void faddp_(void)
108 /* faddp st(i),st */
109 int i = FPU_rm;
110 clear_C1();
111 if (FPU_add(&st(i), FPU_gettagi(i), i, control_word) >= 0)
112 FPU_pop();
115 void fmulp_(void)
117 /* fmulp st(i),st */
118 clear_C1();
119 if (FPU_mul(&st(0), FPU_gettag0(), FPU_rm, control_word) >= 0)
120 FPU_pop();
123 void fsubrp(void)
125 /* fsubrp st(i),st */
126 clear_C1();
127 if (FPU_sub(DEST_RM, FPU_rm, control_word) >= 0)
128 FPU_pop();
131 void fsubp_(void)
133 /* fsubp st(i),st */
134 clear_C1();
135 if (FPU_sub(REV | DEST_RM, FPU_rm, control_word) >= 0)
136 FPU_pop();
139 void fdivrp(void)
141 /* fdivrp st(i),st */
142 clear_C1();
143 if (FPU_div(DEST_RM, FPU_rm, control_word) >= 0)
144 FPU_pop();
147 void fdivp_(void)
149 /* fdivp st(i),st */
150 clear_C1();
151 if (FPU_div(REV | DEST_RM, FPU_rm, control_word) >= 0)
152 FPU_pop();