299 switch (bt) {
300 case T_BOOLEAN:
301 case T_BYTE:
302 return new (C, 2) ReplicateBNode(s, vt);
303 case T_CHAR:
304 case T_SHORT:
305 return new (C, 2) ReplicateSNode(s, vt);
306 case T_INT:
307 return new (C, 2) ReplicateINode(s, vt);
308 case T_LONG:
309 return new (C, 2) ReplicateLNode(s, vt);
310 case T_FLOAT:
311 return new (C, 2) ReplicateFNode(s, vt);
312 case T_DOUBLE:
313 return new (C, 2) ReplicateDNode(s, vt);
314 }
315 ShouldNotReachHere();
316 return NULL;
317 }
318
319 // Return initial Pack node. Additional operands added with add_opd() calls.
320 PackNode* PackNode::make(Compile* C, Node* s, uint vlen, BasicType bt) {
321 const TypeVect* vt = TypeVect::make(bt, vlen);
322 switch (bt) {
323 case T_BOOLEAN:
324 case T_BYTE:
325 return new (C, 2) PackBNode(s, vt);
326 case T_CHAR:
327 case T_SHORT:
328 return new (C, 2) PackSNode(s, vt);
329 case T_INT:
330 return new (C, 2) PackINode(s, vt);
331 case T_LONG:
332 return new (C, 2) PackLNode(s, vt);
333 case T_FLOAT:
334 return new (C, 2) PackFNode(s, vt);
335 case T_DOUBLE:
336 return new (C, 2) PackDNode(s, vt);
337 }
338 ShouldNotReachHere();
364 return new (C, 3) PackINode(n1, n2, TypeVect::make(T_INT, 2));
365 case T_INT:
366 return new (C, 3) PackLNode(n1, n2, TypeVect::make(T_LONG, 2));
367 case T_LONG:
368 return new (C, 3) Pack2LNode(n1, n2, TypeVect::make(T_LONG, 2));
369 case T_FLOAT:
370 return new (C, 3) PackDNode(n1, n2, TypeVect::make(T_DOUBLE, 2));
371 case T_DOUBLE:
372 return new (C, 3) Pack2DNode(n1, n2, TypeVect::make(T_DOUBLE, 2));
373 }
374 ShouldNotReachHere();
375 }
376 return NULL;
377 }
378
379 // Return the vector version of a scalar load node.
380 LoadVectorNode* LoadVectorNode::make(Compile* C, int opc, Node* ctl, Node* mem,
381 Node* adr, const TypePtr* atyp, uint vlen, BasicType bt) {
382 const TypeVect* vt = TypeVect::make(bt, vlen);
383 return new (C, 3) LoadVectorNode(ctl, mem, adr, atyp, vt);
384 return NULL;
385 }
386
387 // Return the vector version of a scalar store node.
388 StoreVectorNode* StoreVectorNode::make(Compile* C, int opc, Node* ctl, Node* mem,
389 Node* adr, const TypePtr* atyp, Node* val,
390 uint vlen) {
391 return new (C, 4) StoreVectorNode(ctl, mem, adr, atyp, val);
392 }
393
394 // Extract a scalar element of vector.
395 Node* ExtractNode::make(Compile* C, Node* v, uint position, BasicType bt) {
396 assert((int)position < Matcher::max_vector_size(bt), "pos in range");
397 ConINode* pos = ConINode::make(C, (int)position);
398 switch (bt) {
399 case T_BOOLEAN:
400 return new (C, 3) ExtractUBNode(v, pos);
401 case T_BYTE:
402 return new (C, 3) ExtractBNode(v, pos);
403 case T_CHAR:
404 return new (C, 3) ExtractCNode(v, pos);
|
299 switch (bt) {
300 case T_BOOLEAN:
301 case T_BYTE:
302 return new (C, 2) ReplicateBNode(s, vt);
303 case T_CHAR:
304 case T_SHORT:
305 return new (C, 2) ReplicateSNode(s, vt);
306 case T_INT:
307 return new (C, 2) ReplicateINode(s, vt);
308 case T_LONG:
309 return new (C, 2) ReplicateLNode(s, vt);
310 case T_FLOAT:
311 return new (C, 2) ReplicateFNode(s, vt);
312 case T_DOUBLE:
313 return new (C, 2) ReplicateDNode(s, vt);
314 }
315 ShouldNotReachHere();
316 return NULL;
317 }
318
319 VectorNode* VectorNode::shift_count(Compile* C, Node* shift, Node* cnt, uint vlen, BasicType bt) {
320 assert(VectorNode::is_shift(shift) && !cnt->is_Con(), "only variable shift count");
321 // Match shift count type with shift vector type.
322 const TypeVect* vt = TypeVect::make(bt, vlen);
323 switch (shift->Opcode()) {
324 case Op_LShiftI:
325 case Op_LShiftL:
326 return new (C, 2) LShiftCntVNode(cnt, vt);
327 case Op_RShiftI:
328 case Op_RShiftL:
329 case Op_URShiftI:
330 case Op_URShiftL:
331 return new (C, 2) RShiftCntVNode(cnt, vt);
332 }
333 ShouldNotReachHere();
334 return NULL;
335 }
336
337 // Return initial Pack node. Additional operands added with add_opd() calls.
338 PackNode* PackNode::make(Compile* C, Node* s, uint vlen, BasicType bt) {
339 const TypeVect* vt = TypeVect::make(bt, vlen);
340 switch (bt) {
341 case T_BOOLEAN:
342 case T_BYTE:
343 return new (C, 2) PackBNode(s, vt);
344 case T_CHAR:
345 case T_SHORT:
346 return new (C, 2) PackSNode(s, vt);
347 case T_INT:
348 return new (C, 2) PackINode(s, vt);
349 case T_LONG:
350 return new (C, 2) PackLNode(s, vt);
351 case T_FLOAT:
352 return new (C, 2) PackFNode(s, vt);
353 case T_DOUBLE:
354 return new (C, 2) PackDNode(s, vt);
355 }
356 ShouldNotReachHere();
382 return new (C, 3) PackINode(n1, n2, TypeVect::make(T_INT, 2));
383 case T_INT:
384 return new (C, 3) PackLNode(n1, n2, TypeVect::make(T_LONG, 2));
385 case T_LONG:
386 return new (C, 3) Pack2LNode(n1, n2, TypeVect::make(T_LONG, 2));
387 case T_FLOAT:
388 return new (C, 3) PackDNode(n1, n2, TypeVect::make(T_DOUBLE, 2));
389 case T_DOUBLE:
390 return new (C, 3) Pack2DNode(n1, n2, TypeVect::make(T_DOUBLE, 2));
391 }
392 ShouldNotReachHere();
393 }
394 return NULL;
395 }
396
397 // Return the vector version of a scalar load node.
398 LoadVectorNode* LoadVectorNode::make(Compile* C, int opc, Node* ctl, Node* mem,
399 Node* adr, const TypePtr* atyp, uint vlen, BasicType bt) {
400 const TypeVect* vt = TypeVect::make(bt, vlen);
401 return new (C, 3) LoadVectorNode(ctl, mem, adr, atyp, vt);
402 }
403
404 // Return the vector version of a scalar store node.
405 StoreVectorNode* StoreVectorNode::make(Compile* C, int opc, Node* ctl, Node* mem,
406 Node* adr, const TypePtr* atyp, Node* val,
407 uint vlen) {
408 return new (C, 4) StoreVectorNode(ctl, mem, adr, atyp, val);
409 }
410
411 // Extract a scalar element of vector.
412 Node* ExtractNode::make(Compile* C, Node* v, uint position, BasicType bt) {
413 assert((int)position < Matcher::max_vector_size(bt), "pos in range");
414 ConINode* pos = ConINode::make(C, (int)position);
415 switch (bt) {
416 case T_BOOLEAN:
417 return new (C, 3) ExtractUBNode(v, pos);
418 case T_BYTE:
419 return new (C, 3) ExtractBNode(v, pos);
420 case T_CHAR:
421 return new (C, 3) ExtractCNode(v, pos);
|