Changeset 5191


Ignore:
Timestamp:
Sep 11, 2006, 7:08:53 PM (18 years ago)
Author:
Gary Byers
Message:

Partialy inline 2-arg logior/logand.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/compiler/PPC/ppc2.lisp

    r5181 r5191  
    55435543         (fix2 (acode-fixnum-form-p form2)))
    55445544    (if (and fix1 fix2)
    5545       (ppc2-use-operator (%nx1-operator fixnum) seg vreg xfer (logand fix1 fix2)))
    5546     (let* ((fixval (or fix1 fix2))
    5547            (fixlen (if fixval (integer-length fixval)))
    5548            (unboxed-fixval (if fixval (ash fixval *ppc2-target-fixnum-shift*)))
    5549            (high (if fixval (if (= unboxed-fixval (logand #xffff0000 unboxed-fixval)) (ash unboxed-fixval -16))))
    5550            (low (if fixval (unless high (if (= unboxed-fixval (logand #x0000ffff unboxed-fixval)) unboxed-fixval))))
    5551            (otherform (if (or high low) (if fix1 form2 form1))))
    5552       (if otherform
    5553         (let* ((other-reg (ppc2-one-untargeted-reg-form seg otherform ppc::arg_z)))
    5554           (when vreg
    5555             (ensuring-node-target (target vreg)
    5556               (if high
    5557                 (! logand-high target other-reg high)
    5558                 (! logand-low target other-reg low)))))
    5559         (if (and fixval (= fixlen (logcount fixval)))
    5560           (let* ((nbits (- *ppc2-target-bits-in-word*
    5561                            (1+ (+ *ppc2-target-fixnum-shift* fixlen))))
    5562                  (otherreg (ppc2-one-untargeted-reg-form seg (if fix1 form2 form1) ppc::arg_z)))
     5545      (ppc2-use-operator (%nx1-operator fixnum) seg vreg xfer (logand fix1 fix2))
     5546      (let* ((fixval (or fix1 fix2))
     5547             (fixlen (if fixval (integer-length fixval)))
     5548             (unboxed-fixval (if fixval (ash fixval *ppc2-target-fixnum-shift*)))
     5549             (high (if fixval (if (= unboxed-fixval (logand #xffff0000 unboxed-fixval)) (ash unboxed-fixval -16))))
     5550             (low (if fixval (unless high (if (= unboxed-fixval (logand #x0000ffff unboxed-fixval)) unboxed-fixval))))
     5551             (otherform (if (or high low) (if fix1 form2 form1))))
     5552        (if otherform
     5553          (let* ((other-reg (ppc2-one-untargeted-reg-form seg otherform ppc::arg_z)))
     5554            (when vreg
     5555              (ensuring-node-target (target vreg)
     5556                (if high
     5557                  (! logand-high target other-reg high)
     5558                  (! logand-low target other-reg low)))))
     5559          (if (and fixval (= fixlen (logcount fixval)))
     5560            (let* ((nbits (- *ppc2-target-bits-in-word*
     5561                             (1+ (+ *ppc2-target-fixnum-shift* fixlen))))
     5562                   (otherreg (ppc2-one-untargeted-reg-form seg (if fix1 form2 form1) ppc::arg_z)))
    55635563           
    5564             (if vreg (ensuring-node-target (target vreg)
    5565                        (if (> fixval 0)
    5566                          (! clear-left target otherreg nbits)
    5567                          (! clear-right target otherreg (+ fixlen
    5568                                                            *ppc2-target-fixnum-shift*))))))
     5564              (if vreg (ensuring-node-target (target vreg)
     5565                         (if (> fixval 0)
     5566                           (! clear-left target otherreg nbits)
     5567                           (! clear-right target otherreg (+ fixlen
     5568                                                             *ppc2-target-fixnum-shift*))))))
    55695569         
    5570           (multiple-value-bind (r1 r2) (ppc2-two-untargeted-reg-forms seg form1 ppc::arg_y form2 ppc::arg_z)
    5571             (if vreg (ensuring-node-target (target vreg) (! %logand2 target r1 r2))))))
    5572       (^))))
     5570            (multiple-value-bind (r1 r2) (ppc2-two-untargeted-reg-forms seg form1 ppc::arg_y form2 ppc::arg_z)
     5571              (if vreg (ensuring-node-target (target vreg) (! %logand2 target r1 r2))))))
     5572        (^)))))
    55735573
    55745574(defppc2 ppc2-%ilogxor2 %ilogxor2 (seg vreg xfer form1 form2)
     
    61626162        (^)))))
    61636163
    6164 ;;; Return T if form is declare to be something that couldn't be a fixnum.
     6164;;; Return T if form is declared to be something that couldn't be a fixnum.
    61656165(defun ppc2-explicit-non-fixnum-type-p (form)
    6166   (or (ppc2-form-typep form 'float)
    6167       (ppc2-form-typep form 'complex)
    6168       (ppc2-form-typep form 'ratio)
    6169       (ppc2-form-typep form 'bignum)))
     6166  (let* ((type (ppc2-form-type form))
     6167         (target-fixnum-type (nx-target-type 'fixnum)))
     6168    (and (not (subtypep type target-fixnum-type))
     6169         (not (subtypep target-fixnum-type type)))))
    61706170
    61716171
     
    62816281  (ppc2-binary-builtin seg vreg xfer 'logbitp bitnum int))
    62826282
     6283
     6284(defun ppc2-inline-logior2 (seg vreg xfer form1 form2)
     6285  (with-ppc-local-vinsn-macros (seg vreg xfer)
     6286    (let* ((fix1 (acode-fixnum-form-p form1))
     6287           (fix2 (acode-fixnum-form-p form2)))
     6288      (if (and fix1 fix2)
     6289        (ppc2-use-operator (%nx1-operator fixnum) seg vreg xfer (logior fix1 fix2))
     6290        (let* ((fixval (or fix1 fix2))
     6291               (unboxed-fixval (if fixval (ash fixval *ppc2-target-fixnum-shift*)))
     6292               (high (if fixval (if (= unboxed-fixval (logand #xffff0000 unboxed-fixval)) (ash unboxed-fixval -16))))
     6293               (low (if fixval (unless high (if (= unboxed-fixval (logand #x0000ffff unboxed-fixval)) unboxed-fixval))))
     6294               (otherform (if (or high low) (if fix1 form2 form1)))
     6295               (out-of-line (backend-get-next-label))
     6296               (done (backend-get-next-label)))
     6297
     6298          (if otherform
     6299            (ppc2-one-targeted-reg-form seg otherform ($ ppc::arg_z))
     6300            (ppc2-two-targeted-reg-forms seg form1 ($ ppc::arg_y) form2 ($ ppc::arg_z)))
     6301          (ensuring-node-target (target vreg)
     6302            (if otherform
     6303              (unless (acode-fixnum-form-p otherform)
     6304                (! branch-unless-arg-fixnum ($ ppc::arg_z) (aref *backend-labels* out-of-line)))
     6305              (if (acode-fixnum-form-p form1)
     6306                (! branch-unless-arg-fixnum ($ ppc::arg_z) (aref *backend-labels* out-of-line))
     6307                (if (acode-fixnum-form-p form2)
     6308                  (! branch-unless-arg-fixnum ($ ppc::arg_y) (aref *backend-labels* out-of-line)) 
     6309                  (! branch-unless-both-args-fixnums ($ ppc::arg_y) ($ ppc::arg_z) (aref *backend-labels* out-of-line)))))
     6310            (if otherform
     6311              (if high
     6312                (! logior-high ($ ppc::arg_z) ($ ppc::arg_z) high)
     6313                (! logior-low ($ ppc::arg_z) ($ ppc::arg_z) low))
     6314              (! %logior2 ($ ppc::arg_z) ($ ppc::arg_z) ($ ppc::arg_y)))
     6315            (-> done)
     6316            (@ out-of-line)
     6317            (if otherform
     6318              (ppc2-lri seg ($ ppc::arg_y) (ash fixval *ppc2-target-fixnum-shift*)))
     6319            (! call-subprim-2 ($ ppc::arg_z) (subprim-name->offset '.SPbuiltin-logior) ($ ppc::arg_y) ($ ppc::arg_z))
     6320            (@ done)
     6321            (ppc2-copy-register seg target ($ ppc::arg_z))
     6322            (^)))))))
     6323
    62836324(defppc2 ppc2-logior2 logior2 (seg vreg xfer form1 form2)
    6284   (ppc2-binary-builtin seg vreg xfer 'logior-2 form1 form2))
     6325  (if (or (ppc2-explicit-non-fixnum-type-p form1)
     6326          (ppc2-explicit-non-fixnum-type-p form2))
     6327    (ppc2-binary-builtin seg vreg xfer 'logior-2 form1 form2)
     6328    (ppc2-inline-logior2 seg vreg xfer form1 form2)))
    62856329
    62866330(defppc2 ppc2-logxor2 logxor2 (seg vreg xfer form1 form2)
    62876331  (ppc2-binary-builtin seg vreg xfer 'logxor-2 form1 form2))
    62886332
     6333(defun ppc2-inline-logand2 (seg vreg xfer form1 form2)
     6334  (with-ppc-local-vinsn-macros (seg vreg xfer)
     6335  (let* ((fix1 (acode-fixnum-form-p form1))
     6336         (fix2 (acode-fixnum-form-p form2)))
     6337    (if (and fix1 fix2)
     6338      (ppc2-use-operator (%nx1-operator fixnum) seg vreg xfer (logand fix1 fix2))
     6339      (let* ((fixval (or fix1 fix2))
     6340             (fixlen (if fixval (integer-length fixval)))
     6341             (unboxed-fixval (if fixval (ash fixval *ppc2-target-fixnum-shift*)))
     6342             (high (if fixval (if (= unboxed-fixval (logand #xffff0000 unboxed-fixval)) (ash unboxed-fixval -16))))
     6343             (low (if fixval (unless high (if (= unboxed-fixval (logand #x0000ffff unboxed-fixval)) unboxed-fixval))))
     6344             (maskable (and fixval (= fixlen (logcount fixval))))
     6345             (otherform (if (or high low maskable) (if fix1 form2 form1)))
     6346             (out-of-line (backend-get-next-label))
     6347             (done (backend-get-next-label)))
     6348        (if otherform
     6349          (ppc2-one-targeted-reg-form seg otherform ($ ppc::arg_z))
     6350          (ppc2-two-targeted-reg-forms  seg form1 ($ ppc::arg_y) form2 ($ ppc::arg_z)))
     6351        (ensuring-node-target (target vreg)
     6352          (if otherform
     6353            (unless (acode-fixnum-form-p otherform)
     6354              (! branch-unless-arg-fixnum ($ ppc::arg_z) (aref *backend-labels* out-of-line)))
     6355            (if (acode-fixnum-form-p form1)
     6356              (! branch-unless-arg-fixnum ($ ppc::arg_z) (aref *backend-labels* out-of-line))
     6357              (if (acode-fixnum-form-p form2)
     6358                (! branch-unless-arg-fixnum ($ ppc::arg_y) (aref *backend-labels* out-of-line)) 
     6359                (! branch-unless-both-args-fixnums ($ ppc::arg_y) ($ ppc::arg_z) (aref *backend-labels* out-of-line)))))
     6360          (if otherform
     6361            (if (or high low)
     6362              (if high
     6363                (! logand-high ($ ppc::arg_z) ($ ppc::arg_z) high)
     6364                (! logand-low ($ ppc::arg_z) ($ ppc::arg_z) low))
     6365              (let* ((nbits (- *ppc2-target-bits-in-word*
     6366                             (1+ (+ *ppc2-target-fixnum-shift* fixlen)))))
     6367                (if (> fixval 0)
     6368                  (! clear-left ($ ppc::arg_z) ($ ppc::arg_z)  nbits)
     6369                  (! clear-right ($ ppc::arg_z) ($ ppc::arg_z) (+ fixlen
     6370                                                                  *ppc2-target-fixnum-shift*)))))
     6371            (! %logand2 ($ ppc::arg_z) ($ ppc::arg_z) ($ ppc::arg_y)))
     6372          (-> done)
     6373          (@ out-of-line)
     6374          (if otherform
     6375            (ppc2-lri seg ($ ppc::arg_y) (ash fixval *ppc2-target-fixnum-shift*)))
     6376            (! call-subprim-2 ($ ppc::arg_z) (subprim-name->offset '.SPbuiltin-logand) ($ ppc::arg_y) ($ ppc::arg_z))         
     6377            (@ done)
     6378            (ppc2-copy-register seg target ($ ppc::arg_z))
     6379            (^)))))))
     6380
    62896381(defppc2 ppc2-logand2 logand2 (seg vreg xfer form1 form2)
    6290   (ppc2-binary-builtin seg vreg xfer 'logand-2 form1 form2))
     6382  (if (or (ppc2-explicit-non-fixnum-type-p form1)
     6383          (ppc2-explicit-non-fixnum-type-p form2))
     6384    (ppc2-binary-builtin seg vreg xfer 'logand-2 form1 form2)
     6385    (ppc2-inline-logand2 seg vreg xfer form1 form2)))
    62916386
    62926387(defppc2 ppc2-div2 div2 (seg vreg xfer form1 form2)
Note: See TracChangeset for help on using the changeset viewer.