From 11dc847696f9c5441c409ce5b7fdf77cf27746c5 Mon Sep 17 00:00:00 2001 From: Paul Khuong Date: Tue, 21 May 2013 23:43:03 -0400 Subject: [PATCH] Simplify (- (- x)) for rationals The transform is trivial enough to execute without a real pattern matching framework, but we're close to the limit. --- src/compiler/srctran.lisp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/compiler/srctran.lisp b/src/compiler/srctran.lisp index 0d22154..ff0a51c 100644 --- a/src/compiler/srctran.lisp +++ b/src/compiler/srctran.lisp @@ -3344,6 +3344,11 @@ "convert (* x 0) to 0" 0) +(deftransform %negate ((x) (rational)) + "Eliminate %negate/%negate of rationals" + (splice-fun-args x '%negate 1) + '(the rational x)) + ;;; Return T if in an arithmetic op including lvars X and Y, the ;;; result type is not affected by the type of X. That is, Y is at ;;; least as contagious as X. -- 1.7.10.4