aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog7
-rw-r--r--src/algebra/strap/SYMBOL.lsp2
-rw-r--r--src/interp/g-opt.boot6
3 files changed, 14 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 7c5e2ac4..17b9cf46 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,12 @@
2010-07-24 Gabriel Dos Reis <gdr@cs.tamu.edu>
+ * interp/g-opt.boot (optIadd): More simplification if either
+ operand is zero.
+ (optIsub): Likewise.
+ (optImul): More simplifications if either operand is one.
+
+2010-07-24 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
* interp/c-util.boot (usedSymbol?): Move to g-util.boot.
* interp/nruncomp.boot (NRTsetVector4a): Tidy.
diff --git a/src/algebra/strap/SYMBOL.lsp b/src/algebra/strap/SYMBOL.lsp
index c2af9d6f..b1cb0a30 100644
--- a/src/algebra/strap/SYMBOL.lsp
+++ b/src/algebra/strap/SYMBOL.lsp
@@ -610,7 +610,7 @@
(DEFUN |SYMBOL;istring| (|n| $)
(COND
((< 9 |n|) (|error| "Can have at most 9 scripts of each kind"))
- (T (|getSimpleArrayEntry| (|getShellEntry| $ 18) (+ |n| 0)))))
+ (T (|getSimpleArrayEntry| (|getShellEntry| $ 18) |n|))))
(DEFUN |SYMBOL;list;$L;34| (|sy| $)
(COND
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]) ==