2009-09-03 03:33:07 -04:00
|
|
|
! Copyright (C) 2009 Slava Pestov.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2009-09-28 07:34:22 -04:00
|
|
|
USING: alien.c-types combinators fry kernel parser math math.parser
|
2009-09-20 17:48:17 -04:00
|
|
|
math.vectors.simd.functor sequences splitting vocabs.generated
|
2009-09-29 05:46:38 -04:00
|
|
|
vocabs.loader vocabs.parser words accessors vocabs compiler.units
|
|
|
|
definitions ;
|
2009-09-23 21:23:25 -04:00
|
|
|
QUALIFIED-WITH: alien.c-types c
|
2009-09-03 03:33:07 -04:00
|
|
|
IN: math.vectors.simd
|
|
|
|
|
2009-09-23 21:23:25 -04:00
|
|
|
ERROR: bad-base-type type ;
|
2009-09-03 03:33:07 -04:00
|
|
|
|
2009-09-20 17:48:17 -04:00
|
|
|
<PRIVATE
|
2009-09-03 03:33:07 -04:00
|
|
|
|
2009-09-23 21:23:25 -04:00
|
|
|
: simd-vocab ( base-type -- vocab )
|
2009-09-28 07:34:22 -04:00
|
|
|
name>> "math.vectors.simd.instances." prepend ;
|
2009-09-03 03:33:07 -04:00
|
|
|
|
2009-09-28 07:34:22 -04:00
|
|
|
: parse-base-type ( c-type -- c-type )
|
|
|
|
dup { c:char c:uchar c:short c:ushort c:int c:uint c:longlong c:ulonglong c:float c:double } memq?
|
|
|
|
[ bad-base-type ] unless ;
|
2009-09-20 17:48:17 -04:00
|
|
|
|
2009-09-29 05:46:38 -04:00
|
|
|
: forget-instances ( -- )
|
|
|
|
[
|
|
|
|
"math.vectors.simd.instances" child-vocabs
|
|
|
|
[ forget-vocab ] each
|
|
|
|
] with-compilation-unit ;
|
|
|
|
|
2009-09-20 17:48:17 -04:00
|
|
|
PRIVATE>
|
|
|
|
|
|
|
|
: define-simd-vocab ( type -- vocab )
|
2009-09-28 17:33:39 -04:00
|
|
|
parse-base-type
|
2009-09-23 21:23:25 -04:00
|
|
|
[ simd-vocab ] keep '[
|
2009-09-28 17:33:39 -04:00
|
|
|
_
|
2009-09-23 21:23:25 -04:00
|
|
|
[ define-simd-128 ]
|
|
|
|
[ define-simd-256 ] bi
|
|
|
|
] generate-vocab ;
|
2009-09-20 17:48:17 -04:00
|
|
|
|
|
|
|
SYNTAX: SIMD:
|
2009-09-28 07:34:22 -04:00
|
|
|
scan-word define-simd-vocab use-vocab ;
|
2009-09-29 05:46:38 -04:00
|
|
|
|