Merge branch 'master' of git://factorcode.org/git/factor

db4
Doug Coleman 2009-09-28 17:16:26 -05:00
commit 9b64d206ff
7 changed files with 32 additions and 24 deletions

View File

@ -235,8 +235,13 @@ M:: ppc %box-float ( dst src temp -- )
dst 16 float temp %allot
src dst float-offset STFD ;
: float-function-param ( i spill-slot -- )
[ float-regs param-regs nth 1 ] [ n>> spill@ ] bi* LFD ;
GENERIC: float-function-param* ( dst src -- )
M: spill-slot float-function-param* [ 1 ] dip n>> spill@ LFD ;
M: integer float-function-param* FMR ;
: float-function-param ( i src -- )
[ float-regs param-regs nth ] dip float-function-param* ;
: float-function-return ( reg -- )
float-regs return-reg double-rep %copy ;

View File

@ -618,11 +618,15 @@ ALIAS: PINSRQ PINSRD
: MOVDQA ( dest src -- ) { HEX: 6f HEX: 7f } HEX: 66 2-operand-rm-mr-sse ;
: MOVDQU ( dest src -- ) { HEX: 6f HEX: 7f } HEX: f3 2-operand-rm-mr-sse ;
<PRIVATE
: 2shuffler ( indexes/mask -- mask )
dup integer? [ first2 { 1 0 } bitfield ] unless ;
: 4shuffler ( indexes/mask -- mask )
dup integer? [ first4 { 6 4 2 0 } bitfield ] unless ;
PRIVATE>
: PSHUFD ( dest src imm -- ) 4shuffler HEX: 70 HEX: 66 3-operand-rm-sse ;
: PSHUFLW ( dest src imm -- ) 4shuffler HEX: 70 HEX: f2 3-operand-rm-sse ;
: PSHUFHW ( dest src imm -- ) 4shuffler HEX: 70 HEX: f3 3-operand-rm-sse ;

View File

@ -579,12 +579,12 @@ MACRO: available-reps ( alist -- )
'[ _ cond ] ;
: unsign-rep ( rep -- rep' )
dup {
{
{ uint-4-rep int-4-rep }
{ ulonglong-2-rep longlong-2-rep }
{ ushort-8-rep short-8-rep }
{ uchar-16-rep char-16-rep }
} at* [ nip ] [ drop ] if ;
} ?at drop ;
M:: x86 %broadcast-vector ( dst src rep -- )
rep unsign-rep {
@ -592,22 +592,23 @@ M:: x86 %broadcast-vector ( dst src rep -- )
dst src float-4-rep %copy
dst dst { 0 0 0 0 } SHUFPS
] }
{ double-2-rep [
{ double-2-rep [
dst src MOVDDUP
] }
{ longlong-2-rep [
dst src = [
dst dst PUNPCKLQDQ
] [
dst src { 0 1 0 1 } PSHUFD
] if
dst src =
[ dst dst PUNPCKLQDQ ]
[ dst src { 0 1 0 1 } PSHUFD ]
if
] }
{ int-4-rep [ dst src { 0 0 0 0 } PSHUFD ] }
{ short-8-rep [
{ int-4-rep [
dst src { 0 0 0 0 } PSHUFD
] }
{ short-8-rep [
dst src { 0 0 0 0 } PSHUFLW
dst dst PUNPCKLQDQ
] }
{ char-16-rep [
{ char-16-rep [
dst src char-16-rep %copy
dst dst PUNPCKLBW
dst dst { 0 0 0 0 } PSHUFLW
@ -619,13 +620,7 @@ M: x86 %broadcast-vector-reps
{
! Can't do this with sse1 since it will want to unbox
! a double-precision float and convert to single precision
{ sse2? {
float-4-rep double-2-rep
longlong-2-rep ulonglong-2-rep
int-4-rep uint-4-rep
short-8-rep ushort-8-rep
char-16-rep uchar-16-rep
} }
{ sse2? { float-4-rep double-2-rep longlong-2-rep ulonglong-2-rep int-4-rep uint-4-rep short-8-rep ushort-8-rep char-16-rep uchar-16-rep } }
} available-reps ;
M:: x86 %gather-vector-4 ( dst src1 src2 src3 src4 rep -- )

View File

@ -20,8 +20,9 @@ ERROR: bad-base-type type ;
PRIVATE>
: define-simd-vocab ( type -- vocab )
parse-base-type
[ simd-vocab ] keep '[
_ parse-base-type
_
[ define-simd-128 ]
[ define-simd-256 ] bi
] generate-vocab ;

View File

@ -1,6 +1,7 @@
USING: specialized-arrays sequences.complex
kernel sequences tools.test arrays accessors ;
SPECIALIZED-ARRAY: float
QUALIFIED-WITH: alien.c-types c
SPECIALIZED-ARRAY: c:float
IN: sequences.complex.tests
: test-array ( -- x )

View File

@ -5,7 +5,8 @@ USING: arrays accessors io io.files io.files.temp
io.encodings.binary kernel math math.constants math.functions
math.vectors math.vectors.simd math.parser make sequences
sequences.private words hints classes.struct ;
SIMD: double
QUALIFIED-WITH: alien.c-types c
SIMD: c:double
IN: benchmark.raytracer-simd
! parameters

View File

@ -2,7 +2,8 @@
! See http://factorcode.org/license.txt for BSD license.
USING: kernel io math math.functions math.parser math.vectors
math.vectors.simd sequences specialized-arrays ;
SIMD: float
QUALIFIED-WITH: alien.c-types c
SIMD: c:float
SPECIALIZED-ARRAY: float-4
IN: benchmark.simd-1