code beautification

db4
Joe Groff 2011-11-13 15:45:03 -08:00
parent a10fa68218
commit 248066c710
5 changed files with 77 additions and 76 deletions

View File

@ -476,7 +476,7 @@ M: x86 %compare-vector-ccs
{ vcc-notall [ dst mask CMP dst temp \ CMOVNE (%boolean) ] } { vcc-notall [ dst mask CMP dst temp \ CMOVNE (%boolean) ] }
} case ; } case ;
: %move-vector-mask* ( dst src rep -- mask ) : (%move-vector-mask) ( dst src rep -- mask )
{ {
{ double-2-rep [ MOVMSKPS HEX: f ] } { double-2-rep [ MOVMSKPS HEX: f ] }
{ float-4-rep [ MOVMSKPS HEX: f ] } { float-4-rep [ MOVMSKPS HEX: f ] }
@ -484,7 +484,7 @@ M: x86 %compare-vector-ccs
} case ; } case ;
M: x86 %move-vector-mask ( dst src rep -- ) M: x86 %move-vector-mask ( dst src rep -- )
%move-vector-mask* drop ; (%move-vector-mask) drop ;
M: x86 %move-vector-mask-reps M: x86 %move-vector-mask-reps
{ {
@ -493,7 +493,7 @@ M: x86 %move-vector-mask-reps
} available-reps ; } available-reps ;
M:: x86 %test-vector ( dst src temp rep vcc -- ) 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 ; dst temp mask vcc %test-vector-mask ;
:: %test-vector-mask-branch ( label temp mask vcc -- ) :: %test-vector-mask-branch ( label temp mask vcc -- )
@ -505,7 +505,7 @@ M:: x86 %test-vector ( dst src temp rep vcc -- )
} case ; } case ;
M:: x86 %test-vector-branch ( label src temp rep vcc -- ) 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 ; label temp mask vcc %test-vector-mask-branch ;
M: x86 %test-vector-reps M: x86 %test-vector-reps

View File

@ -88,16 +88,22 @@ GENERIC: (bit-count) ( x -- n )
: fixnum-bit-count ( x -- n ) : fixnum-bit-count ( x -- n )
{ fixnum } declare { fixnum } declare
[ byte-bit-count ] keep {
[ -8 shift byte-bit-count + ] keep [ byte-bit-count ]
[ -16 shift byte-bit-count + ] keep [ -8 shift byte-bit-count + ]
[ -24 shift byte-bit-count + ] keep [ -16 shift byte-bit-count + ]
[ -24 shift byte-bit-count + ]
[
cell 8 = [ cell 8 = [
[ -32 shift byte-bit-count + ] keep {
[ -40 shift byte-bit-count + ] keep [ -32 shift byte-bit-count + ]
[ -48 shift byte-bit-count + ] keep [ -40 shift byte-bit-count + ]
-56 shift byte-bit-count + >fixnum [ -48 shift byte-bit-count + ]
] [ drop ] if ; [ -56 shift byte-bit-count + ]
} cleave >fixnum
] [ drop ] if
]
} cleave ;
M: fixnum (bit-count) M: fixnum (bit-count)
fixnum-bit-count { fixnum } declare ; inline fixnum-bit-count { fixnum } declare ; inline

View File

@ -115,7 +115,6 @@ SYNTAX: SIMD-INTRINSIC::
[ [ >rep-array ] [ rep-length ] bi ] dip unrolled-map-unsafe underlying>> ; inline [ [ >rep-array ] [ rep-length ] bi ] dip unrolled-map-unsafe underlying>> ; inline
: components-2map ( a b rep quot -- c ) : components-2map ( a b rep quot -- c )
[ [ 2>rep-array ] [ rep-length ] bi ] dip unrolled-2map-unsafe underlying>> ; inline [ [ 2>rep-array ] [ rep-length ] bi ] dip unrolled-2map-unsafe underlying>> ; inline
! XXX
: components-reduce ( a rep quot -- x ) : components-reduce ( a rep quot -- x )
[ >rep-array [ ] ] dip map-reduce ; inline [ >rep-array [ ] ] dip map-reduce ; inline
@ -125,7 +124,6 @@ SYNTAX: SIMD-INTRINSIC::
: bitwise-components-2map ( a b rep quot -- c ) : bitwise-components-2map ( a b rep quot -- c )
[ >bitwise-vector-rep [ 2>rep-array ] [ rep-length ] bi ] dip [ >bitwise-vector-rep [ 2>rep-array ] [ rep-length ] bi ] dip
unrolled-2map-unsafe underlying>> ; inline unrolled-2map-unsafe underlying>> ; inline
! XXX
: bitwise-components-reduce ( a rep quot -- x ) : bitwise-components-reduce ( a rep quot -- x )
[ >bitwise-vector-rep >rep-array [ ] ] dip map-reduce ; inline [ >bitwise-vector-rep >rep-array [ ] ] dip map-reduce ; inline
: bitwise-components-reduce* ( a rep identity quot -- x ) : 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 ] [ [ 2>rep-array cord-append ] [ rep-length 2 * ] bi ]
[ narrow-vector-rep >uint-vector-rep [ <rep-array> ] [ rep-component-type ] bi ] bi [ narrow-vector-rep >uint-vector-rep [ <rep-array> ] [ rep-component-type ] bi ] bi
'[ _ c:c-type-clamp ] swap unrolled-map-as-unsafe underlying>> ; '[ _ c:c-type-clamp ] swap unrolled-map-as-unsafe underlying>> ;
! XXX
SIMD-INTRINSIC: (simd-vunpack-head) ( a rep -- c ) SIMD-INTRINSIC: (simd-vunpack-head) ( a rep -- c )
[ >rep-array ] [ widen-vector-rep [ rep-length ] [ [>rep-array] ] bi ] bi [ >rep-array ] [ widen-vector-rep [ rep-length ] [ [>rep-array] ] bi ] bi
[ head-slice ] dip call( a' -- c' ) underlying>> ; [ head-slice ] dip call( a' -- c' ) underlying>> ;
! XXX
SIMD-INTRINSIC: (simd-vunpack-tail) ( a rep -- c ) SIMD-INTRINSIC: (simd-vunpack-tail) ( a rep -- c )
[ >rep-array ] [ widen-vector-rep [ rep-length ] [ [>rep-array] ] bi ] bi [ >rep-array ] [ widen-vector-rep [ rep-length ] [ [>rep-array] ] bi ] bi
[ tail-slice ] dip call( a' -- c' ) underlying>> ; [ tail-slice ] dip call( a' -- c' ) underlying>> ;
! XXX
SIMD-INTRINSIC: (simd-with) ( n rep -- v ) SIMD-INTRINSIC: (simd-with) ( n rep -- v )
[ rep-length swap '[ _ ] ] [ <rep-array> ] bi replicate-as [ rep-length swap '[ _ ] ] [ <rep-array> ] bi replicate-as
underlying>> ; underlying>> ;

View File

@ -236,12 +236,12 @@ M: simd-128 vany?
dup simd-rep [ (simd-vany?) ] [ call-next-method ] v->x-op ; inline dup simd-rep [ (simd-vany?) ] [ call-next-method ] v->x-op ; inline
M: simd-128 vall? M: simd-128 vall?
dup simd-rep [ (simd-vall?) ] [ call-next-method ] v->x-op ; inline 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 M: simd-128 vcount
dup simd-rep dup simd-rep
[ [ (simd-vgetmask) assert-positive ] [ call-next-method ] v->x-op ] [ [ (simd-vgetmask) assert-positive ] [ call-next-method ] v->x-op ]
[ mask>count ] bi ; inline [ mask>count ] bi ; inline
M: simd-128 vnone?
dup simd-rep [ (simd-vnone?) ] [ call-next-method ] v->x-op ; inline
! SIMD high-level specializations ! SIMD high-level specializations