Changeset 5447


Ignore:
Timestamp:
Nov 3, 2006, 11:38:01 AM (18 years ago)
Author:
Gary Byers
Message:

Change handling of 2d-aref.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/compiler/nx1.lisp

    r5341 r5447  
    791791
    792792(defnx1 nx1-%aref2 ((%aref2)) (&whole whole &environment env arr i j)
    793   ;; For now, we only care about the (simple-array double-float (* *)) case.
    794   (let* ((subtype
    795           (cond ((nx-form-typep arr '(simple-array double-float (* *)) env)
    796                  :double-float-vector)
    797                 ((nx-form-typep arr '(simple-array single-float (* *)) env)
    798                  :single-float-vector))))
    799     (if subtype
    800       (let* ((ctype (specifier-type (nx-form-type arr env)))
    801              (dims (array-ctype-dimensions ctype))
    802              (dim0 (car dims))
    803              (dim1 (cadr dims)))
    804         (make-acode (%nx1-operator aref2)
    805                     (nx1-form subtype)
    806                     (nx1-form arr)
    807                     (nx1-form i)
    808                     (nx1-form j)
    809                     (nx1-form (if (typep dim0 'fixnum) dim0))
    810                     (nx1-form (if (typep dim1 'fixnum) dim1))))
    811         (nx1-treat-as-call whole))))
     793  (let* ((arch (backend-target-arch *target-backend*))
     794         (ctype (specifier-type (nx-form-type arr env)))
     795         (atype (if (csubtypep ctype (specifier-type '(array * (* *)))) ctype))
     796         (simple-atype (if (and atype
     797                                (csubtypep atype (specifier-type '(simple-array * (* *)))))
     798                         atype))
     799         (type-keyword (if atype
     800                         (funcall
     801                          (arch::target-array-type-name-from-ctype-function arch)
     802                          atype))))
     803    (if (and type-keyword simple-atype)
     804      (let* ((dims (array-ctype-dimensions atype))
     805             (dim0 (car dims))
     806             (dim1 (cadr dims)))
     807        (make-acode (%nx1-operator simple-typed-aref2)
     808                    (nx1-form type-keyword)
     809                    (nx1-form arr)
     810                    (nx1-form i)
     811                    (nx1-form j)
     812                    (nx1-form (if (typep dim0 'fixnum) dim0))
     813                    (nx1-form (if (typep dim1 'fixnum) dim1))))
     814      (make-acode (%nx1-operator general-aref2)
     815                  (nx1-form arr)
     816                  (nx1-form i)
     817                  (nx1-form j)))))
    812818
    813819(defun nx1-1d-vset (arr newval dim0 env)
Note: See TracChangeset for help on using the changeset viewer.