compiler: update unit tests for 4-bit tag change

db4
Slava Pestov 2009-11-03 21:40:29 -06:00
parent ed3ab1335e
commit 109aa88b06
5 changed files with 40 additions and 38 deletions

View File

@ -82,7 +82,7 @@ IN: compiler.cfg.value-numbering.tests
T{ ##load-reference f 1 + } T{ ##load-reference f 1 + }
T{ ##peek f 2 D 0 } T{ ##peek f 2 D 0 }
T{ ##compare f 4 2 1 cc> } T{ ##compare f 4 2 1 cc> }
T{ ##compare-imm f 6 4 5 cc/= } T{ ##compare-imm f 6 4 $[ \ f type-number ] cc/= }
T{ ##replace f 6 D 0 } T{ ##replace f 6 D 0 }
} value-numbering-step trim-temps } value-numbering-step trim-temps
] unit-test ] unit-test
@ -100,7 +100,7 @@ IN: compiler.cfg.value-numbering.tests
T{ ##load-reference f 1 + } T{ ##load-reference f 1 + }
T{ ##peek f 2 D 0 } T{ ##peek f 2 D 0 }
T{ ##compare f 4 2 1 cc<= } T{ ##compare f 4 2 1 cc<= }
T{ ##compare-imm f 6 4 5 cc= } T{ ##compare-imm f 6 4 $[ \ f type-number ] cc= }
T{ ##replace f 6 D 0 } T{ ##replace f 6 D 0 }
} value-numbering-step trim-temps } value-numbering-step trim-temps
] unit-test ] unit-test
@ -118,7 +118,7 @@ IN: compiler.cfg.value-numbering.tests
T{ ##peek f 8 D 0 } T{ ##peek f 8 D 0 }
T{ ##peek f 9 D -1 } T{ ##peek f 9 D -1 }
T{ ##compare-float-unordered f 12 8 9 cc< } T{ ##compare-float-unordered f 12 8 9 cc< }
T{ ##compare-imm f 14 12 5 cc= } T{ ##compare-imm f 14 12 $[ \ f type-number ] cc= }
T{ ##replace f 14 D 0 } T{ ##replace f 14 D 0 }
} value-numbering-step trim-temps } value-numbering-step trim-temps
] unit-test ] unit-test
@ -135,7 +135,7 @@ IN: compiler.cfg.value-numbering.tests
T{ ##peek f 29 D -1 } T{ ##peek f 29 D -1 }
T{ ##peek f 30 D -2 } T{ ##peek f 30 D -2 }
T{ ##compare f 33 29 30 cc<= } T{ ##compare f 33 29 30 cc<= }
T{ ##compare-imm-branch f 33 5 cc/= } T{ ##compare-imm-branch f 33 $[ \ f type-number ] cc/= }
} value-numbering-step trim-temps } value-numbering-step trim-temps
] unit-test ] unit-test
@ -149,7 +149,7 @@ IN: compiler.cfg.value-numbering.tests
{ {
T{ ##peek f 1 D -1 } T{ ##peek f 1 D -1 }
T{ ##test-vector f 2 1 f float-4-rep vcc-any } T{ ##test-vector f 2 1 f float-4-rep vcc-any }
T{ ##compare-imm-branch f 2 5 cc/= } T{ ##compare-imm-branch f 2 $[ \ f type-number ] cc/= }
} value-numbering-step trim-temps } value-numbering-step trim-temps
] unit-test ] unit-test
@ -1071,14 +1071,14 @@ cell 8 = [
! Branch folding ! Branch folding
[ [
{ {
T{ ##load-immediate f 1 1 } T{ ##load-immediate f 1 10 }
T{ ##load-immediate f 2 2 } T{ ##load-immediate f 2 20 }
T{ ##load-immediate f 3 5 } T{ ##load-immediate f 3 $[ \ f type-number ] }
} }
] [ ] [
{ {
T{ ##load-immediate f 1 1 } T{ ##load-immediate f 1 10 }
T{ ##load-immediate f 2 2 } T{ ##load-immediate f 2 20 }
T{ ##compare f 3 1 2 cc= } T{ ##compare f 3 1 2 cc= }
} value-numbering-step } value-numbering-step
] unit-test ] unit-test
@ -1113,14 +1113,14 @@ cell 8 = [
[ [
{ {
T{ ##load-immediate f 1 1 } T{ ##load-immediate f 1 10 }
T{ ##load-immediate f 2 2 } T{ ##load-immediate f 2 20 }
T{ ##load-immediate f 3 5 } T{ ##load-immediate f 3 $[ \ f type-number ] }
} }
] [ ] [
{ {
T{ ##load-immediate f 1 1 } T{ ##load-immediate f 1 10 }
T{ ##load-immediate f 2 2 } T{ ##load-immediate f 2 20 }
T{ ##compare f 3 2 1 cc< } T{ ##compare f 3 2 1 cc< }
} value-numbering-step } value-numbering-step
] unit-test ] unit-test
@ -1128,7 +1128,7 @@ cell 8 = [
[ [
{ {
T{ ##peek f 0 D 0 } T{ ##peek f 0 D 0 }
T{ ##load-immediate f 1 5 } T{ ##load-immediate f 1 $[ \ f type-number ] }
} }
] [ ] [
{ {
@ -1152,7 +1152,7 @@ cell 8 = [
[ [
{ {
T{ ##peek f 0 D 0 } T{ ##peek f 0 D 0 }
T{ ##load-immediate f 1 5 } T{ ##load-immediate f 1 $[ \ f type-number ] }
} }
] [ ] [
{ {
@ -1176,7 +1176,7 @@ cell 8 = [
[ [
{ {
T{ ##peek f 0 D 0 } T{ ##peek f 0 D 0 }
T{ ##load-immediate f 1 5 } T{ ##load-immediate f 1 $[ \ f type-number ] }
} }
] [ ] [
{ {
@ -1557,7 +1557,7 @@ cell 8 = [
{ {
T{ ##peek f 0 D 0 } T{ ##peek f 0 D 0 }
T{ ##compare f 1 0 0 cc<= } T{ ##compare f 1 0 0 cc<= }
T{ ##compare-imm-branch f 1 5 cc/= } T{ ##compare-imm-branch f 1 $[ \ f type-number ] cc/= }
} test-branch-folding } test-branch-folding
] unit-test ] unit-test
@ -1659,7 +1659,7 @@ V{
T{ ##copy { dst 21 } { src 20 } { rep any-rep } } T{ ##copy { dst 21 } { src 20 } { rep any-rep } }
T{ ##compare-imm-branch T{ ##compare-imm-branch
{ src1 21 } { src1 21 }
{ src2 5 } { src2 $[ \ f type-number ] }
{ cc cc/= } { cc cc/= }
} }
} 1 test-bb } 1 test-bb

View File

@ -285,8 +285,8 @@ cell 8 = [
! 64-bit overflow ! 64-bit overflow
cell 8 = [ cell 8 = [
[ t ] [ 1 59 fixnum-shift dup [ fixnum+ ] compile-call 1 60 fixnum-shift = ] unit-test [ t ] [ 1 58 fixnum-shift dup [ fixnum+ ] compile-call 1 59 fixnum-shift = ] unit-test
[ -1152921504606846977 ] [ 1 60 shift neg >fixnum [ -1 fixnum+ ] compile-call ] unit-test [ -576460752303423489 ] [ 1 59 shift neg >fixnum [ -1 fixnum+ ] compile-call ] unit-test
[ t ] [ 1 40 shift 1 40 shift [ fixnum* ] compile-call 1 80 shift = ] unit-test [ t ] [ 1 40 shift 1 40 shift [ fixnum* ] compile-call 1 80 shift = ] unit-test
[ t ] [ 1 40 shift neg 1 40 shift [ fixnum* ] compile-call 1 80 shift neg = ] unit-test [ t ] [ 1 40 shift neg 1 40 shift [ fixnum* ] compile-call 1 80 shift neg = ] unit-test
@ -301,9 +301,9 @@ cell 8 = [
[ -18446744073709551616 ] [ -1 [ 64 fixnum-shift ] compile-call ] unit-test [ -18446744073709551616 ] [ -1 [ 64 fixnum-shift ] compile-call ] unit-test
[ -18446744073709551616 ] [ -1 [ 32 fixnum-shift 32 fixnum-shift ] compile-call ] unit-test [ -18446744073709551616 ] [ -1 [ 32 fixnum-shift 32 fixnum-shift ] compile-call ] unit-test
[ 1152921504606846976 ] [ -1152921504606846976 >fixnum -1 [ fixnum/i ] compile-call ] unit-test [ 576460752303423488 ] [ -576460752303423488 >fixnum -1 [ fixnum/i ] compile-call ] unit-test
[ 1152921504606846976 0 ] [ -1152921504606846976 >fixnum -1 [ fixnum/mod ] compile-call ] unit-test [ 576460752303423488 0 ] [ -576460752303423488 >fixnum -1 [ fixnum/mod ] compile-call ] unit-test
[ -268435457 ] [ 28 2^ [ fixnum-bitnot ] compile-call ] unit-test [ -268435457 ] [ 28 2^ [ fixnum-bitnot ] compile-call ] unit-test
] when ] when
@ -311,12 +311,14 @@ cell 8 = [
! Some randomized tests ! Some randomized tests
: compiled-fixnum* ( a b -- c ) fixnum* ; : compiled-fixnum* ( a b -- c ) fixnum* ;
ERROR: bug-in-fixnum* x y a b ;
[ ] [ [ ] [
10000 [ 10000 [
32 random-bits >fixnum 32 random-bits >fixnum 32 random-bits >fixnum
2dup 32 random-bits >fixnum
[ fixnum* ] 2keep compiled-fixnum* = 2dup [ fixnum* ] [ compiled-fixnum* ] 2bi 2dup =
[ 2drop ] [ "Oops" throw ] if [ 2drop 2drop ] [ bug-in-fixnum* ] if
] times ] times
] unit-test ] unit-test

View File

@ -36,7 +36,7 @@ IN: compiler.tests.low-level-ir
! loading immediates ! loading immediates
[ f ] [ [ f ] [
V{ V{
T{ ##load-immediate f 0 5 } T{ ##load-immediate f 0 $[ \ f type-number ] }
} compile-test-bb } compile-test-bb
] unit-test ] unit-test
@ -80,7 +80,7 @@ IN: compiler.tests.low-level-ir
dup first eq? dup first eq?
] unit-test ] unit-test
[ 8 ] [ [ 4 ] [
V{ V{
T{ ##load-immediate f 0 4 } T{ ##load-immediate f 0 4 }
T{ ##shl f 0 0 0 } T{ ##shl f 0 0 0 }
@ -90,16 +90,16 @@ IN: compiler.tests.low-level-ir
[ 4 ] [ [ 4 ] [
V{ V{
T{ ##load-immediate f 0 4 } T{ ##load-immediate f 0 4 }
T{ ##shl-imm f 0 0 3 } T{ ##shl-imm f 0 0 4 }
} compile-test-bb } compile-test-bb
] unit-test ] unit-test
[ 31 ] [ [ 31 ] [
V{ V{
T{ ##load-reference f 1 B{ 31 67 52 } } T{ ##load-reference f 1 B{ 31 67 52 } }
T{ ##unbox-any-c-ptr f 0 1 2 } T{ ##unbox-any-c-ptr f 0 1 }
T{ ##alien-unsigned-1 f 0 0 0 } T{ ##alien-unsigned-1 f 0 0 0 }
T{ ##shl-imm f 0 0 3 } T{ ##shl-imm f 0 0 4 }
} compile-test-bb } compile-test-bb
] unit-test ] unit-test
@ -108,13 +108,13 @@ IN: compiler.tests.low-level-ir
T{ ##load-reference f 0 "hello world" } T{ ##load-reference f 0 "hello world" }
T{ ##load-immediate f 1 3 } T{ ##load-immediate f 1 3 }
T{ ##string-nth f 0 0 1 2 } T{ ##string-nth f 0 0 1 2 }
T{ ##shl-imm f 0 0 3 } T{ ##shl-imm f 0 0 4 }
} compile-test-bb } compile-test-bb
] unit-test ] unit-test
[ 1 ] [ [ 1 ] [
V{ V{
T{ ##load-immediate f 0 16 } T{ ##load-immediate f 0 32 }
T{ ##add-imm f 0 0 -8 } T{ ##add-imm f 0 0 -16 }
} compile-test-bb } compile-test-bb
] unit-test ] unit-test

View File

@ -202,7 +202,7 @@ USE: binary-search.private
dup length 1 <= [ dup length 1 <= [
from>> from>>
] [ ] [
[ midpoint swap call ] 3keep roll dup zero? [ midpoint swap call ] 3keep [ rot ] dip swap dup zero?
[ drop dup from>> swap midpoint@ + ] [ drop dup from>> swap midpoint@ + ]
[ drop dup midpoint@ head-slice old-binsearch ] if [ drop dup midpoint@ head-slice old-binsearch ] if
] if ; inline recursive ] if ; inline recursive

View File

@ -53,7 +53,7 @@ SYMBOL: mega-cache-size
first-bignum neg >fixnum ; inline first-bignum neg >fixnum ; inline
: (max-array-capacity) ( b -- n ) : (max-array-capacity) ( b -- n )
5 - 2^ 1 - ; inline 6 - 2^ 1 - ; inline
: max-array-capacity ( -- n ) : max-array-capacity ( -- n )
cell-bits (max-array-capacity) ; inline cell-bits (max-array-capacity) ; inline