Index: tools/dev/gen_arithmetics_pmc.pl
===================================================================
--- tools/dev/gen_arithmetics_pmc.pl	(revision 0)
+++ tools/dev/gen_arithmetics_pmc.pl	(revision 0)
@@ -0,0 +1,68 @@
+#!/usr/bin/env perl
+
+# Perl code used to generate t/op/arithmetics_pmc.t
+
+# We should generate more tests for all possible combinations
+# Map vtable method to op
+my %methods = qw{
+    add             add
+    subtract        sub
+    multiply        mul
+    divide          div
+
+    floor_divide    fdiv
+    modulus         mod
+    pow             pow
+
+    bitwise_or      bor
+    bitwise_and     band
+    bitwise_xor     bxor
+
+    bitwise_shr     shr
+    bitwise_shl     shl
+    bitwise_lsr     lsr
+
+    concatenate     concat
+
+    logical_or      or
+    logical_and     and
+    logical_xor     xor
+};
+
+# foreach my $pmc (@pmcs) {
+while(my($vtable, $op) = each(%methods)) {
+
+print <<"END";
+.sub test_$vtable
+    .param pmc type
+
+    \$P0 = new type
+    \$P0 = 40
+    \$P1 = new type
+    \$P1 = 2
+    \$P2 = new type
+    \$P2 = 115200
+
+    \$P99 = \$P2
+
+    \$S0 = "original dest is untouched in $vtable for "
+    \$S1 = type
+    concat \$S0, \$S1
+
+    # ignore exceptions
+    push_eh done
+    $op \$P2, \$P0, \$P1
+
+    \$I0 = cmp \$P99, 115200
+    
+    is( \$I0, 0, \$S0 )
+    goto end
+
+  done:
+    ok(1, 'ignoring exceptions')
+  end:
+.end
+
+END
+
+}
