cvsuser 03/12/07 03:17:09
Modified: ops cmp.ops ops.num
Log:
added missing branch and compare opcodes
Revision Changes Path
1.3 +37 -0 parrot/ops/cmp.ops
Index: cmp.ops
===================================================================
RCS file: /cvs/public/parrot/ops/cmp.ops,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -r1.2 -r1.3
--- cmp.ops 23 Oct 2003 17:41:55 -0000 1.2
+++ cmp.ops 7 Dec 2003 11:17:09 -0000 1.3
@@ -90,6 +90,8 @@
=item B<ne>(in PMC, in PMC, inconst INT)
+=item B<ne>(in PMC, in INT, inconst INT)
+
Branch if $1 is not equal to $2.
=cut
@@ -122,6 +124,13 @@
goto NEXT();
}
+op ne (in PMC, in INT, inconst INT) {
+ if ($1->vtable->get_integer(interpreter, $1) != $2) {
+ goto OFFSET($3);
+ }
+ goto NEXT();
+}
+
########################################
=item B<lt>(in INT, in INT, inconst INT)
@@ -234,6 +243,8 @@
=item B<gt>(in PMC, in PMC, inconst INT)
+=item B<gt>(in PMC, in INT, inconst INT)
+
Branch if $1 is greater than $2.
=cut
@@ -266,6 +277,13 @@
goto NEXT();
}
+op gt(in PMC, in INT, inconst INT) {
+ if ($1->vtable->get_integer(interpreter, $1) > $2) {
+ goto OFFSET($3);
+ }
+ goto NEXT();
+}
+
########################################
=item B<ge>(in INT, in INT, inconst INT)
@@ -276,6 +294,8 @@
=item B<ge>(in PMC, in PMC, inconst INT)
+=item B<ge>(in PMC, in INT, inconst INT)
+
Branch if $1 is greater than or equal to $2.
=cut
@@ -308,6 +328,13 @@
goto NEXT();
}
+op ge(in PMC, in INT, inconst INT) {
+ if ($1->vtable->get_integer(interpreter, $1) >= $2) {
+ goto OFFSET($3);
+ }
+ goto NEXT();
+}
+
=back
=cut
@@ -333,6 +360,8 @@
=item B<cmp>(out INT, in PMC, in PMC)
+=item B<cmp>(out INT, in PMC, in INT)
+
Sets $1 to -1 if $2 < $3, +1 if $2 > $3, and 0 otherwise.
=cut
@@ -358,6 +387,14 @@
inline op cmp(out INT, in PMC, in PMC) {
$1 = VTABLE_cmp(interpreter, $2, $3);
+ goto NEXT();
+}
+
+inline op cmp(out INT, in PMC, in INT) {
+ INTVAL l = VTABLE_get_integer(interpreter, $2);
+ $1 = l < $3 ? -1 :
+ l > $3 ? +1 :
+ 0;
goto NEXT();
}
1.14 +8 -0 parrot/ops/ops.num
Index: ops.num
===================================================================
RCS file: /cvs/public/parrot/ops/ops.num,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -w -r1.13 -r1.14
--- ops.num 5 Dec 2003 12:07:56 -0000 1.13
+++ ops.num 7 Dec 2003 11:17:09 -0000 1.14
@@ -1280,3 +1280,11 @@
thaw_p_sc 1253
addattrib_i_p_s 1254
addattrib_i_p_sc 1255
+ne_p_i_ic 1256
+ne_p_ic_ic 1257
+gt_p_i_ic 1258
+gt_p_ic_ic 1259
+ge_p_i_ic 1260
+ge_p_ic_ic 1261
+cmp_i_p_i 1262
+cmp_i_p_ic 1263