Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8265917: Different values computed by C2 and interpreter/C1 for Math.pow(x, 2.0) on x86_32 #3677

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
@@ -2515,6 +2515,8 @@ ATTRIBUTE_ALIGNED(16) juint _static_const_table_pow[] =

};

ATTRIBUTE_ALIGNED(8) double _DOUBLE2 = 2.0;

//registers,
// input: xmm0, xmm1
// scratch: xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7
@@ -2543,7 +2545,7 @@ void MacroAssembler::fast_pow(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xm
assert_different_registers(tmp, eax, ecx, edx);

address static_const_table_pow = (address)_static_const_table_pow;
static double DOUBLE2 = 2.0;
address DOUBLE2 = (address) &_DOUBLE2;

bind(start);
subl(rsp, 120);
@@ -2553,7 +2555,7 @@ void MacroAssembler::fast_pow(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xm
movsd(xmm1, Address(rsp, 136));

// Special case: pow(x, 2.0) => x * x

This comment has been minimized.

Loading
@TobiHartmann

TobiHartmann Apr 27, 2021
Member

64-bit code also handles Special case: pow(x, 0.5) => sqrt(x). Don't we need to add that as well for consistency?

This comment has been minimized.

Loading
@DamonFool

DamonFool Apr 27, 2021
Author Member

64-bit code also handles Special case: pow(x, 0.5) => sqrt(x). Don't we need to add that as well for consistency?

This is the bug fix for C2's optimization of pow(x, 2.0).

pow(x, 0.5) will be handled in JDK-8265940 .
Thanks.

ucomisd(xmm1, ExternalAddress((address) &DOUBLE2));
ucomisd(xmm1, ExternalAddress(DOUBLE2));
jccb(Assembler::notEqual, L_NOT_DOUBLE2);
jccb(Assembler::parity, L_NOT_DOUBLE2);
mulsd(xmm0, xmm0);