Author: leo
Date: Sat Feb 18 14:26:45 2006
New Revision: 11653
Modified:
trunk/src/jit/i386/core.jit
trunk/src/jit/i386/jit_emit.h
Log:
JIT/x86 use 8087 ops for sin/cos/sqrt
Modified: trunk/src/jit/i386/core.jit
==============================================================================
--- trunk/src/jit/i386/core.jit (original)
+++ trunk/src/jit/i386/core.jit Sat Feb 18 14:26:45 2006
@@ -845,6 +845,18 @@ Parrot_neg_n {
unary_x s/<_N>/_n/ s/INT/NUM/ s/<op>/neg/
}
+Parrot_sin {
+ unary_x s/<_N>/_n/ s/INT/NUM/ s/<op>/sin/
+}
+
+Parrot_cos_n {
+ unary_x s/<_N>/_n/ s/INT/NUM/ s/<op>/cos/
+}
+
+Parrot_sqrt_n {
+ unary_x s/<_N>/_n/ s/INT/NUM/ s/<op>/sqrt/
+}
+
Parrot_bnot_i {
unary_x s/<_N>/_i/ s/<op>/not/
}
Modified: trunk/src/jit/i386/jit_emit.h
==============================================================================
--- trunk/src/jit/i386/jit_emit.h (original)
+++ trunk/src/jit/i386/jit_emit.h Sat Feb 18 14:26:45 2006
@@ -1052,6 +1052,9 @@ opt_shift_rm(Parrot_jit_info_t *jit_info
/* 0xD9 ops */
# define emitm_fldz(pc) { *((pc)++) = (char) 0xd9; *((pc)++) = (char) 0xee; }
# define emitm_fld1(pc) { *((pc)++) = (char) 0xd9; *((pc)++) = (char) 0xe8; }
+# define emitm_fsqrt(pc) { *((pc)++) = (char) 0xd9; *((pc)++) = (char) 0xfa; }
+# define emitm_fsin(pc) { *((pc)++) = (char) 0xd9; *((pc)++) = (char) 0xfe; }
+# define emitm_fcos(pc) { *((pc)++) = (char) 0xd9; *((pc)++) = (char) 0xff; }
/* FXCH ST,ST(i) , optimize 2 consecutive fxch with same reg */
# define emitm_fxch(pc, sti) { \
@@ -1251,6 +1254,32 @@ static unsigned char *lastpc;
}
# endif
+# define jit_emit_sin_n(pc, r) \
+ if (r) { \
+ emitm_fld(pc, r); \
+ } \
+ emitm_fsqrt(pc); \
+ if (r) { \
+ emitm_fstp(pc, (r+1)); \
+ }
+
+# define jit_emit_cos_n(pc, r) \
+ if (r) { \
+ emitm_fld(pc, r); \
+ } \
+ emitm_fcos(pc); \
+ if (r) { \
+ emitm_fstp(pc, (r+1)); \
+ }
+
+# define jit_emit_sqrt_n(pc, r) \
+ if (r) { \
+ emitm_fld(pc, r); \
+ } \
+ emitm_fsqrt(pc); \
+ if (r) { \
+ emitm_fstp(pc, (r+1)); \
+ }
# define jit_emit_abs_r_n(pc, r) { \
if (r) { \