math.vectors.simd: allow punning SIMD vectors between types
parent
6494e7a53b
commit
e11d1e37f5
|
@ -51,10 +51,15 @@ M: vector-rep emit-unbox
|
||||||
{ [ dup int-rep eq? ] [ drop emit-unbox ] }
|
{ [ dup int-rep eq? ] [ drop emit-unbox ] }
|
||||||
{ [ over int-rep eq? ] [ nip emit-box ] }
|
{ [ over int-rep eq? ] [ nip emit-box ] }
|
||||||
[
|
[
|
||||||
2array {
|
2dup 2array {
|
||||||
{ { double-rep float-rep } [ ##single>double-float ] }
|
{ { double-rep float-rep } [ 2drop ##single>double-float ] }
|
||||||
{ { float-rep double-rep } [ ##double>single-float ] }
|
{ { float-rep double-rep } [ 2drop ##double>single-float ] }
|
||||||
[ first2 bad-conversion ]
|
! Punning SIMD vector types? Naughty naughty! But
|
||||||
|
! it is allowed... otherwise bail out.
|
||||||
|
[
|
||||||
|
drop 2dup [ reg-class-of ] bi@ eq?
|
||||||
|
[ drop ##copy ] [ bad-conversion ] if
|
||||||
|
]
|
||||||
} case
|
} case
|
||||||
]
|
]
|
||||||
} cond ;
|
} cond ;
|
||||||
|
|
|
@ -348,3 +348,14 @@ tools.test compiler.tree.debugger accessors kernel ;
|
||||||
-2.0
|
-2.0
|
||||||
[ { float-8 float } declare v/n ] compile-call
|
[ { float-8 float } declare v/n ] compile-call
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
|
! Test puns
|
||||||
|
[ double-2{ 4 1024 } ] [
|
||||||
|
float-4{ 0 1 0 2 }
|
||||||
|
[ { float-4 } declare dup v+ underlying>> double-2 boa dup v+ ] compile-call
|
||||||
|
] unit-test
|
||||||
|
|
||||||
|
[ 33.0 ] [
|
||||||
|
double-2{ 1 2 } double-2{ 10 20 }
|
||||||
|
[ { double-2 double-2 } declare v+ underlying>> 3.0 float* ] compile-call
|
||||||
|
] unit-test
|
||||||
|
|
Loading…
Reference in New Issue