     [ rep rep ] if :> ( a-rep b-rep )
     b-rep widen-vector-rep signed-rep :> wide-rep
     wide-rep rep-component-type :> wide-type
-    a a-rep >rep-array 2 <groups> :> a'
-    b b-rep >rep-array 2 <groups> :> b'
+    a a-rep byte>rep-array 2 <groups> :> a'
+    b b-rep byte>rep-array 2 <groups> :> b'
     a' b' rep rep-length 2 /i [
         [ [ first  ] bi@ * ]
         [ [ second ] bi@ * ] 2bi +

SIMD-INTRINSIC: (simd-vmax)              ( a b rep -- c ) [ max ] components-2map ;
! XXX
SIMD-INTRINSIC: (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-INTRINSIC: (simd-vsqrt)             ( a   rep -- c ) [ fsqrt ] components-map ;
SIMD-INTRINSIC: (simd-vsad)              ( a b rep -- c ) 2>rep-array [ - abs ] [ + ] 2map-reduce ;
SIMD-INTRINSIC: (simd-sum)               ( a   rep -- n ) [ + ] components-reduce ;
SIMD-INTRINSIC: (simd-vabs)              ( a   rep -- c ) [ abs ] components-map ;
SIMD-INTRINSIC: (simd-vbitand)           ( a b rep -- c ) [ bitand ] bitwise-components-2map ;

        { longlong-2-rep [ double-2-rep ] }
    } case ; foldable

: byte>rep-array ( byte-array rep -- array )
    {
        { char-16-rep      [ 16 c:char <c-direct-array>      ] }
        { uchar-16-rep     [ 16 c:uchar <c-direct-array>     ] }
        { short-8-rep      [  8 c:short <c-direct-array>     ] }
        { ushort-8-rep     [  8 c:ushort <c-direct-array>    ] }
        { int-4-rep        [  4 c:int <c-direct-array>       ] }
        { uint-4-rep       [  4 c:uint <c-direct-array>      ] }
        { longlong-2-rep   [  2 c:longlong <c-direct-array>  ] }
        { ulonglong-2-rep  [  2 c:ulonglong <c-direct-array> ] }
        { float-4-rep      [  4 c:float <c-direct-array>     ] }
        { double-2-rep     [  2 c:double <c-direct-array>    ] }
    } case ; inline

: >rep-array ( seq rep -- array )
    {
        { char-16-rep      [ c:char >c-array      ] }
        { uchar-16-rep     [ c:uchar >c-array     ] }
        { short-8-rep      [ c:short >c-array     ] }
        { ushort-8-rep     [ c:ushort >c-array    ] }
        { int-4-rep        [ c:int >c-array       ] }
        { uint-4-rep       [ c:uint >c-array      ] }
        { longlong-2-rep   [ c:longlong >c-array  ] }
        { ulonglong-2-rep  [ c:ulonglong >c-array ] }
        { float-4-rep      [ c:float >c-array     ] }
        { double-2-rep     [ c:double >c-array    ] }
    } case ; inline

: <rep-array> ( rep -- array )
    {
        { char-16-rep      [ 16 c:char (c-array)      ] }
        { uchar-16-rep     [ 16 c:uchar (c-array)     ] }
        { short-8-rep      [  8 c:short (c-array)     ] }
        { ushort-8-rep     [  8 c:ushort (c-array)    ] }
        { int-4-rep        [  4 c:int (c-array)       ] }
        { uint-4-rep       [  4 c:uint (c-array)      ] }
        { longlong-2-rep   [  2 c:longlong (c-array)  ] }
        { ulonglong-2-rep  [  2 c:ulonglong (c-array) ] }
        { float-4-rep      [  4 c:float (c-array)     ] }
        { double-2-rep     [  2 c:double (c-array)    ] }
    } case ; inline

: rep-tf-values ( rep -- t f )
    float-vector-rep? [ -1 bits>double 0.0 ] [ -1 0 ] if ;

: 2byte>rep-array ( a b rep -- a' b' )
    '[ _ byte>rep-array ] bi@ ; inline

: components-map ( a rep quot -- c )
    [ [ byte>rep-array ] [ rep-length ] bi ] dip unrolled-map-unsafe underlying>> ; inline
: components-2map ( a b rep quot -- c )
    [ [ 2byte>rep-array ] [ rep-length ] bi ] dip unrolled-2map-unsafe underlying>> ; inline
: components-reduce ( a rep quot -- x )
    [ byte>rep-array [ ] ] dip map-reduce ; inline

: bitwise-components-map ( a rep quot -- c )
    [ >bitwise-vector-rep [ byte>rep-array ] [ rep-length ] bi ] dip
    unrolled-map-unsafe underlying>> ; inline
: bitwise-components-2map ( a b rep quot -- c )
    [ >bitwise-vector-rep [ 2byte>rep-array ] [ rep-length ] bi ] dip
    unrolled-2map-unsafe underlying>> ; inline
: bitwise-components-reduce ( a rep quot -- x )
    [ >bitwise-vector-rep byte>rep-array [ ] ] dip map-reduce ; inline
: bitwise-components-reduce* ( a rep identity quot -- x )
    [ >bitwise-vector-rep byte>rep-array ] 2dip reduce ; inline

:: (vshuffle) ( a elts rep -- c )
    a rep byte>rep-array :> a'
    rep <rep-array> :> c'
    elts rep rep-length [| from to |
        from rep rep-length 1 - bitand
