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

db4
Doug Coleman 2009-10-07 12:47:44 -05:00
commit 901f87e752
5 changed files with 47 additions and 12 deletions

View File

@ -226,24 +226,40 @@ SYMBOL: phi-mappings
M: ##phi conversions-for-insn
[ , ] [ [ inputs>> values ] [ dst>> ] bi phi-mappings get set-at ] bi ;
! When a literal zero vector is unboxed, we replace the ##load-reference
! with a ##zero-vector instruction since this is more efficient.
! When a literal zeroes/ones vector is unboxed, we replace the ##load-reference
! with a ##zero-vector or ##fill-vector instruction since this is more efficient.
: convert-to-zero-vector? ( insn -- ? )
{
[ dst>> rep-of vector-rep? ]
[ obj>> B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 } = ]
[ obj>> B{ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 } = ]
} 1&& ;
: convert-to-fill-vector? ( insn -- ? )
{
[ dst>> rep-of vector-rep? ]
[ obj>> B{ 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 } = ]
} 1&& ;
: convert-to-zero-vector ( insn -- )
dst>> dup rep-of ##zero-vector ;
: (convert-to-zero/fill-vector) ( insn -- dst rep )
dst>> dup rep-of ; inline
: conversions-for-load-insn ( insn -- ?insn )
{
{
[ dup convert-to-zero-vector? ]
[ (convert-to-zero/fill-vector) ##zero-vector f ]
}
{
[ dup convert-to-fill-vector? ]
[ (convert-to-zero/fill-vector) ##fill-vector f ]
}
[ ]
} cond ;
M: ##load-reference conversions-for-insn
dup convert-to-zero-vector?
[ convert-to-zero-vector ] [ call-next-method ] if ;
conversions-for-load-insn [ call-next-method ] when* ;
M: ##load-constant conversions-for-insn
dup convert-to-zero-vector?
[ convert-to-zero-vector ] [ call-next-method ] if ;
conversions-for-load-insn [ call-next-method ] when* ;
M: vreg-insn conversions-for-insn
[ compute-renaming-set ] [ perform-renaming ] bi ;
@ -312,4 +328,4 @@ PRIVATE>
[ insert-conversions ]
[ ]
} cleave
representations get cfg get (>>reps) ;
representations get cfg get (>>reps) ;

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
<<