aboutsummaryrefslogtreecommitdiff
path: root/src/interp/g-opt.boot
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2010-07-22 21:44:34 +0000
committerdos-reis <gdr@axiomatics.org>2010-07-22 21:44:34 +0000
commit024f4b2055594e528ec98e733bd50684b2366db0 (patch)
treecf3da9fdf92fe71c354e720428fa4f4c43bb98b1 /src/interp/g-opt.boot
parent510c2f70ce377d60eed221e46294767f7f548f5d (diff)
downloadopen-axiom-024f4b2055594e528ec98e733bd50684b2366db0.tar.gz
* interp/g-util.boot (expandIeq): New expander for %ieq.
* interp/g-opt.boot (optIeq): New. (optIadd): Likewise. (optIsub): Likewise. (optImul): Likewise. (optIneg): Likewise. (lispize): Remove.
Diffstat (limited to 'src/interp/g-opt.boot')
-rw-r--r--src/interp/g-opt.boot33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot
index b29d9034..1c8964f6 100644
--- a/src/interp/g-opt.boot
+++ b/src/interp/g-opt.boot
@@ -694,6 +694,12 @@ optOr(x is ['%or,a,b]) ==
a = '%true => '%true
x
+optIeq(x is ['%ieq,a,b]) ==
+ integer? a and integer? b =>
+ a = b => '%true
+ '%false
+ x
+
optIlt(x is ['%ilt,a,b]) ==
integer? a and integer? b =>
a < b => '%true
@@ -709,11 +715,27 @@ optIgt x ==
optIge x ==
optNot ['%not,optIlt ['%ilt,second x,third x]]
---%
+--% Integer operations
-lispize x == simplifyVMForm x
-
+optIadd(x is ['%iadd,a,b]) ==
+ integer? a and integer? b => a + b
+ x
+
+optIsub(x is ['%isub,a,b]) ==
+ integer? a and integer? b => a - b
+ x
+
+optImul(x is ['%imul,a,b]) ==
+ integer? a and integer? b => a * b
+ x
+
+optIneg(x is ['%ineg,a]) ==
+ integer? a => -a
+ x
+
+--%
--% optimizer hash table
+--%
for x in '( (%call optCall) _
(SEQ optSEQ)_
@@ -723,10 +745,15 @@ for x in '( (%call optCall) _
(%not optNot)_
(%and optAnd)_
(%or optOr)_
+ (%ieq optIeq)_
(%ilt optIlt)_
(%ile optIle)_
(%igt optIgt)_
(%ige optIge)_
+ (%ineg optIneg)_
+ (%iadd optIadd)_
+ (%isub optIsub)_
+ (%imul optImul)_
(LIST optLIST)_
(MINUS optMINUS)_
(QSMINUS optQSMINUS)_