comparison src/cpu/x86/vm/macroAssembler_x86.cpp @ 24010:5aaa43d91c73

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 daaf806995b3
children 371fd9bb8202
comparison
equal deleted inserted replaced
24009:619e7d418a44 24010:5aaa43d91c73
3200 ffree(1); 3200 ffree(1);
3201 } 3201 }
3202 jmp(done); 3202 jmp(done);
3203 } else { 3203 } else {
3204 // Stack: X Y 3204 // Stack: X Y
3205 Label x_negative, y_odd; 3205 Label x_negative, y_not_2;
3206
3207 static double two = 2.0;
3208 ExternalAddress two_addr((address)&two);
3209
3210 // constant maybe too far on 64 bit
3211 lea(tmp2, two_addr);
3212 fld_d(Address(tmp2, 0)); // Stack: 2 X Y
3213 fcmp(tmp, 2, true, false); // Stack: X Y
3214 jcc(Assembler::parity, y_not_2);
3215 jcc(Assembler::notEqual, y_not_2);
3216
3217 fxch(); fpop(); // Stack: X
3218 fmul(0); // Stack: X*X
3219
3220 jmp(done);
3221
3222 bind(y_not_2);
3206 3223
3207 fldz(); // Stack: 0 X Y 3224 fldz(); // Stack: 0 X Y
3208 fcmp(tmp, 1, true, false); // Stack: X Y 3225 fcmp(tmp, 1, true, false); // Stack: X Y
3209 jcc(Assembler::above, x_negative); 3226 jcc(Assembler::above, x_negative);
3210 3227