math.vectors.simd.intrinsics: fix scalar fallback for (simd-vshuffle2-elements)

db4
Joe Groff 2010-05-14 02:47:39 -07:00
parent 2744816209
commit 8f1751cd54
2 changed files with 14 additions and 2 deletions

View File

@ -39,6 +39,7 @@ CONSTANT: vector>vector-intrinsics
(simd-hlshift)
(simd-hrshift)
(simd-vshuffle-elements)
(simd-vshuffle2-elements)
(simd-vshuffle-bytes)
(simd-vmerge-head)
(simd-vmerge-tail)

View File

@ -119,6 +119,18 @@ IN: math.vectors.simd.intrinsics
] each-index
c' underlying>> ; inline
:: (vshuffle2) ( a b elts rep -- c )
a rep >rep-array :> a'
b rep >rep-array :> b'
a' b' cord-append :> ab'
rep <rep-array> :> c'
elts [| from to |
from rep rep-length dup + 1 - bitand
ab' nth-unsafe
to c' set-nth-unsafe
] each-index
c' underlying>> ; inline
PRIVATE>
: (simd-v+) ( a b rep -- c ) [ + ] components-2map ;
@ -186,8 +198,7 @@ PRIVATE>
: (simd-hrshift) ( a n rep -- c )
drop tail-slice 16 0 pad-tail ;
: (simd-vshuffle-elements) ( a n rep -- c ) [ rep-length 0 pad-tail ] keep (vshuffle) ;
: (simd-vshuffle2-elements) ( a b n rep -- c )
[ cord-append ] 2dip [ rep-length 0 pad-tail ] keep (vshuffle) ;
: (simd-vshuffle2-elements) ( a b n rep -- c ) [ rep-length 0 pad-tail ] keep (vshuffle2) ;
: (simd-vshuffle-bytes) ( a b rep -- c ) drop uchar-16-rep (vshuffle) ;
:: (simd-vmerge-head) ( a b rep -- c )
a b rep 2>rep-array :> ( a' b' )