From: Nikodemus Siivola Date: Sun, 21 Jun 2009 18:19:25 +0000 (+0000) Subject: 1.0.29.28: optimize (EXPT -1 INTEGER) X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=fa464c0810199b91ffdf7f3dfab932239210a044;p=sbcl.git 1.0.29.28: optimize (EXPT -1 INTEGER) * Patch by Stas Boukarev. --- diff --git a/NEWS b/NEWS index deb4eb7..f1845f7 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,8 @@ about object allocation. * optimization: more efficient type-checks for FIXNUMs when the value is known to be a signed word on x86 and x86-64. + * optimization: (EXPT -1 INTEGER) is compiled into (IF (EVENP INTEGER) 1 -1). + (thanks to Stas Boukarev) * improvement: failure to provide requested stack allocation compiler notes provided in all cases (requested stack allocation not happening without a note being issued is now considered a bug.) diff --git a/src/compiler/float-tran.lisp b/src/compiler/float-tran.lisp index 681aa48..dc2cadc 100644 --- a/src/compiler/float-tran.lisp +++ b/src/compiler/float-tran.lisp @@ -512,6 +512,8 @@ 'single-float)) (deftransform expt ((x y) ((double-float 0d0) (signed-byte 32)) *) `(%pow x (coerce y 'double-float))) +(deftransform expt ((x y) ((integer -1 -1) integer) *) + `(if (evenp y) 1 -1)) ;;; ANSI says log with base zero returns zero. (deftransform log ((x y) (float float) float) diff --git a/version.lisp-expr b/version.lisp-expr index 37d4dde..c27e3d6 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.29.27" +"1.0.29.28"