179 case Op_XorL:
180 return Op_XorV;
181
182 case Op_LoadB:
183 case Op_LoadUB:
184 case Op_LoadUS:
185 case Op_LoadS:
186 case Op_LoadI:
187 case Op_LoadL:
188 case Op_LoadF:
189 case Op_LoadD:
190 return Op_LoadVector;
191
192 case Op_StoreB:
193 case Op_StoreC:
194 case Op_StoreI:
195 case Op_StoreL:
196 case Op_StoreF:
197 case Op_StoreD:
198 return Op_StoreVector;
199
200 default:
201 return 0; // Unimplemented
202 }
203 }
204
205 // Also used to check if the code generator
206 // supports the vector operation.
207 bool VectorNode::implemented(int opc, uint vlen, BasicType bt) {
208 if (is_java_primitive(bt) &&
209 (vlen > 1) && is_power_of_2(vlen) &&
210 Matcher::vector_size_supported(bt, vlen)) {
211 int vopc = VectorNode::opcode(opc, bt);
212 return vopc > 0 && Matcher::match_rule_supported_vector(vopc, vlen);
213 }
214 return false;
215 }
216
217 bool VectorNode::is_shift(Node* n) {
218 switch (n->Opcode()) {
219 case Op_LShiftI:
220 case Op_LShiftL:
221 case Op_RShiftI:
222 case Op_RShiftL:
223 case Op_URShiftI:
224 case Op_URShiftL:
225 return true;
226 default:
227 return false;
228 }
229 }
230
231 // Check if input is loop invariant vector.
232 bool VectorNode::is_invariant_vector(Node* n) {
233 // Only Replicate vector nodes are loop invariant for now.
234 switch (n->Opcode()) {
235 case Op_ReplicateB:
236 case Op_ReplicateS:
260 case Op_StoreB: case Op_StoreC:
261 case Op_StoreI: case Op_StoreL:
262 case Op_StoreF: case Op_StoreD:
263 case Op_StoreP: case Op_StoreN:
264 *start = MemNode::ValueIn;
265 *end = MemNode::ValueIn + 1; // 1 vector operand
266 break;
267 case Op_LShiftI: case Op_LShiftL:
268 case Op_RShiftI: case Op_RShiftL:
269 case Op_URShiftI: case Op_URShiftL:
270 *start = 1;
271 *end = 2; // 1 vector operand
272 break;
273 case Op_AddI: case Op_AddL: case Op_AddF: case Op_AddD:
274 case Op_SubI: case Op_SubL: case Op_SubF: case Op_SubD:
275 case Op_MulI: case Op_MulL: case Op_MulF: case Op_MulD:
276 case Op_DivF: case Op_DivD:
277 case Op_AndI: case Op_AndL:
278 case Op_OrI: case Op_OrL:
279 case Op_XorI: case Op_XorL:
280 *start = 1;
281 *end = 3; // 2 vector operands
282 break;
283 case Op_CMoveI: case Op_CMoveL: case Op_CMoveF: case Op_CMoveD:
284 *start = 2;
285 *end = n->req();
286 break;
287 case Op_FmaD:
288 case Op_FmaF:
289 *start = 1;
290 *end = 4; // 3 vector operands
291 break;
292 default:
293 *start = 1;
294 *end = n->req(); // default is all operands
295 }
296 }
297
298 // Return the vector version of a scalar operation node.
299 VectorNode* VectorNode::make(int opc, Node* n1, Node* n2, uint vlen, BasicType bt) {
337 case Op_PopCountVI: return new PopCountVINode(n1, vt);
338
339 case Op_LShiftVB: return new LShiftVBNode(n1, n2, vt);
340 case Op_LShiftVS: return new LShiftVSNode(n1, n2, vt);
341 case Op_LShiftVI: return new LShiftVINode(n1, n2, vt);
342 case Op_LShiftVL: return new LShiftVLNode(n1, n2, vt);
343
344 case Op_RShiftVB: return new RShiftVBNode(n1, n2, vt);
345 case Op_RShiftVS: return new RShiftVSNode(n1, n2, vt);
346 case Op_RShiftVI: return new RShiftVINode(n1, n2, vt);
347 case Op_RShiftVL: return new RShiftVLNode(n1, n2, vt);
348
349 case Op_URShiftVB: return new URShiftVBNode(n1, n2, vt);
350 case Op_URShiftVS: return new URShiftVSNode(n1, n2, vt);
351 case Op_URShiftVI: return new URShiftVINode(n1, n2, vt);
352 case Op_URShiftVL: return new URShiftVLNode(n1, n2, vt);
353
354 case Op_AndV: return new AndVNode(n1, n2, vt);
355 case Op_OrV: return new OrVNode (n1, n2, vt);
356 case Op_XorV: return new XorVNode(n1, n2, vt);
357 default:
358 fatal("Missed vector creation for '%s'", NodeClassNames[vopc]);
359 return NULL;
360 }
361 }
362
363 VectorNode* VectorNode::make(int opc, Node* n1, Node* n2, Node* n3, uint vlen, BasicType bt) {
364 const TypeVect* vt = TypeVect::make(bt, vlen);
365 int vopc = VectorNode::opcode(opc, bt);
366 // This method should not be called for unimplemented vectors.
367 guarantee(vopc > 0, "Vector for '%s' is not implemented", NodeClassNames[opc]);
368 switch (vopc) {
369 case Op_FmaVD: return new FmaVDNode(n1, n2, n3, vt);
370 case Op_FmaVF: return new FmaVFNode(n1, n2, n3, vt);
371 default:
372 fatal("Missed vector creation for '%s'", NodeClassNames[vopc]);
373 return NULL;
374 }
375 }
376
|
179 case Op_XorL:
180 return Op_XorV;
181
182 case Op_LoadB:
183 case Op_LoadUB:
184 case Op_LoadUS:
185 case Op_LoadS:
186 case Op_LoadI:
187 case Op_LoadL:
188 case Op_LoadF:
189 case Op_LoadD:
190 return Op_LoadVector;
191
192 case Op_StoreB:
193 case Op_StoreC:
194 case Op_StoreI:
195 case Op_StoreL:
196 case Op_StoreF:
197 case Op_StoreD:
198 return Op_StoreVector;
199 case Op_MulAddS2I:
200 return Op_MulAddVS2VI;
201
202 default:
203 return 0; // Unimplemented
204 }
205 }
206
207 // Also used to check if the code generator
208 // supports the vector operation.
209 bool VectorNode::implemented(int opc, uint vlen, BasicType bt) {
210 if (is_java_primitive(bt) &&
211 (vlen > 1) && is_power_of_2(vlen) &&
212 Matcher::vector_size_supported(bt, vlen)) {
213 int vopc = VectorNode::opcode(opc, bt);
214 return vopc > 0 && Matcher::match_rule_supported_vector(vopc, vlen);
215 }
216 return false;
217 }
218
219 bool VectorNode::is_type_transition_short_to_int(Node* n) {
220 switch (n->Opcode()) {
221 case Op_MulAddS2I:
222 return true;
223 }
224 return false;
225 }
226
227 bool VectorNode::is_type_transition_to_int(Node* n) {
228 return is_type_transition_short_to_int(n);
229 }
230
231 bool VectorNode::is_muladds2i(Node* n) {
232 if (n->Opcode() == Op_MulAddS2I) {
233 return true;
234 }
235 return false;
236 }
237
238 bool VectorNode::is_shift(Node* n) {
239 switch (n->Opcode()) {
240 case Op_LShiftI:
241 case Op_LShiftL:
242 case Op_RShiftI:
243 case Op_RShiftL:
244 case Op_URShiftI:
245 case Op_URShiftL:
246 return true;
247 default:
248 return false;
249 }
250 }
251
252 // Check if input is loop invariant vector.
253 bool VectorNode::is_invariant_vector(Node* n) {
254 // Only Replicate vector nodes are loop invariant for now.
255 switch (n->Opcode()) {
256 case Op_ReplicateB:
257 case Op_ReplicateS:
281 case Op_StoreB: case Op_StoreC:
282 case Op_StoreI: case Op_StoreL:
283 case Op_StoreF: case Op_StoreD:
284 case Op_StoreP: case Op_StoreN:
285 *start = MemNode::ValueIn;
286 *end = MemNode::ValueIn + 1; // 1 vector operand
287 break;
288 case Op_LShiftI: case Op_LShiftL:
289 case Op_RShiftI: case Op_RShiftL:
290 case Op_URShiftI: case Op_URShiftL:
291 *start = 1;
292 *end = 2; // 1 vector operand
293 break;
294 case Op_AddI: case Op_AddL: case Op_AddF: case Op_AddD:
295 case Op_SubI: case Op_SubL: case Op_SubF: case Op_SubD:
296 case Op_MulI: case Op_MulL: case Op_MulF: case Op_MulD:
297 case Op_DivF: case Op_DivD:
298 case Op_AndI: case Op_AndL:
299 case Op_OrI: case Op_OrL:
300 case Op_XorI: case Op_XorL:
301 case Op_MulAddS2I:
302 *start = 1;
303 *end = 3; // 2 vector operands
304 break;
305 case Op_CMoveI: case Op_CMoveL: case Op_CMoveF: case Op_CMoveD:
306 *start = 2;
307 *end = n->req();
308 break;
309 case Op_FmaD:
310 case Op_FmaF:
311 *start = 1;
312 *end = 4; // 3 vector operands
313 break;
314 default:
315 *start = 1;
316 *end = n->req(); // default is all operands
317 }
318 }
319
320 // Return the vector version of a scalar operation node.
321 VectorNode* VectorNode::make(int opc, Node* n1, Node* n2, uint vlen, BasicType bt) {
359 case Op_PopCountVI: return new PopCountVINode(n1, vt);
360
361 case Op_LShiftVB: return new LShiftVBNode(n1, n2, vt);
362 case Op_LShiftVS: return new LShiftVSNode(n1, n2, vt);
363 case Op_LShiftVI: return new LShiftVINode(n1, n2, vt);
364 case Op_LShiftVL: return new LShiftVLNode(n1, n2, vt);
365
366 case Op_RShiftVB: return new RShiftVBNode(n1, n2, vt);
367 case Op_RShiftVS: return new RShiftVSNode(n1, n2, vt);
368 case Op_RShiftVI: return new RShiftVINode(n1, n2, vt);
369 case Op_RShiftVL: return new RShiftVLNode(n1, n2, vt);
370
371 case Op_URShiftVB: return new URShiftVBNode(n1, n2, vt);
372 case Op_URShiftVS: return new URShiftVSNode(n1, n2, vt);
373 case Op_URShiftVI: return new URShiftVINode(n1, n2, vt);
374 case Op_URShiftVL: return new URShiftVLNode(n1, n2, vt);
375
376 case Op_AndV: return new AndVNode(n1, n2, vt);
377 case Op_OrV: return new OrVNode (n1, n2, vt);
378 case Op_XorV: return new XorVNode(n1, n2, vt);
379
380 case Op_MulAddVS2VI: return new MulAddVS2VINode(n1, n2, vt);
381 default:
382 fatal("Missed vector creation for '%s'", NodeClassNames[vopc]);
383 return NULL;
384 }
385 }
386
387 VectorNode* VectorNode::make(int opc, Node* n1, Node* n2, Node* n3, uint vlen, BasicType bt) {
388 const TypeVect* vt = TypeVect::make(bt, vlen);
389 int vopc = VectorNode::opcode(opc, bt);
390 // This method should not be called for unimplemented vectors.
391 guarantee(vopc > 0, "Vector for '%s' is not implemented", NodeClassNames[opc]);
392 switch (vopc) {
393 case Op_FmaVD: return new FmaVDNode(n1, n2, n3, vt);
394 case Op_FmaVF: return new FmaVFNode(n1, n2, n3, vt);
395 default:
396 fatal("Missed vector creation for '%s'", NodeClassNames[vopc]);
397 return NULL;
398 }
399 }
400
|