src/cpu/x86/vm/x86_64.ad
Print this page
rev 3227 : 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:
*** 9840,9850 ****
--- 9840,9882 ----
Opcode(0xD9), Opcode(0xF1), // fyl2x
Push_ResultXD(dst));
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---------------------------------
instruct roundFloat_nop(regF dst)
%{