From 38bafd2be8844d759af8492d688f9deb01313e97 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 2 May 2010 02:40:19 -0400 Subject: [PATCH] compiler.cfg.linear-scan.assignment: spill slot representation logic was backwards, just like Factor --- .../linear-scan/assignment/assignment.factor | 2 +- basis/compiler/tests/float.factor | 20 ++++++++++++++++++- basis/math/vectors/simd/simd-tests.factor | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/basis/compiler/cfg/linear-scan/assignment/assignment.factor b/basis/compiler/cfg/linear-scan/assignment/assignment.factor index f457713380..b160bd776c 100644 --- a/basis/compiler/cfg/linear-scan/assignment/assignment.factor +++ b/basis/compiler/cfg/linear-scan/assignment/assignment.factor @@ -93,7 +93,7 @@ SYMBOL: machine-live-outs init-unhandled ; : insert-spill ( live-interval -- ) - [ reg>> ] [ first-use rep>> ] [ spill-to>> ] tri ##spill ; + [ reg>> ] [ last-use rep>> ] [ spill-to>> ] tri ##spill ; : handle-spill ( live-interval -- ) dup spill-to>> [ insert-spill ] [ drop ] if ; diff --git a/basis/compiler/tests/float.factor b/basis/compiler/tests/float.factor index 0d4e30279e..b1ce0e454d 100644 --- a/basis/compiler/tests/float.factor +++ b/basis/compiler/tests/float.factor @@ -1,6 +1,8 @@ USING: compiler.units compiler.test kernel kernel.private memory math math.private tools.test math.floats.private math.order fry -; +specialized-arrays sequences ; +QUALIFIED-WITH: alien.c-types c +SPECIALIZED-ARRAY: c:float IN: compiler.tests.float [ 5.0 ] [ [ 5.0 ] compile-call gc gc gc ] unit-test @@ -116,3 +118,19 @@ IN: compiler.tests.float [ t ] [ 3.0 0/0. \ min check-compiled-binary-op ] unit-test [ t ] [ 0/0. 3.0 \ max check-compiled-binary-op ] unit-test [ t ] [ 3.0 0/0. \ max check-compiled-binary-op ] unit-test + +! Test vector ops +[ 30.0 ] [ + float-array{ 1 2 3 4 } float-array{ 1 2 3 4 } + [ { float-array float-array } declare [ * ] [ + ] 2map-reduce ] compile-call +] unit-test + +[ 30.0 ] [ + float-array{ 1 2 3 4 } + [ { float-array } declare dup [ * ] [ + ] 2map-reduce ] compile-call +] unit-test + +[ 30.0 ] [ + float-array{ 1 2 3 4 } + [ { float-array } declare [ dup * ] [ + ] map-reduce ] compile-call +] unit-test diff --git a/basis/math/vectors/simd/simd-tests.factor b/basis/math/vectors/simd/simd-tests.factor index 1d19c76dc1..f3d56ba868 100644 --- a/basis/math/vectors/simd/simd-tests.factor +++ b/basis/math/vectors/simd/simd-tests.factor @@ -128,7 +128,7 @@ CONSTANT: vector-words @ [ dup [ class ] { } map-as ] dip '[ _ declare @ ] { - [ "print-mr" get [ nip test-mr mr. ] [ 2drop ] if ] + [ "print-mr" get [ nip regs. ] [ 2drop ] if ] [ "print-checks" get [ [ . ] bi@ ] [ 2drop ] if ] [ [ [ call ] dip call ] call( quot quot -- result ) ] [ [ [ call ] dip compile-call ] call( quot quot -- result ) ]