From: lisphacker Date: Fri, 13 Apr 2007 19:23:52 +0000 (+0000) Subject: 1.0.4.81: more x86 backend cleanups X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=804bd4d97228b8ddde6e5d9b4f0c75c889efd819;p=sbcl.git 1.0.4.81: more x86 backend cleanups * make-ea-for-vector-data macro and use where appropriate. --- diff --git a/src/compiler/x86/arith.lisp b/src/compiler/x86/arith.lisp index fc8651c..1e86a0b 100644 --- a/src/compiler/x86/arith.lisp +++ b/src/compiler/x86/arith.lisp @@ -1747,16 +1747,10 @@ (inst xor k k) NO-UPDATE ;; y = ptgfsr[k++]; - (inst mov y (make-ea :dword :base state :index k :scale 4 - :disp (- (* (+ 3 vector-data-offset) - n-word-bytes) - other-pointer-lowtag))) + (inst mov y (make-ea-for-vector-data state :index k :offset 3)) ;; y ^= (y >> 11); (inst shr y 11) - (inst xor y (make-ea :dword :base state :index k :scale 4 - :disp (- (* (+ 3 vector-data-offset) - n-word-bytes) - other-pointer-lowtag))) + (inst xor y (make-ea-for-vector-data state :index k :offset 3)) ;; y ^= (y << 7) & #x9d2c5680 (inst mov tmp y) (inst inc k) diff --git a/src/compiler/x86/array.lisp b/src/compiler/x86/array.lisp index b0df555..f617419 100644 --- a/src/compiler/x86/array.lisp +++ b/src/compiler/x86/array.lisp @@ -171,10 +171,7 @@ (:generator 20 (move ecx index) (inst shr ecx ,bit-shift) - (inst mov result - (make-ea :dword :base object :index ecx :scale 4 - :disp (- (* vector-data-offset n-word-bytes) - other-pointer-lowtag))) + (inst mov result (make-ea-for-vector-data object :index ecx)) (move ecx index) ;; We used to mask ECX for all values of ELEMENT-PER-WORD, ;; but since Intel's documentation says that the chip will @@ -218,10 +215,7 @@ (:generator 25 (move word-index index) (inst shr word-index ,bit-shift) - (inst mov old - (make-ea :dword :base object :index word-index :scale 4 - :disp (- (* vector-data-offset n-word-bytes) - other-pointer-lowtag))) + (inst mov old (make-ea-for-vector-data object :index word-index)) (move ecx index) ;; We used to mask ECX for all values of ELEMENT-PER-WORD, ;; but since Intel's documentation says that the chip will @@ -242,9 +236,7 @@ (unsigned-reg (inst or old value))) (inst rol old :cl) - (inst mov (make-ea :dword :base object :index word-index :scale 4 - :disp (- (* vector-data-offset n-word-bytes) - other-pointer-lowtag)) + (inst mov (make-ea-for-vector-data object :index word-index) old) (sc-case value (immediate @@ -566,18 +558,13 @@ (:generator 5 (sc-case index (immediate - (inst ,ref-inst value - (make-ea :byte :base object - :disp (- (+ (* vector-data-offset n-word-bytes) - (tn-value index) - offset) - other-pointer-lowtag)))) + (inst ,ref-inst value (make-ea-for-vector-data + object :size :byte + :offset (+ (tn-value index) offset)))) (t (inst ,ref-inst value - (make-ea :byte :base object :index index :scale 1 - :disp (- (+ (* vector-data-offset n-word-bytes) - offset) - other-pointer-lowtag))))))) + (make-ea-for-vector-data object :size :byte + :index index :offset offset)))))) (define-vop (,(symbolicate "DATA-VECTOR-SET-WITH-OFFSET/" ptype)) (:translate data-vector-set-with-offset) (:policy :fast-safe) @@ -601,19 +588,14 @@ '((move eax value))) (sc-case index (immediate - (inst mov (make-ea :byte :base object - :disp (- (+ (* vector-data-offset n-word-bytes) - (tn-value index) - offset) - other-pointer-lowtag)) + (inst mov (make-ea-for-vector-data + object :size :byte :offset (+ (tn-value index) offset)) ,(if 8-bit-tns-p 'value 'al-tn))) (t - (inst mov (make-ea :byte :base object :index index :scale 1 - :disp (- (+ (* vector-data-offset n-word-bytes) - offset) - other-pointer-lowtag)) + (inst mov (make-ea-for-vector-data object :size :byte + :index index :offset offset) ,(if 8-bit-tns-p 'value 'al-tn)))) @@ -648,16 +630,12 @@ (sc-case index (immediate (inst ,ref-inst value - (make-ea :word :base object - :disp (- (+ (* vector-data-offset n-word-bytes) - (* 2 (+ offset (tn-value index)))) - other-pointer-lowtag)))) + (make-ea-for-vector-data object :size :word + :offset (+ (tn-value index) offset)))) (t (inst ,ref-inst value - (make-ea :word :base object :index index :scale 2 - :disp (- (+ (* vector-data-offset n-word-bytes) - (* 2 offset)) - other-pointer-lowtag))))))) + (make-ea-for-vector-data object :size :word + :index index :offset offset)))))) (define-vop (,(symbolicate "DATA-VECTOR-SET-WITH-OFFSET/" ptype)) (:translate data-vector-set-with-offset) (:policy :fast-safe) @@ -678,16 +656,12 @@ (move eax value) (sc-case index (immediate - (inst mov (make-ea :word :base object - :disp (- (+ (* vector-data-offset n-word-bytes) - (* 2 (+ offset (tn-value index)))) - other-pointer-lowtag)) + (inst mov (make-ea-for-vector-data + object :size :word :offset (+ (tn-value index) offset)) ax-tn)) (t - (inst mov (make-ea :word :base object :index index :scale 2 - :disp (- (+ (* vector-data-offset n-word-bytes) - (* 2 offset)) - other-pointer-lowtag)) + (inst mov (make-ea-for-vector-data object :size :word + :index index :offset offset) ax-tn))) (move result eax)))))) (define-data-vector-frobs simple-array-unsigned-byte-15 positive-fixnum diff --git a/src/compiler/x86/macros.lisp b/src/compiler/x86/macros.lisp index af95da2..7e608ce 100644 --- a/src/compiler/x86/macros.lisp +++ b/src/compiler/x86/macros.lisp @@ -66,6 +66,13 @@ (defmacro popw (ptr &optional (slot 0) (lowtag 0)) `(inst pop (make-ea-for-object-slot ,ptr ,slot ,lowtag))) + +(defmacro make-ea-for-vector-data (object &key (size :dword) (offset 0) + index (scale (ash (width-bits size) -3))) + `(make-ea ,size :base ,object :index ,index :scale ,scale + :disp (- (+ (* vector-data-offset n-word-bytes) + (* ,offset ,scale)) + other-pointer-lowtag))) ;;;; macros to generate useful values diff --git a/src/compiler/x86/system.lisp b/src/compiler/x86/system.lisp index 44b1df4..96ca14d 100644 --- a/src/compiler/x86/system.lisp +++ b/src/compiler/x86/system.lisp @@ -289,6 +289,4 @@ (:args (count-vector :scs (descriptor-reg))) (:info index) (:generator 0 - (inst inc (make-ea-for-object-slot count-vector - (+ vector-data-offset index) - other-pointer-lowtag)))) + (inst inc (make-ea-for-vector-data count-vector :offset index)))) diff --git a/version.lisp-expr b/version.lisp-expr index 7680589..98d8c4e 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.4.80" +"1.0.4.81"