Update of /project/sb-simd/cvsroot/sb-simd/sbcl-src/src/compiler/x86 In directory common-lisp.net:/tmp/cvs-serv26463/sbcl-src/src/compiler/x86
Modified Files: vm.lisp insts.lisp Log Message:
Date: Fri Aug 12 13:55:38 2005 Author: rlaakso
Index: sb-simd/sbcl-src/src/compiler/x86/vm.lisp diff -u sb-simd/sbcl-src/src/compiler/x86/vm.lisp:1.1.1.1 sb-simd/sbcl-src/src/compiler/x86/vm.lisp:1.2 --- sb-simd/sbcl-src/src/compiler/x86/vm.lisp:1.1.1.1 Fri Aug 5 15:13:29 2005 +++ sb-simd/sbcl-src/src/compiler/x86/vm.lisp Fri Aug 12 13:55:38 2005 @@ -22,7 +22,7 @@ (defvar *word-register-names* (make-array 16 :initial-element nil)) (defvar *dword-register-names* (make-array 16 :initial-element nil)) (defvar *float-register-names* (make-array 8 :initial-element nil)) - (defvar *dqword-register-names* (make-array 8 :initial-element nil))) + (defvar *xmmword-register-names* (make-array 8 :initial-element nil)))
(macrolet ((defreg (name offset size) (let ((offset-sym (symbolicate name "-OFFSET")) @@ -93,15 +93,15 @@ (defregset *float-regs* fr0 fr1 fr2 fr3 fr4 fr5 fr6 fr7)
;; sse registers - (defreg xmm0 0 :dqword) - (defreg xmm1 1 :dqword) - (defreg xmm2 2 :dqword) - (defreg xmm3 3 :dqword) - (defreg xmm4 4 :dqword) - (defreg xmm5 5 :dqword) - (defreg xmm6 6 :dqword) - (defreg xmm7 7 :dqword) - (defregset *sse-regs* xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7) + (defreg xmm0 0 :xmmword) + (defreg xmm1 1 :xmmword) + (defreg xmm2 2 :xmmword) + (defreg xmm3 3 :xmmword) + (defreg xmm4 4 :xmmword) + (defreg xmm5 5 :xmmword) + (defreg xmm6 6 :xmmword) + (defreg xmm7 7 :xmmword) + (defregset *xmm-regs* xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7)
;; registers used to pass arguments ;; @@ -130,7 +130,7 @@ ;;; the new way: (define-storage-base float-registers :finite :size 8)
-(define-storage-base sse-registers :finite :size 8) +(define-storage-base xmm-registers :finite :size 8)
(define-storage-base stack :unbounded :size 8) (define-storage-base constant :non-packed) @@ -334,8 +334,8 @@ :save-p t :alternate-scs (complex-long-stack))
- (sse-reg sse-registers - :locations #.*sse-regs*) + (xmm-reg xmm-registers + :locations #.*xmm-regs*) ;; a catch or unwind block (catch-block stack :element-size kludge-nondeterministic-catch-block-size))
@@ -353,7 +353,7 @@ ;;; These are used to (at least) determine operand size. (defparameter *float-sc-names* '(single-reg)) (defparameter *double-sc-names* '(double-reg double-stack)) -(defparameter *dqword-sc-names* '(sse-reg)) +(defparameter *xmmword-sc-names* '(xmm-reg)) ) ; EVAL-WHEN ;;;; miscellaneous TNs for the various registers @@ -461,7 +461,7 @@ ;; FIXME: Shouldn't this be an ERROR? (format nil "<unknown reg: off=~W, sc=~A>" offset sc-name)))) (float-registers (format nil "FR~D" offset)) - (sse-registers (format nil "XMM~D" offset)) + (xmm-registers (format nil "XMM~D" offset)) (stack (format nil "S~D" offset)) (constant (format nil "Const~D" offset)) (immediate-constant "Immed")
Index: sb-simd/sbcl-src/src/compiler/x86/insts.lisp diff -u sb-simd/sbcl-src/src/compiler/x86/insts.lisp:1.2 sb-simd/sbcl-src/src/compiler/x86/insts.lisp:1.3 --- sb-simd/sbcl-src/src/compiler/x86/insts.lisp:1.2 Mon Aug 8 15:33:23 2005 +++ sb-simd/sbcl-src/src/compiler/x86/insts.lisp Fri Aug 12 13:55:38 2005 @@ -39,13 +39,16 @@ #(ax cx dx bx sp bp si di)) (defparameter *dword-reg-names* #(eax ecx edx ebx esp ebp esi edi)) +(defparameter *xmmword-reg-names* + #(xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7))
(defun print-reg-with-width (value width stream dstate) (declare (ignore dstate)) (princ (aref (ecase width (:byte *byte-reg-names*) (:word *word-reg-names*) - (:dword *dword-reg-names*)) + (:dword *dword-reg-names*) + (:xmmword *xmmword-reg-names*)) value) stream) ;; XXX plus should do some source-var notes @@ -193,7 +196,7 @@ (:word 16) (:dword 32) (:qword 64) - (:dqword 128) + (:xmmword 128) (:float 32) (:double 64)))
@@ -680,7 +683,7 @@
(defstruct (ea (:constructor make-ea (size &key base index scale disp)) (:copier nil)) - (size nil :type (member :byte :word :dword)) + (size nil :type (member :byte :word :dword :xmmword)) (base nil :type (or tn null)) (index nil :type (or tn null)) (scale 1 :type (member 1 2 4 8)) @@ -720,7 +723,7 @@ (ecase (sb-name (sc-sb (tn-sc thing))) (registers (emit-mod-reg-r/m-byte segment #b11 reg (reg-tn-encoding thing))) - (sse-registers + (xmm-registers (emit-mod-reg-r/m-byte segment #b11 reg (reg-tn-encoding thing))) (stack ;; Convert stack tns into an index off of EBP. @@ -834,9 +837,18 @@ (and (tn-p thing) (eq (sb-name (sc-sb (tn-sc thing))) 'registers)))
-(defun sse-register-p (thing) +(defun xmm-register-p (thing) (and (tn-p thing) - (eq (sb-name (sc-sb (tn-sc thing))) 'sse-registers))) + (eq (sb-name (sc-sb (tn-sc thing))) 'xmm-registers) + (member (sc-name (tn-sc thing)) *xmmword-sc-names*) + t)) + +(defun xmm-ea-p (thing) + (typecase thing + (ea (eq (ea-size thing) :xmmword)) + (tn + (and (member (sc-name (tn-sc thing)) *xmmword-sc-names*) t)) + (t nil)))
(defun accumulator-p (thing) (and (register-p thing) @@ -867,6 +879,8 @@ :float) (#.*double-sc-names* :double) + (#.*xmmword-sc-names* + :xmmword) (t (error "can't tell the size of ~S ~S" thing (sc-name (tn-sc thing)))))) (ea @@ -3210,7 +3224,7 @@ (SEGMENT DST SRC) (:EMITTER (COND - ((SSE-REGISTER-P DST) (EMIT-BYTE SEGMENT 102) + ((XMM-REGISTER-P DST) (EMIT-BYTE SEGMENT 102) (EMIT-BYTE SEGMENT 15) (EMIT-BYTE SEGMENT 40) (EMIT-EA SEGMENT SRC (REG-TN-ENCODING DST))) (T (EMIT-BYTE SEGMENT 102) @@ -3222,7 +3236,7 @@ (SEGMENT DST SRC) (:EMITTER (COND - ((SSE-REGISTER-P DST) (EMIT-BYTE SEGMENT 15) + ((XMM-REGISTER-P DST) (EMIT-BYTE SEGMENT 15) (EMIT-BYTE SEGMENT 40) (EMIT-EA SEGMENT SRC (REG-TN-ENCODING DST))) (T (EMIT-BYTE SEGMENT 15) @@ -3233,7 +3247,7 @@ (SEGMENT DST SRC) (:EMITTER (COND - ((SSE-REGISTER-P DST) (EMIT-BYTE SEGMENT 102) + ((XMM-REGISTER-P DST) (EMIT-BYTE SEGMENT 102) (EMIT-BYTE SEGMENT 15) (EMIT-BYTE SEGMENT 110) (EMIT-EA SEGMENT SRC (REG-TN-ENCODING DST))) (T (EMIT-BYTE SEGMENT 102) @@ -3245,7 +3259,7 @@ (SEGMENT DST SRC) (:EMITTER (COND - ((SSE-REGISTER-P DST) (EMIT-BYTE SEGMENT 102) + ((XMM-REGISTER-P DST) (EMIT-BYTE SEGMENT 102) (EMIT-BYTE SEGMENT 15) (EMIT-BYTE SEGMENT 111) (EMIT-EA SEGMENT SRC (REG-TN-ENCODING DST))) (T (EMIT-BYTE SEGMENT 102) @@ -3257,7 +3271,7 @@ (SEGMENT DST SRC) (:EMITTER (COND - ((SSE-REGISTER-P DST) (EMIT-BYTE SEGMENT 243) + ((XMM-REGISTER-P DST) (EMIT-BYTE SEGMENT 243) (EMIT-BYTE SEGMENT 15) (EMIT-BYTE SEGMENT 111) (EMIT-EA SEGMENT SRC (REG-TN-ENCODING DST))) (T (EMIT-BYTE SEGMENT 243) @@ -3269,7 +3283,7 @@ (SEGMENT DST SRC) (:EMITTER (COND - ((SSE-REGISTER-P DST) (EMIT-BYTE SEGMENT 102) + ((XMM-REGISTER-P DST) (EMIT-BYTE SEGMENT 102) (EMIT-BYTE SEGMENT 15) (EMIT-BYTE SEGMENT 22) (EMIT-EA SEGMENT SRC (REG-TN-ENCODING DST))) (T (EMIT-BYTE SEGMENT 102) @@ -3281,7 +3295,7 @@ (SEGMENT DST SRC) (:EMITTER (COND - ((SSE-REGISTER-P DST) (EMIT-BYTE SEGMENT 15) + ((XMM-REGISTER-P DST) (EMIT-BYTE SEGMENT 15) (EMIT-BYTE SEGMENT 22) (EMIT-EA SEGMENT SRC (REG-TN-ENCODING DST))) (T (EMIT-BYTE SEGMENT 15) @@ -3292,7 +3306,7 @@ (SEGMENT DST SRC) (:EMITTER (COND - ((SSE-REGISTER-P DST) (EMIT-BYTE SEGMENT 102) + ((XMM-REGISTER-P DST) (EMIT-BYTE SEGMENT 102) (EMIT-BYTE SEGMENT 15) (EMIT-BYTE SEGMENT 18) (EMIT-EA SEGMENT SRC (REG-TN-ENCODING DST))) (T (EMIT-BYTE SEGMENT 102) @@ -3304,7 +3318,7 @@ (SEGMENT DST SRC) (:EMITTER (COND - ((SSE-REGISTER-P DST) (EMIT-BYTE SEGMENT 15) + ((XMM-REGISTER-P DST) (EMIT-BYTE SEGMENT 15) (EMIT-BYTE SEGMENT 18) (EMIT-EA SEGMENT SRC (REG-TN-ENCODING DST))) (T (EMIT-BYTE SEGMENT 15) @@ -3315,7 +3329,7 @@ (SEGMENT DST SRC) (:EMITTER (COND - ((SSE-REGISTER-P DST) (EMIT-BYTE SEGMENT 243) + ((XMM-REGISTER-P DST) (EMIT-BYTE SEGMENT 243) (EMIT-BYTE SEGMENT 15) (EMIT-BYTE SEGMENT 126) (EMIT-EA SEGMENT SRC (REG-TN-ENCODING DST))) (T (EMIT-BYTE SEGMENT 102) @@ -3327,7 +3341,7 @@ (SEGMENT DST SRC) (:EMITTER (COND - ((SSE-REGISTER-P DST) (EMIT-BYTE SEGMENT 242) + ((XMM-REGISTER-P DST) (EMIT-BYTE SEGMENT 242) (EMIT-BYTE SEGMENT 15) (EMIT-BYTE SEGMENT 16) (EMIT-EA SEGMENT SRC (REG-TN-ENCODING DST))) (T (EMIT-BYTE SEGMENT 242) @@ -3339,7 +3353,7 @@ (SEGMENT DST SRC) (:EMITTER (COND - ((SSE-REGISTER-P DST) (EMIT-BYTE SEGMENT 243) + ((XMM-REGISTER-P DST) (EMIT-BYTE SEGMENT 243) (EMIT-BYTE SEGMENT 15) (EMIT-BYTE SEGMENT 16) (EMIT-EA SEGMENT SRC (REG-TN-ENCODING DST))) (T (EMIT-BYTE SEGMENT 243) @@ -3351,7 +3365,7 @@ (SEGMENT DST SRC) (:EMITTER (COND - ((SSE-REGISTER-P DST) (EMIT-BYTE SEGMENT 102) + ((XMM-REGISTER-P DST) (EMIT-BYTE SEGMENT 102) (EMIT-BYTE SEGMENT 15) (EMIT-BYTE SEGMENT 16) (EMIT-EA SEGMENT SRC (REG-TN-ENCODING DST))) (T (EMIT-BYTE SEGMENT 102) @@ -3363,12 +3377,92 @@ (SEGMENT DST SRC) (:EMITTER (COND - ((SSE-REGISTER-P DST) (EMIT-BYTE SEGMENT 15) + ((XMM-REGISTER-P DST) (EMIT-BYTE SEGMENT 15) (EMIT-BYTE SEGMENT 16) (EMIT-EA SEGMENT SRC (REG-TN-ENCODING DST))) (T (EMIT-BYTE SEGMENT 15) (EMIT-BYTE SEGMENT 17) (EMIT-EA SEGMENT DST (REG-TN-ENCODING SRC)))))) + +(DEFINE-INSTRUCTION PSLLD-IB + (SEGMENT DST AMOUNT) + (:EMITTER (EMIT-BYTE SEGMENT 102) + (EMIT-BYTE SEGMENT 15) + (EMIT-BYTE SEGMENT 114) + (EMIT-EA SEGMENT DST 6) + (EMIT-BYTE SEGMENT AMOUNT))) + +(DEFINE-INSTRUCTION PSLLDQ-IB + (SEGMENT DST AMOUNT) + (:EMITTER (EMIT-BYTE SEGMENT 102) + (EMIT-BYTE SEGMENT 15) + (EMIT-BYTE SEGMENT 115) + (EMIT-EA SEGMENT DST 7) + (EMIT-BYTE SEGMENT AMOUNT))) + +(DEFINE-INSTRUCTION PSLLQ-IB + (SEGMENT DST AMOUNT) + (:EMITTER (EMIT-BYTE SEGMENT 102) + (EMIT-BYTE SEGMENT 15) + (EMIT-BYTE SEGMENT 115) + (EMIT-EA SEGMENT DST 6) + (EMIT-BYTE SEGMENT AMOUNT))) + +(DEFINE-INSTRUCTION PSLLW-IB + (SEGMENT DST AMOUNT) + (:EMITTER (EMIT-BYTE SEGMENT 102) + (EMIT-BYTE SEGMENT 15) + (EMIT-BYTE SEGMENT 113) + (EMIT-EA SEGMENT DST 6) + (EMIT-BYTE SEGMENT AMOUNT))) + +(DEFINE-INSTRUCTION PSRAD-IB + (SEGMENT DST AMOUNT) + (:EMITTER (EMIT-BYTE SEGMENT 102) + (EMIT-BYTE SEGMENT 15) + (EMIT-BYTE SEGMENT 114) + (EMIT-EA SEGMENT DST 4) + (EMIT-BYTE SEGMENT AMOUNT))) + +(DEFINE-INSTRUCTION PSRAW-IB + (SEGMENT DST AMOUNT) + (:EMITTER (EMIT-BYTE SEGMENT 102) + (EMIT-BYTE SEGMENT 15) + (EMIT-BYTE SEGMENT 113) + (EMIT-EA SEGMENT DST 4) + (EMIT-BYTE SEGMENT AMOUNT))) + +(DEFINE-INSTRUCTION PSRLD-IB + (SEGMENT DST AMOUNT) + (:EMITTER (EMIT-BYTE SEGMENT 102) + (EMIT-BYTE SEGMENT 15) + (EMIT-BYTE SEGMENT 114) + (EMIT-EA SEGMENT DST 2) + (EMIT-BYTE SEGMENT AMOUNT))) + +(DEFINE-INSTRUCTION PSRLDQ-IB + (SEGMENT DST AMOUNT) + (:EMITTER (EMIT-BYTE SEGMENT 102) + (EMIT-BYTE SEGMENT 15) + (EMIT-BYTE SEGMENT 115) + (EMIT-EA SEGMENT DST 3) + (EMIT-BYTE SEGMENT AMOUNT))) + +(DEFINE-INSTRUCTION PSRLQ-IB + (SEGMENT DST AMOUNT) + (:EMITTER (EMIT-BYTE SEGMENT 102) + (EMIT-BYTE SEGMENT 15) + (EMIT-BYTE SEGMENT 115) + (EMIT-EA SEGMENT DST 2) + (EMIT-BYTE SEGMENT AMOUNT))) + +(DEFINE-INSTRUCTION PSRLW-IB + (SEGMENT DST AMOUNT) + (:EMITTER (EMIT-BYTE SEGMENT 102) + (EMIT-BYTE SEGMENT 15) + (EMIT-BYTE SEGMENT 113) + (EMIT-EA SEGMENT DST 2) + (EMIT-BYTE SEGMENT AMOUNT)))