aboutsummaryrefslogtreecommitdiff
path: root/src/interp
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2010-07-26 06:54:30 +0000
committerdos-reis <gdr@axiomatics.org>2010-07-26 06:54:30 +0000
commit2676acdd33957fe60f54ff9ec73fac8b7a6ed705 (patch)
treee54fb299ccbd1a782c86e3c47ef4208731046d7e /src/interp
parent4d2e94d7512864a3ef79698daa1b2b90b694b790 (diff)
downloadopen-axiom-2676acdd33957fe60f54ff9ec73fac8b7a6ed705.tar.gz
* algebra/si.spad.pamphlet (SingleInteger): Tidy.
* interp/g-opt.boot (simplifyVMForm): Expand %icst0 and %icst1. (optIlt): Fold more configurations.
Diffstat (limited to 'src/interp')
-rw-r--r--src/interp/g-opt.boot8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot
index 85bee73c..2a2f5a60 100644
--- a/src/interp/g-opt.boot
+++ b/src/interp/g-opt.boot
@@ -147,6 +147,8 @@ resetTo(x,y) ==
++ Simplify the VM form `x'
simplifyVMForm x ==
+ x = '%icst0 => 0
+ x = '%icst1 => 1
isAtomicForm x => x
x.op = 'CLOSEDFN => x
atom x.op =>
@@ -440,6 +442,7 @@ $VMsideEffectFreeOperators ==
CGREATERP GGREATERP CHAR GET BVEC_-GREATER %false %true
%and %or %not %peq %ieq %ilt %ile %igt %ige %head %tail %integer?
%beq %blt %ble %bgt %bge %bitand %bitior %bitnot %bcompl
+ %icst0 %icst1
%imul %iadd %isub %igcd %ilcm %ipow %imin %imax %ieven? %iodd? %iinc
%feq %flt %fle %fgt %fge %fmul %fadd %fsub %fexp %fmin %fmax %float?
%fpow %fdiv %fneg %i2f %fminval %fmaxval %fbase %fprec %ftrunc
@@ -673,9 +676,14 @@ optIeq(x is ['%ieq,a,b]) ==
x
optIlt(x is ['%ilt,a,b]) ==
+ -- 1. Don't delay if both operands are literals.
integer? a and integer? b =>
a < b => '%true
'%false
+ -- 2. max(a,b) cannot be negative if either a or b is zero.
+ b = 0 and a is ['%imax,:.] and (second a = 0 or third a = 0) => '%false
+ -- 3. min(a,b) cannot be positive if either a or b is zero.
+ a = 0 and b is ['%imin,:.] and (second b = 0 or third b = 0) => '%false
x
optIle(x is ['%ile,a,b]) ==