From 47b7b2d32188ff5786cf90c8eb43359ccf0f90fe Mon Sep 17 00:00:00 2001 From: florian Date: Wed, 15 Sep 1999 20:24:11 +0000 Subject: [PATCH] * some math functions are now coded inline by the compiler --- rtl/i386/math.inc | 74 +++++++++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 31 deletions(-) diff --git a/rtl/i386/math.inc b/rtl/i386/math.inc index 0afc1e5a4c..de53aaf816 100644 --- a/rtl/i386/math.inc +++ b/rtl/i386/math.inc @@ -19,6 +19,16 @@ EXTENDED data type routines ****************************************************************************} +{$ifdef hasinternmath} + function pi : extended;[internproc:in_pi]; + function abs(d : extended) : extended;[internproc:in_abs_extended]; + function sqr(d : extended) : extended;[internproc:in_sqr_extended]; + function sqrt(d : extended) : extended;[internproc:in_sqrt_extended]; + function arctan(d : extended) : extended;[internproc:in_arctan_extended]; + function ln(d : extended) : extended;[internproc:in_ln_extended]; + function sin(d : extended) : extended;[internproc:in_sin_extended]; + function cos(d : extended) : extended;[internproc:in_cos_extended]; +{$else hasinternmath} function pi : extended;assembler;[internconst:in_const_pi]; asm fldpi @@ -54,7 +64,6 @@ fpatan end []; - function cos(d : extended) : extended;assembler;[internconst:in_const_cos]; asm fldt d @@ -74,6 +83,35 @@ .LCOS1: end ['EAX']; + function ln(d : extended) : extended;assembler;[internconst:in_const_ln]; + asm + fldln2 + fldt d + fyl2x + end []; + + + function sin(d : extended) : extended;assembler;[internconst:in_const_sin]; + asm + fldt d + fsin + fstsw + sahf + jnp .LSIN1 + fstp %st(0) + fldt .LSIN0 + jmp .LSIN1 + .data + .LSIN0: + .long 0xffffffff + .long 0xffffffff + .long 0xffffffff + .text + .LSIN1: + end ['EAX']; + + +{$endif hasinternmath} function exp(d : extended) : extended;assembler;[internconst:in_const_exp]; asm @@ -83,7 +121,6 @@ fmulp fstcw .LCW1 fstcw .LCW2 - fwait andw $0xf3ff,.LCW2 orw $0x0400,.LCW2 fldcw .LCW2 @@ -178,34 +215,6 @@ end ['EAX','ECX']; - function ln(d : extended) : extended;assembler;[internconst:in_const_ln]; - asm - fldln2 - fldt d - fyl2x - end []; - - - function sin(d : extended) : extended;assembler;[internconst:in_const_sin]; - asm - fldt d - fsin - fstsw - sahf - jnp .LSIN1 - fstp %st(0) - fldt .LSIN0 - jmp .LSIN1 - .data - .LSIN0: - .long 0xffffffff - .long 0xffffffff - .long 0xffffffff - .text - .LSIN1: - end ['EAX']; - - function power(bas,expo : extended) : extended; begin power:=exp(ln(bas)*expo); @@ -341,7 +350,10 @@ { $Log$ - Revision 1.15 1999-07-06 15:35:59 peter + Revision 1.16 1999-09-15 20:24:11 florian + * some math functions are now coded inline by the compiler + + Revision 1.15 1999/07/06 15:35:59 peter * removed temp defines Revision 1.14 1999/03/01 15:40:57 peter