# New Ticket Created by  Stephane Peiry 
# Please include the string:  [perl #26201]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=26201 >



This patch implements the inc_i and dec_i ops (cf. math.ops),  for the Sun/Sparc
JIT core.  Mainly it follows the SPARC Architecture Manual "Mapping of Synthetic
Instructions" where:

  inc <reg>    maps to    add <reg>, 1, <reg>
  dec <reg>    maps to    sub <reg>, 1, <reg>

where 1 is an immediate value (hence emitm_add_i or emitm_sub_i).

Since the required add/sub instructions are already in jit/sun4/jit_emit.h,
only core.jit needs to be patched to have these jitted for the sun/sparc.
Thanks,
StÃphane

Index: jit/sun4/core.jit
===================================================================
RCS file: /cvs/public/parrot/jit/sun4/core.jit,v
retrieving revision 1.4
diff -u -r1.4 core.jit
--- jit/sun4/core.jit   8 Mar 2003 09:05:42 -0000       1.4
+++ jit/sun4/core.jit   8 Feb 2004 15:10:29 -0000
@@ -180,6 +180,32 @@
     Parrot_binop_x_x s/<op>/fdivd/ s/<_N>/_n/
 }
 
+TEMPLATE Parrot_incdec_i {
+    int arg1;
+
+    if(MAP[1]){
+        arg1 = MAP[1];
+    }
+    else {
+        arg1 = ISR1;
+        jit_emit_load_i(jit_info, interpreter, 1, arg1);
+    }
+
+    emitm_<op>_i(NATIVECODE, arg1, 1, arg1);
+
+    if(!MAP[1]){
+        jit_emit_store_i(jit_info, interpreter, 1, arg1);
+    }
+}
+                                                                                      
                     
+Parrot_inc_i {
+    Parrot_incdec_i s/<op>/add/
+}
+                                                                                      
                     
+Parrot_dec_i {
+    Parrot_incdec_i s/<op>/sub/
+}
+
 TEMPLATE Parrot_binop_i_xc {
     int arg1;
 

Reply via email to