Fix fixnum* problem; result was shifted to the right by 3 bits if both input registers were equal

db4
sheeple 2008-11-29 00:44:46 -06:00
parent c43690a8fb
commit 26c002d23f
3 changed files with 11 additions and 6 deletions

View File

@ -261,3 +261,6 @@ TUPLE: id obj ;
[ 3 ] [ 1 t fixnum-overflow-control-flow-test ] unit-test
[ 2 ] [ 1 f fixnum-overflow-control-flow-test ] unit-test
[ 4 ] [ 2 [ dup fixnum* ] compile-call ] unit-test
[ 7 ] [ 2 [ dup fixnum* 3 fixnum+fast ] compile-call ] unit-test

View File

@ -228,12 +228,12 @@ M:: ppc %fixnum-mul ( src1 src2 -- )
"no-overflow" define-label
0 0 LI
0 MTXER
src1 src1 tag-bits get SRAWI
scratch-reg src1 src2 MULLWO.
scratch-reg src1 tag-bits get SRAWI
scratch-reg scratch-reg src2 MULLWO.
scratch-reg ds-reg 0 STW
"no-overflow" get BNO
src2 src2 tag-bits get SRAWI
src1 src2 move>args
scratch-reg src2 move>args
%prepare-alien-invoke
"overflow_fixnum_multiply" f %alien-invoke
"no-overflow" resolve-label ;
@ -242,14 +242,14 @@ M:: ppc %fixnum-mul-tail ( src1 src2 -- )
"overflow" define-label
0 0 LI
0 MTXER
src1 src1 tag-bits get SRAWI
scratch-reg src1 src2 MULLWO.
scratch-reg src1 tag-bits get SRAWI
scratch-reg scratch-reg src2 MULLWO.
"overflow" get BO
scratch-reg ds-reg 0 STW
BLR
"overflow" resolve-label
src2 src2 tag-bits get SRAWI
src1 src2 move>args
scratch-reg src2 move>args
%prepare-alien-invoke
"overflow_fixnum_multiply" f %alien-invoke-tail ;

View File

@ -102,3 +102,5 @@ USING: math.matrices math.vectors tools.test math ;
[ { 0 0 -1 } ] [ { 1 0 0 } { 0 1 0 } cross ] unit-test
[ { 1 0 0 } ] [ { 0 1 0 } { 0 0 1 } cross ] unit-test
[ { 0 1 0 } ] [ { 0 0 1 } { 1 0 0 } cross ] unit-test
[ { 1 0 0 } ] [ { 1 1 0 } { 1 0 0 } proj ] unit-test