1 IN: math.vectors.simd.alien.tests
2 USING: cpu.architecture math.vectors.simd
3 math.vectors.simd.intrinsics accessors math.vectors.simd.alien
4 kernel classes.struct tools.test compiler sequences byte-arrays
5 alien math kernel.private specialized-arrays.float combinators ;
7 ! Vector alien intrinsics
8 [ float-4{ 1 2 3 4 } ] [
11 underlying>> 0 float-4-rep alien-vector
12 ] compile-call float-4 boa
15 [ B{ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 } ] [
16 16 [ 1 ] B{ } replicate-as 16 <byte-array>
19 { byte-array c-ptr fixnum } declare
20 float-4-rep set-alien-vector
25 [ float-array{ 1 2 3 4 } ] [
27 float-array{ 1 2 3 4 } underlying>>
28 float-array{ 4 3 2 1 } clone
29 [ underlying>> 0 float-4-rep set-alien-vector ] keep
39 [ t ] [ [ simd-struct <struct> ] compile-call >c-ptr [ 0 = ] all? ] unit-test
45 float-8{ 1 2 3 4 5 6 7 8 }
48 float-4{ 1 2 3 4 } >>x
50 double-4{ 4 3 2 1 } >>z
51 float-8{ 1 2 3 4 5 6 7 8 } >>w
52 { [ x>> ] [ y>> ] [ z>> ] [ w>> ] } cleave
59 float-8{ 1 2 3 4 5 6 7 8 }
63 float-4{ 1 2 3 4 } >>x
65 double-4{ 4 3 2 1 } >>z
66 float-8{ 1 2 3 4 5 6 7 8 } >>w
67 { [ x>> ] [ y>> ] [ z>> ] [ w>> ] } cleave