1 //
2 // Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
3 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 //
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 //
666 if (size < 4) return 0;
667 break;
668 default:
669 ShouldNotReachHere();
670 }
671 return size;
672 }
673
674 // Limits on vector size (number of elements) loaded into vector.
675 const int Matcher::max_vector_size(const BasicType bt) {
676 return vector_width_in_bytes(bt)/type2aelembytes(bt);
677 }
678 const int Matcher::min_vector_size(const BasicType bt) {
679 int max_size = max_vector_size(bt);
680 // Min size which can be loaded into vector is 4 bytes.
681 int size = (type2aelembytes(bt) == 1) ? 4 : 2;
682 return MIN2(size,max_size);
683 }
684
685 // Vector ideal reg corresponding to specidied size in bytes
686 const int Matcher::vector_ideal_reg(int size) {
687 assert(MaxVectorSize >= size, "");
688 switch(size) {
689 case 4: return Op_VecS;
690 case 8: return Op_VecD;
691 case 16: return Op_VecX;
692 case 32: return Op_VecY;
693 }
694 ShouldNotReachHere();
695 return 0;
696 }
697
698 // Only lowest bits of xmm reg are used for vector shift count.
699 const int Matcher::vector_shift_count_ideal_reg(int size) {
700 return Op_VecS;
701 }
702
703 // x86 supports misaligned vectors store/load.
704 const bool Matcher::misaligned_vectors_ok() {
705 return !AlignVector; // can be changed by flag
706 }
707
708 // x86 AES instructions are compatible with SunJCE expanded
709 // keys, hence we do not need to pass the original key to stubs
710 const bool Matcher::pass_original_key_for_aes() {
711 return false;
712 }
713
714 // Helper methods for MachSpillCopyNode::implementation().
715 static int vec_mov_helper(CodeBuffer *cbuf, bool do_size, int src_lo, int dst_lo,
716 int src_hi, int dst_hi, uint ireg, outputStream* st) {
717 // In 64-bit VM size calculation is very complex. Emitting instructions
718 // into scratch buffer is used to get size in 64-bit VM.
719 LP64_ONLY( assert(!do_size, "this method calculates size only for 32-bit VM"); )
|
1 //
2 // Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
3 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 //
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 //
666 if (size < 4) return 0;
667 break;
668 default:
669 ShouldNotReachHere();
670 }
671 return size;
672 }
673
674 // Limits on vector size (number of elements) loaded into vector.
675 const int Matcher::max_vector_size(const BasicType bt) {
676 return vector_width_in_bytes(bt)/type2aelembytes(bt);
677 }
678 const int Matcher::min_vector_size(const BasicType bt) {
679 int max_size = max_vector_size(bt);
680 // Min size which can be loaded into vector is 4 bytes.
681 int size = (type2aelembytes(bt) == 1) ? 4 : 2;
682 return MIN2(size,max_size);
683 }
684
685 // Vector ideal reg corresponding to specidied size in bytes
686 const uint Matcher::vector_ideal_reg(int size) {
687 assert(MaxVectorSize >= size, "");
688 switch(size) {
689 case 4: return Op_VecS;
690 case 8: return Op_VecD;
691 case 16: return Op_VecX;
692 case 32: return Op_VecY;
693 }
694 ShouldNotReachHere();
695 return 0;
696 }
697
698 // Only lowest bits of xmm reg are used for vector shift count.
699 const uint Matcher::vector_shift_count_ideal_reg(int size) {
700 return Op_VecS;
701 }
702
703 // x86 supports misaligned vectors store/load.
704 const bool Matcher::misaligned_vectors_ok() {
705 return !AlignVector; // can be changed by flag
706 }
707
708 // x86 AES instructions are compatible with SunJCE expanded
709 // keys, hence we do not need to pass the original key to stubs
710 const bool Matcher::pass_original_key_for_aes() {
711 return false;
712 }
713
714 // Helper methods for MachSpillCopyNode::implementation().
715 static int vec_mov_helper(CodeBuffer *cbuf, bool do_size, int src_lo, int dst_lo,
716 int src_hi, int dst_hi, uint ireg, outputStream* st) {
717 // In 64-bit VM size calculation is very complex. Emitting instructions
718 // into scratch buffer is used to get size in 64-bit VM.
719 LP64_ONLY( assert(!do_size, "this method calculates size only for 32-bit VM"); )
|