aboutsummaryrefslogtreecommitdiff
path: root/src/interp
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2010-07-25 04:37:08 +0000
committerdos-reis <gdr@axiomatics.org>2010-07-25 04:37:08 +0000
commit32593f2cb2bd9c344b83edec738f81eee3128d34 (patch)
tree126f3fa36e8f127d16fce172fa1c01bfc3d38c63 /src/interp
parent0df43e77732de95d97212f042ed922d2f7314bab (diff)
downloadopen-axiom-32593f2cb2bd9c344b83edec738f81eee3128d34.tar.gz
* interp/g-opt.boot (optIadd): More simplification if either
operand is zero. (optIsub): Likewise. (optImul): More simplifications if either operand is one.
Diffstat (limited to 'src/interp')
-rw-r--r--src/interp/g-opt.boot6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot
index 8224b450..47f3ca2d 100644
--- a/src/interp/g-opt.boot
+++ b/src/interp/g-opt.boot
@@ -714,14 +714,20 @@ optBge ['%bge,a,b] ==
optIadd(x is ['%iadd,a,b]) ==
integer? a and integer? b => a + b
+ integer? a and a = 0 => b
+ integer? b and b = 0 => a
x
optIsub(x is ['%isub,a,b]) ==
integer? a and integer? b => a - b
+ integer? a and a = 0 => ['%ineg,b]
+ integer? b and b = 0 => a
x
optImul(x is ['%imul,a,b]) ==
integer? a and integer? b => a * b
+ integer? a and a = 1 => b
+ integer? b and b = 1 => a
x
optIneg(x is ['%ineg,a]) ==