src/hotspot/cpu/x86/macroAssembler_x86_pow.cpp
changeset 48396 3c9975e46464
parent 47216 71c04702a3d5
child 50120 9da00197ff72
--- a/src/hotspot/cpu/x86/macroAssembler_x86_pow.cpp	Wed Dec 13 07:14:18 2017 -0500
+++ b/src/hotspot/cpu/x86/macroAssembler_x86_pow.cpp	Wed Dec 13 19:32:48 2017 +0300
@@ -765,6 +765,11 @@
     0xfefa39efUL, 0x3fe62e42UL, 0xfefa39efUL, 0xbfe62e42UL
 };
 
+ALIGNED_(8) juint _DOUBLE2[] =
+{
+    0x00000000UL, 0x40000000UL
+};
+
 //registers,
 // input: xmm0, xmm1
 // scratch: xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7
@@ -803,6 +808,7 @@
   address HIGHMASK_LOG_X = (address)_HIGHMASK_LOG_X;
   address HALFMASK = (address)_HALFMASK;
   address log2 = (address)_log2_pow;
+  address DOUBLE2 = (address)_DOUBLE2;
 
 
   bind(start);
@@ -810,6 +816,13 @@
   movsd(Address(rsp, 8), xmm0);
   movsd(Address(rsp, 16), xmm1);
 
+  // Special case: pow(x, 2.0) => x * x
+  movdq(tmp1, xmm1);
+  cmp64(tmp1, ExternalAddress(DOUBLE2));
+  jccb(Assembler::notEqual, B1_2);
+  mulsd(xmm0, xmm0);
+  jmp(B1_5);
+
   bind(B1_2);
   pextrw(eax, xmm0, 3);
   xorpd(xmm2, xmm2);