]> gitweb.factorcode.org Git - factor.git/commitdiff
fix ##load-constant/##scalar>vector folding when constant is a fixnum
authorJoe Groff <arcata@gmail.com>
Wed, 7 Oct 2009 17:46:08 +0000 (12:46 -0500)
committerJoe Groff <arcata@gmail.com>
Wed, 7 Oct 2009 17:46:08 +0000 (12:46 -0500)
basis/compiler/cfg/value-numbering/rewrite/rewrite.factor
basis/compiler/cfg/value-numbering/value-numbering-tests.factor
basis/math/vectors/simd/simd-tests.factor
core/layouts/layouts.factor

index 9827e02bf545d09b647952adc2573720687b75e6..56ec16eed6c24163e45834a40f71cdb1f3baef15 100755 (executable)
@@ -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
index b959a09e192f9180782a9ecdd37088f98bc548f4..5f8eda2c085de1d2507663faea51c5aa46ab1c0d 100644 (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 }
index a66265e4887c1088ff0c78a6d2ff6953dac8a34a..78c938959112956defc8db4a4fbc57901c2f86cf 100644 (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
 
 [ { } ] [
index 4aa806c81f6505527beeff74a877220c2208914b..be6276a6841f12658d4ac07d67df999f443fb1a4 100644 (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
 <<