1 /*
   2  * Copyright (c) 2020, 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  *
  23  */
  24 
  25 #ifndef SHARE_PRIMS_VECTORSUPPORT_HPP
  26 #define SHARE_PRIMS_VECTORSUPPORT_HPP
  27 
  28 #include "jni.h"
  29 #include "code/debugInfo.hpp"
  30 #include "memory/allocation.hpp"
  31 #include "oops/typeArrayOop.inline.hpp"
  32 #include "runtime/frame.inline.hpp"
  33 #include "runtime/registerMap.hpp"
  34 #include "utilities/exceptions.hpp"
  35 
  36 extern "C" {
  37   void JNICALL JVM_RegisterVectorSupportMethods(JNIEnv* env, jclass vsclass);
  38 }
  39 
  40 class VectorSupport : AllStatic {
  41  public:
  42 
  43    // Should be aligned with constants in jdk.internal.vm.vector.VectorSupport
  44   enum VectorOperation {
  45     // Unary
  46     VECTOR_OP_ABS     = 0,
  47     VECTOR_OP_NEG     = 1,
  48     VECTOR_OP_SQRT    = 2,
  49     VECTOR_OP_NOT     = 3,
  50 
  51     // Binary
  52     VECTOR_OP_ADD     = 4,
  53     VECTOR_OP_SUB     = 5,
  54     VECTOR_OP_MUL     = 6,
  55     VECTOR_OP_DIV     = 7,
  56     VECTOR_OP_MIN     = 8,
  57     VECTOR_OP_MAX     = 9,
  58     VECTOR_OP_AND     = 10,
  59     VECTOR_OP_OR      = 11,
  60     VECTOR_OP_XOR     = 12,
  61 
  62     // Ternary
  63     VECTOR_OP_FMA     = 13,
  64 
  65     // Broadcast int
  66     VECTOR_OP_LSHIFT  = 14,
  67     VECTOR_OP_RSHIFT  = 15,
  68     VECTOR_OP_URSHIFT = 16,
  69 
  70     // Convert
  71     VECTOR_OP_CAST        = 17,
  72     VECTOR_OP_REINTERPRET = 18
  73   };
  74 
  75   static int vop2ideal(jint vop, BasicType bt);
  76 
  77   static bool is_vector(Klass* klass);
  78   static bool is_vector_mask(Klass* klass);
  79   static bool is_vector_shuffle(Klass* klass);
  80 };
  81 #endif // SHARE_PRIMS_VECTORSUPPORT_HPP