hotspot/src/share/vm/opto/vectornode.cpp
changeset 13485 6c7faa516fc6
parent 13104 657b387034fb
child 13488 a9ec58a1f613
equal deleted inserted replaced
13465:d3fc5d192448 13485:6c7faa516fc6
    67     assert(bt == T_FLOAT, "must be");
    67     assert(bt == T_FLOAT, "must be");
    68     return Op_SubVF;
    68     return Op_SubVF;
    69   case Op_SubD:
    69   case Op_SubD:
    70     assert(bt == T_DOUBLE, "must be");
    70     assert(bt == T_DOUBLE, "must be");
    71     return Op_SubVD;
    71     return Op_SubVD;
       
    72   case Op_MulI:
       
    73     switch (bt) {
       
    74     case T_BOOLEAN:
       
    75     case T_BYTE:   return 0;   // Unimplemented
       
    76     case T_CHAR:
       
    77     case T_SHORT:  return Op_MulVS;
       
    78     case T_INT:    return Matcher::match_rule_supported(Op_MulVI) ? Op_MulVI : 0; // SSE4_1
       
    79     }
       
    80     ShouldNotReachHere();
    72   case Op_MulF:
    81   case Op_MulF:
    73     assert(bt == T_FLOAT, "must be");
    82     assert(bt == T_FLOAT, "must be");
    74     return Op_MulVF;
    83     return Op_MulVF;
    75   case Op_MulD:
    84   case Op_MulD:
    76     assert(bt == T_DOUBLE, "must be");
    85     assert(bt == T_DOUBLE, "must be");
    88     case T_CHAR:
    97     case T_CHAR:
    89     case T_SHORT:  return Op_LShiftVS;
    98     case T_SHORT:  return Op_LShiftVS;
    90     case T_INT:    return Op_LShiftVI;
    99     case T_INT:    return Op_LShiftVI;
    91     }
   100     }
    92     ShouldNotReachHere();
   101     ShouldNotReachHere();
       
   102   case Op_LShiftL:
       
   103     assert(bt == T_LONG, "must be");
       
   104     return Op_LShiftVL;
    93   case Op_RShiftI:
   105   case Op_RShiftI:
    94     switch (bt) {
   106     switch (bt) {
    95     case T_BOOLEAN:
   107     case T_BOOLEAN:
    96     case T_BYTE:   return Op_RShiftVB;
   108     case T_BYTE:   return Op_RShiftVB;
    97     case T_CHAR:
   109     case T_CHAR:
    98     case T_SHORT:  return Op_RShiftVS;
   110     case T_SHORT:  return Op_RShiftVS;
    99     case T_INT:    return Op_RShiftVI;
   111     case T_INT:    return Op_RShiftVI;
   100     }
   112     }
   101     ShouldNotReachHere();
   113     ShouldNotReachHere();
       
   114   case Op_RShiftL:
       
   115     assert(bt == T_LONG, "must be");
       
   116     return Op_RShiftVL;
       
   117   case Op_URShiftI:
       
   118     switch (bt) {
       
   119     case T_BOOLEAN:
       
   120     case T_BYTE:   return Op_URShiftVB;
       
   121     case T_CHAR:
       
   122     case T_SHORT:  return Op_URShiftVS;
       
   123     case T_INT:    return Op_URShiftVI;
       
   124     }
       
   125     ShouldNotReachHere();
       
   126   case Op_URShiftL:
       
   127     assert(bt == T_LONG, "must be");
       
   128     return Op_URShiftVL;
   102   case Op_AndI:
   129   case Op_AndI:
   103   case Op_AndL:
   130   case Op_AndL:
   104     return Op_AndV;
   131     return Op_AndV;
   105   case Op_OrI:
   132   case Op_OrI:
   106   case Op_OrL:
   133   case Op_OrL:
   138     return vopc > 0 && Matcher::has_match_rule(vopc);
   165     return vopc > 0 && Matcher::has_match_rule(vopc);
   139   }
   166   }
   140   return false;
   167   return false;
   141 }
   168 }
   142 
   169 
       
   170 bool VectorNode::is_shift(Node* n) {
       
   171   switch (n->Opcode()) {
       
   172   case Op_LShiftI:
       
   173   case Op_LShiftL:
       
   174   case Op_RShiftI:
       
   175   case Op_RShiftL:
       
   176   case Op_URShiftI:
       
   177   case Op_URShiftL:
       
   178     return true;
       
   179   }
       
   180   return false;
       
   181 }
       
   182 
       
   183 // Check if input is loop invarient vector.
       
   184 bool VectorNode::is_invariant_vector(Node* n) {
       
   185   // Only Replicate vector nodes are loop invarient for now.
       
   186   switch (n->Opcode()) {
       
   187   case Op_ReplicateB:
       
   188   case Op_ReplicateS:
       
   189   case Op_ReplicateI:
       
   190   case Op_ReplicateL:
       
   191   case Op_ReplicateF:
       
   192   case Op_ReplicateD:
       
   193     return true;
       
   194   }
       
   195   return false;
       
   196 }
       
   197 
   143 // Return the vector version of a scalar operation node.
   198 // Return the vector version of a scalar operation node.
   144 VectorNode* VectorNode::make(Compile* C, int opc, Node* n1, Node* n2, uint vlen, BasicType bt) {
   199 VectorNode* VectorNode::make(Compile* C, int opc, Node* n1, Node* n2, uint vlen, BasicType bt) {
   145   const TypeVect* vt = TypeVect::make(bt, vlen);
   200   const TypeVect* vt = TypeVect::make(bt, vlen);
   146   int vopc = VectorNode::opcode(opc, vlen, bt);
   201   int vopc = VectorNode::opcode(opc, vlen, bt);
   147 
   202 
   158   case Op_SubVI: return new (C, 3) SubVINode(n1, n2, vt);
   213   case Op_SubVI: return new (C, 3) SubVINode(n1, n2, vt);
   159   case Op_SubVL: return new (C, 3) SubVLNode(n1, n2, vt);
   214   case Op_SubVL: return new (C, 3) SubVLNode(n1, n2, vt);
   160   case Op_SubVF: return new (C, 3) SubVFNode(n1, n2, vt);
   215   case Op_SubVF: return new (C, 3) SubVFNode(n1, n2, vt);
   161   case Op_SubVD: return new (C, 3) SubVDNode(n1, n2, vt);
   216   case Op_SubVD: return new (C, 3) SubVDNode(n1, n2, vt);
   162 
   217 
       
   218   case Op_MulVS: return new (C, 3) MulVSNode(n1, n2, vt);
       
   219   case Op_MulVI: return new (C, 3) MulVINode(n1, n2, vt);
   163   case Op_MulVF: return new (C, 3) MulVFNode(n1, n2, vt);
   220   case Op_MulVF: return new (C, 3) MulVFNode(n1, n2, vt);
   164   case Op_MulVD: return new (C, 3) MulVDNode(n1, n2, vt);
   221   case Op_MulVD: return new (C, 3) MulVDNode(n1, n2, vt);
   165 
   222 
   166   case Op_DivVF: return new (C, 3) DivVFNode(n1, n2, vt);
   223   case Op_DivVF: return new (C, 3) DivVFNode(n1, n2, vt);
   167   case Op_DivVD: return new (C, 3) DivVDNode(n1, n2, vt);
   224   case Op_DivVD: return new (C, 3) DivVDNode(n1, n2, vt);
   168 
   225 
   169   case Op_LShiftVB: return new (C, 3) LShiftVBNode(n1, n2, vt);
   226   case Op_LShiftVB: return new (C, 3) LShiftVBNode(n1, n2, vt);
   170   case Op_LShiftVS: return new (C, 3) LShiftVSNode(n1, n2, vt);
   227   case Op_LShiftVS: return new (C, 3) LShiftVSNode(n1, n2, vt);
   171   case Op_LShiftVI: return new (C, 3) LShiftVINode(n1, n2, vt);
   228   case Op_LShiftVI: return new (C, 3) LShiftVINode(n1, n2, vt);
       
   229   case Op_LShiftVL: return new (C, 3) LShiftVLNode(n1, n2, vt);
   172 
   230 
   173   case Op_RShiftVB: return new (C, 3) RShiftVBNode(n1, n2, vt);
   231   case Op_RShiftVB: return new (C, 3) RShiftVBNode(n1, n2, vt);
   174   case Op_RShiftVS: return new (C, 3) RShiftVSNode(n1, n2, vt);
   232   case Op_RShiftVS: return new (C, 3) RShiftVSNode(n1, n2, vt);
   175   case Op_RShiftVI: return new (C, 3) RShiftVINode(n1, n2, vt);
   233   case Op_RShiftVI: return new (C, 3) RShiftVINode(n1, n2, vt);
       
   234   case Op_RShiftVL: return new (C, 3) RShiftVLNode(n1, n2, vt);
       
   235 
       
   236   case Op_URShiftVB: return new (C, 3) URShiftVBNode(n1, n2, vt);
       
   237   case Op_URShiftVS: return new (C, 3) URShiftVSNode(n1, n2, vt);
       
   238   case Op_URShiftVI: return new (C, 3) URShiftVINode(n1, n2, vt);
       
   239   case Op_URShiftVL: return new (C, 3) URShiftVLNode(n1, n2, vt);
   176 
   240 
   177   case Op_AndV: return new (C, 3) AndVNode(n1, n2, vt);
   241   case Op_AndV: return new (C, 3) AndVNode(n1, n2, vt);
   178   case Op_OrV:  return new (C, 3) OrVNode (n1, n2, vt);
   242   case Op_OrV:  return new (C, 3) OrVNode (n1, n2, vt);
   179   case Op_XorV: return new (C, 3) XorVNode(n1, n2, vt);
   243   case Op_XorV: return new (C, 3) XorVNode(n1, n2, vt);
   180   }
   244   }