Changeset 14893


Ignore:
Timestamp:
Jul 20, 2011, 6:04:36 PM (8 years ago)
Author:
gb
Message:

ACODE-CONSTANT-P returns (values constant-value constant-p), not
what ACODE-CONSTANT-FOLD-BINOP expects. (There was some other
function that did it the other way, but there was a bootstrapping
issue calling that function from old images.)

In ACODE-OPTIMIZE-MUL2, we need to check a constant's sign as well as
use LOGCOUNT to recognize positive powers of two (so that (* 2N x)
can be simplified to (ASH X N)).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/compiler/nx2.lisp

    r14890 r14893  
    300300
    301301(defun acode-constant-fold-binop (seg vreg xfer x y function)
    302   (multiple-value-bind (x-p const-x) (acode-constant-p x)
     302  (multiple-value-bind (const-x x-p) (acode-constant-p x)
    303303    (when x-p
    304       (multiple-value-bind (y-p const-y) (acode-constant-p y)
     304      (multiple-value-bind (const-y y-p) (acode-constant-p y)
    305305        (when y-p
    306306          (let* ((result (ignore-errors (funcall function const-x const-y))))
     
    624624                 t)
    625625                ((and (eql (logcount f1) 1)
     626                      (> f1 0)
    626627                      (acode-form-typep num2 *nx-target-fixnum-type* trust-decls))
    627628                 (backend-use-operator (%nx1-operator ash)
     
    639640                 (backend-apply-acode num1 seg vreg xfer)
    640641                 t)
    641                 ((and (eql (logcount f2) 1) (acode-form-typep num1 *nx-target-fixnum-type* trust-decls))
     642                ((and (eql (logcount f2) 1)
     643                      (> f2 0)
     644                      (acode-form-typep num1 *nx-target-fixnum-type* trust-decls))
    642645                 (backend-use-operator (%nx1-operator ash)
    643646                                       seg
Note: See TracChangeset for help on using the changeset viewer.