Ignore:
Timestamp:
Sep 25, 2010, 9:49:11 PM (9 years ago)
Author:
gb
Message:

Avoid register conflicts in ARM2-TWO-TARGETED-REG-FORMS, especially
when imm regs are involved and unboxing may be. (Similar functions
have the same issue, but this is currently the only variant that's
used to get multiple values into imm regs.)

Fix various problems in %NATURAL-LOGAND, %NATURAL-LOGIOR,
%NATURAL-LOGXOR. Note that there's a little bit of asymmetry: a
complemented ARM constant can be used with an AND instruction
(and becomes a BIC), but there aren't variants of ORR or EOR that
allow this transform.

Fixes ticket:747.

File:
1 edited

Legend:

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

    r14200 r14302  
    28052805         (aconst (and (not atriv) (or (arm-side-effect-free-form-p aform)
    28062806                                      (if avar (arm2-var-not-set-by-form-p avar bform)))))
    2807          (apushed (not (or atriv aconst))))
     2807         (apushed))
    28082808    (progn
    28092809      (unless aconst
     
    28132813      (arm2-one-targeted-reg-form seg bform breg)
    28142814      (if aconst
    2815         (arm2-one-targeted-reg-form seg aform areg)
     2815        (let* ((*available-backend-imm-temps* *available-backend-imm-temps*)
     2816               (*available-backend-node-temps* *available-backend-node-temps*)
     2817               (*available-backend-fp-temps* *available-backend-fp-temps*)
     2818               (bclass (hard-regspec-class breg))
     2819               (bregval (hard-regspec-value breg)))
     2820          (if (eq bclass hard-reg-class-fpr)
     2821            (use-fp-temp bregval)
     2822            (if (eq bclass hard-reg-class-gpr)
     2823              (if (eq (get-regspec-mode breg) hard-reg-class-gpr-mode-node)
     2824                (use-node-temp bregval)
     2825                (use-imm-temp bregval))))
     2826          (arm2-one-targeted-reg-form seg aform areg))
    28162827        (if apushed
    28172828          (arm2-elide-pushes seg apushed (arm2-pop-register seg areg)))))
     
    83248335      (if (and naturalx naturaly)
    83258336        (arm2-absolute-natural seg vreg xfer (logior naturalx naturaly))
    8326         (let* ((u32x (nx-u32-constant-p x))
    8327                (u32y (nx-u32-constant-p y))
    8328                (constant (or u32x u32y)))
     8337        (let* ((constant (let* ((c (or naturalx naturaly)))
     8338                           (when c
     8339                             (if (arm::encode-arm-immediate c)
     8340                               c)))))
    83298341          (if (not constant)
    83308342            (with-imm-target () (xreg :natural)
     
    83338345                (! %natural-logior xreg xreg yreg))
    83348346              (<- xreg))
    8335             (let* ((other (if u32x y x))
    8336                    (high (ldb (byte 16 16) constant))
    8337                    (low (ldb (byte 16 0) constant)))
     8347            (let* ((other (if naturalx y x)))
    83388348              (with-imm-target () (other-reg :natural)
    83398349                (arm2-one-targeted-reg-form seg other other-reg)
    8340                 (! %natural-logior-c other-reg other-reg high low)
     8350                (! logior-immediate other-reg other-reg (logand constant #xffffffff))
    83418351                (<- other-reg))))
    83428352          (^))))))
     
    83518361      (if (and naturalx naturaly)
    83528362        (arm2-absolute-natural seg vreg xfer (logxor naturalx naturaly))
    8353         (let* ((u32x (nx-u32-constant-p x))
    8354                (u32y (nx-u32-constant-p y))
    8355                (constant (or u32x u32y)))
     8363        (let* ((constant (let* ((c (or naturalx naturaly)))
     8364                           (when c
     8365                             (if (arm::encode-arm-immediate c)
     8366                               c)))))
    83568367          (if (not constant)
    83578368            (with-imm-target () (xreg :natural)
     
    83608371                (! %natural-logxor xreg xreg yreg))
    83618372              (<- xreg))
    8362             (let* ((other (if u32x y x))
    8363                    (high (ldb (byte 16 16) constant))
    8364                    (low (ldb (byte 16 0) constant)))
     8373            (let* ((other (if naturalx y x)))
    83658374              (with-imm-target () (other-reg :natural)
    83668375                (arm2-one-targeted-reg-form seg other other-reg)
    8367                 (! %natural-logxor-c other-reg other-reg high low)
     8376                (! logxor-immediate other-reg other-reg (logand constant #xffffffff))
    83688377                (<- other-reg))))
    83698378          (^))))))
     
    83788387      (if (and naturalx naturaly)
    83798388        (arm2-absolute-natural seg vreg xfer (logand naturalx naturaly))
    8380         (let* ((u32x (nx-u32-constant-p x))
    8381                (u32y (nx-u32-constant-p y))
    8382                (constant (let* ((c (or u32x u32y)))
    8383                            (if (arm::encode-arm-immediate c)
    8384                              c
    8385                              (if (arm::encode-arm-immediate (lognot c))
    8386                                (lognot c))))))
     8389        (let* ((constant (let* ((c (or naturalx naturaly)))
     8390                           (when c
     8391                             (if (or (arm::encode-arm-immediate c)
     8392                                     (arm::encode-arm-immediate (lognot c)))
     8393                               c)))))
    83878394          (if (not constant)
    83888395            (with-imm-target () (xreg :natural)
     
    83918398                (! %natural-logand xreg xreg yreg))
    83928399              (<- xreg))
    8393             (let* ((other (if u32x y x)))
     8400            (let* ((other (if naturalx y x)))
    83948401              (with-imm-target () (other-reg :natural)
    83958402                (arm2-one-targeted-reg-form seg other other-reg)
Note: See TracChangeset for help on using the changeset viewer.