Mercurial > hg > graal-jvmci-8
diff src/cpu/x86/vm/macroAssembler_x86.cpp @ 23940:f958bebdee26 jdk8u92-b32
8063086: Math.pow yields different results upon repeated calls
Summary: C2 treats x^2 as a special case and computes x * x while the interpreter and c1 don't have special case code for X^2.
Reviewed-by: kvn
author | csahu |
---|---|
date | Tue, 24 May 2016 17:49:06 +0530 |
parents | 445941ba41c0 |
children | d71d6679e879 |
line wrap: on
line diff
--- a/src/cpu/x86/vm/macroAssembler_x86.cpp Sun Apr 10 23:17:09 2016 -0700 +++ b/src/cpu/x86/vm/macroAssembler_x86.cpp Tue May 24 17:49:06 2016 +0530 @@ -3202,7 +3202,24 @@ jmp(done); } else { // Stack: X Y - Label x_negative, y_odd; + Label x_negative, y_not_2; + + static double two = 2.0; + ExternalAddress two_addr((address)&two); + + // constant maybe too far on 64 bit + lea(tmp2, two_addr); + fld_d(Address(tmp2, 0)); // Stack: 2 X Y + fcmp(tmp, 2, true, false); // Stack: X Y + jcc(Assembler::parity, y_not_2); + jcc(Assembler::notEqual, y_not_2); + + fxch(); fpop(); // Stack: X + fmul(0); // Stack: X*X + + jmp(done); + + bind(y_not_2); fldz(); // Stack: 0 X Y fcmp(tmp, 1, true, false); // Stack: X Y