fix simd tests
parent
d412845b41
commit
3e40a36c50
|
@ -392,7 +392,10 @@ PREDICATE: fixnum-vector-rep < int-vector-rep
|
|||
|
||||
: emit-simd-vsad ( node -- )
|
||||
{
|
||||
[ [ ^^sad-vector ] [ widen-vector-rep ^^vector>scalar ] bi ]
|
||||
[
|
||||
[ ^^sad-vector dup { 2 3 0 1 } int-4-rep ^^shuffle-vector-imm int-4-rep ^^add-vector ]
|
||||
[ widen-vector-rep ^^vector>scalar ] bi
|
||||
]
|
||||
} emit-vv-vector-op ;
|
||||
|
||||
: emit-simd-vsqrt ( node -- )
|
||||
|
|
|
@ -1124,12 +1124,11 @@ M: x86 %mul-horizontal-add-vector ( dst src1 src2 rep -- )
|
|||
{ char-16-rep [ PMADDUBSW ] }
|
||||
{ uchar-16-rep [ PMADDUBSW ] }
|
||||
{ short-8-rep [ PMADDWD ] }
|
||||
{ ushort-8-rep [ PMADDWD ] }
|
||||
} case ;
|
||||
|
||||
M: x86 %mul-horizontal-add-vector-reps
|
||||
{
|
||||
{ sse2? { short-8-rep ushort-8-rep } }
|
||||
{ sse2? { short-8-rep } }
|
||||
{ ssse3? { char-16-rep uchar-16-rep } }
|
||||
} available-reps ;
|
||||
|
||||
|
@ -1213,13 +1212,12 @@ M: x86 %dot-vector-reps
|
|||
M: x86 %sad-vector
|
||||
[ two-operand ] keep
|
||||
{
|
||||
{ char-16-rep [ PSADBW ] }
|
||||
{ uchar-16-rep [ PSADBW ] }
|
||||
} case ;
|
||||
|
||||
M: x86 %sad-vector-reps
|
||||
{
|
||||
{ sse2? { char-16-rep uchar-16-rep } }
|
||||
{ sse2? { uchar-16-rep } }
|
||||
} available-reps ;
|
||||
|
||||
M: x86 %horizontal-add-vector ( dst src1 src2 rep -- )
|
||||
|
|
|
@ -145,24 +145,28 @@ PRIVATE>
|
|||
: (simd-v*high) ( a b rep -- c )
|
||||
dup rep-component-type heap-size -8 * '[ * _ shift ] components-2map ;
|
||||
:: (simd-v*hs+) ( a b rep -- c )
|
||||
rep widen-vector-rep signed-rep :> wide-rep
|
||||
rep { char-16-rep uchar-16-rep } member-eq?
|
||||
[ uchar-16-rep char-16-rep ]
|
||||
[ rep rep ] if :> ( a-rep b-rep )
|
||||
b-rep widen-vector-rep signed-rep :> wide-rep
|
||||
wide-rep rep-component-type :> wide-type
|
||||
a rep >rep-array 2 <groups> :> a'
|
||||
b rep >rep-array 2 <groups> :> b'
|
||||
a a-rep >rep-array 2 <groups> :> a'
|
||||
b b-rep >rep-array 2 <groups> :> b'
|
||||
a' b' [
|
||||
[ [ first ] bi@ * ]
|
||||
[ [ second ] bi@ * ] 2bi +
|
||||
wide-type c-type-clamp
|
||||
] wide-rep <rep-array> 2map-as ;
|
||||
] wide-rep <rep-array> 2map-as underlying>> ;
|
||||
: (simd-v/) ( a b rep -- c ) [ / ] components-2map ;
|
||||
: (simd-vavg) ( a b rep -- c ) [ + 2 / ] components-2map ;
|
||||
: (simd-vavg) ( a b rep -- c )
|
||||
[ + dup integer? [ 1 + -1 shift ] [ 0.5 * ] if ] components-2map ;
|
||||
: (simd-vmin) ( a b rep -- c ) [ min ] components-2map ;
|
||||
: (simd-vmax) ( a b rep -- c ) [ max ] components-2map ;
|
||||
: (simd-v.) ( a b rep -- n )
|
||||
[ 2>rep-array [ [ first ] bi@ * ] 2keep ] keep
|
||||
1 swap rep-length [a,b) [ '[ _ swap nth-unsafe ] bi@ * + ] with with each ;
|
||||
: (simd-vsqrt) ( a rep -- c ) [ fsqrt ] components-map ;
|
||||
: (simd-vsad) ( a b rep -- n ) 2>rep-array [ - abs ] [ + ] 2map-reduce ;
|
||||
: (simd-vsad) ( a b rep -- c ) 2>rep-array [ - abs ] [ + ] 2map-reduce ;
|
||||
: (simd-sum) ( a rep -- n ) [ + ] components-reduce ;
|
||||
: (simd-vabs) ( a rep -- c ) [ abs ] components-map ;
|
||||
: (simd-vbitand) ( a b rep -- c ) [ bitand ] bitwise-components-2map ;
|
||||
|
|
|
@ -201,7 +201,7 @@ CONSTANT: vector-words
|
|||
{ vsqrt n/v v/n v/ normalize } unique assoc-diff ;
|
||||
|
||||
: remove-integer-words ( alist -- alist' )
|
||||
{ vlshift vrshift v*high } unique assoc-diff ;
|
||||
{ vlshift vrshift v*high v*hs+ } unique assoc-diff ;
|
||||
|
||||
: boolean-ops ( -- words )
|
||||
{ vand vandn vor vxor vnot } ;
|
||||
|
|
|
@ -273,7 +273,7 @@ M: simd-128 vshuffle ( u perm -- v )
|
|||
vshuffle-bytes ; inline
|
||||
|
||||
M: uchar-16 v*hs+
|
||||
uchar-16-rep [ (simd-v*hs+) ] [ call-next-method ] vv->v-op ushort-8-cast ; inline
|
||||
uchar-16-rep [ (simd-v*hs+) ] [ call-next-method ] vv->v-op short-8-cast ; inline
|
||||
M: ushort-8 v*hs+
|
||||
ushort-8-rep [ (simd-v*hs+) ] [ call-next-method ] vv->v-op uint-4-cast ; inline
|
||||
M: uint-4 v*hs+
|
||||
|
|
Loading…
Reference in New Issue