This patch allows you to do thingies like:
and I1,I2,0xffff
'and', 'or', and 'xor' have been adapted to use this.
Also, shl and shr can take an integer register as the amount to shift.
Brian
? pasm.pl
? patch
? test2.pbc
? test3.pbc
? euclid0.pbc
? euclid1.pbc
? euclid.pbc
? const_bitops.diff
? bitops.pbc
? t/bitops.pasm
Index: basic_opcodes.ops
===================================================================
RCS file: /home/perlcvs/parrot/basic_opcodes.ops,v
retrieving revision 1.14
diff -u -r1.14 basic_opcodes.ops
--- basic_opcodes.ops 2001/09/13 16:16:38 1.14
+++ basic_opcodes.ops 2001/09/13 19:13:43
@@ -562,6 +562,12 @@
INT_REG(P1) = INT_REG(P2) & INT_REG(P3);
}
+/* AND_i_ic */
+AUTO_OP and_i_ic {
+ INT_REG(P1) = INT_REG(P2) & P3;
+}
+
+
/* NOT_i */
AUTO_OP not_i {
INT_REG(P1) = ! INT_REG(P2);
@@ -572,17 +578,37 @@
INT_REG(P1) = INT_REG(P2) | INT_REG(P3);
}
+/* OR_i_ic */
+AUTO_OP or_i_ic {
+ INT_REG(P1) = INT_REG(P2) | P3;
+}
+
/* SHL_i_ic */
AUTO_OP shl_i_ic {
INT_REG(P1) = INT_REG(P2) << P3;
}
+/* SHL_i */
+AUTO_OP shl_i {
+ INT_REG(P1) = INT_REG(P2) << INT_REG(P3);
+}
+
/* SHR_i_ic */
AUTO_OP shr_i_ic {
INT_REG(P1) = INT_REG(P2) >> P3;
}
+/* SHR_i */
+AUTO_OP shr_i {
+ INT_REG(P1) = INT_REG(P2) >> INT_REG(P3);
+}
+
/* XOR_i */
AUTO_OP xor_i {
INT_REG(P1) = INT_REG(P2) ^ INT_REG(P3);
+}
+
+/* XOR_i_ic */
+AUTO_OP xor_i_ic {
+ INT_REG(P1) = INT_REG(P2) ^ P3;
}
Index: opcode_table
===================================================================
RCS file: /home/perlcvs/parrot/opcode_table,v
retrieving revision 1.13
diff -u -r1.13 opcode_table
--- opcode_table 2001/09/13 16:16:38 1.13
+++ opcode_table 2001/09/13 19:13:44
@@ -152,9 +152,15 @@
# Bitwise Ops
and_i 3 I I I
+and_i_ic 3 I I i
not_i 2 I I
or_i 3 I I I
+or_i_ic 3 I I i
+shl_i 3 I I I
shl_i_ic 3 I I i
+shr_i 3 I I I
shr_i_ic 3 I I i
xor_i 3 I I I
+xor_i_ic 3 I I i
+