aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog5
-rw-r--r--src/interp/g-opt.boot11
2 files changed, 16 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 564676c1..981e07de 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
2010-07-27 Gabriel Dos Reis <gdr@cs.tamu.edu>
+ * interp/g-opt.boot: Transform %iquo and %irem expressions.
+ ($VMsideEffectFreeOperators): Include %irem and %iquo.
+
+2010-07-27 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
* boot/tokens.boot: quo and rem are now keywords and infix operators.
* boot/parser.boot (bpEuclid): New. Parse integer quotient and
remainder expressions.
diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot
index ca4dd8a4..af4eb981 100644
--- a/src/interp/g-opt.boot
+++ b/src/interp/g-opt.boot
@@ -443,6 +443,7 @@ $VMsideEffectFreeOperators ==
%beq %blt %ble %bgt %bge %bitand %bitior %bitnot %bcompl
%icst0 %icst1
%imul %iadd %isub %igcd %ilcm %ipow %imin %imax %ieven? %iodd? %iinc
+ %irem %iquo
%feq %flt %fle %fgt %fge %fmul %fadd %fsub %fexp %fmin %fmax %float?
%fpow %fdiv %fneg %i2f %fminval %fmaxval %fbase %fprec %ftrunc
%nil %pair? %lconcat %llength %lfirst %lsecond %lthird
@@ -732,6 +733,14 @@ optIneg(x is ['%ineg,a]) ==
integer? a => -a
x
+optIrem(x is ['%irem,a,b]) ==
+ integer? a and integer? b => a rem b
+ x
+
+optIquo(x is ['%iquo,a,b]) ==
+ integer? a and integer? b => a quo b
+ x
+
--%
--% optimizer hash table
--%
@@ -755,6 +764,8 @@ for x in '( (%call optCall) _
(%ineg optIneg)_
(%iadd optIadd)_
(%isub optIsub)_
+ (%irem optIrem)_
+ (%iquo optIquo)_
(%imul optImul)_
(LIST optLIST)_
(QSMINUS optQSMINUS)_