Author: leo
Date: Sat Feb 18 18:36:12 2006
New Revision: 11661
Modified:
trunk/examples/shootout/partialsums-2.pir
trunk/src/jit/i386/core.jit
trunk/src/jit/i386/jit_emit.h
Log:
JIT/x86 - better codegen
* (micro)opt <op>_n_nc_n, if the constant is 1.0 for div,add,mul,sub
* speedup partialsums-2.pir
Modified: trunk/examples/shootout/partialsums-2.pir
==============================================================================
--- trunk/examples/shootout/partialsums-2.pir (original)
+++ trunk/examples/shootout/partialsums-2.pir Sat Feb 18 18:36:12 2006
@@ -65,9 +65,10 @@ beginfor:
$N1 = a / $N1
sum9 += $N1
lastfor:
- $N1 = k - 1
- $N1 = pow $N0, $N1
+ $I1 = k - 1
+ $N1 = pow $N0, $I1
sum1 += $N1
+ $I1 = k - 1
inc k
if k <= n goto beginfor
dec $I2
Modified: trunk/src/jit/i386/core.jit
==============================================================================
--- trunk/src/jit/i386/core.jit (original)
+++ trunk/src/jit/i386/core.jit Sat Feb 18 18:36:12 2006
@@ -594,6 +594,13 @@ TEMPLATE Parrot_binop_x_xc_x {
if (*CUR_OPCODE == PARROT_OP_add_i_ic_i) {
emitm_lea_m_r(NATIVECODE, MAP(1), MAP(3), 0, 1, CUR_OPCODE[2]);
}
+#ifdef emitm_f<op>
+ else if (*CUR_OPCODE == PARROT_OP_<op>_n_nc_n && *&NUM_CONST[2] ==
1.0) {
+ emitm_fld1(NATIVECODE);
+ emitm_f<op>(NATIVECODE, (MAP[3]+1));
+ emitm_fstp(NATIVECODE, (MAP[1]+1));
+ }
+#endif
else {
if (MAP[1] == MAP[3]) {
jit_emit_mov_ri<_N>(NATIVECODE, ISR1, <typ>_CONST[2]);
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 18:36:12 2006
@@ -1103,6 +1103,8 @@ static unsigned char *lastpc;
/* FMULP Mul ST(i) = ST * ST(i); POP */
# define emitm_fmulp(pc, sti) emitm_fl_3(pc, emit_b110, emit_b001, sti)
+/* FSUB ST = ST - ST(i) */
+
/* FSUBRP SubR ST(i) = ST - ST(i); POP */
# define emitm_fsubrp(pc, sti) emitm_fl_3(pc, emit_b110, emit_b100, sti)