patch-2.1.73 linux/arch/i386/math-emu/fpu_arith.c

Next file: linux/arch/i386/math-emu/fpu_asm.h
Previous file: linux/arch/i386/math-emu/errors.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.72/linux/arch/i386/math-emu/fpu_arith.c linux/arch/i386/math-emu/fpu_arith.c
@@ -3,9 +3,9 @@
  |                                                                           |
  | 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    |
+ | Copyright (C) 1992,1993,1997                                              |
+ |                  W. Metzenthen, 22 Parker St, Ormond, Vic 3163, Australia |
+ |                  E-mail   billm@suburbia.net                              |
  |                                                                           |
  |                                                                           |
  +---------------------------------------------------------------------------*/
@@ -19,16 +19,18 @@
 void fadd__()
 {
   /* fadd st,st(i) */
+  int i = FPU_rm;
   clear_C1();
-  reg_add(&st(0), &st(FPU_rm), &st(0), control_word);
+  FPU_add(&st(i), FPU_gettagi(i), 0, control_word);
 }
 
 
 void fmul__()
 {
   /* fmul st,st(i) */
+  int i = FPU_rm;
   clear_C1();
-  reg_mul(&st(0), &st(FPU_rm), &st(0), control_word);
+  FPU_mul(&st(i), FPU_gettagi(i), 0, control_word);
 }
 
 
@@ -37,7 +39,7 @@
 {
   /* fsub st,st(i) */
   clear_C1();
-  reg_sub(&st(0), &st(FPU_rm), &st(0), control_word);
+  FPU_sub(0, FPU_rm, control_word);
 }
 
 
@@ -45,7 +47,7 @@
 {
   /* fsubr st,st(i) */
   clear_C1();
-  reg_sub(&st(FPU_rm), &st(0), &st(0), control_word);
+  FPU_sub(REV, FPU_rm, control_word);
 }
 
 
@@ -53,7 +55,7 @@
 {
   /* fdiv st,st(i) */
   clear_C1();
-  reg_div(&st(0), &st(FPU_rm), &st(0), control_word);
+  FPU_div(0, FPU_rm, control_word);
 }
 
 
@@ -61,7 +63,7 @@
 {
   /* fdivr st,st(i) */
   clear_C1();
-  reg_div(&st(FPU_rm), &st(0), &st(0), control_word);
+  FPU_div(REV, FPU_rm, control_word);
 }
 
 
@@ -69,8 +71,9 @@
 void fadd_i()
 {
   /* fadd st(i),st */
+  int i = FPU_rm;
   clear_C1();
-  reg_add(&st(0), &st(FPU_rm), &st(FPU_rm), control_word);
+  FPU_add(&st(i), FPU_gettagi(i), i, control_word);
 }
 
 
@@ -78,27 +81,23 @@
 {
   /* fmul st(i),st */
   clear_C1();
-  reg_mul(&st(0), &st(FPU_rm), &st(FPU_rm), control_word);
+  FPU_mul(&st(0), FPU_gettag0(), 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);
+  FPU_sub(DEST_RM, 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);
+  FPU_sub(REV|DEST_RM, FPU_rm, control_word);
 }
 
 
@@ -106,7 +105,7 @@
 {
   /* fdivr st(i),st */
   clear_C1();
-  reg_div(&st(0), &st(FPU_rm), &st(FPU_rm), control_word);
+  FPU_div(DEST_RM, FPU_rm, control_word);
 }
 
 
@@ -114,7 +113,7 @@
 {
   /* fdiv st(i),st */
   clear_C1();
-  reg_div(&st(FPU_rm), &st(0), &st(FPU_rm), control_word);
+  FPU_div(REV|DEST_RM, FPU_rm, control_word);
 }
 
 
@@ -122,9 +121,10 @@
 void faddp_()
 {
   /* faddp st(i),st */
+  int i = FPU_rm;
   clear_C1();
-  if ( !reg_add(&st(0), &st(FPU_rm), &st(FPU_rm), control_word) )
-    pop();
+  if ( FPU_add(&st(i), FPU_gettagi(i), i, control_word) >= 0 )
+    FPU_pop();
 }
 
 
@@ -132,8 +132,8 @@
 {
   /* fmulp st(i),st */
   clear_C1();
-  if ( !reg_mul(&st(0), &st(FPU_rm), &st(FPU_rm), control_word) )
-    pop();
+  if ( FPU_mul(&st(0), FPU_gettag0(), FPU_rm, control_word) >= 0 )
+    FPU_pop();
 }
 
 
@@ -141,22 +141,18 @@
 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();
+  if ( FPU_sub(DEST_RM, FPU_rm, control_word) >= 0 )
+    FPU_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();
+  if ( FPU_sub(REV|DEST_RM, FPU_rm, control_word) >= 0 )
+    FPU_pop();
 }
 
 
@@ -164,8 +160,8 @@
 {
   /* fdivrp st(i),st */
   clear_C1();
-  if ( !reg_div(&st(0), &st(FPU_rm), &st(FPU_rm), control_word) )
-    pop();
+  if ( FPU_div(DEST_RM, FPU_rm, control_word) >= 0 )
+    FPU_pop();
 }
 
 
@@ -173,7 +169,6 @@
 {
   /* fdivp st(i),st */
   clear_C1();
-  if ( !reg_div(&st(FPU_rm), &st(0), &st(FPU_rm), control_word) )
-    pop();
+  if ( FPU_div(REV|DEST_RM, FPU_rm, control_word) >= 0 )
+    FPU_pop();
 }
-

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov