From 32593f2cb2bd9c344b83edec738f81eee3128d34 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Sun, 25 Jul 2010 04:37:08 +0000 Subject: * interp/g-opt.boot (optIadd): More simplification if either operand is zero. (optIsub): Likewise. (optImul): More simplifications if either operand is one. --- src/ChangeLog | 7 +++++++ src/algebra/strap/SYMBOL.lsp | 2 +- src/interp/g-opt.boot | 6 ++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 7c5e2ac4..17b9cf46 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2010-07-24 Gabriel Dos Reis + + * 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 * interp/c-util.boot (usedSymbol?): Move to g-util.boot. 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]) == -- cgit v1.2.3