diff --git a/basis/compiler/cfg/intrinsics/simd/simd.factor b/basis/compiler/cfg/intrinsics/simd/simd.factor index 54f105ca02..5f4b71a846 100644 --- a/basis/compiler/cfg/intrinsics/simd/simd.factor +++ b/basis/compiler/cfg/intrinsics/simd/simd.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: accessors alien alien.c-types byte-arrays fry classes.algebra cpu.architecture kernel math sequences -math.vectors math.vectors.simd math.vectors.simd.private +math.vectors math.vectors.simd.intrinsics macros generalizations combinators combinators.short-circuit arrays locals compiler.tree.propagation.info compiler.cfg.builder.blocks diff --git a/basis/compiler/cfg/value-numbering/simd/simd.factor b/basis/compiler/cfg/value-numbering/simd/simd.factor index 9bb4453313..16d38bc5bb 100644 --- a/basis/compiler/cfg/value-numbering/simd/simd.factor +++ b/basis/compiler/cfg/value-numbering/simd/simd.factor @@ -4,7 +4,7 @@ USING: accessors combinators combinators.short-circuit arrays fry kernel layouts math namespaces sequences cpu.architecture math.bitwise math.order classes vectors locals make alien.c-types io.binary grouping -math.vectors.simd +math.vectors.simd.intrinsics compiler.cfg compiler.cfg.registers compiler.cfg.comparisons diff --git a/basis/compiler/tree/propagation/simd/simd.factor b/basis/compiler/tree/propagation/simd/simd.factor index b71a34e938..679cc09273 100644 --- a/basis/compiler/tree/propagation/simd/simd.factor +++ b/basis/compiler/tree/propagation/simd/simd.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: accessors byte-arrays combinators fry sequences compiler.tree.propagation.info cpu.architecture kernel words math -math.intervals math.vectors.simd math.vectors.simd.private ; +math.intervals math.vectors.simd.intrinsics ; IN: compiler.tree.propagation.simd { diff --git a/basis/cpu/architecture/architecture.factor b/basis/cpu/architecture/architecture.factor index f4d150033b..86d68caa66 100644 --- a/basis/cpu/architecture/architecture.factor +++ b/basis/cpu/architecture/architecture.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2006, 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors arrays assocs generic kernel kernel.private +USING: accessors alien.c-types arrays assocs generic kernel kernel.private math memory namespaces make sequences layouts system hashtables classes alien byte-arrays combinators words sets fry ; IN: cpu.architecture @@ -160,6 +160,9 @@ M: ulonglong-scalar-rep rep-size drop 8 ; GENERIC: rep-component-type ( rep -- n ) +: rep-length ( rep -- n ) + 16 swap rep-component-type heap-size /i ; foldable + ! Methods defined in alien.c-types GENERIC: scalar-rep-of ( rep -- rep' ) diff --git a/basis/math/vectors/simd/simd.factor b/basis/math/vectors/simd/simd.factor index 5d96df8b7f..9265df7343 100644 --- a/basis/math/vectors/simd/simd.factor +++ b/basis/math/vectors/simd/simd.factor @@ -1,18 +1,12 @@ USING: accessors alien.c-types arrays byte-arrays classes combinators cpu.architecture effects fry functors generalizations generic generic.parser kernel lexer literals macros math math.functions -math.vectors math.vectors.private namespaces parser +math.vectors math.vectors.private math.vectors.simd.intrinsics namespaces parser prettyprint.custom quotations sequences sequences.private vocabs vocabs.loader words ; QUALIFIED-WITH: alien.c-types c IN: math.vectors.simd -DEFER: vconvert -DEFER: simd-with -DEFER: simd-boa -DEFER: simd-cast - -ERROR: bad-simd-call word ; ERROR: bad-simd-length got expected ; << @@ -30,68 +24,6 @@ PRIVATE> ) ( a b rep -- c ) \ v> bad-simd-call ; -: (simd-v>=) ( a b rep -- c ) \ v>= bad-simd-call ; -: (simd-vunordered?) ( a b rep -- c ) \ vunordered? bad-simd-call ; -: (simd-vany?) ( a rep -- ? ) \ vany? bad-simd-call ; -: (simd-vall?) ( a rep -- ? ) \ vall? bad-simd-call ; -: (simd-vnone?) ( a rep -- ? ) \ vnone? bad-simd-call ; -: (simd-v>float) ( a rep -- c ) \ vconvert bad-simd-call ; -: (simd-v>integer) ( a rep -- c ) \ vconvert bad-simd-call ; -: (simd-vpack-signed) ( a b rep -- c ) \ vconvert bad-simd-call ; -: (simd-vpack-unsigned) ( a b rep -- c ) \ vconvert bad-simd-call ; -: (simd-vunpack-head) ( a rep -- c ) \ vconvert bad-simd-call ; -: (simd-vunpack-tail) ( a rep -- c ) \ vconvert bad-simd-call ; -: (simd-with) ( n rep -- v ) \ simd-with bad-simd-call ; -: (simd-gather-2) ( m n rep -- v ) \ simd-boa bad-simd-call ; -: (simd-gather-4) ( m n o p rep -- v ) \ simd-boa bad-simd-call ; -: (simd-select) ( a n rep -- n ) \ nth bad-simd-call ; - -PRIVATE> - -: alien-vector ( c-ptr n rep -- value ) \ alien-vector bad-simd-call ; -: set-alien-vector ( value c-ptr n rep -- ) \ set-alien-vector bad-simd-call ; - -> - << A ] unless ; inline M: A hashcode* underlying>> hashcode* ; inline M: A clone [ clone ] change-underlying ; inline M: A length drop N ; inline -M: A nth-unsafe swap \ A-rep (simd-select) ; inline +M: A nth-unsafe + swap { + { 0 [ 0 \ A-rep (simd-select) ] } + { 1 [ 1 \ A-rep (simd-select) ] } + { 2 [ 2 \ A-rep (simd-select) ] } + { 3 [ 3 \ A-rep (simd-select) ] } + { 4 [ 4 \ A-rep (simd-select) ] } + { 5 [ 5 \ A-rep (simd-select) ] } + { 6 [ 6 \ A-rep (simd-select) ] } + { 7 [ 7 \ A-rep (simd-select) ] } + { 8 [ 8 \ A-rep (simd-select) ] } + { 9 [ 9 \ A-rep (simd-select) ] } + { 10 [ 10 \ A-rep (simd-select) ] } + { 11 [ 11 \ A-rep (simd-select) ] } + { 12 [ 12 \ A-rep (simd-select) ] } + { 13 [ 13 \ A-rep (simd-select) ] } + { 14 [ 14 \ A-rep (simd-select) ] } + { 15 [ 15 \ A-rep (simd-select) ] } + } case ; inline M: A c:byte-length drop 16 ; inline M: A new-sequence @@ -353,10 +296,6 @@ SIMD-128: double-2 M: simd-128 vshuffle ( u perm -- v ) vshuffle-bytes ; inline -"compiler.tree.propagation.simd" require -"compiler.cfg.intrinsics.simd" require -"compiler.cfg.value-numbering.simd" require - "mirrors" vocab [ "math.vectors.simd.mirrors" require ] when