1 USING: cpu.architecture math.vectors.simd
2 math.vectors.simd.intrinsics accessors math.vectors.simd.alien
3 kernel classes.struct tools.test compiler sequences byte-arrays
4 alien math kernel.private specialized-arrays combinators ;
5 SPECIALIZED-ARRAY: float
6 IN: math.vectors.simd.alien.tests
8 ! Vector alien intrinsics
9 [ float-4{ 1 2 3 4 } ] [
12 underlying>> 0 float-4-rep alien-vector
13 ] compile-call float-4 boa
16 [ B{ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 } ] [
17 16 [ 1 ] B{ } replicate-as 16 <byte-array>
20 { byte-array c-ptr fixnum } declare
21 float-4-rep set-alien-vector
26 [ float-array{ 1 2 3 4 } ] [
28 float-array{ 1 2 3 4 } underlying>>
29 float-array{ 4 3 2 1 } clone
30 [ underlying>> 0 float-4-rep set-alien-vector ] keep
40 [ t ] [ [ simd-struct <struct> ] compile-call >c-ptr [ 0 = ] all? ] unit-test
46 float-8{ 1 2 3 4 5 6 7 8 }
49 float-4{ 1 2 3 4 } >>x
51 double-4{ 4 3 2 1 } >>z
52 float-8{ 1 2 3 4 5 6 7 8 } >>w
53 { [ x>> ] [ y>> ] [ z>> ] [ w>> ] } cleave
60 float-8{ 1 2 3 4 5 6 7 8 }
64 float-4{ 1 2 3 4 } >>x
66 double-4{ 4 3 2 1 } >>z
67 float-8{ 1 2 3 4 5 6 7 8 } >>w
68 { [ x>> ] [ y>> ] [ z>> ] [ w>> ] } cleave