7169934: pow(x,y) or x64 computes incorrect result when x<0 and y is an odd integer
authorroland
Mon, 21 May 2012 09:46:02 +0200
changeset 12742 b055b648431a
parent 12741 9315df9ea655
child 12743 e1f1f1cc8d2b
7169934: pow(x,y) or x64 computes incorrect result when x<0 and y is an odd integer Summary: bad test for parity of y in pow(x,y) (c1, interpreter) Reviewed-by: kvn, twisti
hotspot/src/cpu/x86/vm/assembler_x86.cpp
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Fri May 18 12:20:24 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Mon May 21 09:46:02 2012 +0200
@@ -6954,7 +6954,7 @@
     tmp = rdx;
   }
   Register tmp2 = rax;
-  NOT_LP64(Register tmp3 = rcx;)
+  Register tmp3 = rcx;
 
   if (is_exp) {
     // Stack: X
@@ -7081,7 +7081,8 @@
 #else
     {
       Label integer;
-      shlq(tmp2, 1);
+      mov(tmp3, tmp2); // preserve tmp2 for parity check below
+      shlq(tmp3, 1);
       jcc(Assembler::carryClear, integer);
       jcc(Assembler::notZero, integer);
       stop("integer indefinite value shouldn't be seen here");