Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / i386 / math-emu / fpu_arith.c
blob6972dec01af6a109df63a88e76e3de2ee99c5d06
1 /*---------------------------------------------------------------------------+
2 | fpu_arith.c |
3 | |
4 | Code to implement the FPU register/register arithmetic instructions |
5 | |
6 | Copyright (C) 1992,1993,1997 |
7 | W. Metzenthen, 22 Parker St, Ormond, Vic 3163, Australia |
8 | E-mail billm@suburbia.net |
9 | |
10 | |
11 +---------------------------------------------------------------------------*/
13 #include "fpu_system.h"
14 #include "fpu_emu.h"
15 #include "control_w.h"
16 #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);
28 void fmul__(void)
30 /* fmul st,st(i) */
31 int i = FPU_rm;
32 clear_C1();
33 FPU_mul(&st(i), FPU_gettagi(i), 0, control_word);
38 void fsub__(void)
40 /* fsub st,st(i) */
41 clear_C1();
42 FPU_sub(0, FPU_rm, control_word);
46 void fsubr_(void)
48 /* fsubr st,st(i) */
49 clear_C1();
50 FPU_sub(REV, FPU_rm, control_word);
54 void fdiv__(void)
56 /* fdiv st,st(i) */
57 clear_C1();
58 FPU_div(0, FPU_rm, control_word);
62 void fdivr_(void)
64 /* fdivr st,st(i) */
65 clear_C1();
66 FPU_div(REV, FPU_rm, control_word);
71 void fadd_i(void)
73 /* fadd st(i),st */
74 int i = FPU_rm;
75 clear_C1();
76 FPU_add(&st(i), FPU_gettagi(i), i, control_word);
80 void fmul_i(void)
82 /* fmul st(i),st */
83 clear_C1();
84 FPU_mul(&st(0), FPU_gettag0(), FPU_rm, control_word);
88 void fsubri(void)
90 /* fsubr st(i),st */
91 clear_C1();
92 FPU_sub(DEST_RM, FPU_rm, control_word);
96 void fsub_i(void)
98 /* fsub st(i),st */
99 clear_C1();
100 FPU_sub(REV|DEST_RM, FPU_rm, control_word);
104 void fdivri(void)
106 /* fdivr st(i),st */
107 clear_C1();
108 FPU_div(DEST_RM, FPU_rm, control_word);
112 void fdiv_i(void)
114 /* fdiv st(i),st */
115 clear_C1();
116 FPU_div(REV|DEST_RM, FPU_rm, control_word);
121 void faddp_(void)
123 /* faddp st(i),st */
124 int i = FPU_rm;
125 clear_C1();
126 if ( FPU_add(&st(i), FPU_gettagi(i), i, control_word) >= 0 )
127 FPU_pop();
131 void fmulp_(void)
133 /* fmulp st(i),st */
134 clear_C1();
135 if ( FPU_mul(&st(0), FPU_gettag0(), FPU_rm, control_word) >= 0 )
136 FPU_pop();
141 void fsubrp(void)
143 /* fsubrp st(i),st */
144 clear_C1();
145 if ( FPU_sub(DEST_RM, FPU_rm, control_word) >= 0 )
146 FPU_pop();
150 void fsubp_(void)
152 /* fsubp st(i),st */
153 clear_C1();
154 if ( FPU_sub(REV|DEST_RM, FPU_rm, control_word) >= 0 )
155 FPU_pop();
159 void fdivrp(void)
161 /* fdivrp st(i),st */
162 clear_C1();
163 if ( FPU_div(DEST_RM, FPU_rm, control_word) >= 0 )
164 FPU_pop();
168 void fdivp_(void)
170 /* fdivp st(i),st */
171 clear_C1();
172 if ( FPU_div(REV|DEST_RM, FPU_rm, control_word) >= 0 )
173 FPU_pop();