Merge branch 'test' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi...
[linux-2.6/linux-acpi-2.6/acpi4asus.git] / arch / x86 / math-emu / fpu_arith.c
blobaeab24e083c40a5f4aa231b2346f5af3377b660f
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"
18 void fadd__(void)
20 /* fadd st,st(i) */
21 int i = FPU_rm;
22 clear_C1();
23 FPU_add(&st(i), FPU_gettagi(i), 0, control_word);
26 void fmul__(void)
28 /* fmul st,st(i) */
29 int i = FPU_rm;
30 clear_C1();
31 FPU_mul(&st(i), FPU_gettagi(i), 0, control_word);
34 void fsub__(void)
36 /* fsub st,st(i) */
37 clear_C1();
38 FPU_sub(0, FPU_rm, control_word);
41 void fsubr_(void)
43 /* fsubr st,st(i) */
44 clear_C1();
45 FPU_sub(REV, FPU_rm, control_word);
48 void fdiv__(void)
50 /* fdiv st,st(i) */
51 clear_C1();
52 FPU_div(0, FPU_rm, control_word);
55 void fdivr_(void)
57 /* fdivr st,st(i) */
58 clear_C1();
59 FPU_div(REV, FPU_rm, control_word);
62 void fadd_i(void)
64 /* fadd st(i),st */
65 int i = FPU_rm;
66 clear_C1();
67 FPU_add(&st(i), FPU_gettagi(i), i, control_word);
70 void fmul_i(void)
72 /* fmul st(i),st */
73 clear_C1();
74 FPU_mul(&st(0), FPU_gettag0(), FPU_rm, control_word);
77 void fsubri(void)
79 /* fsubr st(i),st */
80 clear_C1();
81 FPU_sub(DEST_RM, FPU_rm, control_word);
84 void fsub_i(void)
86 /* fsub st(i),st */
87 clear_C1();
88 FPU_sub(REV | DEST_RM, FPU_rm, control_word);
91 void fdivri(void)
93 /* fdivr st(i),st */
94 clear_C1();
95 FPU_div(DEST_RM, FPU_rm, control_word);
98 void fdiv_i(void)
100 /* fdiv st(i),st */
101 clear_C1();
102 FPU_div(REV | DEST_RM, FPU_rm, control_word);
105 void faddp_(void)
107 /* faddp st(i),st */
108 int i = FPU_rm;
109 clear_C1();
110 if (FPU_add(&st(i), FPU_gettagi(i), i, control_word) >= 0)
111 FPU_pop();
114 void fmulp_(void)
116 /* fmulp st(i),st */
117 clear_C1();
118 if (FPU_mul(&st(0), FPU_gettag0(), FPU_rm, control_word) >= 0)
119 FPU_pop();
122 void fsubrp(void)
124 /* fsubrp st(i),st */
125 clear_C1();
126 if (FPU_sub(DEST_RM, FPU_rm, control_word) >= 0)
127 FPU_pop();
130 void fsubp_(void)
132 /* fsubp st(i),st */
133 clear_C1();
134 if (FPU_sub(REV | DEST_RM, FPU_rm, control_word) >= 0)
135 FPU_pop();
138 void fdivrp(void)
140 /* fdivrp st(i),st */
141 clear_C1();
142 if (FPU_div(DEST_RM, FPU_rm, control_word) >= 0)
143 FPU_pop();
146 void fdivp_(void)
148 /* fdivp st(i),st */
149 clear_C1();
150 if (FPU_div(REV | DEST_RM, FPU_rm, control_word) >= 0)
151 FPU_pop();