From 09fd18b542622457512fae2c75d5cfe26a8a7cb1 Mon Sep 17 00:00:00 2001 From: Alex Vondrak Date: Tue, 18 Sep 2012 00:07:10 -0700 Subject: [PATCH] compiler.cfg.gvn.math: missed some availability checks that were causing math.vectors.simd.tests to fail (issue #671) --- basis/math/vectors/simd/simd-tests.factor | 7 ++++--- extra/compiler/cfg/gvn/math/math.factor | 16 ++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/basis/math/vectors/simd/simd-tests.factor b/basis/math/vectors/simd/simd-tests.factor index 198846c1fc..5da775dc24 100644 --- a/basis/math/vectors/simd/simd-tests.factor +++ b/basis/math/vectors/simd/simd-tests.factor @@ -159,9 +159,10 @@ TUPLE: simd-test-failure input-quot code-quot' [ [ call ] dip compile-call ] call( i c -- result ) :> optimized-result input-quot code-quot' [ - t "always-inline-simd-intrinsics" - [ [ call ] dip compile-call ] - with-variable + t "always-inline-simd-intrinsics" [ + "print-inline-mr" get [ code-quot' regs. ] when + [ call ] dip compile-call + ] with-variable ] call( i c -- result ) :> nonintrinsic-result unoptimized-result optimized-result eq-quot call diff --git a/extra/compiler/cfg/gvn/math/math.factor b/extra/compiler/cfg/gvn/math/math.factor index 5b5fcd0bd5..d6ef1f1fcb 100644 --- a/extra/compiler/cfg/gvn/math/math.factor +++ b/extra/compiler/cfg/gvn/math/math.factor @@ -81,7 +81,7 @@ M: ##add-imm rewrite { { [ dup src2>> 0 = ] [ identity ] } { [ dup binary-constant-fold? ] [ binary-constant-fold ] } - { [ dup src1>> vreg>insn ##add-imm? ] [ ##add-imm reassociate-arithmetic ] } + { [ dup src1>> vreg>insn [ ##add-imm? ] with-available-uses? ] [ ##add-imm reassociate-arithmetic ] } [ drop f ] } cond ; @@ -145,7 +145,7 @@ M: ##mul-imm rewrite { [ dup binary-constant-fold? ] [ binary-constant-fold ] } { [ dup mul-to-neg? ] [ mul-to-neg ] } { [ dup mul-to-shl? ] [ mul-to-shl ] } - { [ dup src1>> vreg>insn ##mul-imm? ] [ ##mul-imm reassociate-arithmetic ] } + { [ dup src1>> vreg>insn [ ##mul-imm? ] with-available-uses? ] [ ##mul-imm reassociate-arithmetic ] } { [ dup distribute-over-add? ] [ \ ##add-imm, \ ##mul-imm, distribute ] } { [ dup distribute-over-sub? ] [ \ ##sub-imm, \ ##mul-imm, distribute ] } [ drop f ] @@ -154,7 +154,7 @@ M: ##mul-imm rewrite M: ##and-imm rewrite { { [ dup binary-constant-fold? ] [ binary-constant-fold ] } - { [ dup src1>> vreg>insn ##and-imm? ] [ ##and-imm reassociate-bitwise ] } + { [ dup src1>> vreg>insn [ ##and-imm? ] with-available-uses? ] [ ##and-imm reassociate-bitwise ] } { [ dup src2>> 0 = ] [ dst>> 0 ##load-integer new-insn ] } { [ dup src2>> -1 = ] [ identity ] } [ drop f ] @@ -165,7 +165,7 @@ M: ##or-imm rewrite { [ dup src2>> 0 = ] [ identity ] } { [ dup src2>> -1 = ] [ dst>> -1 ##load-integer new-insn ] } { [ dup binary-constant-fold? ] [ binary-constant-fold ] } - { [ dup src1>> vreg>insn ##or-imm? ] [ ##or-imm reassociate-bitwise ] } + { [ dup src1>> vreg>insn [ ##or-imm? ] with-available-uses? ] [ ##or-imm reassociate-bitwise ] } [ drop f ] } cond ; @@ -174,7 +174,7 @@ M: ##xor-imm rewrite { [ dup src2>> 0 = ] [ identity ] } { [ dup src2>> -1 = ] [ [ dst>> ] [ src1>> ] bi ##not new-insn ] } { [ dup binary-constant-fold? ] [ binary-constant-fold ] } - { [ dup src1>> vreg>insn ##xor-imm? ] [ ##xor-imm reassociate-bitwise ] } + { [ dup src1>> vreg>insn [ ##xor-imm? ] with-available-uses? ] [ ##xor-imm reassociate-bitwise ] } [ drop f ] } cond ; @@ -182,7 +182,7 @@ M: ##shl-imm rewrite { { [ dup src2>> 0 = ] [ identity ] } { [ dup binary-constant-fold? ] [ binary-constant-fold ] } - { [ dup src1>> vreg>insn ##shl-imm? ] [ ##shl-imm reassociate-shift ] } + { [ dup src1>> vreg>insn [ ##shl-imm? ] with-available-uses? ] [ ##shl-imm reassociate-shift ] } { [ dup distribute-over-add? ] [ \ ##add-imm, \ ##shl-imm, distribute ] } { [ dup distribute-over-sub? ] [ \ ##sub-imm, \ ##shl-imm, distribute ] } [ drop f ] @@ -192,7 +192,7 @@ M: ##shr-imm rewrite { { [ dup src2>> 0 = ] [ identity ] } { [ dup binary-constant-fold? ] [ binary-constant-fold ] } - { [ dup src1>> vreg>insn ##shr-imm? ] [ ##shr-imm reassociate-shift ] } + { [ dup src1>> vreg>insn [ ##shr-imm? ] with-available-uses? ] [ ##shr-imm reassociate-shift ] } [ drop f ] } cond ; @@ -200,7 +200,7 @@ M: ##sar-imm rewrite { { [ dup src2>> 0 = ] [ identity ] } { [ dup binary-constant-fold? ] [ binary-constant-fold ] } - { [ dup src1>> vreg>insn ##sar-imm? ] [ ##sar-imm reassociate-shift ] } + { [ dup src1>> vreg>insn [ ##sar-imm? ] with-available-uses? ] [ ##sar-imm reassociate-shift ] } [ drop f ] } cond ;