         n b' nth-unsafe n 2 * 1 + c' set-nth-unsafe
     ] each
     c' underlying>> ;
-:: (simd-vmerge-tail)      ( a b rep -- c )
+SIMD-INTRINSIC:: (simd-vmerge-tail)      ( a b rep -- c )
     a b rep 2>rep-array :> ( a' b' )
     rep <rep-array> :> c'
     rep rep-length 2 /i :> len

        n 1 + c' set-nth-unsafe
    ] each
    c' underlying>> ;
: (simd-vs+)               ( a b rep -- c )
    dup rep-component-type '[ + _ c-type-clamp ] components-2map ;
: (simd-vs-)               ( a b rep -- c )
    dup rep-component-type '[ - _ c-type-clamp ] components-2map ;
: (simd-vs*)               ( a b rep -- c )
    dup rep-component-type '[ * _ c-type-clamp ] components-2map ;
: (simd-v*)                ( a b rep -- c ) [ * ] components-2map ;
: (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 { char-16-rep uchar-16-rep } member-eq?
    [ uchar-16-rep char-16-rep ]
    [ rep rep ] if :> ( a-rep b-rep )

        n len + b' nth-unsafe n 2 * 1 + c' set-nth-unsafe
    ] each
    c' underlying>> ;
SIMD-INTRINSIC: (simd-v<=)               ( a b rep -- c )
    dup rep-tf-values '[ <= _ _ ? ] components-2map ; 
SIMD-INTRINSIC: (simd-v<)                ( a b rep -- c )
    dup rep-tf-values '[ <  _ _ ? ] components-2map ;
SIMD-INTRINSIC: (simd-v=)                ( a b rep -- c )
    dup rep-tf-values '[ =  _ _ ? ] components-2map ;
SIMD-INTRINSIC: (simd-v>)                ( a b rep -- c )
    dup rep-tf-values '[ >  _ _ ? ] components-2map ;
SIMD-INTRINSIC: (simd-v>=)               ( a b rep -- c )
    dup rep-tf-values '[ >= _ _ ? ] components-2map ;
SIMD-INTRINSIC: (simd-vunordered?)       ( a b rep -- c )
    dup rep-tf-values '[ unordered? _ _ ? ] components-2map ;
SIMD-INTRINSIC: (simd-vany?)             ( a   rep -- ? ) [ bitor  ] bitwise-components-reduce zero? not ;
SIMD-INTRINSIC: (simd-vall?)             ( a   rep -- ? ) [ bitand ] bitwise-components-reduce zero? not ;
SIMD-INTRINSIC: (simd-vnone?)            ( a   rep -- ? ) [ bitor  ] bitwise-components-reduce zero?     ;
SIMD-INTRINSIC: (simd-v>float)           ( a   rep -- c )
    [ >rep-array [ >float ] ] [ >float-vector-rep <rep-array> ] bi map-as underlying>> ;
SIMD-INTRINSIC: (simd-v>integer)         ( a   rep -- c )
    [ >rep-array [ >integer ] ] [ >int-vector-rep <rep-array> ] bi map-as underlying>> ;
SIMD-INTRINSIC: (simd-vpack-signed)      ( a b rep -- c )
    [ 2>rep-array cord-append ]
    [ narrow-vector-rep [ <rep-array> ] [ rep-component-type ] bi ] bi
    '[ _ c-type-clamp ] swap map-as underlying>> ;
SIMD-INTRINSIC: (simd-vpack-unsigned)    ( a b rep -- c )
    [ 2>rep-array cord-append ]
    [ narrow-vector-rep >uint-vector-rep [ <rep-array> ] [ rep-component-type ] bi ] bi
    '[ _ c-type-clamp ] swap map-as underlying>> ;
SIMD-INTRINSIC: (simd-vunpack-head)      ( a   rep -- c ) 
    [ >rep-array ] [ widen-vector-rep [ rep-length ] [ [>rep-array] ] bi ] bi
    [ head-slice ] dip call( a' -- c' ) underlying>> ;
SIMD-INTRINSIC: (simd-vunpack-tail)      ( a   rep -- c )
    [ >rep-array ] [ widen-vector-rep [ rep-length ] [ [>rep-array] ] bi ] bi
    [ tail-slice ] dip call( a' -- c' ) underlying>> ;
SIMD-INTRINSIC: (simd-with)              (   n rep -- v )
    [ rep-length swap '[ _ ] ] [ <rep-array> ] bi replicate-as 
    underlying>> ;
SIMD-INTRINSIC: (simd-gather-2)          ( m n rep -- v ) <rep-array> [ 2 set-firstn ] keep underlying>> ;
SIMD-INTRINSIC: (simd-gather-4)          ( m n o p rep -- v ) <rep-array> [ 4 set-firstn ] keep underlying>> ;
SIMD-INTRINSIC: (simd-select)            ( a n rep -- x ) [ swap ] dip >rep-array nth-unsafe ;

SIMD-INTRINSIC: alien-vector     (       c-ptr n rep -- value )
    [ swap <displaced-alien> ] dip rep-size memory>byte-array ;
SIMD-INTRINSIC: set-alien-vector ( value c-ptr n rep --       )
    [ swap <displaced-alien> swap ] dip rep-size memcpy ;

"compiler.cfg.intrinsics.simd" require
