math.vectors.simd: add vcount to the tests
Also add a base case to (approx=) for integer returns. vcount returns an integer even for float vector inputs, but the test machinery isn't smart enough to figure that out and uses (approx=) on the outputs anyway.db4
parent
32b7dc116f
commit
a10fa68218
|
@ -92,6 +92,7 @@ CONSTANT: vector-words
|
||||||
{ vneg { +vector+ -> +vector+ } }
|
{ vneg { +vector+ -> +vector+ } }
|
||||||
{ vtruncate { +vector+ -> +vector+ } }
|
{ vtruncate { +vector+ -> +vector+ } }
|
||||||
{ sum { +vector+ -> +scalar+ } }
|
{ sum { +vector+ -> +scalar+ } }
|
||||||
|
{ vcount { +vector+ -> +scalar+ } }
|
||||||
{ vabs { +vector+ -> +vector+ } }
|
{ vabs { +vector+ -> +vector+ } }
|
||||||
{ vsqrt { +vector+ -> +vector+ } }
|
{ vsqrt { +vector+ -> +vector+ } }
|
||||||
{ vbitand { +vector+ +vector+ -> +vector+ } }
|
{ vbitand { +vector+ +vector+ -> +vector+ } }
|
||||||
|
@ -213,7 +214,7 @@ CONSTANT: vector-words
|
||||||
{ vlshift vrshift v*high v*hs+ } unique assoc-diff ;
|
{ vlshift vrshift v*high v*hs+ } unique assoc-diff ;
|
||||||
|
|
||||||
: boolean-ops ( -- words )
|
: boolean-ops ( -- words )
|
||||||
{ vand vandn vor vxor vnot } ;
|
{ vand vandn vor vxor vnot vcount } ;
|
||||||
|
|
||||||
: remove-boolean-words ( alist -- alist' )
|
: remove-boolean-words ( alist -- alist' )
|
||||||
boolean-ops unique assoc-diff ;
|
boolean-ops unique assoc-diff ;
|
||||||
|
@ -235,6 +236,7 @@ CONSTANT: vector-words
|
||||||
{ [ 2dup [ fp-nan? ] either? ] [ 2drop f ] }
|
{ [ 2dup [ fp-nan? ] either? ] [ 2drop f ] }
|
||||||
{ [ 2dup [ fp-infinity? ] either? ] [ fp-bitwise= ] }
|
{ [ 2dup [ fp-infinity? ] either? ] [ fp-bitwise= ] }
|
||||||
{ [ 2dup [ float? ] both? ] [ -1.e8 ~ ] }
|
{ [ 2dup [ float? ] both? ] [ -1.e8 ~ ] }
|
||||||
|
[ = ]
|
||||||
} cond ;
|
} cond ;
|
||||||
|
|
||||||
: approx= ( x y -- ? )
|
: approx= ( x y -- ? )
|
||||||
|
@ -687,8 +689,6 @@ STRUCT: simd-struct
|
||||||
[ float-4{ 0 0 0 0 } ]
|
[ float-4{ 0 0 0 0 } ]
|
||||||
[ 5.0 float-4{ 1 2 3 4 } float-4{ 4 5 6 7 } 0.0 simd-spill-test-2 ] unit-test
|
[ 5.0 float-4{ 1 2 3 4 } float-4{ 4 5 6 7 } 0.0 simd-spill-test-2 ] unit-test
|
||||||
|
|
||||||
USE: alien
|
|
||||||
|
|
||||||
: callback-1 ( -- c )
|
: callback-1 ( -- c )
|
||||||
c:int { c:int c:int c:int c:int c:int } cdecl [ + + + + ] alien-callback ;
|
c:int { c:int c:int c:int c:int c:int } cdecl [ + + + + ] alien-callback ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue