--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp Tue Apr 19 14:21:26 2016 +0200
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp Tue Apr 19 15:26:59 2016 -0400
@@ -2971,35 +2971,6 @@
StubRoutines::_arrayof_oop_arraycopy_uninit = StubRoutines::_oop_arraycopy_uninit;
}
- void generate_math_stubs() {
- {
- StubCodeMark mark(this, "StubRoutines", "log10");
- StubRoutines::_intrinsic_log10 = (double (*)(double)) __ pc();
-
- __ subq(rsp, 8);
- __ movdbl(Address(rsp, 0), xmm0);
- __ fld_d(Address(rsp, 0));
- __ flog10();
- __ fstp_d(Address(rsp, 0));
- __ movdbl(xmm0, Address(rsp, 0));
- __ addq(rsp, 8);
- __ ret(0);
- }
- {
- StubCodeMark mark(this, "StubRoutines", "tan");
- StubRoutines::_intrinsic_tan = (double (*)(double)) __ pc();
-
- __ subq(rsp, 8);
- __ movdbl(Address(rsp, 0), xmm0);
- __ fld_d(Address(rsp, 0));
- __ trigfunc('t');
- __ fstp_d(Address(rsp, 0));
- __ movdbl(xmm0, Address(rsp, 0));
- __ addq(rsp, 8);
- __ ret(0);
- }
- }
-
// AES intrinsic stubs
enum {AESBlockSize = 16};
@@ -4744,6 +4715,46 @@
}
+ address generate_libmLog10() {
+ address start = __ pc();
+
+ const XMMRegister x0 = xmm0;
+ const XMMRegister x1 = xmm1;
+ const XMMRegister x2 = xmm2;
+ const XMMRegister x3 = xmm3;
+
+ const XMMRegister x4 = xmm4;
+ const XMMRegister x5 = xmm5;
+ const XMMRegister x6 = xmm6;
+ const XMMRegister x7 = xmm7;
+
+ const Register tmp = r11;
+
+ BLOCK_COMMENT("Entry:");
+ __ enter(); // required for proper stackwalking of RuntimeStub frame
+
+#ifdef _WIN64
+ // save the xmm registers which must be preserved 6-7
+ __ subptr(rsp, 4 * wordSize);
+ __ movdqu(Address(rsp, 0), xmm6);
+ __ movdqu(Address(rsp, 2 * wordSize), xmm7);
+#endif
+ __ fast_log10(x0, x1, x2, x3, x4, x5, x6, x7, rax, rcx, rdx, tmp);
+
+#ifdef _WIN64
+ // restore xmm regs belonging to calling function
+ __ movdqu(xmm6, Address(rsp, 0));
+ __ movdqu(xmm7, Address(rsp, 2 * wordSize));
+ __ addptr(rsp, 4 * wordSize);
+#endif
+
+ __ leave(); // required for proper stackwalking of RuntimeStub frame
+ __ ret(0);
+
+ return start;
+
+ }
+
address generate_libmPow() {
address start = __ pc();
@@ -4809,6 +4820,8 @@
__ enter(); // required for proper stackwalking of RuntimeStub frame
#ifdef _WIN64
+ __ push(rsi);
+ __ push(rdi);
// save the xmm registers which must be preserved 6-7
__ subptr(rsp, 4 * wordSize);
__ movdqu(Address(rsp, 0), xmm6);
@@ -4821,6 +4834,8 @@
__ movdqu(xmm6, Address(rsp, 0));
__ movdqu(xmm7, Address(rsp, 2 * wordSize));
__ addptr(rsp, 4 * wordSize);
+ __ pop(rdi);
+ __ pop(rsi);
#endif
__ leave(); // required for proper stackwalking of RuntimeStub frame
@@ -4852,6 +4867,8 @@
__ enter(); // required for proper stackwalking of RuntimeStub frame
#ifdef _WIN64
+ __ push(rsi);
+ __ push(rdi);
// save the xmm registers which must be preserved 6-7
__ subptr(rsp, 4 * wordSize);
__ movdqu(Address(rsp, 0), xmm6);
@@ -4864,6 +4881,55 @@
__ movdqu(xmm6, Address(rsp, 0));
__ movdqu(xmm7, Address(rsp, 2 * wordSize));
__ addptr(rsp, 4 * wordSize);
+ __ pop(rdi);
+ __ pop(rsi);
+#endif
+
+ __ leave(); // required for proper stackwalking of RuntimeStub frame
+ __ ret(0);
+
+ return start;
+
+ }
+
+ address generate_libmTan() {
+ address start = __ pc();
+
+ const XMMRegister x0 = xmm0;
+ const XMMRegister x1 = xmm1;
+ const XMMRegister x2 = xmm2;
+ const XMMRegister x3 = xmm3;
+
+ const XMMRegister x4 = xmm4;
+ const XMMRegister x5 = xmm5;
+ const XMMRegister x6 = xmm6;
+ const XMMRegister x7 = xmm7;
+
+ const Register tmp1 = r8;
+ const Register tmp2 = r9;
+ const Register tmp3 = r10;
+ const Register tmp4 = r11;
+
+ BLOCK_COMMENT("Entry:");
+ __ enter(); // required for proper stackwalking of RuntimeStub frame
+
+#ifdef _WIN64
+ __ push(rsi);
+ __ push(rdi);
+ // save the xmm registers which must be preserved 6-7
+ __ subptr(rsp, 4 * wordSize);
+ __ movdqu(Address(rsp, 0), xmm6);
+ __ movdqu(Address(rsp, 2 * wordSize), xmm7);
+#endif
+ __ fast_tan(x0, x1, x2, x3, x4, x5, x6, x7, rax, rcx, rdx, tmp1, tmp2, tmp3, tmp4);
+
+#ifdef _WIN64
+ // restore xmm regs belonging to calling function
+ __ movdqu(xmm6, Address(rsp, 0));
+ __ movdqu(xmm7, Address(rsp, 2 * wordSize));
+ __ addptr(rsp, 4 * wordSize);
+ __ pop(rdi);
+ __ pop(rsi);
#endif
__ leave(); // required for proper stackwalking of RuntimeStub frame
@@ -5064,16 +5130,28 @@
StubRoutines::_crc32c_table_addr = (address)StubRoutines::x86::_crc32c_table;
StubRoutines::_updateBytesCRC32C = generate_updateBytesCRC32C(supports_clmul);
}
- if (VM_Version::supports_sse2()) {
+ if (VM_Version::supports_sse2() && UseLibmIntrinsic) {
+ StubRoutines::x86::_ONEHALF_adr = (address)StubRoutines::x86::_ONEHALF;
+ StubRoutines::x86::_P_2_adr = (address)StubRoutines::x86::_P_2;
+ StubRoutines::x86::_SC_4_adr = (address)StubRoutines::x86::_SC_4;
+ StubRoutines::x86::_Ctable_adr = (address)StubRoutines::x86::_Ctable;
+ StubRoutines::x86::_SC_2_adr = (address)StubRoutines::x86::_SC_2;
+ StubRoutines::x86::_SC_3_adr = (address)StubRoutines::x86::_SC_3;
+ StubRoutines::x86::_SC_1_adr = (address)StubRoutines::x86::_SC_1;
+ StubRoutines::x86::_PI_INV_TABLE_adr = (address)StubRoutines::x86::_PI_INV_TABLE;
+ StubRoutines::x86::_PI_4_adr = (address)StubRoutines::x86::_PI_4;
+ StubRoutines::x86::_PI32INV_adr = (address)StubRoutines::x86::_PI32INV;
+ StubRoutines::x86::_SIGN_MASK_adr = (address)StubRoutines::x86::_SIGN_MASK;
+ StubRoutines::x86::_P_1_adr = (address)StubRoutines::x86::_P_1;
+ StubRoutines::x86::_P_3_adr = (address)StubRoutines::x86::_P_3;
+ StubRoutines::x86::_NEG_ZERO_adr = (address)StubRoutines::x86::_NEG_ZERO;
StubRoutines::_dexp = generate_libmExp();
StubRoutines::_dlog = generate_libmLog();
+ StubRoutines::_dlog10 = generate_libmLog10();
StubRoutines::_dpow = generate_libmPow();
- if (UseLibmSinIntrinsic) {
- StubRoutines::_dsin = generate_libmSin();
- }
- if (UseLibmCosIntrinsic) {
- StubRoutines::_dcos = generate_libmCos();
- }
+ StubRoutines::_dtan = generate_libmTan();
+ StubRoutines::_dsin = generate_libmSin();
+ StubRoutines::_dcos = generate_libmCos();
}
}
@@ -5118,8 +5196,6 @@
// arraycopy stubs used by compilers
generate_arraycopy_stubs();
- generate_math_stubs();
-
// don't bother generating these AES intrinsic stubs unless global flag is set
if (UseAESIntrinsics) {
StubRoutines::x86::_key_shuffle_mask_addr = generate_key_shuffle_mask(); // needed by the others