src/share/vm/opto/vectornode.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6340864 Sdiff src/share/vm/opto

src/share/vm/opto/vectornode.cpp

Print this page




  52     assert(bt == T_DOUBLE, "must be");
  53     return Op_AddVD;
  54   case Op_SubI:
  55     switch (bt) {
  56     case T_BOOLEAN:
  57     case T_BYTE:   return Op_SubVB;
  58     case T_CHAR:
  59     case T_SHORT:  return Op_SubVS;
  60     case T_INT:    return Op_SubVI;
  61     }
  62     ShouldNotReachHere();
  63   case Op_SubL:
  64     assert(bt == T_LONG, "must be");
  65     return Op_SubVL;
  66   case Op_SubF:
  67     assert(bt == T_FLOAT, "must be");
  68     return Op_SubVF;
  69   case Op_SubD:
  70     assert(bt == T_DOUBLE, "must be");
  71     return Op_SubVD;









  72   case Op_MulF:
  73     assert(bt == T_FLOAT, "must be");
  74     return Op_MulVF;
  75   case Op_MulD:
  76     assert(bt == T_DOUBLE, "must be");
  77     return Op_MulVD;
  78   case Op_DivF:
  79     assert(bt == T_FLOAT, "must be");
  80     return Op_DivVF;
  81   case Op_DivD:
  82     assert(bt == T_DOUBLE, "must be");
  83     return Op_DivVD;
  84   case Op_LShiftI:
  85     switch (bt) {
  86     case T_BOOLEAN:
  87     case T_BYTE:   return Op_LShiftVB;
  88     case T_CHAR:
  89     case T_SHORT:  return Op_LShiftVS;
  90     case T_INT:    return Op_LShiftVI;
  91     }
  92     ShouldNotReachHere();



  93   case Op_RShiftI:
  94     switch (bt) {
  95     case T_BOOLEAN:
  96     case T_BYTE:   return Op_RShiftVB;
  97     case T_CHAR:
  98     case T_SHORT:  return Op_RShiftVS;
  99     case T_INT:    return Op_RShiftVI;
 100     }
 101     ShouldNotReachHere();















 102   case Op_AndI:
 103   case Op_AndL:
 104     return Op_AndV;
 105   case Op_OrI:
 106   case Op_OrL:
 107     return Op_OrV;
 108   case Op_XorI:
 109   case Op_XorL:
 110     return Op_XorV;
 111 
 112   case Op_LoadB:
 113   case Op_LoadUB:
 114   case Op_LoadUS:
 115   case Op_LoadS:
 116   case Op_LoadI:
 117   case Op_LoadL:
 118   case Op_LoadF:
 119   case Op_LoadD:
 120     return Op_LoadVector;
 121 


 123   case Op_StoreC:
 124   case Op_StoreI:
 125   case Op_StoreL:
 126   case Op_StoreF:
 127   case Op_StoreD:
 128     return Op_StoreVector;
 129   }
 130   return 0; // Unimplemented
 131 }
 132 
 133 bool VectorNode::implemented(int opc, uint vlen, BasicType bt) {
 134   if (is_java_primitive(bt) &&
 135       (vlen > 1) && is_power_of_2(vlen) &&
 136       Matcher::vector_size_supported(bt, vlen)) {
 137     int vopc = VectorNode::opcode(opc, vlen, bt);
 138     return vopc > 0 && Matcher::has_match_rule(vopc);
 139   }
 140   return false;
 141 }
 142 
















 143 // 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) {
 145   const TypeVect* vt = TypeVect::make(bt, vlen);
 146   int vopc = VectorNode::opcode(opc, vlen, bt);
 147 
 148   switch (vopc) {
 149   case Op_AddVB: return new (C, 3) AddVBNode(n1, n2, vt);
 150   case Op_AddVS: return new (C, 3) AddVSNode(n1, n2, vt);
 151   case Op_AddVI: return new (C, 3) AddVINode(n1, n2, vt);
 152   case Op_AddVL: return new (C, 3) AddVLNode(n1, n2, vt);
 153   case Op_AddVF: return new (C, 3) AddVFNode(n1, n2, vt);
 154   case Op_AddVD: return new (C, 3) AddVDNode(n1, n2, vt);
 155 
 156   case Op_SubVB: return new (C, 3) SubVBNode(n1, n2, vt);
 157   case Op_SubVS: return new (C, 3) SubVSNode(n1, n2, vt);
 158   case Op_SubVI: return new (C, 3) SubVINode(n1, n2, vt);
 159   case Op_SubVL: return new (C, 3) SubVLNode(n1, n2, vt);
 160   case Op_SubVF: return new (C, 3) SubVFNode(n1, n2, vt);
 161   case Op_SubVD: return new (C, 3) SubVDNode(n1, n2, vt);
 162 


 163   case Op_MulVF: return new (C, 3) MulVFNode(n1, n2, vt);
 164   case Op_MulVD: return new (C, 3) MulVDNode(n1, n2, vt);
 165 
 166   case Op_DivVF: return new (C, 3) DivVFNode(n1, n2, vt);
 167   case Op_DivVD: return new (C, 3) DivVDNode(n1, n2, vt);
 168 
 169   case Op_LShiftVB: return new (C, 3) LShiftVBNode(n1, n2, vt);
 170   case Op_LShiftVS: return new (C, 3) LShiftVSNode(n1, n2, vt);
 171   case Op_LShiftVI: return new (C, 3) LShiftVINode(n1, n2, vt);

 172 
 173   case Op_RShiftVB: return new (C, 3) RShiftVBNode(n1, n2, vt);
 174   case Op_RShiftVS: return new (C, 3) RShiftVSNode(n1, n2, vt);
 175   case Op_RShiftVI: return new (C, 3) RShiftVINode(n1, n2, vt);

 176 





 177   case Op_AndV: return new (C, 3) AndVNode(n1, n2, vt);
 178   case Op_OrV:  return new (C, 3) OrVNode (n1, n2, vt);
 179   case Op_XorV: return new (C, 3) XorVNode(n1, n2, vt);
 180   }
 181   ShouldNotReachHere();
 182   return NULL;
 183 
 184 }
 185 
 186 // Scalar promotion
 187 VectorNode* VectorNode::scalar2vector(Compile* C, Node* s, uint vlen, const Type* opd_t) {
 188   BasicType bt = opd_t->array_element_basic_type();
 189   const TypeVect* vt = opd_t->singleton() ? TypeVect::make(opd_t, vlen)
 190                                           : TypeVect::make(bt, vlen);
 191   switch (bt) {
 192   case T_BOOLEAN:
 193   case T_BYTE:
 194     return new (C, 2) ReplicateBNode(s, vt);
 195   case T_CHAR:
 196   case T_SHORT:




  52     assert(bt == T_DOUBLE, "must be");
  53     return Op_AddVD;
  54   case Op_SubI:
  55     switch (bt) {
  56     case T_BOOLEAN:
  57     case T_BYTE:   return Op_SubVB;
  58     case T_CHAR:
  59     case T_SHORT:  return Op_SubVS;
  60     case T_INT:    return Op_SubVI;
  61     }
  62     ShouldNotReachHere();
  63   case Op_SubL:
  64     assert(bt == T_LONG, "must be");
  65     return Op_SubVL;
  66   case Op_SubF:
  67     assert(bt == T_FLOAT, "must be");
  68     return Op_SubVF;
  69   case Op_SubD:
  70     assert(bt == T_DOUBLE, "must be");
  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();
  81   case Op_MulF:
  82     assert(bt == T_FLOAT, "must be");
  83     return Op_MulVF;
  84   case Op_MulD:
  85     assert(bt == T_DOUBLE, "must be");
  86     return Op_MulVD;
  87   case Op_DivF:
  88     assert(bt == T_FLOAT, "must be");
  89     return Op_DivVF;
  90   case Op_DivD:
  91     assert(bt == T_DOUBLE, "must be");
  92     return Op_DivVD;
  93   case Op_LShiftI:
  94     switch (bt) {
  95     case T_BOOLEAN:
  96     case T_BYTE:   return Op_LShiftVB;
  97     case T_CHAR:
  98     case T_SHORT:  return Op_LShiftVS;
  99     case T_INT:    return Op_LShiftVI;
 100     }
 101     ShouldNotReachHere();
 102   case Op_LShiftL:
 103     assert(bt == T_LONG, "must be");
 104     return Op_LShiftVL;
 105   case Op_RShiftI:
 106     switch (bt) {
 107     case T_BOOLEAN:
 108     case T_BYTE:   return Op_RShiftVB;
 109     case T_CHAR:
 110     case T_SHORT:  return Op_RShiftVS;
 111     case T_INT:    return Op_RShiftVI;
 112     }
 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;
 129   case Op_AndI:
 130   case Op_AndL:
 131     return Op_AndV;
 132   case Op_OrI:
 133   case Op_OrL:
 134     return Op_OrV;
 135   case Op_XorI:
 136   case Op_XorL:
 137     return Op_XorV;
 138 
 139   case Op_LoadB:
 140   case Op_LoadUB:
 141   case Op_LoadUS:
 142   case Op_LoadS:
 143   case Op_LoadI:
 144   case Op_LoadL:
 145   case Op_LoadF:
 146   case Op_LoadD:
 147     return Op_LoadVector;
 148 


 150   case Op_StoreC:
 151   case Op_StoreI:
 152   case Op_StoreL:
 153   case Op_StoreF:
 154   case Op_StoreD:
 155     return Op_StoreVector;
 156   }
 157   return 0; // Unimplemented
 158 }
 159 
 160 bool VectorNode::implemented(int opc, uint vlen, BasicType bt) {
 161   if (is_java_primitive(bt) &&
 162       (vlen > 1) && is_power_of_2(vlen) &&
 163       Matcher::vector_size_supported(bt, vlen)) {
 164     int vopc = VectorNode::opcode(opc, vlen, bt);
 165     return vopc > 0 && Matcher::has_match_rule(vopc);
 166   }
 167   return false;
 168 }
 169 
 170 // Check if input should be vectorized.
 171 bool VectorNode::needs_vector_input(Node* n, int opd_idx) {
 172   // Only shift vector instructions don't need a vector for a shift value.
 173   if (opd_idx != 2) return true;
 174   switch (n->Opcode()) {
 175   case Op_LShiftI:
 176   case Op_LShiftL:
 177   case Op_RShiftI:
 178   case Op_RShiftL:
 179   case Op_URShiftI:
 180   case Op_URShiftL:
 181     return false;
 182   }
 183   return true;
 184 }
 185 
 186 // Return the vector version of a scalar operation node.
 187 VectorNode* VectorNode::make(Compile* C, int opc, Node* n1, Node* n2, uint vlen, BasicType bt) {
 188   const TypeVect* vt = TypeVect::make(bt, vlen);
 189   int vopc = VectorNode::opcode(opc, vlen, bt);
 190 
 191   switch (vopc) {
 192   case Op_AddVB: return new (C, 3) AddVBNode(n1, n2, vt);
 193   case Op_AddVS: return new (C, 3) AddVSNode(n1, n2, vt);
 194   case Op_AddVI: return new (C, 3) AddVINode(n1, n2, vt);
 195   case Op_AddVL: return new (C, 3) AddVLNode(n1, n2, vt);
 196   case Op_AddVF: return new (C, 3) AddVFNode(n1, n2, vt);
 197   case Op_AddVD: return new (C, 3) AddVDNode(n1, n2, vt);
 198 
 199   case Op_SubVB: return new (C, 3) SubVBNode(n1, n2, vt);
 200   case Op_SubVS: return new (C, 3) SubVSNode(n1, n2, vt);
 201   case Op_SubVI: return new (C, 3) SubVINode(n1, n2, vt);
 202   case Op_SubVL: return new (C, 3) SubVLNode(n1, n2, vt);
 203   case Op_SubVF: return new (C, 3) SubVFNode(n1, n2, vt);
 204   case Op_SubVD: return new (C, 3) SubVDNode(n1, n2, vt);
 205 
 206   case Op_MulVS: return new (C, 3) MulVSNode(n1, n2, vt);
 207   case Op_MulVI: return new (C, 3) MulVINode(n1, n2, vt);
 208   case Op_MulVF: return new (C, 3) MulVFNode(n1, n2, vt);
 209   case Op_MulVD: return new (C, 3) MulVDNode(n1, n2, vt);
 210 
 211   case Op_DivVF: return new (C, 3) DivVFNode(n1, n2, vt);
 212   case Op_DivVD: return new (C, 3) DivVDNode(n1, n2, vt);
 213 
 214   case Op_LShiftVB: return new (C, 3) LShiftVBNode(n1, n2, vt);
 215   case Op_LShiftVS: return new (C, 3) LShiftVSNode(n1, n2, vt);
 216   case Op_LShiftVI: return new (C, 3) LShiftVINode(n1, n2, vt);
 217   case Op_LShiftVL: return new (C, 3) LShiftVLNode(n1, n2, vt);
 218 
 219   case Op_RShiftVB: return new (C, 3) RShiftVBNode(n1, n2, vt);
 220   case Op_RShiftVS: return new (C, 3) RShiftVSNode(n1, n2, vt);
 221   case Op_RShiftVI: return new (C, 3) RShiftVINode(n1, n2, vt);
 222   case Op_RShiftVL: return new (C, 3) RShiftVLNode(n1, n2, vt);
 223 
 224   case Op_URShiftVB: return new (C, 3) URShiftVBNode(n1, n2, vt);
 225   case Op_URShiftVS: return new (C, 3) URShiftVSNode(n1, n2, vt);
 226   case Op_URShiftVI: return new (C, 3) URShiftVINode(n1, n2, vt);
 227   case Op_URShiftVL: return new (C, 3) URShiftVLNode(n1, n2, vt);
 228 
 229   case Op_AndV: return new (C, 3) AndVNode(n1, n2, vt);
 230   case Op_OrV:  return new (C, 3) OrVNode (n1, n2, vt);
 231   case Op_XorV: return new (C, 3) XorVNode(n1, n2, vt);
 232   }
 233   ShouldNotReachHere();
 234   return NULL;
 235 
 236 }
 237 
 238 // Scalar promotion
 239 VectorNode* VectorNode::scalar2vector(Compile* C, Node* s, uint vlen, const Type* opd_t) {
 240   BasicType bt = opd_t->array_element_basic_type();
 241   const TypeVect* vt = opd_t->singleton() ? TypeVect::make(opd_t, vlen)
 242                                           : TypeVect::make(bt, vlen);
 243   switch (bt) {
 244   case T_BOOLEAN:
 245   case T_BYTE:
 246     return new (C, 2) ReplicateBNode(s, vt);
 247   case T_CHAR:
 248   case T_SHORT:


src/share/vm/opto/vectornode.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File