Changeset 14778


Ignore:
Timestamp:
May 2, 2011, 8:14:22 PM (14 years ago)
Author:
Gary Byers
Message:

Constant-fold in ACODE-OPTIMIZE-MINUS1; call it in the ARM backend.

Location:
trunk/source/compiler
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/compiler/ARM/arm2.lisp

    r14763 r14778  
    61586158
    61596159(defarm2 arm2-minus1 minus1 (seg vreg xfer form)
    6160   (arm2-unary-builtin seg vreg xfer '%negate form))
     6160  (or (acode-optimize-minus1 seg vreg xfer form *arm2-trust-declarations*)
     6161      (arm2-unary-builtin seg vreg xfer '%negate form)))
    61616162
    61626163(defarm2 arm2-%double-float-negate %double-float-negate (seg vreg xfer form)
  • trunk/source/compiler/nx2.lisp

    r14775 r14778  
    739739(defun acode-optimize-minus1 (seg vreg xfer form trust-decls &optional (result-type 'number))
    740740  (declare (ignorable result-type))
    741   (cond ((acode-form-typep form 'double-float trust-decls)
    742          (backend-use-operator (%nx1-operator %double-float-negate) seg vreg xfer form)
    743          t)
    744         ((acode-form-typep form 'single-float trust-decls)
    745          (backend-use-operator (%nx1-operator %single-float-negate) seg vreg xfer form)
    746          t)
    747         ((acode-form-typep form *nx-target-fixnum-type* trust-decls)
    748          (backend-use-operator (%nx1-operator %ineg) seg vreg xfer form)
    749          t)))
     741  (multiple-value-bind (val constp) (acode-constant-p form)
     742    (cond ((and (and constp (ignore-errors (setq val (- val)))))
     743           (backend-use-operator (if (typep val *nx-target-fixnum-type*)
     744                                   (%nx1-operator fixnum)
     745                                   (%nx1-operator immediate))
     746                                 seg vreg xfer val)
     747           t)
     748          ((acode-form-typep form 'double-float trust-decls)
     749           (backend-use-operator (%nx1-operator %double-float-negate) seg vreg xfer form)
     750           t)
     751          ((acode-form-typep form 'single-float trust-decls)
     752           (backend-use-operator (%nx1-operator %single-float-negate) seg vreg xfer form)
     753           t)
     754          ((acode-form-typep form *nx-target-fixnum-type* trust-decls)
     755           (backend-use-operator (%nx1-operator %ineg) seg vreg xfer form)
     756           t))))
    750757
    751758               
Note: See TracChangeset for help on using the changeset viewer.