code beautification
parent
a10fa68218
commit
248066c710
|
@ -476,7 +476,7 @@ M: x86 %compare-vector-ccs
|
|||
{ vcc-notall [ dst mask CMP dst temp \ CMOVNE (%boolean) ] }
|
||||
} case ;
|
||||
|
||||
: %move-vector-mask* ( dst src rep -- mask )
|
||||
: (%move-vector-mask) ( dst src rep -- mask )
|
||||
{
|
||||
{ double-2-rep [ MOVMSKPS HEX: f ] }
|
||||
{ float-4-rep [ MOVMSKPS HEX: f ] }
|
||||
|
@ -484,7 +484,7 @@ M: x86 %compare-vector-ccs
|
|||
} case ;
|
||||
|
||||
M: x86 %move-vector-mask ( dst src rep -- )
|
||||
%move-vector-mask* drop ;
|
||||
(%move-vector-mask) drop ;
|
||||
|
||||
M: x86 %move-vector-mask-reps
|
||||
{
|
||||
|
@ -493,7 +493,7 @@ M: x86 %move-vector-mask-reps
|
|||
} available-reps ;
|
||||
|
||||
M:: x86 %test-vector ( dst src temp rep vcc -- )
|
||||
dst src rep %move-vector-mask* :> mask
|
||||
dst src rep (%move-vector-mask) :> mask
|
||||
dst temp mask vcc %test-vector-mask ;
|
||||
|
||||
:: %test-vector-mask-branch ( label temp mask vcc -- )
|
||||
|
@ -505,7 +505,7 @@ M:: x86 %test-vector ( dst src temp rep vcc -- )
|
|||
} case ;
|
||||
|
||||
M:: x86 %test-vector-branch ( label src temp rep vcc -- )
|
||||
temp src rep %move-vector-mask* :> mask
|
||||
temp src rep (%move-vector-mask) :> mask
|
||||
label temp mask vcc %test-vector-mask-branch ;
|
||||
|
||||
M: x86 %test-vector-reps
|
||||
|
|
|
@ -88,16 +88,22 @@ GENERIC: (bit-count) ( x -- n )
|
|||
|
||||
: fixnum-bit-count ( x -- n )
|
||||
{ fixnum } declare
|
||||
[ byte-bit-count ] keep
|
||||
[ -8 shift byte-bit-count + ] keep
|
||||
[ -16 shift byte-bit-count + ] keep
|
||||
[ -24 shift byte-bit-count + ] keep
|
||||
{
|
||||
[ byte-bit-count ]
|
||||
[ -8 shift byte-bit-count + ]
|
||||
[ -16 shift byte-bit-count + ]
|
||||
[ -24 shift byte-bit-count + ]
|
||||
[
|
||||
cell 8 = [
|
||||
[ -32 shift byte-bit-count + ] keep
|
||||
[ -40 shift byte-bit-count + ] keep
|
||||
[ -48 shift byte-bit-count + ] keep
|
||||
-56 shift byte-bit-count + >fixnum
|
||||
] [ drop ] if ;
|
||||
{
|
||||
[ -32 shift byte-bit-count + ]
|
||||
[ -40 shift byte-bit-count + ]
|
||||
[ -48 shift byte-bit-count + ]
|
||||
[ -56 shift byte-bit-count + ]
|
||||
} cleave >fixnum
|
||||
] [ drop ] if
|
||||
]
|
||||
} cleave ;
|
||||
|
||||
M: fixnum (bit-count)
|
||||
fixnum-bit-count { fixnum } declare ; inline
|
||||
|
|
|
@ -115,7 +115,6 @@ SYNTAX: SIMD-INTRINSIC::
|
|||
[ [ >rep-array ] [ rep-length ] bi ] dip unrolled-map-unsafe underlying>> ; inline
|
||||
: components-2map ( a b rep quot -- c )
|
||||
[ [ 2>rep-array ] [ rep-length ] bi ] dip unrolled-2map-unsafe underlying>> ; inline
|
||||
! XXX
|
||||
: components-reduce ( a rep quot -- x )
|
||||
[ >rep-array [ ] ] dip map-reduce ; inline
|
||||
|
||||
|
@ -125,7 +124,6 @@ SYNTAX: SIMD-INTRINSIC::
|
|||
: bitwise-components-2map ( a b rep quot -- c )
|
||||
[ >bitwise-vector-rep [ 2>rep-array ] [ rep-length ] bi ] dip
|
||||
unrolled-2map-unsafe underlying>> ; inline
|
||||
! XXX
|
||||
: bitwise-components-reduce ( a rep quot -- x )
|
||||
[ >bitwise-vector-rep >rep-array [ ] ] dip map-reduce ; inline
|
||||
: bitwise-components-reduce* ( a rep identity quot -- x )
|
||||
|
@ -282,15 +280,12 @@ SIMD-INTRINSIC: (simd-vpack-unsigned) ( a b rep -- c )
|
|||
[ [ 2>rep-array cord-append ] [ rep-length 2 * ] bi ]
|
||||
[ narrow-vector-rep >uint-vector-rep [ <rep-array> ] [ rep-component-type ] bi ] bi
|
||||
'[ _ c:c-type-clamp ] swap unrolled-map-as-unsafe underlying>> ;
|
||||
! XXX
|
||||
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>> ;
|
||||
! XXX
|
||||
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>> ;
|
||||
! XXX
|
||||
SIMD-INTRINSIC: (simd-with) ( n rep -- v )
|
||||
[ rep-length swap '[ _ ] ] [ <rep-array> ] bi replicate-as
|
||||
underlying>> ;
|
||||
|
|
|
@ -236,12 +236,12 @@ M: simd-128 vany?
|
|||
dup simd-rep [ (simd-vany?) ] [ call-next-method ] v->x-op ; inline
|
||||
M: simd-128 vall?
|
||||
dup simd-rep [ (simd-vall?) ] [ call-next-method ] v->x-op ; inline
|
||||
M: simd-128 vnone?
|
||||
dup simd-rep [ (simd-vnone?) ] [ call-next-method ] v->x-op ; inline
|
||||
M: simd-128 vcount
|
||||
dup simd-rep
|
||||
[ [ (simd-vgetmask) assert-positive ] [ call-next-method ] v->x-op ]
|
||||
[ mask>count ] bi ; inline
|
||||
M: simd-128 vnone?
|
||||
dup simd-rep [ (simd-vnone?) ] [ call-next-method ] v->x-op ; inline
|
||||
|
||||
! SIMD high-level specializations
|
||||
|
||||
|
|
Loading…
Reference in New Issue