Changeset 14758


Ignore:
Timestamp:
Apr 29, 2011, 2:57:56 PM (14 years ago)
Author:
Gary Byers
Message:

In ACODE-OPTIMIZE-SUB2, turn subtraction from 0 into negation.

File:
1 edited

Legend:

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

    r14738 r14758  
    581581                 (acode-form-typep num2 'double-float trust-decls))
    582582          (progn
    583             (backend-use-operator (%nx1-operator %double-float--2)
     583            (if (eql (acode-constant-p num1) 0.0d0)
     584              (backend-use-operator (%nx1-operator %double-float-negate) seg vreg xfer num2)
     585              (backend-use-operator (%nx1-operator %double-float--2)
    584586                                  seg
    585587                                  vreg
    586588                                  xfer
    587589                                  num1
    588                                   num2)
     590                                  num2))
    589591            t)
    590592          (if (and (acode-form-typep num1 'single-float trust-decls)
    591593                   (acode-form-typep num2 'single-float trust-decls))
    592594            (progn
    593               (backend-use-operator (%nx1-operator %short-float--2)
    594                                     seg
    595                                     vreg
    596                                     xfer
    597                                     num1
    598                                     num2)
     595              (if (eql (acode-constant-p num1) 0.0s0)
     596                (backend-use-operator (%nx1-operator %single-float-negate) seg vreg xfer num2)
     597                (backend-use-operator (%nx1-operator %short-float--2)
     598                                      seg
     599                                      vreg
     600                                      xfer
     601                                      num1
     602                                      num2))
    599603              t)
    600604            (if (and (acode-form-typep num1 *nx-target-fixnum-type* trust-decls)
    601605                     (acode-form-typep num2 *nx-target-fixnum-type* trust-decls))
    602606              (progn
    603                 (backend-use-operator (%nx1-operator %i-)
    604                                       seg
    605                                       vreg
    606                                       xfer
    607                                       num1
    608                                       num2
    609                                       t)
     607                (if (eql (acode-constant-p num1) 0)
     608                  (backend-use-operator (%nx1-operator %ineg) seg vreg xfer num2)
     609                  (backend-use-operator (%nx1-operator %i-)
     610                                        seg
     611                                        vreg
     612                                        xfer
     613                                        num1
     614                                        num2
     615                                        t))
    610616                t)))))))
    611617       
Note: See TracChangeset for help on using the changeset viewer.