src/cpu/x86/vm/c1_LIRAssembler_x86.cpp

Print this page




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 # include "incls/_precompiled.incl"
  26 # include "incls/_c1_LIRAssembler_x86.cpp.incl"












  27 
  28 
  29 // These masks are used to provide 128-bit aligned bitmasks to the XMM
  30 // instructions, to allow sign-masking or sign-bit flipping.  They allow
  31 // fast versions of NegF/NegD and AbsF/AbsD.
  32 
  33 // Note: 'double' and 'long long' have 32-bits alignment on x86.
  34 static jlong* double_quadword(jlong *adr, jlong lo, jlong hi) {
  35   // Use the expression (adr)&(~0xF) to provide 128-bits aligned address
  36   // of 128-bits operands for SSE instructions.
  37   jlong *operand = (jlong*)(((long)adr)&((long)(~0xF)));
  38   // Store the value to a 128-bits operand.
  39   operand[0] = lo;
  40   operand[1] = hi;
  41   return operand;
  42 }
  43 
  44 // Buffer for 128-bits masks used by SSE instructions.
  45 static jlong fp_signmask_pool[(4+1)*2]; // 4*128bits(data) + 128bits(alignment)
  46 




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "c1/c1_Compilation.hpp"
  27 #include "c1/c1_LIRAssembler.hpp"
  28 #include "c1/c1_MacroAssembler.hpp"
  29 #include "c1/c1_Runtime1.hpp"
  30 #include "c1/c1_ValueStack.hpp"
  31 #include "ci/ciArrayKlass.hpp"
  32 #include "ci/ciInstance.hpp"
  33 #include "gc_interface/collectedHeap.hpp"
  34 #include "memory/barrierSet.hpp"
  35 #include "memory/cardTableModRefBS.hpp"
  36 #include "nativeInst_x86.hpp"
  37 #include "oops/objArrayKlass.hpp"
  38 #include "runtime/sharedRuntime.hpp"
  39 
  40 
  41 // These masks are used to provide 128-bit aligned bitmasks to the XMM
  42 // instructions, to allow sign-masking or sign-bit flipping.  They allow
  43 // fast versions of NegF/NegD and AbsF/AbsD.
  44 
  45 // Note: 'double' and 'long long' have 32-bits alignment on x86.
  46 static jlong* double_quadword(jlong *adr, jlong lo, jlong hi) {
  47   // Use the expression (adr)&(~0xF) to provide 128-bits aligned address
  48   // of 128-bits operands for SSE instructions.
  49   jlong *operand = (jlong*)(((long)adr)&((long)(~0xF)));
  50   // Store the value to a 128-bits operand.
  51   operand[0] = lo;
  52   operand[1] = hi;
  53   return operand;
  54 }
  55 
  56 // Buffer for 128-bits masks used by SSE instructions.
  57 static jlong fp_signmask_pool[(4+1)*2]; // 4*128bits(data) + 128bits(alignment)
  58