Mercurial > hg > truffle
diff src/cpu/x86/vm/x86_64.ad @ 6084:6759698e3140
7133857: exp() and pow() should use the x87 ISA on x86
Summary: use x87 instructions to implement exp() and pow() in interpreter/c1/c2.
Reviewed-by: kvn, never, twisti
author | roland |
---|---|
date | Tue, 15 May 2012 10:10:23 +0200 |
parents | fd09f2d8283e |
children | ccaa67adfe5b |
line wrap: on
line diff
--- a/src/cpu/x86/vm/x86_64.ad Mon May 14 09:36:00 2012 -0700 +++ b/src/cpu/x86/vm/x86_64.ad Tue May 15 10:10:23 2012 +0200 @@ -9823,7 +9823,39 @@ ins_pipe( pipe_slow ); %} - +instruct powD_reg(regD dst, regD src0, regD src1, rax_RegI rax, rdx_RegI rdx, rcx_RegI rcx, rFlagsReg cr) %{ + match(Set dst (PowD src0 src1)); // Raise src0 to the src1'th power + effect(KILL rax, KILL rdx, KILL rcx, KILL cr); + format %{ "fast_pow $src0 $src1 -> $dst // KILL $rax, $rcx, $rdx" %} + ins_encode %{ + __ subptr(rsp, 8); + __ movdbl(Address(rsp, 0), $src1$$XMMRegister); + __ fld_d(Address(rsp, 0)); + __ movdbl(Address(rsp, 0), $src0$$XMMRegister); + __ fld_d(Address(rsp, 0)); + __ fast_pow(); + __ fstp_d(Address(rsp, 0)); + __ movdbl($dst$$XMMRegister, Address(rsp, 0)); + __ addptr(rsp, 8); + %} + ins_pipe( pipe_slow ); +%} + +instruct expD_reg(regD dst, regD src, rax_RegI rax, rdx_RegI rdx, rcx_RegI rcx, rFlagsReg cr) %{ + match(Set dst (ExpD src)); + effect(KILL rax, KILL rcx, KILL rdx, KILL cr); + format %{ "fast_exp $dst -> $src // KILL $rax, $rcx, $rdx" %} + ins_encode %{ + __ subptr(rsp, 8); + __ movdbl(Address(rsp, 0), $src$$XMMRegister); + __ fld_d(Address(rsp, 0)); + __ fast_exp(); + __ fstp_d(Address(rsp, 0)); + __ movdbl($dst$$XMMRegister, Address(rsp, 0)); + __ addptr(rsp, 8); + %} + ins_pipe( pipe_slow ); +%} //----------Arithmetic Conversion Instructions---------------------------------