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

db4
Slava Pestov 2010-05-16 04:10:03 -04:00
commit 8ebecac4d2
6 changed files with 59 additions and 1 deletions

View File

@ -310,6 +310,11 @@ def: dst
use: src1/int-rep src2/int-rep src3/int-rep src4/int-rep use: src1/int-rep src2/int-rep src3/int-rep src4/int-rep
literal: rep ; literal: rep ;
PURE-INSN: ##select-vector
def: dst/int-rep
use: src
literal: n rep ;
PURE-INSN: ##shuffle-vector PURE-INSN: ##shuffle-vector
def: dst def: dst
use: src shuffle use: src shuffle

View File

@ -21,6 +21,7 @@ M: ##gather-vector-2 insn-available? rep>> %gather-vector-2-reps member? ;
M: ##gather-vector-4 insn-available? rep>> %gather-vector-4-reps member? ; M: ##gather-vector-4 insn-available? rep>> %gather-vector-4-reps member? ;
M: ##gather-int-vector-2 insn-available? rep>> %gather-int-vector-2-reps member? ; M: ##gather-int-vector-2 insn-available? rep>> %gather-int-vector-2-reps member? ;
M: ##gather-int-vector-4 insn-available? rep>> %gather-int-vector-4-reps member? ; M: ##gather-int-vector-4 insn-available? rep>> %gather-int-vector-4-reps member? ;
M: ##select-vector insn-available? rep>> %select-vector-reps member? ;
M: ##store-memory-imm insn-available? rep>> %alien-vector-reps member? ; M: ##store-memory-imm insn-available? rep>> %alien-vector-reps member? ;
M: ##shuffle-vector insn-available? rep>> %shuffle-vector-reps member? ; M: ##shuffle-vector insn-available? rep>> %shuffle-vector-reps member? ;
M: ##shuffle-vector-imm insn-available? rep>> %shuffle-vector-imm-reps member? ; M: ##shuffle-vector-imm insn-available? rep>> %shuffle-vector-imm-reps member? ;

View File

@ -303,7 +303,10 @@ PREDICATE: fixnum-vector-rep < int-vector-rep
[ ^^scalar>vector ] keep [ 0 ] dip ^broadcast-vector ; [ ^^scalar>vector ] keep [ 0 ] dip ^broadcast-vector ;
: ^select-vector ( src n rep -- dst ) : ^select-vector ( src n rep -- dst )
[ ^broadcast-vector ] keep ^^vector>scalar ; {
[ ^^select-vector ]
[ [ ^broadcast-vector ] keep ^^vector>scalar ]
} vl-vector-op ;
! intrinsic emitters ! intrinsic emitters

View File

@ -184,6 +184,7 @@ CODEGEN: ##gather-vector-2 %gather-vector-2
CODEGEN: ##gather-vector-4 %gather-vector-4 CODEGEN: ##gather-vector-4 %gather-vector-4
CODEGEN: ##gather-int-vector-2 %gather-int-vector-2 CODEGEN: ##gather-int-vector-2 %gather-int-vector-2
CODEGEN: ##gather-int-vector-4 %gather-int-vector-4 CODEGEN: ##gather-int-vector-4 %gather-int-vector-4
CODEGEN: ##select-vector %select-vector
CODEGEN: ##shuffle-vector-imm %shuffle-vector-imm CODEGEN: ##shuffle-vector-imm %shuffle-vector-imm
CODEGEN: ##shuffle-vector-halves-imm %shuffle-vector-halves-imm CODEGEN: ##shuffle-vector-halves-imm %shuffle-vector-halves-imm
CODEGEN: ##shuffle-vector %shuffle-vector CODEGEN: ##shuffle-vector %shuffle-vector

View File

@ -297,6 +297,7 @@ HOOK: %gather-vector-2 cpu ( dst src1 src2 rep -- )
HOOK: %gather-int-vector-2 cpu ( dst src1 src2 rep -- ) HOOK: %gather-int-vector-2 cpu ( dst src1 src2 rep -- )
HOOK: %gather-vector-4 cpu ( dst src1 src2 src3 src4 rep -- ) HOOK: %gather-vector-4 cpu ( dst src1 src2 src3 src4 rep -- )
HOOK: %gather-int-vector-4 cpu ( dst src1 src2 src3 src4 rep -- ) HOOK: %gather-int-vector-4 cpu ( dst src1 src2 src3 src4 rep -- )
HOOK: %select-vector cpu ( dst src n rep -- )
HOOK: %shuffle-vector cpu ( dst src shuffle rep -- ) HOOK: %shuffle-vector cpu ( dst src shuffle rep -- )
HOOK: %shuffle-vector-imm cpu ( dst src shuffle rep -- ) HOOK: %shuffle-vector-imm cpu ( dst src shuffle rep -- )
HOOK: %shuffle-vector-halves-imm cpu ( dst src1 src2 shuffle rep -- ) HOOK: %shuffle-vector-halves-imm cpu ( dst src1 src2 shuffle rep -- )
@ -354,6 +355,7 @@ HOOK: %gather-vector-2-reps cpu ( -- reps )
HOOK: %gather-int-vector-2-reps cpu ( -- reps ) HOOK: %gather-int-vector-2-reps cpu ( -- reps )
HOOK: %gather-vector-4-reps cpu ( -- reps ) HOOK: %gather-vector-4-reps cpu ( -- reps )
HOOK: %gather-int-vector-4-reps cpu ( -- reps ) HOOK: %gather-int-vector-4-reps cpu ( -- reps )
HOOK: %select-vector-reps cpu ( -- reps )
HOOK: %alien-vector-reps cpu ( -- reps ) HOOK: %alien-vector-reps cpu ( -- reps )
HOOK: %shuffle-vector-reps cpu ( -- reps ) HOOK: %shuffle-vector-reps cpu ( -- reps )
HOOK: %shuffle-vector-imm-reps cpu ( -- reps ) HOOK: %shuffle-vector-imm-reps cpu ( -- reps )
@ -405,6 +407,7 @@ M: object %gather-vector-2-reps { } ;
M: object %gather-int-vector-2-reps { } ; M: object %gather-int-vector-2-reps { } ;
M: object %gather-vector-4-reps { } ; M: object %gather-vector-4-reps { } ;
M: object %gather-int-vector-4-reps { } ; M: object %gather-int-vector-4-reps { } ;
M: object %select-vector-reps { } ;
M: object %alien-vector-reps { } ; M: object %alien-vector-reps { } ;
M: object %shuffle-vector-reps { } ; M: object %shuffle-vector-reps { } ;
M: object %shuffle-vector-imm-reps { } ; M: object %shuffle-vector-imm-reps { } ;

View File

@ -781,6 +781,51 @@ M: x86.64 %gather-int-vector-2-reps
{ sse4.1? { longlong-2-rep ulonglong-2-rep } } { sse4.1? { longlong-2-rep ulonglong-2-rep } }
} available-reps ; } available-reps ;
:: %select-vector-32 ( dst src n rep -- )
rep {
{ char-16-rep [
dst 32-bit-version-of src n PEXTRB
dst dst 8-bit-version-of MOVSX
] }
{ uchar-16-rep [
dst 32-bit-version-of src n PEXTRB
] }
{ short-8-rep [
dst 32-bit-version-of src n PEXTRW
dst dst 16-bit-version-of MOVSX
] }
{ ushort-8-rep [
dst 32-bit-version-of src n PEXTRW
] }
{ int-4-rep [
dst 32-bit-version-of src n PEXTRD
dst dst 32-bit-version-of 2dup = [ 2drop ] [ MOVSX ] if
] }
{ uint-4-rep [
dst 32-bit-version-of src n PEXTRD
] }
} case ;
M: x86.32 %select-vector
%select-vector-32 ;
M: x86.32 %select-vector-reps
{
{ sse4.1? { uchar-16-rep char-16-rep ushort-8-rep short-8-rep uint-4-rep int-4-rep } }
} available-reps ;
M: x86.64 %select-vector
{
{ longlong-2-rep [ PEXTRQ ] }
{ ulonglong-2-rep [ PEXTRQ ] }
[ %select-vector-32 ]
} case ;
M: x86.64 %select-vector-reps
{
{ sse4.1? { uchar-16-rep char-16-rep ushort-8-rep short-8-rep uint-4-rep int-4-rep ulonglong-2-rep longlong-2-rep } }
} available-reps ;
: sse1-float-4-shuffle ( dst shuffle -- ) : sse1-float-4-shuffle ( dst shuffle -- )
{ {
{ { 0 1 2 3 } [ drop ] } { { 0 1 2 3 } [ drop ] }