Index: build_tools/jit2h.pl
===================================================================
RCS file: /cvs/public/parrot/build_tools/jit2h.pl,v
retrieving revision 1.54
diff -u -r1.54 jit2h.pl
--- build_tools/jit2h.pl	30 Oct 2003 09:08:03 -0000	1.54
+++ build_tools/jit2h.pl	12 Jan 2004 09:35:54 -0000
@@ -117,13 +117,6 @@
             }
         }
         if ($line =~ m/^}/) { #{
-            # end of template definition?
-            if (defined($template)) {
-                $templates{$template} = $asm;
-                $template = undef;
-                next;
-            }
-            # no, end of function
             # 1. check templates
             while (my($t, $body) = each(%templates)) {
                 if ($asm =~ /$t\s+/) {
@@ -140,6 +133,14 @@
                     last;
                 }
             }
+
+            # end of template definition?
+            if (defined($template)) {
+                $templates{$template} = $asm;
+                $template = undef;
+                next;
+            }
+            # no, end of function
 
             # then do other substitutions
             $asm =~ s/([\&\*])([a-zA-Z_]+)\[(\d+)\]/make_subs($1,$2,$3)/ge;
Index: jit/ppc/core.jit
===================================================================
RCS file: /cvs/public/parrot/jit/ppc/core.jit,v
retrieving revision 1.15
diff -u -r1.15 core.jit
--- jit/ppc/core.jit	6 Jan 2004 16:57:25 -0000	1.15
+++ jit/ppc/core.jit	12 Jan 2004 09:35:56 -0000
@@ -13,6 +13,11 @@
     jit_emit_blr(NATIVECODE);
 }
 
+Parrot_noop {
+; preferred no-op on ppc
+    jit_emit_ori(NATIVECODE, r0, r0, 0);
+}
+
 Parrot_set_i_ic {
     if (MAP[1]) {
         jit_emit_mov_ri_i(NATIVECODE, MAP[1], *INT_CONST[2]);
@@ -484,6 +489,52 @@
         jit_emit_mov_rm_n(NATIVECODE, FSR1, &NUM_REG[2]);
         jit_emit_fneg_rrr(NATIVECODE, FSR1, FSR1);
         jit_emit_mov_mr_n(NATIVECODE, &NUM_REG[1], FSR1);
+    }
+}
+
+TEMPLATE Parrot_unaryop_x {
+    if (MAP[1]) {
+        jit_emit_<op>(NATIVECODE, MAP[1], MAP[1]);
+    }
+    else {
+        jit_emit_mov_rm<_N>(NATIVECODE, SCRATCH1, &SOME_REG[1]);
+        jit_emit_<op>(NATIVECODE, SCRATCH1, SCRATCH1);
+        jit_emit_mov_mr<_N>(NATIVECODE, &SOME_REG[1], SCRATCH1);
+    }
+}
+
+TEMPLATE Parrot_unaryop_i {
+    Parrot_unaryop_x s/<_N>/_i/ s/SOME_R/INT_R/ s/SCRATCH1/ISR1/
+}
+
+TEMPLATE Parrot_unaryop_n {
+    Parrot_unaryop_x s/<_N>/_n/ s/SOME_R/NUM_R/ s/SCRATCH1/FSR1/
+}
+
+Parrot_neg_i {
+    Parrot_unaryop_i s/<op>/neg_rr/
+}
+
+Parrot_neg_n {
+    Parrot_unaryop_n s/<op>/fneg_rrr/
+}
+
+Parrot_abs_n {
+    Parrot_unaryop_n s/<op>/fabs_rrr/
+}
+
+Parrot_abs_i {
+    if (MAP[1]) {
+        jit_emit_srawi(NATIVECODE, ISR1, MAP[1], 31);
+        jit_emit_add_rrr(NATIVECODE, ISR2, ISR1, MAP[1]);
+        jit_emit_xor_rrr(NATIVECODE, MAP[1], ISR2, ISR1);
+    }
+    else {
+        jit_emit_mov_rm_i(NATIVECODE, ISR1, &INT_REG[1]);
+        jit_emit_srawi(NATIVECODE, ISR2, ISR1, 31);
+        jit_emit_add_rrr(NATIVECODE, ISR1, ISR2, ISR1);
+        jit_emit_xor_rrr(NATIVECODE, ISR1, ISR1, ISR2);
+        jit_emit_mov_mr_i(NATIVECODE, &INT_REG[1], ISR1);
     }
 }
 
Index: jit/ppc/jit_emit.h
===================================================================
RCS file: /cvs/public/parrot/jit/ppc/jit_emit.h,v
retrieving revision 1.33
diff -u -r1.33 jit_emit.h
--- jit/ppc/jit_emit.h	6 Jan 2004 17:13:28 -0000	1.33
+++ jit/ppc/jit_emit.h	12 Jan 2004 09:35:56 -0000
@@ -284,6 +284,9 @@
 #  define jit_emit_xor_rrr(pc, D, A, B) \
     jit_emit_3reg_x(pc, 31, A, D, B, 316, 0)
 
+#  define jit_emit_srawi(pc, D, A, immediate) \
+    jit_emit_3reg_x(pc, 31, A, D, immediate, 824, 0)
+
 /* 2 register and immediate operation.
  *
  *  +--------------------------------------------------------------------+
