Changeset 5533
- Timestamp:
- Nov 9, 2006, 9:08:59 AM (18 years ago)
- Location:
- trunk/ccl/compiler
- Files:
-
- 3 edited
-
X86/X8664/x8664-vinsns.lisp (modified) (5 diffs)
-
X86/x862.lisp (modified) (4 diffs)
-
nx1.lisp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/compiler/X86/X8664/x8664-vinsns.lisp
r5512 r5533 3900 3900 (uuo-error-reg-not-type (:%q object) (:$ub type-error)) 3901 3901 :good) 3902 3903 (define-x8664-vinsn trap-unless-simple-array-3 (() 3904 ((object :lisp) 3905 (expected-flags :u32const) 3906 (type-error :u8const)) 3907 ((tag :u8))) 3908 3909 (movb (:%b object) (:%b tag)) 3910 (andb (:$b x8664::tagmask) (:%b tag)) 3911 (cmpb (:$b x8664::tag-misc) (:%b tag)) 3912 (jne :bad) 3913 (cmpb (:$b x8664::subtag-arrayH) (:@ x8664::misc-subtag-offset (:%q object))) 3914 (jne :bad) 3915 (cmpq (:$b (ash 3 x8664::fixnumshift)) (:@ x8664::arrayH.rank (:%q object))) 3916 (jne :bad) 3917 (cmpq (:$l (:apply ash expected-flags x8664::fixnumshift)) (:@ x8664::arrayH.flags (:%q object))) 3918 (je.pt :good) 3919 :bad 3920 (uuo-error-reg-not-type (:%q object) (:$ub type-error)) 3921 :good) 3902 3922 3903 3923 (define-x8664-vinsn trap-unless-array-header (() … … 4084 4104 (j :imm) 4085 4105 (header :lisp))) 4086 (cmpq (:@ (+ x8664::misc-data-offset (* 8 x8664::arrayH.dim0-cell)) (:%q header)) 4087 (:%q i)) 4106 (cmpq (:@ (+ x8664::misc-data-offset (* 8 x8664::arrayH.dim0-cell)) (:%q header)) (:%q i)) 4088 4107 (jb :i-ok) 4089 4108 (uuo-error-array-bounds (:%q i) (:%q header)) … … 4097 4116 (sarq (:$ub x8664::fixnumshift) (:%q dim))) 4098 4117 4118 ;;; Return dim1, dim2 (unboxed) 4119 (define-x8664-vinsn check-3d-bound (((dim1 :u64) 4120 (dim2 :u64)) 4121 ((i :imm) 4122 (j :imm) 4123 (k :imm) 4124 (header :lisp))) 4125 (cmpq (:@ (+ x8664::misc-data-offset (* 8 x8664::arrayH.dim0-cell)) (:%q header)) (:%q i)) 4126 (jb :i-ok) 4127 (uuo-error-array-bounds (:%q i) (:%q header)) 4128 :i-ok 4129 (movq (:@ (+ x8664::misc-data-offset (* 8 (1+ x8664::arrayH.dim0-cell))) (:%q header)) (:%q dim1)) 4130 (cmpq (:%q dim1) (:%q j)) 4131 (jb :j-ok) 4132 (uuo-error-array-bounds (:%q j) (:%q header)) 4133 :j-ok 4134 (sarq (:$ub x8664::fixnumshift) (:%q dim1)) 4135 (movq (:@ (+ x8664::misc-data-offset (* 8 (+ 2 x8664::arrayH.dim0-cell))) (:%q header)) (:%q dim2)) 4136 (cmpq (:%q dim2) (:%q k)) 4137 (jb ::k-ok) 4138 (uuo-error-array-bounds (:%q k) (:%q header)) 4139 :k-ok 4140 (sarq (:$ub x8664::fixnumshift) (:%q dim2))) 4141 4142 4099 4143 (define-x8664-vinsn 2d-dim1 (((dest :u64)) 4100 4144 ((header :lisp))) … … 4104 4148 4105 4149 4150 (define-x8664-vinsn 3d-dims (((dim1 :u64) 4151 (dim2 :u64)) 4152 ((header :lisp))) 4153 (movq (:@ (+ x8664::misc-data-offset (* 8 (1+ x8664::arrayH.dim0-cell))) (:%q header)) (:%q dim1)) 4154 (movq (:@ (+ x8664::misc-data-offset (* 8 (+ 2 x8664::arrayH.dim0-cell))) (:%q header)) (:%q dim2)) 4155 (sarq (:$ub x8664::fixnumshift) (:%q dim1)) 4156 (sarq (:$ub x8664::fixnumshift) (:%q dim2))) 4157 4106 4158 (define-x8664-vinsn 2d-unscaled-index (((dest :imm) 4107 4159 (dim1 :u64)) … … 4112 4164 (imulq (:%q i) (:%q dim1)) 4113 4165 (leaq (:@ (:%q j) (:%q dim1)) (:%q dest))) 4166 4167 4168 ;; dest <- (+ (* i dim1 dim2) (* j dim2) k) 4169 (define-x8664-vinsn 3d-unscaled-index (((dest :imm) 4170 (dim1 :u64) 4171 (dim2 :u64)) 4172 ((dim1 :u64) 4173 (dim2 :u64) 4174 (i :imm) 4175 (j :imm) 4176 (k :imm))) 4177 (imulq (:%q dim1) (:%q dim2)) 4178 (imulq (:%q j) (:%q dim1)) 4179 (imulq (:%q i) (:%q dim2)) 4180 (addq (:%q dim1) (:%q dim2)) 4181 (leaq (:@ (:%q k) (:%q dim2)) (:%q dest))) 4114 4182 4115 4183 (define-x8664-vinsn branch-unless-both-args-fixnums (() -
trunk/ccl/compiler/X86/x862.lisp
r5515 r5533 1675 1675 (x862-vset1 seg vreg xfer type-keyword v idx-reg constidx val-reg (x862-unboxed-reg-for-aset seg type-keyword val-reg safe constval) constval needs-memoization)))))))) 1676 1676 1677 1677 1678 (defun x862-aset3 (seg vreg xfer array i j k new safe type-keyword dim0 dim1 dim2) 1679 (with-x86-local-vinsn-macros (seg target) 1680 (let* ((i-known-fixnum (acode-fixnum-form-p i)) 1681 (j-known-fixnum (acode-fixnum-form-p j)) 1682 (k-known-fixnum (acode-fixnum-form-p k)) 1683 (arch (backend-target-arch *target-backend*)) 1684 (is-node (member type-keyword (arch::target-gvector-types arch))) 1685 (constval (x862-constant-value-ok-for-type-keyword type-keyword new)) 1686 (needs-memoization (and is-node (x862-acode-needs-memoization new))) 1687 (src) 1688 (unscaled-i) 1689 (unscaled-j) 1690 (unscaled-k) 1691 (val-reg (x862-target-reg-for-aset vreg type-keyword)) 1692 (constidx 1693 (and dim0 dim1 dim2 i-known-fixnum j-known-fixnum k-known-fixnum 1694 (>= i-known-fixnum 0) 1695 (>= j-known-fixnum 0) 1696 (>= k-known-fixnum 0) 1697 (< i-known-fixnum dim0) 1698 (< j-known-fixnum dim1) 1699 (< k-known-fixnum dim2) 1700 (+ (* i-known-fixnum dim1 dim2) 1701 (* j-known-fixnum dim2) 1702 k-known-fixnum)))) 1703 (progn 1704 (if constidx 1705 (multiple-value-setq (src val-reg) 1706 (x862-two-targeted-reg-forms seg array ($ x8664::temp0) new val-reg)) 1707 (progn 1708 (setq src ($ x8664::temp1) 1709 unscaled-i ($ x8664::temp0) 1710 unscaled-j ($ x8664::arg_x) 1711 unscaled-k ($ x8664::arg_y)) 1712 (x862-push-register 1713 seg 1714 (x862-one-untargeted-reg-form seg array ($ x8664::arg_z))) 1715 (x862-four-targeted-reg-forms seg 1716 i ($ x8664::temp0) 1717 j ($ x8664::arg_x) 1718 k ($ x8664::arg_y) 1719 new val-reg) 1720 (x862-pop-register seg src))) 1721 (when safe 1722 (when (typep safe 'fixnum) 1723 (! trap-unless-simple-array-3 1724 src 1725 (dpb safe target::arrayH.flags-cell-subtag-byte 1726 (ash 1 $arh_simple_bit)) 1727 (nx-error-for-simple-3d-array-type type-keyword))) 1728 (unless i-known-fixnum 1729 (! trap-unless-fixnum unscaled-i)) 1730 (unless j-known-fixnum 1731 (! trap-unless-fixnum unscaled-j)) 1732 (unless k-known-fixnum 1733 (! trap-unless-fixnum unscaled-k))) 1734 (with-imm-target () dim1 1735 (with-imm-target (dim1) dim2 1736 (let* ((idx-reg ($ x8664::arg_y))) 1737 (unless constidx 1738 (if safe 1739 (! check-3d-bound dim1 dim2 unscaled-i unscaled-j unscaled-k src) 1740 (! 3d-dims dim1 dim2 src)) 1741 (! 3d-unscaled-index idx-reg dim1 dim2 unscaled-i unscaled-j unscaled-k)) 1742 (let* ((v ($ x8664::arg_x))) 1743 (! array-data-vector-ref v src) 1744 (x862-vset1 seg vreg xfer type-keyword v idx-reg constidx val-reg (x862-unboxed-reg-for-aset seg type-keyword val-reg safe constval) constval needs-memoization))))))))) 1745 1746 1678 1747 (defun x862-aref2 (seg vreg xfer array i j safe typekeyword &optional dim0 dim1) 1679 1748 (with-x86-local-vinsn-macros (seg vreg xfer) … … 1718 1787 (! array-data-vector-ref v src) 1719 1788 (x862-vref1 seg vreg xfer typekeyword v idx-reg constidx))))))) 1789 1790 (defun x862-aref3 (seg vreg xfer array i j k safe typekeyword &optional dim0 dim1 dim2) 1791 (with-x86-local-vinsn-macros (seg vreg xfer) 1792 (let* ((i-known-fixnum (acode-fixnum-form-p i)) 1793 (j-known-fixnum (acode-fixnum-form-p j)) 1794 (k-known-fixnum (acode-fixnum-form-p k)) 1795 (src) 1796 (unscaled-i) 1797 (unscaled-j) 1798 (unscaled-k) 1799 (constidx 1800 (and dim0 dim1 i-known-fixnum j-known-fixnum k-known-fixnum 1801 (>= i-known-fixnum 0) 1802 (>= j-known-fixnum 0) 1803 (>= k-known-fixnum 0) 1804 (< i-known-fixnum dim0) 1805 (< j-known-fixnum dim1) 1806 (< k-known-fixnum dim2) 1807 (+ (* i-known-fixnum dim1 dim2) 1808 (* j-known-fixnum dim2) 1809 k-known-fixnum)))) 1810 (if constidx 1811 (setq src (x862-one-targeted-reg-form seg array ($ x8664::arg_z))) 1812 (multiple-value-setq (src unscaled-i unscaled-j unscaled-k) 1813 (x862-four-untargeted-reg-forms seg 1814 array x8664::temp0 1815 i x8664::arg_x 1816 j x8664::arg_y 1817 k x8664::arg_z))) 1818 (when safe 1819 (when (typep safe 'fixnum) 1820 (! trap-unless-simple-array-3 1821 src 1822 (dpb safe target::arrayH.flags-cell-subtag-byte 1823 (ash 1 $arh_simple_bit)) 1824 (nx-error-for-simple-3d-array-type typekeyword))) 1825 (unless i-known-fixnum 1826 (! trap-unless-fixnum unscaled-i)) 1827 (unless j-known-fixnum 1828 (! trap-unless-fixnum unscaled-j)) 1829 (unless k-known-fixnum 1830 (! trap-unless-fixnum unscaled-k))) 1831 (with-node-target (src) idx-reg 1832 (with-imm-target () dim1 1833 (with-imm-target (dim1) dim2 1834 (unless constidx 1835 (if safe 1836 (! check-3d-bound dim1 dim2 unscaled-i unscaled-j unscaled-k src) 1837 (! 3d-dims dim1 dim2 src)) 1838 (! 3d-unscaled-index idx-reg dim1 dim2 unscaled-i unscaled-j unscaled-k)))) 1839 (with-node-target (idx-reg) v 1840 (! array-data-vector-ref v src) 1841 (x862-vref1 seg vreg xfer typekeyword v idx-reg constidx)))))) 1720 1842 1721 1843 … … 7631 7753 j ($ x8664::arg_z)) 7632 7754 (x862-fixed-call-builtin seg vreg xfer nil (subprim-name->offset '.SParef2)))))) 7755 7756 (defx862 x862-%aref3 simple-typed-aref3 (seg vreg xfer typename arr i j k &optional dim0 dim1 dim2) 7757 (if (null vreg) 7758 (progn 7759 (x862-form seg nil nil arr) 7760 (x862-form seg nil nil i) 7761 (x862-form seg nil nil j) 7762 (x862-form seg nil xfer k))) 7763 (let* ((type-keyword (x862-immediate-operand typename)) 7764 (fixtype (nx-lookup-target-uvector-subtag type-keyword )) 7765 (safe (unless *x862-reckless* fixtype)) 7766 (dim0 (acode-fixnum-form-p dim0)) 7767 (dim1 (acode-fixnum-form-p dim1)) 7768 (dim2 (acode-fixnum-form-p dim2))) 7769 (x862-aref3 seg vreg xfer arr i j k safe type-keyword dim0 dim1 dim2))) 7770 7771 7772 (defx862 x862-general-aref3 general-aref3 (seg vreg xfer arr i j k) 7773 (let* ((atype0 (acode-form-type arr t)) 7774 (ctype (if atype0 (specifier-type atype0))) 7775 (atype (if (array-ctype-p ctype) ctype)) 7776 (keyword (and atype 7777 (let* ((dims (array-ctype-dimensions atype))) 7778 (and (typep dims 'list) 7779 (= 3 (length dims)))) 7780 (not (array-ctype-complexp atype)) 7781 (funcall 7782 (arch::target-array-type-name-from-ctype-function 7783 (backend-target-arch *target-backend*)) 7784 atype)))) 7785 (cond (keyword 7786 (let* ((dims (array-ctype-dimensions atype)) 7787 (dim0 (car dims)) 7788 (dim1 (cadr dims)) 7789 (dim2 (caddr dims))) 7790 (x862-aref3 seg 7791 vreg 7792 xfer 7793 arr 7794 i 7795 j 7796 k 7797 (if *x862-reckless* 7798 *nx-nil* 7799 (nx-lookup-target-uvector-subtag keyword )) 7800 keyword ;(make-acode (%nx1-operator immediate) ) 7801 (if (typep dim0 'fixnum) dim0) 7802 (if (typep dim1 'fixnum) dim1) 7803 (if (typep dim2 'fixnum) dim2)))) 7804 (t 7805 (x862-four-targeted-reg-forms seg 7806 arr ($ x8664::temp0) 7807 i ($ x8664::arg_x) 7808 j ($ x8664::arg_y) 7809 k ($ x8664::arg_z)) 7810 (x862-fixed-call-builtin seg vreg xfer nil (subprim-name->offset '.SParef3)))))) 7633 7811 7634 7812 (defx862 x862-general-aset2 general-aset2 (seg vreg xfer arr i j new) … … 7666 7844 new ($ x8664::arg_z)) 7667 7845 (x862-fixed-call-builtin seg vreg xfer nil (subprim-name->offset '.SPaset2)))))) 7846 7847 (defx862 x862-general-aset3 general-aset3 (seg vreg xfer arr i j k new) 7848 (let* ((atype0 (acode-form-type arr t)) 7849 (ctype (if atype0 (specifier-type atype0))) 7850 (atype (if (array-ctype-p ctype) ctype)) 7851 (keyword (and atype 7852 (let* ((dims (array-ctype-dimensions atype))) 7853 (unless (atom dims) 7854 (= 3 (length dims)))) 7855 (not (array-ctype-complexp atype)) 7856 (funcall 7857 (arch::target-array-type-name-from-ctype-function 7858 (backend-target-arch *target-backend*)) 7859 atype)))) 7860 (cond (keyword 7861 (let* ((dims (array-ctype-dimensions atype)) 7862 (dim0 (car dims)) 7863 (dim1 (cadr dims)) 7864 (dim2 (caddr dims))) 7865 (x862-aset3 seg 7866 vreg 7867 xfer 7868 arr 7869 i 7870 j 7871 k 7872 new 7873 (unless *x862-reckless* 7874 (nx-lookup-target-uvector-subtag keyword )) 7875 keyword 7876 (if (typep dim0 'fixnum) dim0) 7877 (if (typep dim1 'fixnum) dim1) 7878 (if (typep dim2 'fixnum) dim2)))) 7879 (t 7880 (x862-push-register seg (x862-one-untargeted-reg-form seg arr ($ x8664::arg_z))) 7881 (x862-four-targeted-reg-forms seg 7882 i ($ x8664::temp0) 7883 j ($ x8664::arg_x) 7884 k ($ x8664::arg_y) 7885 new ($ x8664::arg_z)) 7886 (x862-pop-register seg ($ x8664::temp1)) 7887 (x862-fixed-call-builtin seg vreg xfer nil (subprim-name->offset '.SParef3)))))) 7668 7888 7669 7889 -
trunk/ccl/compiler/nx1.lisp
r5498 r5533 817 817 (nx1-form j))))) 818 818 819 (defnx1 nx1-%aref3 ((%aref3)) (&whole whole &environment env arr i j k) 820 (let* ((arch (backend-target-arch *target-backend*)) 821 (ctype (specifier-type (nx-form-type arr env))) 822 (atype (if (csubtypep ctype (specifier-type '(array * (* * *)))) ctype)) 823 (simple-atype (if (and atype 824 (csubtypep atype (specifier-type '(simple-array * (* * *))))) 825 atype)) 826 (type-keyword (if atype 827 (funcall 828 (arch::target-array-type-name-from-ctype-function arch) 829 atype)))) 830 (if (and type-keyword simple-atype) 831 (let* ((dims (array-ctype-dimensions atype)) 832 (dim0 (car dims)) 833 (dim1 (cadr dims)) 834 (dim2 (caddr dims))) 835 (make-acode (%nx1-operator simple-typed-aref3) 836 (nx1-form type-keyword) 837 (nx1-form arr) 838 (nx1-form i) 839 (nx1-form j) 840 (nx1-form k) 841 (nx1-form (if (typep dim0 'fixnum) dim0)) 842 (nx1-form (if (typep dim1 'fixnum) dim1)) 843 (nx1-form (if (typep dim2 'fixnum) dim2)))) 844 (make-acode (%nx1-operator general-aref3) 845 (nx1-form arr) 846 (nx1-form i) 847 (nx1-form j) 848 (nx1-form k))))) 849 819 850 (defun nx1-1d-vset (arr newval dim0 env) 820 851 (let* ((simple-vector-p (nx-form-typep arr 'simple-vector env)) … … 885 916 (nx1-form i) 886 917 (nx1-form j) 918 (nx1-form new))))) 919 920 (defnx1 nx1-%aset3 ((%aset3)) (&whole whole &environment env arr i j k new) 921 (let* ((arch (backend-target-arch *target-backend*)) 922 (ctype (specifier-type (nx-form-type arr env))) 923 (atype (if (csubtypep ctype (specifier-type '(array * (* * *)))) ctype)) 924 (simple-atype (if (and atype 925 (csubtypep atype (specifier-type '(simple-array * (* * *))))) 926 atype)) 927 (type-keyword (if atype 928 (funcall 929 (arch::target-array-type-name-from-ctype-function arch) 930 atype)))) 931 932 (if (and type-keyword simple-atype) 933 (let* ((dims (array-ctype-dimensions atype)) 934 (dim0 (car dims)) 935 (dim1 (cadr dims)) 936 (dim2 (caddr dims))) 937 (make-acode (%nx1-operator simple-typed-aset3) 938 (nx1-form type-keyword) 939 (nx1-form arr) 940 (nx1-form i) 941 (nx1-form j) 942 (nx1-form k) 943 (nx1-form new) 944 (nx1-form (if (typep dim0 'fixnum) dim0)) 945 (nx1-form (if (typep dim1 'fixnum) dim1)) 946 (nx1-form (if (typep dim2 'fixnum) dim2)))) 947 (make-acode (%nx1-operator general-aset3) 948 (nx1-form arr) 949 (nx1-form i) 950 (nx1-form j) 951 (nx1-form k) 887 952 (nx1-form new))))) 888 953
Note:
See TracChangeset
for help on using the changeset viewer.
