cvsuser 04/10/04 05:07:12
Modified: jit/sun4 core.jit jit_emit.h
Log:
[perl #31726] [PATCH] non-branching compare opcodes - JIT
These two patches add jit support for is<compare> style ops (isgt, isge, isle,
islt, iseq, isne) on integers for the sun/sparc platform.
Courtesy of Stephane Peiry <[EMAIL PROTECTED]>
Revision Changes Path
1.8 +128 -3 parrot/jit/sun4/core.jit
Index: core.jit
===================================================================
RCS file: /cvs/public/parrot/jit/sun4/core.jit,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -w -r1.7 -r1.8
--- core.jit 25 Sep 2004 14:44:22 -0000 1.7
+++ core.jit 4 Oct 2004 12:07:12 -0000 1.8
@@ -1,7 +1,7 @@
;
; sun4/core.jit
;
-; $Id: core.jit,v 1.7 2004/09/25 14:44:22 leo Exp $
+; $Id: core.jit,v 1.8 2004/10/04 12:07:12 leo Exp $
;
Parrot_end {
@@ -701,6 +701,131 @@
Parrot_cmp_ix_ix_ic s/<a>/bge/
}
+TEMPLATE Parrot_iscmp_ix_ix_ix {
+ if(MAP[2] && MAP[3]){
+ emitm_subcc_r(NATIVECODE, MAP[2], MAP[3], emitm_g(0));
+ }
+ else if (MAP[2]) {
+ jit_emit_load_i(jit_info, interpreter, 3, ISR2);
+ emitm_subcc_r(NATIVECODE, MAP[2], ISR2, emitm_g(0));
+ }
+ else if (MAP[3]) {
+ jit_emit_load_i(jit_info, interpreter, 2, ISR1);
+ emitm_subcc_r(NATIVECODE, ISR1, MAP[3], emitm_g(0));
+ }
+ else {
+ jit_emit_load_i(jit_info, interpreter, 2, ISR1);
+ jit_emit_load_i(jit_info, interpreter, 3, ISR2);
+ emitm_subcc_r(NATIVECODE, ISR1, ISR2, emitm_g(0));
+ }
+
+ emitm_bicc(NATIVECODE, 1, emitm_<a>, 3);
+
+ if(MAP[1]){
+ emitm_mov_i(NATIVECODE, 1, MAP[1]);
+ emitm_or_r(NATIVECODE, emitm_g(0), emitm_g(0), MAP[1]);
+ } else {
+ jit_emit_store_i(jit_info, interpreter, 1, 1);
+ jit_emit_store_i(jit_info, interpreter, 1, 0);
+ }
+}
+
+Parrot_isgt_i_i_i {
+ Parrot_iscmp_ix_ix_ix s/<a>/bg/
+}
+
+Parrot_isgt_i_ic_i {
+ Parrot_iscmp_ix_ix_ix s/<a>/bg/
+}
+
+Parrot_isgt_i_i_ic {
+ Parrot_iscmp_ix_ix_ix s/<a>/bg/
+}
+
+Parrot_isgt_i_ic_ic {
+ Parrot_iscmp_ix_ix_ix s/<a>/bg/
+}
+
+Parrot_isge_i_i_i {
+ Parrot_iscmp_ix_ix_ix s/<a>/bge/
+}
+
+Parrot_isge_i_ic_i {
+ Parrot_iscmp_ix_ix_ix s/<a>/bge/
+}
+
+Parrot_isge_i_i_ic {
+ Parrot_iscmp_ix_ix_ix s/<a>/bge/
+}
+
+Parrot_isge_i_ic_ic {
+ Parrot_iscmp_ix_ix_ix s/<a>/bge/
+}
+
+Parrot_isle_i_i_i {
+ Parrot_iscmp_ix_ix_ix s/<a>/ble/
+}
+
+Parrot_isle_i_ic_i {
+ Parrot_iscmp_ix_ix_ix s/<a>/ble/
+}
+
+Parrot_isle_i_i_ic {
+ Parrot_iscmp_ix_ix_ix s/<a>/ble/
+}
+
+Parrot_isle_i_ic_ic {
+ Parrot_iscmp_ix_ix_ix s/<a>/ble/
+}
+
+Parrot_islt_i_i_i {
+ Parrot_iscmp_ix_ix_ix s/<a>/bl/
+}
+
+Parrot_islt_i_ic_i {
+ Parrot_iscmp_ix_ix_ix s/<a>/bl/
+}
+
+Parrot_islt_i_i_ic {
+ Parrot_iscmp_ix_ix_ix s/<a>/bl/
+}
+
+Parrot_islt_i_ic_ic {
+ Parrot_iscmp_ix_ix_ix s/<a>/bl/
+}
+
+Parrot_iseq_i_i_i {
+ Parrot_iscmp_ix_ix_ix s/<a>/be/
+}
+
+Parrot_iseq_i_ic_i {
+ Parrot_iscmp_ix_ix_ix s/<a>/be/
+}
+
+Parrot_iseq_i_i_ic {
+ Parrot_iscmp_ix_ix_ix s/<a>/be/
+}
+
+Parrot_iseq_i_ic_ic {
+ Parrot_iscmp_ix_ix_ix s/<a>/be/
+}
+
+Parrot_isne_i_i_i {
+ Parrot_iscmp_ix_ix_ix s/<a>/bne/
+}
+
+Parrot_isne_i_ic_i {
+ Parrot_iscmp_ix_ix_ix s/<a>/bne/
+}
+
+Parrot_isne_i_i_ic {
+ Parrot_iscmp_ix_ix_ix s/<a>/bne/
+}
+
+Parrot_isne_i_ic_ic {
+ Parrot_iscmp_ix_ix_ix s/<a>/bne/
+}
+
/*
* Local variables:
* c-indentation-style: bsd
1.29 +6 -5 parrot/jit/sun4/jit_emit.h
Index: jit_emit.h
===================================================================
RCS file: /cvs/public/parrot/jit/sun4/jit_emit.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -w -r1.28 -r1.29
--- jit_emit.h 25 Sep 2004 14:44:22 -0000 1.28
+++ jit_emit.h 4 Oct 2004 12:07:12 -0000 1.29
@@ -3,7 +3,7 @@
**
** SPARC
**
-** $Id: jit_emit.h,v 1.28 2004/09/25 14:44:22 leo Exp $
+** $Id: jit_emit.h,v 1.29 2004/10/04 12:07:12 leo Exp $
**/
#if !defined(PARROT_SUN4_JIT_EMIT_H_GUARD)
@@ -77,7 +77,7 @@
emitm_rs1(rs1) | (low14); \
pc +=4 ; }
-/* format 3b */
+/* format 3a */
#define emitm_3a(pc, op, rd, op3, rs1, asi, rs2) \
emitm_fmt3(pc, op, rd, op3, rs1, ((asi) << 5) | (rs2))
@@ -107,7 +107,8 @@
#define emitm_restore_i(pc, rs1, i, rd) emitm_3b(pc, 2, rd, 075, rs1, i)
/* MOV */
-#define emitm_mov(pc, rs, rd) emitm_or_r(pc, emitm_g(0), rs, rd)
+#define emitm_mov_r(pc, rs, rd) emitm_or_r(pc, emitm_g(0), rs, rd)
+#define emitm_mov_i(pc, i, rd) emitm_or_i(pc, emitm_g(0), i, rd)
/* Integer Register Loads */
@@ -283,7 +284,7 @@
/* Branch */
#define emitm_bicc(pc, a, cond, disp22) emitm_2b(pc, a, cond, 02, disp22)
-#define jit_emit_mov_rr_i(pc, dst, src) emitm_mov(pc, src, dst)
+#define jit_emit_mov_rr_i(pc, dst, src) emitm_mov_r(pc, src, dst)
#define jit_emit_mov_rr_n(pc, dst, src) { \
emitm_fmovs(pc, src, dst); \
emitm_fmovs(pc, (src)+1, (dst)+1); }
@@ -671,7 +672,7 @@
(void (*)(void))interpreter->op_func_table[*(jit_info->cur_op)];
emitm_call_30(jit_info->native_ptr, 0);
- emitm_mov(jit_info->native_ptr, Parrot_jit_intrp, emitm_o(1));
+ emitm_mov_r(jit_info->native_ptr, Parrot_jit_intrp, emitm_o(1));
}
void Parrot_jit_cpcf_op(Parrot_jit_info_t *jit_info,