summaryrefslogtreecommitdiffstats
path: root/arch/i386/math-emu/fpu_arith.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1995-11-14 08:00:00 +0000
committer <ralf@linux-mips.org>1995-11-14 08:00:00 +0000
commite7c2a72e2680827d6a733931273a93461c0d8d1b (patch)
treec9abeda78ef7504062bb2e816bcf3e3c9d680112 /arch/i386/math-emu/fpu_arith.c
parentec6044459060a8c9ce7f64405c465d141898548c (diff)
Import of Linux/MIPS 1.3.0
Diffstat (limited to 'arch/i386/math-emu/fpu_arith.c')
-rw-r--r--arch/i386/math-emu/fpu_arith.c179
1 files changed, 179 insertions, 0 deletions
diff --git a/arch/i386/math-emu/fpu_arith.c b/arch/i386/math-emu/fpu_arith.c
new file mode 100644
index 000000000..96e6bd89b
--- /dev/null
+++ b/arch/i386/math-emu/fpu_arith.c
@@ -0,0 +1,179 @@
+/*---------------------------------------------------------------------------+
+ | fpu_arith.c |
+ | |
+ | Code to implement the FPU register/register arithmetic instructions |
+ | |
+ | Copyright (C) 1992,1993 |
+ | W. Metzenthen, 22 Parker St, Ormond, Vic 3163, |
+ | Australia. E-mail billm@vaxc.cc.monash.edu.au |
+ | |
+ | |
+ +---------------------------------------------------------------------------*/
+
+#include "fpu_system.h"
+#include "fpu_emu.h"
+#include "control_w.h"
+#include "status_w.h"
+
+
+void fadd__()
+{
+ /* fadd st,st(i) */
+ clear_C1();
+ reg_add(&st(0), &st(FPU_rm), &st(0), control_word);
+}
+
+
+void fmul__()
+{
+ /* fmul st,st(i) */
+ clear_C1();
+ reg_mul(&st(0), &st(FPU_rm), &st(0), control_word);
+}
+
+
+
+void fsub__()
+{
+ /* fsub st,st(i) */
+ clear_C1();
+ reg_sub(&st(0), &st(FPU_rm), &st(0), control_word);
+}
+
+
+void fsubr_()
+{
+ /* fsubr st,st(i) */
+ clear_C1();
+ reg_sub(&st(FPU_rm), &st(0), &st(0), control_word);
+}
+
+
+void fdiv__()
+{
+ /* fdiv st,st(i) */
+ clear_C1();
+ reg_div(&st(0), &st(FPU_rm), &st(0), control_word);
+}
+
+
+void fdivr_()
+{
+ /* fdivr st,st(i) */
+ clear_C1();
+ reg_div(&st(FPU_rm), &st(0), &st(0), control_word);
+}
+
+
+
+void fadd_i()
+{
+ /* fadd st(i),st */
+ clear_C1();
+ reg_add(&st(0), &st(FPU_rm), &st(FPU_rm), control_word);
+}
+
+
+void fmul_i()
+{
+ /* fmul st(i),st */
+ clear_C1();
+ reg_mul(&st(0), &st(FPU_rm), &st(FPU_rm), control_word);
+}
+
+
+void fsubri()
+{
+ /* fsubr st(i),st */
+ /* This is the sense of the 80486 manual
+ reg_sub(&st(FPU_rm), &st(0), &st(FPU_rm), control_word); */
+ clear_C1();
+ reg_sub(&st(0), &st(FPU_rm), &st(FPU_rm), control_word);
+}
+
+
+void fsub_i()
+{
+ /* fsub st(i),st */
+ /* This is the sense of the 80486 manual
+ reg_sub(&st(0), &st(FPU_rm), &st(FPU_rm), control_word); */
+ clear_C1();
+ reg_sub(&st(FPU_rm), &st(0), &st(FPU_rm), control_word);
+}
+
+
+void fdivri()
+{
+ /* fdivr st(i),st */
+ clear_C1();
+ reg_div(&st(0), &st(FPU_rm), &st(FPU_rm), control_word);
+}
+
+
+void fdiv_i()
+{
+ /* fdiv st(i),st */
+ clear_C1();
+ reg_div(&st(FPU_rm), &st(0), &st(FPU_rm), control_word);
+}
+
+
+
+void faddp_()
+{
+ /* faddp st(i),st */
+ clear_C1();
+ if ( !reg_add(&st(0), &st(FPU_rm), &st(FPU_rm), control_word) )
+ pop();
+}
+
+
+void fmulp_()
+{
+ /* fmulp st(i),st */
+ clear_C1();
+ if ( !reg_mul(&st(0), &st(FPU_rm), &st(FPU_rm), control_word) )
+ pop();
+}
+
+
+
+void fsubrp()
+{
+ /* fsubrp st(i),st */
+ /* This is the sense of the 80486 manual
+ reg_sub(&st(FPU_rm), &st(0), &st(FPU_rm), control_word); */
+ clear_C1();
+ if ( !reg_sub(&st(0), &st(FPU_rm), &st(FPU_rm), control_word) )
+ pop();
+}
+
+
+void fsubp_()
+{
+ /* fsubp st(i),st */
+ /* This is the sense of the 80486 manual
+ reg_sub(&st(0), &st(FPU_rm), &st(FPU_rm), control_word); */
+ clear_C1();
+ if ( !reg_sub(&st(FPU_rm), &st(0), &st(FPU_rm), control_word) )
+ pop();
+}
+
+
+void fdivrp()
+{
+ /* fdivrp st(i),st */
+ clear_C1();
+ if ( !reg_div(&st(0), &st(FPU_rm), &st(FPU_rm), control_word) )
+ pop();
+}
+
+
+void fdivp_()
+{
+ /* fdivp st(i),st */
+ clear_C1();
+ if ( !reg_div(&st(FPU_rm), &st(0), &st(FPU_rm), control_word) )
+ pop();
+}
+