6925 movl(Address(rsp,0),0); |
6925 movl(Address(rsp,0),0); |
6926 fmul_d(Address(rsp,0)); // Stack: 2^X ... |
6926 fmul_d(Address(rsp,0)); // Stack: 2^X ... |
6927 addptr(rsp,sizeof(jdouble)); |
6927 addptr(rsp,sizeof(jdouble)); |
6928 } |
6928 } |
6929 |
6929 |
|
6930 void MacroAssembler::increase_precision() { |
|
6931 subptr(rsp, BytesPerWord); |
|
6932 fnstcw(Address(rsp, 0)); |
|
6933 movl(rax, Address(rsp, 0)); |
|
6934 orl(rax, 0x300); |
|
6935 push(rax); |
|
6936 fldcw(Address(rsp, 0)); |
|
6937 pop(rax); |
|
6938 } |
|
6939 |
|
6940 void MacroAssembler::restore_precision() { |
|
6941 fldcw(Address(rsp, 0)); |
|
6942 addptr(rsp, BytesPerWord); |
|
6943 } |
|
6944 |
6930 void MacroAssembler::fast_pow() { |
6945 void MacroAssembler::fast_pow() { |
6931 // computes X^Y = 2^(Y * log2(X)) |
6946 // computes X^Y = 2^(Y * log2(X)) |
6932 // if fast computation is not possible, result is NaN. Requires |
6947 // if fast computation is not possible, result is NaN. Requires |
6933 // fallback from user of this macro. |
6948 // fallback from user of this macro. |
|
6949 // increase precision for intermediate steps of the computation |
|
6950 increase_precision(); |
6934 fyl2x(); // Stack: (Y*log2(X)) ... |
6951 fyl2x(); // Stack: (Y*log2(X)) ... |
6935 pow_exp_core_encoding(); // Stack: exp(X) ... |
6952 pow_exp_core_encoding(); // Stack: exp(X) ... |
|
6953 restore_precision(); |
6936 } |
6954 } |
6937 |
6955 |
6938 void MacroAssembler::fast_exp() { |
6956 void MacroAssembler::fast_exp() { |
6939 // computes exp(X) = 2^(X * log2(e)) |
6957 // computes exp(X) = 2^(X * log2(e)) |
6940 // if fast computation is not possible, result is NaN. Requires |
6958 // if fast computation is not possible, result is NaN. Requires |
6941 // fallback from user of this macro. |
6959 // fallback from user of this macro. |
|
6960 // increase precision for intermediate steps of the computation |
|
6961 increase_precision(); |
6942 fldl2e(); // Stack: log2(e) X ... |
6962 fldl2e(); // Stack: log2(e) X ... |
6943 fmulp(1); // Stack: (X*log2(e)) ... |
6963 fmulp(1); // Stack: (X*log2(e)) ... |
6944 pow_exp_core_encoding(); // Stack: exp(X) ... |
6964 pow_exp_core_encoding(); // Stack: exp(X) ... |
|
6965 restore_precision(); |
6945 } |
6966 } |
6946 |
6967 |
6947 void MacroAssembler::pow_or_exp(bool is_exp, int num_fpu_regs_in_use) { |
6968 void MacroAssembler::pow_or_exp(bool is_exp, int num_fpu_regs_in_use) { |
6948 // kills rax, rcx, rdx |
6969 // kills rax, rcx, rdx |
6949 // pow and exp needs 2 extra registers on the fpu stack. |
6970 // pow and exp needs 2 extra registers on the fpu stack. |