hotspot/src/share/vm/opto/vectornode.cpp
author kvn
Mon, 20 Aug 2012 09:07:21 -0700
changeset 13485 6c7faa516fc6
parent 13104 657b387034fb
child 13488 a9ec58a1f613
permissions -rw-r--r--
6340864: Implement vectorization optimizations in hotspot-server Summary: Added asm encoding and mach nodes for vector arithmetic instructions on x86. Reviewed-by: roland
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
     2
 * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2105
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2105
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2105
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    24
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#include "memory/allocation.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#include "opto/connode.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
#include "opto/vectornode.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
//------------------------------VectorNode--------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
// Return the vector operator for the specified scalar operation
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
    32
// and vector length.  Also used to check if the code generator
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
// supports the vector operation.
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
    34
int VectorNode::opcode(int sopc, uint vlen, BasicType bt) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  switch (sopc) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  case Op_AddI:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
    switch (bt) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
    case T_BOOLEAN:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
    case T_BYTE:      return Op_AddVB;
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
    40
    case T_CHAR:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
    case T_SHORT:     return Op_AddVS;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
    case T_INT:       return Op_AddVI;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
    ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  case Op_AddL:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
    assert(bt == T_LONG, "must be");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
    return Op_AddVL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  case Op_AddF:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
    assert(bt == T_FLOAT, "must be");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
    return Op_AddVF;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  case Op_AddD:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
    assert(bt == T_DOUBLE, "must be");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
    return Op_AddVD;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  case Op_SubI:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
    switch (bt) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
    case T_BOOLEAN:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
    case T_BYTE:   return Op_SubVB;
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
    58
    case T_CHAR:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
    case T_SHORT:  return Op_SubVS;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
    case T_INT:    return Op_SubVI;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
    ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  case Op_SubL:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
    assert(bt == T_LONG, "must be");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
    return Op_SubVL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  case Op_SubF:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
    assert(bt == T_FLOAT, "must be");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
    return Op_SubVF;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  case Op_SubD:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
    assert(bt == T_DOUBLE, "must be");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
    return Op_SubVD;
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
    72
  case Op_MulI:
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
    73
    switch (bt) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
    74
    case T_BOOLEAN:
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
    75
    case T_BYTE:   return 0;   // Unimplemented
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
    76
    case T_CHAR:
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
    77
    case T_SHORT:  return Op_MulVS;
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
    78
    case T_INT:    return Matcher::match_rule_supported(Op_MulVI) ? Op_MulVI : 0; // SSE4_1
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
    79
    }
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
    80
    ShouldNotReachHere();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  case Op_MulF:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
    assert(bt == T_FLOAT, "must be");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
    return Op_MulVF;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  case Op_MulD:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
    assert(bt == T_DOUBLE, "must be");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
    return Op_MulVD;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  case Op_DivF:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
    assert(bt == T_FLOAT, "must be");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
    return Op_DivVF;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  case Op_DivD:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
    assert(bt == T_DOUBLE, "must be");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
    return Op_DivVD;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  case Op_LShiftI:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
    switch (bt) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
    case T_BOOLEAN:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
    case T_BYTE:   return Op_LShiftVB;
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
    97
    case T_CHAR:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
    case T_SHORT:  return Op_LShiftVS;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
    case T_INT:    return Op_LShiftVI;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
    ShouldNotReachHere();
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   102
  case Op_LShiftL:
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   103
    assert(bt == T_LONG, "must be");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   104
    return Op_LShiftVL;
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   105
  case Op_RShiftI:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
    switch (bt) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
    case T_BOOLEAN:
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   108
    case T_BYTE:   return Op_RShiftVB;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   109
    case T_CHAR:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   110
    case T_SHORT:  return Op_RShiftVS;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   111
    case T_INT:    return Op_RShiftVI;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
    ShouldNotReachHere();
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   114
  case Op_RShiftL:
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   115
    assert(bt == T_LONG, "must be");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   116
    return Op_RShiftVL;
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   117
  case Op_URShiftI:
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   118
    switch (bt) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   119
    case T_BOOLEAN:
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   120
    case T_BYTE:   return Op_URShiftVB;
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   121
    case T_CHAR:
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   122
    case T_SHORT:  return Op_URShiftVS;
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   123
    case T_INT:    return Op_URShiftVI;
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   124
    }
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   125
    ShouldNotReachHere();
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   126
  case Op_URShiftL:
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   127
    assert(bt == T_LONG, "must be");
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   128
    return Op_URShiftVL;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  case Op_AndI:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  case Op_AndL:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
    return Op_AndV;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  case Op_OrI:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  case Op_OrL:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
    return Op_OrV;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  case Op_XorI:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  case Op_XorL:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
    return Op_XorV;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  case Op_LoadB:
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   140
  case Op_LoadUB:
2022
28ce8115a91d 6796746: rename LoadC (char) opcode class to LoadUS (unsigned short)
twisti
parents: 670
diff changeset
   141
  case Op_LoadUS:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  case Op_LoadS:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
  case Op_LoadI:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  case Op_LoadL:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  case Op_LoadF:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  case Op_LoadD:
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   147
    return Op_LoadVector;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  case Op_StoreB:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  case Op_StoreC:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  case Op_StoreI:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
  case Op_StoreL:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  case Op_StoreF:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  case Op_StoreD:
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   155
    return Op_StoreVector;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  return 0; // Unimplemented
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   160
bool VectorNode::implemented(int opc, uint vlen, BasicType bt) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   161
  if (is_java_primitive(bt) &&
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   162
      (vlen > 1) && is_power_of_2(vlen) &&
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   163
      Matcher::vector_size_supported(bt, vlen)) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   164
    int vopc = VectorNode::opcode(opc, vlen, bt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   165
    return vopc > 0 && Matcher::has_match_rule(vopc);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  }
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   167
  return false;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   170
bool VectorNode::is_shift(Node* n) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   171
  switch (n->Opcode()) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   172
  case Op_LShiftI:
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   173
  case Op_LShiftL:
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   174
  case Op_RShiftI:
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   175
  case Op_RShiftL:
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   176
  case Op_URShiftI:
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   177
  case Op_URShiftL:
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   178
    return true;
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   179
  }
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   180
  return false;
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   181
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   182
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   183
// Check if input is loop invarient vector.
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   184
bool VectorNode::is_invariant_vector(Node* n) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   185
  // Only Replicate vector nodes are loop invarient for now.
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   186
  switch (n->Opcode()) {
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   187
  case Op_ReplicateB:
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   188
  case Op_ReplicateS:
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   189
  case Op_ReplicateI:
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   190
  case Op_ReplicateL:
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   191
  case Op_ReplicateF:
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   192
  case Op_ReplicateD:
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   193
    return true;
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   194
  }
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   195
  return false;
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   196
}
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   197
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
// Return the vector version of a scalar operation node.
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   199
VectorNode* VectorNode::make(Compile* C, int opc, Node* n1, Node* n2, uint vlen, BasicType bt) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   200
  const TypeVect* vt = TypeVect::make(bt, vlen);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   201
  int vopc = VectorNode::opcode(opc, vlen, bt);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  switch (vopc) {
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   204
  case Op_AddVB: return new (C, 3) AddVBNode(n1, n2, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   205
  case Op_AddVS: return new (C, 3) AddVSNode(n1, n2, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   206
  case Op_AddVI: return new (C, 3) AddVINode(n1, n2, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   207
  case Op_AddVL: return new (C, 3) AddVLNode(n1, n2, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   208
  case Op_AddVF: return new (C, 3) AddVFNode(n1, n2, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   209
  case Op_AddVD: return new (C, 3) AddVDNode(n1, n2, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   210
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   211
  case Op_SubVB: return new (C, 3) SubVBNode(n1, n2, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   212
  case Op_SubVS: return new (C, 3) SubVSNode(n1, n2, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   213
  case Op_SubVI: return new (C, 3) SubVINode(n1, n2, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   214
  case Op_SubVL: return new (C, 3) SubVLNode(n1, n2, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   215
  case Op_SubVF: return new (C, 3) SubVFNode(n1, n2, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   216
  case Op_SubVD: return new (C, 3) SubVDNode(n1, n2, vt);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   218
  case Op_MulVS: return new (C, 3) MulVSNode(n1, n2, vt);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   219
  case Op_MulVI: return new (C, 3) MulVINode(n1, n2, vt);
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   220
  case Op_MulVF: return new (C, 3) MulVFNode(n1, n2, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   221
  case Op_MulVD: return new (C, 3) MulVDNode(n1, n2, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   222
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   223
  case Op_DivVF: return new (C, 3) DivVFNode(n1, n2, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   224
  case Op_DivVD: return new (C, 3) DivVDNode(n1, n2, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   225
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   226
  case Op_LShiftVB: return new (C, 3) LShiftVBNode(n1, n2, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   227
  case Op_LShiftVS: return new (C, 3) LShiftVSNode(n1, n2, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   228
  case Op_LShiftVI: return new (C, 3) LShiftVINode(n1, n2, vt);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   229
  case Op_LShiftVL: return new (C, 3) LShiftVLNode(n1, n2, vt);
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   230
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   231
  case Op_RShiftVB: return new (C, 3) RShiftVBNode(n1, n2, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   232
  case Op_RShiftVS: return new (C, 3) RShiftVSNode(n1, n2, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   233
  case Op_RShiftVI: return new (C, 3) RShiftVINode(n1, n2, vt);
13485
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   234
  case Op_RShiftVL: return new (C, 3) RShiftVLNode(n1, n2, vt);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   235
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   236
  case Op_URShiftVB: return new (C, 3) URShiftVBNode(n1, n2, vt);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   237
  case Op_URShiftVS: return new (C, 3) URShiftVSNode(n1, n2, vt);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   238
  case Op_URShiftVI: return new (C, 3) URShiftVINode(n1, n2, vt);
6c7faa516fc6 6340864: Implement vectorization optimizations in hotspot-server
kvn
parents: 13104
diff changeset
   239
  case Op_URShiftVL: return new (C, 3) URShiftVLNode(n1, n2, vt);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   241
  case Op_AndV: return new (C, 3) AndVNode(n1, n2, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   242
  case Op_OrV:  return new (C, 3) OrVNode (n1, n2, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   243
  case Op_XorV: return new (C, 3) XorVNode(n1, n2, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   244
  }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   245
  ShouldNotReachHere();
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   246
  return NULL;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   248
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   250
// Scalar promotion
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   251
VectorNode* VectorNode::scalar2vector(Compile* C, Node* s, uint vlen, const Type* opd_t) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   252
  BasicType bt = opd_t->array_element_basic_type();
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   253
  const TypeVect* vt = opd_t->singleton() ? TypeVect::make(opd_t, vlen)
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   254
                                          : TypeVect::make(bt, vlen);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   255
  switch (bt) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   256
  case T_BOOLEAN:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   257
  case T_BYTE:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   258
    return new (C, 2) ReplicateBNode(s, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   259
  case T_CHAR:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   260
  case T_SHORT:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   261
    return new (C, 2) ReplicateSNode(s, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   262
  case T_INT:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   263
    return new (C, 2) ReplicateINode(s, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   264
  case T_LONG:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   265
    return new (C, 2) ReplicateLNode(s, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   266
  case T_FLOAT:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   267
    return new (C, 2) ReplicateFNode(s, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   268
  case T_DOUBLE:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   269
    return new (C, 2) ReplicateDNode(s, vt);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
  ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
  return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   275
// Return initial Pack node. Additional operands added with add_opd() calls.
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   276
PackNode* PackNode::make(Compile* C, Node* s, uint vlen, BasicType bt) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   277
  const TypeVect* vt = TypeVect::make(bt, vlen);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   278
  switch (bt) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   279
  case T_BOOLEAN:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   280
  case T_BYTE:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   281
    return new (C, vlen+1) PackBNode(s, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   282
  case T_CHAR:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   283
  case T_SHORT:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   284
    return new (C, vlen+1) PackSNode(s, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   285
  case T_INT:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   286
    return new (C, vlen+1) PackINode(s, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   287
  case T_LONG:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   288
    return new (C, vlen+1) PackLNode(s, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   289
  case T_FLOAT:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   290
    return new (C, vlen+1) PackFNode(s, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   291
  case T_DOUBLE:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   292
    return new (C, vlen+1) PackDNode(s, vt);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
  ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
  return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   298
// Create a binary tree form for Packs. [lo, hi) (half-open) range
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   299
Node* PackNode::binaryTreePack(Compile* C, int lo, int hi) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   300
  int ct = hi - lo;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   301
  assert(is_power_of_2(ct), "power of 2");
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   302
  if (ct == 2) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   303
    PackNode* pk = PackNode::make(C, in(lo), 2, vect_type()->element_basic_type());
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   304
    pk->add_opd(1, in(lo+1));
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   305
    return pk;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   307
  } else {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   308
    int mid = lo + ct/2;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   309
    Node* n1 = binaryTreePack(C, lo,  mid);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   310
    Node* n2 = binaryTreePack(C, mid, hi );
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   312
    BasicType bt = vect_type()->element_basic_type();
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   313
    switch (bt) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   314
    case T_BOOLEAN:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   315
    case T_BYTE:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   316
      return new (C, 3) PackSNode(n1, n2, TypeVect::make(T_SHORT, 2));
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   317
    case T_CHAR:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   318
    case T_SHORT:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   319
      return new (C, 3) PackINode(n1, n2, TypeVect::make(T_INT, 2));
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   320
    case T_INT:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   321
      return new (C, 3) PackLNode(n1, n2, TypeVect::make(T_LONG, 2));
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   322
    case T_LONG:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   323
      return new (C, 3) Pack2LNode(n1, n2, TypeVect::make(T_LONG, 2));
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   324
    case T_FLOAT:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   325
      return new (C, 3) PackDNode(n1, n2, TypeVect::make(T_DOUBLE, 2));
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   326
    case T_DOUBLE:
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   327
      return new (C, 3) Pack2DNode(n1, n2, TypeVect::make(T_DOUBLE, 2));
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   328
    }
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   329
    ShouldNotReachHere();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
  return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   334
// Return the vector version of a scalar load node.
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   335
LoadVectorNode* LoadVectorNode::make(Compile* C, int opc, Node* ctl, Node* mem,
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   336
                                     Node* adr, const TypePtr* atyp, uint vlen, BasicType bt) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   337
  const TypeVect* vt = TypeVect::make(bt, vlen);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   338
  return new (C, 3) LoadVectorNode(ctl, mem, adr, atyp, vt);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   339
  return NULL;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   340
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   341
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   342
// Return the vector version of a scalar store node.
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   343
StoreVectorNode* StoreVectorNode::make(Compile* C, int opc, Node* ctl, Node* mem,
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   344
                                       Node* adr, const TypePtr* atyp, Node* val,
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   345
                                       uint vlen) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   346
  return new (C, 4) StoreVectorNode(ctl, mem, adr, atyp, val);
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   347
}
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   348
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
// Extract a scalar element of vector.
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   350
Node* ExtractNode::make(Compile* C, Node* v, uint position, BasicType bt) {
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   351
  assert((int)position < Matcher::max_vector_size(bt), "pos in range");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
  ConINode* pos = ConINode::make(C, (int)position);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
  switch (bt) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
  case T_BOOLEAN:
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   355
    return new (C, 3) ExtractUBNode(v, pos);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
  case T_BYTE:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
    return new (C, 3) ExtractBNode(v, pos);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
  case T_CHAR:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
    return new (C, 3) ExtractCNode(v, pos);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
  case T_SHORT:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
    return new (C, 3) ExtractSNode(v, pos);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
  case T_INT:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
    return new (C, 3) ExtractINode(v, pos);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
  case T_LONG:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
    return new (C, 3) ExtractLNode(v, pos);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
  case T_FLOAT:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
    return new (C, 3) ExtractFNode(v, pos);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
  case T_DOUBLE:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
    return new (C, 3) ExtractDNode(v, pos);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
  ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
  return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
}
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10255
diff changeset
   374