Add fixnum>float intrinsic for PowerPC; speeds up spectral norm

db4
Slava Pestov 2008-01-13 00:56:31 -05:00
parent b71e07affe
commit 3fd394d06e
1 changed files with 20 additions and 2 deletions

View File

@ -360,9 +360,10 @@ IN: cpu.ppc.intrinsics
} define-intrinsic
: define-float-op ( word op -- )
[ "x" operand "x" operand "y" operand ] swap add H{
[ "z" operand "x" operand "y" operand ] swap add H{
{ +input+ { { float "x" } { float "y" } } }
{ +output+ { "x" } }
{ +scratch+ { { float "z" } } }
{ +output+ { "z" } }
} define-intrinsic ;
{
@ -399,6 +400,23 @@ IN: cpu.ppc.intrinsics
{ +output+ { "out" } }
} define-intrinsic
\ fixnum>float [
HEX: 4330 "scratch" operand LIS
"scratch" operand 1 0 param@ STW
"scratch" operand "in" operand %untag-fixnum
"scratch" operand dup HEX: 8000 XORIS
"scratch" operand 1 cell param@ STW
"f1" operand 1 0 param@ LFD
4503601774854144.0 "scratch" operand load-indirect
"f2" operand "scratch" operand float-offset LFD
"f1" operand "f1" operand "f2" operand FSUB
] H{
{ +input+ { { f "in" } } }
{ +scratch+ { { f "scratch" } { float "f1" } { float "f2" } } }
{ +output+ { "f1" } }
} define-intrinsic
\ tag [
"out" operand "in" operand tag-mask get ANDI
"out" operand dup %tag-fixnum