aboutsummaryrefslogtreecommitdiff
path: root/src/interp/g-opt.boot
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2012-04-30 12:57:58 +0000
committerdos-reis <gdr@axiomatics.org>2012-04-30 12:57:58 +0000
commit52d8ccbf25a71457f923860824696742328bdb35 (patch)
treedbfbf21d1ef7c887013a6171e12074663bf95abe /src/interp/g-opt.boot
parentef0788534700412ae77cd7ce4377f57599b11f01 (diff)
downloadopen-axiom-52d8ccbf25a71457f923860824696742328bdb35.tar.gz
* algebra/si.spad.pamphlet (SingleInteger): Use %iaddmod,
%isubmod, and %imulmod. * interp/g-opt.boot: These are now builtin side-effect operators. (optIaddmod): New optimizer. Register. (optIsubmod): Likewise. (optImulmod): Likewise. * interp/sys-macros.lisp (QSADDMOD): Remove. (QSDIFMOD): Likewise. (QSMULMOD): Likewise.
Diffstat (limited to 'src/interp/g-opt.boot')
-rw-r--r--src/interp/g-opt.boot14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot
index ecf4b08c..fedbc988 100644
--- a/src/interp/g-opt.boot
+++ b/src/interp/g-opt.boot
@@ -639,7 +639,7 @@ $VMsideEffectFreeOperators ==
%beq %blt %ble %bgt %bge %bitand %bitior %bitxor %bitnot %bcompl
%ilength %ibit %icst0 %icst1 %icstmin %icstmax
%imul %iadd %isub %igcd %ilcm %ipow %imin %imax %ieven? %iodd? %iinc
- %idec %irem %iquo %idivide %idec %irandom
+ %idec %irem %iquo %idivide %idec %irandom %imulmod %iaddmod %isubmod
%feq %flt %fle %fgt %fge %fmul %fadd %fsub %fexp %fmin %fmax %float?
%fpowi %fdiv %fneg %i2f %fminval %fmaxval %fbase %fprec %ftrunc
%fsqrt %fpowf %flog %flog2 %flog10 %fmanexp %fNaN? %fdecode
@@ -917,6 +917,9 @@ optIadd(x is ['%iadd,a,b]) ==
x
x
+optIaddmod ['%iaddmod,a,b,c] ==
+ optIrem ['%irem,optIadd ['%iadd,a,b],c]
+
optIinc(x is ['%iinc,a]) ==
integer? a => a + 1
a is [op,b,c] and op in '(%isub %iadd) =>
@@ -951,6 +954,9 @@ optIsub(x is ['%isub,a,b]) ==
x
x
+optIsubmod ['%isubmod,a,b,c] ==
+ optIrem ['%irem,optIsub ['%isub,a,b],c]
+
optIdec(x is ['%idec,a]) ==
integer? a => a - 1
a is ['%iadd,b,c] =>
@@ -969,6 +975,9 @@ optImul(x is ['%imul,a,b]) ==
integer? b and b = 1 => a
x
+optImulmod(x is ['%imulmod,a,b,c]) ==
+ optIrem ['%irem,optImul ['%imul,a,b],c]
+
optIneg(x is ['%ineg,a]) ==
integer? a => -a
x
@@ -1001,11 +1010,14 @@ for x in '((%call optCall) _
(%ige optIge)_
(%ineg optIneg)_
(%iadd optIadd)_
+ (%iaddmod optIaddmod)_
(%iinc optIinc)_
(%isub optIsub)_
+ (%isubmod optIsubmod)_
(%irem optIrem)_
(%iquo optIquo)_
(%imul optImul)_
+ (%imulmod optImulmod)_
(%2bit opt2bit)_
(%2bool opt2bool)_
(%list optList)_