fix ##load-constant/##scalar>vector folding when constant is a fixnum

db4
Joe Groff 2009-10-07 12:46:08 -05:00
parent ea051063a4
commit 47cfb7d3a5
4 changed files with 21 additions and 2 deletions

View File

@ -459,7 +459,7 @@ M: ##shuffle-vector rewrite
value>> over rep>> {
{ float-4-rep [ float>bits 4 >le (fold-scalar>vector) ] }
{ double-2-rep [ double>bits 8 >le (fold-scalar>vector) ] }
[ rep-component-type heap-size >le (fold-scalar>vector) ]
[ [ untag-fixnum ] dip rep-component-type heap-size >le (fold-scalar>vector) ]
} case ;
M: ##scalar>vector rewrite

View File

@ -4,7 +4,7 @@ cpu.architecture tools.test kernel math combinators.short-circuit
accessors sequences compiler.cfg.predecessors locals compiler.cfg.dce
compiler.cfg.ssa.destruction compiler.cfg.loop-detection
compiler.cfg.representations compiler.cfg assocs vectors arrays
layouts namespaces alien ;
layouts literals namespaces alien ;
IN: compiler.cfg.value-numbering.tests
: trim-temps ( insns -- insns )
@ -1215,6 +1215,20 @@ cell 8 = [
} value-numbering-step
] unit-test
[
{
T{ ##load-constant f 0 $[ 55 tag-fixnum ] }
T{ ##load-constant f 1 B{ 55 0 0 0 55 0 0 0 55 0 0 0 55 0 0 0 } }
T{ ##copy f 2 1 any-rep }
}
] [
{
T{ ##load-constant f 0 $[ 55 tag-fixnum ] }
T{ ##scalar>vector f 1 0 int-4-rep }
T{ ##shuffle-vector f 2 1 { 0 0 0 0 } float-4-rep }
} value-numbering-step
] unit-test
[
{
T{ ##load-constant f 0 1.25 }

View File

@ -129,6 +129,8 @@ CONSTANT: simd-classes
[ HEX: ffffffff ] [ HEX: ffffffff [ uint-4-with ] compile-call first ] unit-test
[ HEX: ffffffff ] [ [ HEX: ffffffff uint-4-with ] compile-call first ] unit-test
"== Checking -boa constructors" print
[ { } ] [

View File

@ -27,6 +27,9 @@ SYMBOL: mega-cache-size
: tag-fixnum ( n -- tagged )
tag-bits get shift ;
: untag-fixnum ( n -- tagged )
tag-bits get neg shift ;
! We do this in its own compilation unit so that they can be
! folded below
<<