(:generator 13
(inst lea bytes
(make-ea :dword :base rank
- :disp (+ (* (1+ array-dimensions-offset) word-bytes)
+ :disp (+ (* (1+ array-dimensions-offset) n-word-bytes)
lowtag-mask)))
(inst and bytes (lognot lowtag-mask))
(inst lea header (make-ea :dword :base rank
;;;; bit, 2-bit, and 4-bit vectors
(macrolet ((def-small-data-vector-frobs (type bits)
- (let* ((elements-per-word (floor sb!vm:word-bits bits))
+ (let* ((elements-per-word (floor sb!vm:n-word-bits bits))
(bit-shift (1- (integer-length elements-per-word))))
`(progn
(define-vop (,(symbolicate 'data-vector-ref/ type))
(inst shr ecx ,bit-shift)
(inst mov result
(make-ea :dword :base object :index ecx :scale 4
- :disp (- (* vector-data-offset word-bytes)
+ :disp (- (* vector-data-offset n-word-bytes)
other-pointer-lowtag)))
(move ecx index)
(inst and ecx ,(1- elements-per-word))
(inst shr word-index ,bit-shift)
(inst lea ptr
(make-ea :dword :base object :index word-index :scale 4
- :disp (- (* vector-data-offset word-bytes)
+ :disp (- (* vector-data-offset n-word-bytes)
other-pointer-lowtag)))
(loadw old ptr)
(move ecx index)
(multiple-value-bind (word extra) (floor index ,elements-per-word)
(inst mov old
(make-ea :dword :base object
- :disp (- (* (+ word vector-data-offset) word-bytes)
+ :disp (- (* (+ word vector-data-offset)
+ n-word-bytes)
other-pointer-lowtag)))
(sc-case value
(immediate
(inst rol old shift)))))
(inst mov (make-ea :dword :base object
:disp (- (* (+ word vector-data-offset)
- word-bytes)
+ n-word-bytes)
other-pointer-lowtag))
old)
(sc-case value
(:generator 5
(with-empty-tn@fp-top(value)
(inst fld (make-ea :dword :base object :index index :scale 1
- :disp (- (* sb!vm:vector-data-offset sb!vm:word-bytes)
+ :disp (- (* sb!vm:vector-data-offset
+ sb!vm:n-word-bytes)
sb!vm:other-pointer-lowtag))))))
(define-vop (data-vector-ref-c/simple-array-single-float)
(with-empty-tn@fp-top(value)
(inst fld (make-ea :dword :base object
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
(* 4 index))
sb!vm:other-pointer-lowtag))))))
;; Value is in ST0.
(inst fst (make-ea :dword :base object :index index :scale 1
:disp (- (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
sb!vm:other-pointer-lowtag)))
(unless (zerop (tn-offset result))
;; Value is in ST0 but not result.
(inst fxch value)
(inst fst (make-ea :dword :base object :index index :scale 1
:disp (- (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
sb!vm:other-pointer-lowtag)))
(cond ((zerop (tn-offset result))
;; The result is in ST0.
;; Value is in ST0.
(inst fst (make-ea :dword :base object
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
(* 4 index))
sb!vm:other-pointer-lowtag)))
(unless (zerop (tn-offset result))
(inst fxch value)
(inst fst (make-ea :dword :base object
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
(* 4 index))
sb!vm:other-pointer-lowtag)))
(cond ((zerop (tn-offset result))
(:generator 7
(with-empty-tn@fp-top(value)
(inst fldd (make-ea :dword :base object :index index :scale 2
- :disp (- (* sb!vm:vector-data-offset sb!vm:word-bytes)
+ :disp (- (* sb!vm:vector-data-offset
+ sb!vm:n-word-bytes)
sb!vm:other-pointer-lowtag))))))
(define-vop (data-vector-ref-c/simple-array-double-float)
(with-empty-tn@fp-top(value)
(inst fldd (make-ea :dword :base object
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
(* 8 index))
sb!vm:other-pointer-lowtag))))))
;; Value is in ST0.
(inst fstd (make-ea :dword :base object :index index :scale 2
:disp (- (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
sb!vm:other-pointer-lowtag)))
(unless (zerop (tn-offset result))
;; Value is in ST0 but not result.
(inst fxch value)
(inst fstd (make-ea :dword :base object :index index :scale 2
:disp (- (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
sb!vm:other-pointer-lowtag)))
(cond ((zerop (tn-offset result))
;; The result is in ST0.
;; Value is in ST0.
(inst fstd (make-ea :dword :base object
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
(* 8 index))
sb!vm:other-pointer-lowtag)))
(unless (zerop (tn-offset result))
(inst fxch value)
(inst fstd (make-ea :dword :base object
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
(* 8 index))
sb!vm:other-pointer-lowtag)))
(cond ((zerop (tn-offset result))
(with-empty-tn@fp-top(value)
(inst fldl (make-ea :dword :base object :index temp :scale 1
:disp (- (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
sb!vm:other-pointer-lowtag))))))
#!+long-float
(with-empty-tn@fp-top(value)
(inst fldl (make-ea :dword :base object
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
(* 12 index))
sb!vm:other-pointer-lowtag))))))
;; Value is in ST0.
(store-long-float
(make-ea :dword :base object :index temp :scale 1
- :disp (- (* sb!vm:vector-data-offset sb!vm:word-bytes)
+ :disp (- (* sb!vm:vector-data-offset sb!vm:n-word-bytes)
sb!vm:other-pointer-lowtag)))
(unless (zerop (tn-offset result))
;; Value is in ST0 but not result.
(inst fxch value)
(store-long-float
(make-ea :dword :base object :index temp :scale 1
- :disp (- (* sb!vm:vector-data-offset sb!vm:word-bytes)
+ :disp (- (* sb!vm:vector-data-offset sb!vm:n-word-bytes)
sb!vm:other-pointer-lowtag)))
(cond ((zerop (tn-offset result))
;; The result is in ST0.
;; Value is in ST0.
(store-long-float (make-ea :dword :base object
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
(* 12 index))
sb!vm:other-pointer-lowtag)))
(unless (zerop (tn-offset result))
(inst fxch value)
(store-long-float (make-ea :dword :base object
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
(* 12 index))
sb!vm:other-pointer-lowtag)))
(cond ((zerop (tn-offset result))
(with-empty-tn@fp-top (real-tn)
(inst fld (make-ea :dword :base object :index index :scale 2
:disp (- (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
sb!vm:other-pointer-lowtag)))))
(let ((imag-tn (complex-single-reg-imag-tn value)))
(with-empty-tn@fp-top (imag-tn)
(inst fld (make-ea :dword :base object :index index :scale 2
:disp (- (* (1+ sb!vm:vector-data-offset)
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
sb!vm:other-pointer-lowtag)))))))
(define-vop (data-vector-ref-c/simple-array-complex-single-float)
(with-empty-tn@fp-top (real-tn)
(inst fld (make-ea :dword :base object
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
(* 8 index))
sb!vm:other-pointer-lowtag)))))
(let ((imag-tn (complex-single-reg-imag-tn value)))
(with-empty-tn@fp-top (imag-tn)
(inst fld (make-ea :dword :base object
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
(* 8 index) 4)
sb!vm:other-pointer-lowtag)))))))
;; Value is in ST0.
(inst fst (make-ea :dword :base object :index index :scale 2
:disp (- (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
sb!vm:other-pointer-lowtag)))
(unless (zerop (tn-offset result-real))
;; Value is in ST0 but not result.
(inst fxch value-real)
(inst fst (make-ea :dword :base object :index index :scale 2
:disp (- (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
sb!vm:other-pointer-lowtag)))
(cond ((zerop (tn-offset result-real))
;; The result is in ST0.
(inst fxch value-imag)
(inst fst (make-ea :dword :base object :index index :scale 2
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
4)
sb!vm:other-pointer-lowtag)))
(unless (location= value-imag result-imag)
;; Value is in ST0.
(inst fst (make-ea :dword :base object
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
(* 8 index))
sb!vm:other-pointer-lowtag)))
(unless (zerop (tn-offset result-real))
(inst fxch value-real)
(inst fst (make-ea :dword :base object
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
(* 8 index))
sb!vm:other-pointer-lowtag)))
(cond ((zerop (tn-offset result-real))
(inst fxch value-imag)
(inst fst (make-ea :dword :base object
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
(* 8 index) 4)
sb!vm:other-pointer-lowtag)))
(unless (location= value-imag result-imag)
(with-empty-tn@fp-top (real-tn)
(inst fldd (make-ea :dword :base object :index index :scale 4
:disp (- (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
sb!vm:other-pointer-lowtag)))))
(let ((imag-tn (complex-double-reg-imag-tn value)))
(with-empty-tn@fp-top (imag-tn)
(inst fldd (make-ea :dword :base object :index index :scale 4
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
8)
sb!vm:other-pointer-lowtag)))))))
(with-empty-tn@fp-top (real-tn)
(inst fldd (make-ea :dword :base object
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
(* 16 index))
sb!vm:other-pointer-lowtag)))))
(let ((imag-tn (complex-double-reg-imag-tn value)))
(with-empty-tn@fp-top (imag-tn)
(inst fldd (make-ea :dword :base object
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
(* 16 index) 8)
sb!vm:other-pointer-lowtag)))))))
;; Value is in ST0.
(inst fstd (make-ea :dword :base object :index index :scale 4
:disp (- (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
sb!vm:other-pointer-lowtag)))
(unless (zerop (tn-offset result-real))
;; Value is in ST0 but not result.
(inst fxch value-real)
(inst fstd (make-ea :dword :base object :index index :scale 4
:disp (- (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
sb!vm:other-pointer-lowtag)))
(cond ((zerop (tn-offset result-real))
;; The result is in ST0.
(inst fxch value-imag)
(inst fstd (make-ea :dword :base object :index index :scale 4
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
8)
sb!vm:other-pointer-lowtag)))
(unless (location= value-imag result-imag)
;; Value is in ST0.
(inst fstd (make-ea :dword :base object
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
(* 16 index))
sb!vm:other-pointer-lowtag)))
(unless (zerop (tn-offset result-real))
(inst fxch value-real)
(inst fstd (make-ea :dword :base object
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
(* 16 index))
sb!vm:other-pointer-lowtag)))
(cond ((zerop (tn-offset result-real))
(inst fxch value-imag)
(inst fstd (make-ea :dword :base object
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
(* 16 index) 8)
sb!vm:other-pointer-lowtag)))
(unless (location= value-imag result-imag)
(with-empty-tn@fp-top (real-tn)
(inst fldl (make-ea :dword :base object :index temp :scale 2
:disp (- (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
sb!vm:other-pointer-lowtag)))))
(let ((imag-tn (complex-long-reg-imag-tn value)))
(with-empty-tn@fp-top (imag-tn)
(inst fldl (make-ea :dword :base object :index temp :scale 2
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
12)
sb!vm:other-pointer-lowtag)))))))
(with-empty-tn@fp-top (real-tn)
(inst fldl (make-ea :dword :base object
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
(* 24 index))
sb!vm:other-pointer-lowtag)))))
(let ((imag-tn (complex-long-reg-imag-tn value)))
(with-empty-tn@fp-top (imag-tn)
(inst fldl (make-ea :dword :base object
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
(* 24 index) 12)
sb!vm:other-pointer-lowtag)))))))
;; Value is in ST0.
(store-long-float
(make-ea :dword :base object :index temp :scale 2
- :disp (- (* sb!vm:vector-data-offset sb!vm:word-bytes)
+ :disp (- (* sb!vm:vector-data-offset sb!vm:n-word-bytes)
sb!vm:other-pointer-lowtag)))
(unless (zerop (tn-offset result-real))
;; Value is in ST0 but not result.
(inst fxch value-real)
(store-long-float
(make-ea :dword :base object :index temp :scale 2
- :disp (- (* sb!vm:vector-data-offset sb!vm:word-bytes)
+ :disp (- (* sb!vm:vector-data-offset sb!vm:n-word-bytes)
sb!vm:other-pointer-lowtag)))
(cond ((zerop (tn-offset result-real))
;; The result is in ST0.
(inst fxch value-imag)
(store-long-float
(make-ea :dword :base object :index temp :scale 2
- :disp (- (+ (* sb!vm:vector-data-offset sb!vm:word-bytes) 12)
+ :disp (- (+ (* sb!vm:vector-data-offset sb!vm:n-word-bytes) 12)
sb!vm:other-pointer-lowtag)))
(unless (location= value-imag result-imag)
(inst fstd result-imag))
(store-long-float
(make-ea :dword :base object
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
(* 24 index))
sb!vm:other-pointer-lowtag)))
(unless (zerop (tn-offset result-real))
(store-long-float
(make-ea :dword :base object
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
(* 24 index))
sb!vm:other-pointer-lowtag)))
(cond ((zerop (tn-offset result-real))
(store-long-float
(make-ea :dword :base object
:disp (- (+ (* sb!vm:vector-data-offset
- sb!vm:word-bytes)
+ sb!vm:n-word-bytes)
;; FIXME: There are so many of these bare constants
;; (24, 12..) in the LONG-FLOAT code that it's
;; ridiculous. I should probably just delete it all
(:generator 5
(inst movzx value
(make-ea :byte :base object :index index :scale 1
- :disp (- (* vector-data-offset word-bytes)
+ :disp (- (* vector-data-offset n-word-bytes)
other-pointer-lowtag)))))
(define-vop (data-vector-ref-c/simple-array-unsigned-byte-8)
(:generator 4
(inst movzx value
(make-ea :byte :base object
- :disp (- (+ (* vector-data-offset word-bytes) index)
+ :disp (- (+ (* vector-data-offset n-word-bytes) index)
other-pointer-lowtag)))))
(define-vop (data-vector-set/simple-array-unsigned-byte-8)
(:generator 5
(move eax value)
(inst mov (make-ea :byte :base object :index index :scale 1
- :disp (- (* vector-data-offset word-bytes)
+ :disp (- (* vector-data-offset n-word-bytes)
other-pointer-lowtag))
al-tn)
(move result eax)))
(:generator 4
(move eax value)
(inst mov (make-ea :byte :base object
- :disp (- (+ (* vector-data-offset word-bytes) index)
+ :disp (- (+ (* vector-data-offset n-word-bytes) index)
other-pointer-lowtag))
al-tn)
(move result eax)))
(:generator 5
(inst movzx value
(make-ea :word :base object :index index :scale 2
- :disp (- (* vector-data-offset word-bytes)
+ :disp (- (* vector-data-offset n-word-bytes)
other-pointer-lowtag)))))
(define-vop (data-vector-ref-c/simple-array-unsigned-byte-16)
(:generator 4
(inst movzx value
(make-ea :word :base object
- :disp (- (+ (* vector-data-offset word-bytes) (* 2 index))
+ :disp (- (+ (* vector-data-offset n-word-bytes) (* 2 index))
other-pointer-lowtag)))))
(define-vop (data-vector-set/simple-array-unsigned-byte-16)
(:generator 5
(move eax value)
(inst mov (make-ea :word :base object :index index :scale 2
- :disp (- (* vector-data-offset word-bytes)
+ :disp (- (* vector-data-offset n-word-bytes)
other-pointer-lowtag))
ax-tn)
(move result eax)))
(:generator 4
(move eax value)
(inst mov (make-ea :word :base object
- :disp (- (+ (* vector-data-offset word-bytes)
+ :disp (- (+ (* vector-data-offset n-word-bytes)
(* 2 index))
other-pointer-lowtag))
ax-tn)
(:generator 5
(inst mov al-tn
(make-ea :byte :base object :index index :scale 1
- :disp (- (* vector-data-offset word-bytes)
+ :disp (- (* vector-data-offset n-word-bytes)
other-pointer-lowtag)))
(move value al-tn)))
(:generator 4
(inst mov al-tn
(make-ea :byte :base object
- :disp (- (+ (* vector-data-offset word-bytes) index)
+ :disp (- (+ (* vector-data-offset n-word-bytes) index)
other-pointer-lowtag)))
(move value al-tn)))
(:result-types base-char)
(:generator 5
(inst mov (make-ea :byte :base object :index index :scale 1
- :disp (- (* vector-data-offset word-bytes)
+ :disp (- (* vector-data-offset n-word-bytes)
other-pointer-lowtag))
value)
(move result value)))
(:result-types base-char)
(:generator 4
(inst mov (make-ea :byte :base object
- :disp (- (+ (* vector-data-offset word-bytes) index)
+ :disp (- (+ (* vector-data-offset n-word-bytes) index)
other-pointer-lowtag))
value)
(move result value)))
(:generator 5
(inst movsx value
(make-ea :byte :base object :index index :scale 1
- :disp (- (* vector-data-offset word-bytes)
+ :disp (- (* vector-data-offset n-word-bytes)
other-pointer-lowtag)))))
(define-vop (data-vector-ref-c/simple-array-signed-byte-8)
(:generator 4
(inst movsx value
(make-ea :byte :base object
- :disp (- (+ (* vector-data-offset word-bytes) index)
+ :disp (- (+ (* vector-data-offset n-word-bytes) index)
other-pointer-lowtag)))))
(define-vop (data-vector-set/simple-array-signed-byte-8)
(:generator 5
(move eax value)
(inst mov (make-ea :byte :base object :index index :scale 1
- :disp (- (* vector-data-offset word-bytes)
+ :disp (- (* vector-data-offset n-word-bytes)
other-pointer-lowtag))
al-tn)
(move result eax)))
(:generator 4
(move eax value)
(inst mov (make-ea :byte :base object
- :disp (- (+ (* vector-data-offset word-bytes) index)
+ :disp (- (+ (* vector-data-offset n-word-bytes) index)
other-pointer-lowtag))
al-tn)
(move result eax)))
(:generator 5
(inst movsx value
(make-ea :word :base object :index index :scale 2
- :disp (- (* vector-data-offset word-bytes)
+ :disp (- (* vector-data-offset n-word-bytes)
other-pointer-lowtag)))))
(define-vop (data-vector-ref-c/simple-array-signed-byte-16)
(:generator 4
(inst movsx value
(make-ea :word :base object
- :disp (- (+ (* vector-data-offset word-bytes)
+ :disp (- (+ (* vector-data-offset n-word-bytes)
(* 2 index))
other-pointer-lowtag)))))
(:generator 5
(move eax value)
(inst mov (make-ea :word :base object :index index :scale 2
- :disp (- (* vector-data-offset word-bytes)
+ :disp (- (* vector-data-offset n-word-bytes)
other-pointer-lowtag))
ax-tn)
(move result eax)))
(move eax value)
(inst mov
(make-ea :word :base object
- :disp (- (+ (* vector-data-offset word-bytes)
+ :disp (- (+ (* vector-data-offset n-word-bytes)
(* 2 index))
other-pointer-lowtag))
ax-tn)