1 /* 2 * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 #ifndef SHARE_VM_OPTO_VECTORNODE_HPP 25 #define SHARE_VM_OPTO_VECTORNODE_HPP 26 27 #include "opto/matcher.hpp" 28 #include "opto/memnode.hpp" 29 #include "opto/node.hpp" 30 #include "opto/opcodes.hpp" 31 32 //------------------------------VectorNode------------------------------------- 33 // Vector Operation 34 class VectorNode : public TypeNode { 35 public: 36 37 VectorNode(Node* n1, const TypeVect* vt) : TypeNode(vt, 2) { 38 init_class_id(Class_Vector); 39 init_req(1, n1); 40 } 41 VectorNode(Node* n1, Node* n2, const TypeVect* vt) : TypeNode(vt, 3) { 42 init_class_id(Class_Vector); 43 init_req(1, n1); 44 init_req(2, n2); 45 } 46 47 const TypeVect* vect_type() const { return type()->is_vect(); } 48 uint length() const { return vect_type()->length(); } // Vector length 49 uint length_in_bytes() const { return vect_type()->length_in_bytes(); } 50 51 virtual int Opcode() const; 52 53 virtual uint ideal_reg() const { return Matcher::vector_ideal_reg(vect_type()->length_in_bytes()); } 54 55 static VectorNode* scalar2vector(Node* s, uint vlen, const Type* opd_t); 56 static VectorNode* shift_count(Node* shift, Node* cnt, uint vlen, BasicType bt); 57 static VectorNode* make(int opc, Node* n1, Node* n2, uint vlen, BasicType bt); 58 59 static int opcode(int opc, BasicType bt); 60 static bool implemented(int opc, uint vlen, BasicType bt); 61 static bool is_shift(Node* n); 62 static bool is_invariant_vector(Node* n); 63 // [Start, end) half-open range defining which operands are vectors 64 static void vector_operands(Node* n, uint* start, uint* end); 65 }; 66 67 //===========================Vector=ALU=Operations============================= 68 69 //------------------------------AddVBNode-------------------------------------- 70 // Vector add byte 71 class AddVBNode : public VectorNode { 72 public: 73 AddVBNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 74 virtual int Opcode() const; 75 }; 76 77 //------------------------------AddVSNode-------------------------------------- 78 // Vector add char/short 79 class AddVSNode : public VectorNode { 80 public: 81 AddVSNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 82 virtual int Opcode() const; 83 }; 84 85 //------------------------------AddVINode-------------------------------------- 86 // Vector add int 87 class AddVINode : public VectorNode { 88 public: 89 AddVINode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 90 virtual int Opcode() const; 91 }; 92 93 //------------------------------ReductionNode------------------------------------ 94 // Perform reduction of a vector 95 class ReductionNode : public Node { 96 public: 97 ReductionNode(Node *ctrl, Node* in1, Node* in2) : Node(ctrl, in1, in2) {} 98 99 static ReductionNode* make(int opc, Node *ctrl, Node* in1, Node* in2, BasicType bt); 100 static int opcode(int opc, BasicType bt); 101 static bool implemented(int opc, uint vlen, BasicType bt); 102 }; 103 104 //------------------------------AddReductionVINode-------------------------------------- 105 // Vector add int as a reduction 106 class AddReductionVINode : public ReductionNode { 107 public: 108 AddReductionVINode(Node * ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} 109 virtual int Opcode() const; 110 virtual const Type* bottom_type() const { return TypeInt::INT; } 111 virtual uint ideal_reg() const { return Op_RegI; } 112 }; 113 114 //------------------------------AddReductionVLNode-------------------------------------- 115 // Vector add long as a reduction 116 class AddReductionVLNode : public ReductionNode { 117 public: 118 AddReductionVLNode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} 119 virtual int Opcode() const; 120 virtual const Type* bottom_type() const { return TypeLong::LONG; } 121 virtual uint ideal_reg() const { return Op_RegL; } 122 }; 123 124 //------------------------------AddVLNode-------------------------------------- 125 // Vector add long 126 class AddVLNode : public VectorNode { 127 public: 128 AddVLNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 129 virtual int Opcode() const; 130 }; 131 132 //------------------------------AddVFNode-------------------------------------- 133 // Vector add float 134 class AddVFNode : public VectorNode { 135 public: 136 AddVFNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 137 virtual int Opcode() const; 138 }; 139 140 //------------------------------AddReductionVFNode-------------------------------------- 141 // Vector add float as a reduction 142 class AddReductionVFNode : public ReductionNode { 143 public: 144 AddReductionVFNode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} 145 virtual int Opcode() const; 146 virtual const Type* bottom_type() const { return Type::FLOAT; } 147 virtual uint ideal_reg() const { return Op_RegF; } 148 }; 149 150 //------------------------------AddVDNode-------------------------------------- 151 // Vector add double 152 class AddVDNode : public VectorNode { 153 public: 154 AddVDNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 155 virtual int Opcode() const; 156 }; 157 158 //------------------------------AddReductionVDNode-------------------------------------- 159 // Vector add double as a reduction 160 class AddReductionVDNode : public ReductionNode { 161 public: 162 AddReductionVDNode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} 163 virtual int Opcode() const; 164 virtual const Type* bottom_type() const { return Type::DOUBLE; } 165 virtual uint ideal_reg() const { return Op_RegD; } 166 }; 167 168 //------------------------------SubVBNode-------------------------------------- 169 // Vector subtract byte 170 class SubVBNode : public VectorNode { 171 public: 172 SubVBNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 173 virtual int Opcode() const; 174 }; 175 176 //------------------------------SubVSNode-------------------------------------- 177 // Vector subtract short 178 class SubVSNode : public VectorNode { 179 public: 180 SubVSNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 181 virtual int Opcode() const; 182 }; 183 184 //------------------------------SubVINode-------------------------------------- 185 // Vector subtract int 186 class SubVINode : public VectorNode { 187 public: 188 SubVINode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 189 virtual int Opcode() const; 190 }; 191 192 //------------------------------SubVLNode-------------------------------------- 193 // Vector subtract long 194 class SubVLNode : public VectorNode { 195 public: 196 SubVLNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 197 virtual int Opcode() const; 198 }; 199 200 //------------------------------SubVFNode-------------------------------------- 201 // Vector subtract float 202 class SubVFNode : public VectorNode { 203 public: 204 SubVFNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 205 virtual int Opcode() const; 206 }; 207 208 //------------------------------SubVDNode-------------------------------------- 209 // Vector subtract double 210 class SubVDNode : public VectorNode { 211 public: 212 SubVDNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 213 virtual int Opcode() const; 214 }; 215 216 //------------------------------MulVSNode-------------------------------------- 217 // Vector multiply short 218 class MulVSNode : public VectorNode { 219 public: 220 MulVSNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 221 virtual int Opcode() const; 222 }; 223 224 //------------------------------MulVINode-------------------------------------- 225 // Vector multiply int 226 class MulVINode : public VectorNode { 227 public: 228 MulVINode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 229 virtual int Opcode() const; 230 }; 231 232 //------------------------------MulReductionVINode-------------------------------------- 233 // Vector multiply int as a reduction 234 class MulReductionVINode : public ReductionNode { 235 public: 236 MulReductionVINode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} 237 virtual int Opcode() const; 238 virtual const Type* bottom_type() const { return TypeInt::INT; } 239 virtual uint ideal_reg() const { return Op_RegI; } 240 }; 241 242 //------------------------------MulVFNode-------------------------------------- 243 // Vector multiply float 244 class MulVFNode : public VectorNode { 245 public: 246 MulVFNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 247 virtual int Opcode() const; 248 }; 249 250 //------------------------------MulReductionVFNode-------------------------------------- 251 // Vector multiply float as a reduction 252 class MulReductionVFNode : public ReductionNode { 253 public: 254 MulReductionVFNode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} 255 virtual int Opcode() const; 256 virtual const Type* bottom_type() const { return Type::FLOAT; } 257 virtual uint ideal_reg() const { return Op_RegF; } 258 }; 259 260 //------------------------------MulVDNode-------------------------------------- 261 // Vector multiply double 262 class MulVDNode : public VectorNode { 263 public: 264 MulVDNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 265 virtual int Opcode() const; 266 }; 267 268 //------------------------------MulReductionVDNode-------------------------------------- 269 // Vector multiply double as a reduction 270 class MulReductionVDNode : public ReductionNode { 271 public: 272 MulReductionVDNode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} 273 virtual int Opcode() const; 274 virtual const Type* bottom_type() const { return Type::DOUBLE; } 275 virtual uint ideal_reg() const { return Op_RegD; } 276 }; 277 278 //------------------------------DivVFNode-------------------------------------- 279 // Vector divide float 280 class DivVFNode : public VectorNode { 281 public: 282 DivVFNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 283 virtual int Opcode() const; 284 }; 285 286 //------------------------------DivVDNode-------------------------------------- 287 // Vector Divide double 288 class DivVDNode : public VectorNode { 289 public: 290 DivVDNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 291 virtual int Opcode() const; 292 }; 293 294 //------------------------------LShiftVBNode----------------------------------- 295 // Vector left shift bytes 296 class LShiftVBNode : public VectorNode { 297 public: 298 LShiftVBNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 299 virtual int Opcode() const; 300 }; 301 302 //------------------------------LShiftVSNode----------------------------------- 303 // Vector left shift shorts 304 class LShiftVSNode : public VectorNode { 305 public: 306 LShiftVSNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 307 virtual int Opcode() const; 308 }; 309 310 //------------------------------LShiftVINode----------------------------------- 311 // Vector left shift ints 312 class LShiftVINode : public VectorNode { 313 public: 314 LShiftVINode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 315 virtual int Opcode() const; 316 }; 317 318 //------------------------------LShiftVLNode----------------------------------- 319 // Vector left shift longs 320 class LShiftVLNode : public VectorNode { 321 public: 322 LShiftVLNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 323 virtual int Opcode() const; 324 }; 325 326 //------------------------------RShiftVBNode----------------------------------- 327 // Vector right arithmetic (signed) shift bytes 328 class RShiftVBNode : public VectorNode { 329 public: 330 RShiftVBNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 331 virtual int Opcode() const; 332 }; 333 334 //------------------------------RShiftVSNode----------------------------------- 335 // Vector right arithmetic (signed) shift shorts 336 class RShiftVSNode : public VectorNode { 337 public: 338 RShiftVSNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 339 virtual int Opcode() const; 340 }; 341 342 //------------------------------RShiftVINode----------------------------------- 343 // Vector right arithmetic (signed) shift ints 344 class RShiftVINode : public VectorNode { 345 public: 346 RShiftVINode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 347 virtual int Opcode() const; 348 }; 349 350 //------------------------------RShiftVLNode----------------------------------- 351 // Vector right arithmetic (signed) shift longs 352 class RShiftVLNode : public VectorNode { 353 public: 354 RShiftVLNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 355 virtual int Opcode() const; 356 }; 357 358 //------------------------------URShiftVBNode---------------------------------- 359 // Vector right logical (unsigned) shift bytes 360 class URShiftVBNode : public VectorNode { 361 public: 362 URShiftVBNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 363 virtual int Opcode() const; 364 }; 365 366 //------------------------------URShiftVSNode---------------------------------- 367 // Vector right logical (unsigned) shift shorts 368 class URShiftVSNode : public VectorNode { 369 public: 370 URShiftVSNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 371 virtual int Opcode() const; 372 }; 373 374 //------------------------------URShiftVINode---------------------------------- 375 // Vector right logical (unsigned) shift ints 376 class URShiftVINode : public VectorNode { 377 public: 378 URShiftVINode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 379 virtual int Opcode() const; 380 }; 381 382 //------------------------------URShiftVLNode---------------------------------- 383 // Vector right logical (unsigned) shift longs 384 class URShiftVLNode : public VectorNode { 385 public: 386 URShiftVLNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 387 virtual int Opcode() const; 388 }; 389 390 //------------------------------LShiftCntVNode--------------------------------- 391 // Vector left shift count 392 class LShiftCntVNode : public VectorNode { 393 public: 394 LShiftCntVNode(Node* cnt, const TypeVect* vt) : VectorNode(cnt,vt) {} 395 virtual int Opcode() const; 396 virtual uint ideal_reg() const { return Matcher::vector_shift_count_ideal_reg(vect_type()->length_in_bytes()); } 397 }; 398 399 //------------------------------RShiftCntVNode--------------------------------- 400 // Vector right shift count 401 class RShiftCntVNode : public VectorNode { 402 public: 403 RShiftCntVNode(Node* cnt, const TypeVect* vt) : VectorNode(cnt,vt) {} 404 virtual int Opcode() const; 405 virtual uint ideal_reg() const { return Matcher::vector_shift_count_ideal_reg(vect_type()->length_in_bytes()); } 406 }; 407 408 409 //------------------------------AndVNode--------------------------------------- 410 // Vector and integer 411 class AndVNode : public VectorNode { 412 public: 413 AndVNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 414 virtual int Opcode() const; 415 }; 416 417 //------------------------------OrVNode--------------------------------------- 418 // Vector or integer 419 class OrVNode : public VectorNode { 420 public: 421 OrVNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 422 virtual int Opcode() const; 423 }; 424 425 //------------------------------XorVNode--------------------------------------- 426 // Vector xor integer 427 class XorVNode : public VectorNode { 428 public: 429 XorVNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 430 virtual int Opcode() const; 431 }; 432 433 //================================= M E M O R Y =============================== 434 435 //------------------------------LoadVectorNode--------------------------------- 436 // Load Vector from memory 437 class LoadVectorNode : public LoadNode { 438 public: 439 LoadVectorNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const TypeVect* vt) 440 : LoadNode(c, mem, adr, at, vt, MemNode::unordered) { 441 init_class_id(Class_LoadVector); 442 } 443 444 const TypeVect* vect_type() const { return type()->is_vect(); } 445 uint length() const { return vect_type()->length(); } // Vector length 446 447 virtual int Opcode() const; 448 449 virtual uint ideal_reg() const { return Matcher::vector_ideal_reg(memory_size()); } 450 virtual BasicType memory_type() const { return T_VOID; } 451 virtual int memory_size() const { return vect_type()->length_in_bytes(); } 452 453 virtual int store_Opcode() const { return Op_StoreVector; } 454 455 static LoadVectorNode* make(int opc, Node* ctl, Node* mem, 456 Node* adr, const TypePtr* atyp, uint vlen, BasicType bt); 457 }; 458 459 //------------------------------StoreVectorNode-------------------------------- 460 // Store Vector to memory 461 class StoreVectorNode : public StoreNode { 462 public: 463 StoreVectorNode(Node* c, Node* mem, Node* adr, const TypePtr* at, Node* val) 464 : StoreNode(c, mem, adr, at, val, MemNode::unordered) { 465 assert(val->is_Vector() || val->is_LoadVector(), "sanity"); 466 init_class_id(Class_StoreVector); 467 } 468 469 const TypeVect* vect_type() const { return in(MemNode::ValueIn)->bottom_type()->is_vect(); } 470 uint length() const { return vect_type()->length(); } // Vector length 471 472 virtual int Opcode() const; 473 474 virtual uint ideal_reg() const { return Matcher::vector_ideal_reg(memory_size()); } 475 virtual BasicType memory_type() const { return T_VOID; } 476 virtual int memory_size() const { return vect_type()->length_in_bytes(); } 477 478 static StoreVectorNode* make(int opc, Node* ctl, Node* mem, 479 Node* adr, const TypePtr* atyp, Node* val, 480 uint vlen); 481 }; 482 483 484 //=========================Promote_Scalar_to_Vector============================ 485 486 //------------------------------ReplicateBNode--------------------------------- 487 // Replicate byte scalar to be vector 488 class ReplicateBNode : public VectorNode { 489 public: 490 ReplicateBNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {} 491 virtual int Opcode() const; 492 }; 493 494 //------------------------------ReplicateSNode--------------------------------- 495 // Replicate short scalar to be vector 496 class ReplicateSNode : public VectorNode { 497 public: 498 ReplicateSNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {} 499 virtual int Opcode() const; 500 }; 501 502 //------------------------------ReplicateINode--------------------------------- 503 // Replicate int scalar to be vector 504 class ReplicateINode : public VectorNode { 505 public: 506 ReplicateINode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {} 507 virtual int Opcode() const; 508 }; 509 510 //------------------------------ReplicateLNode--------------------------------- 511 // Replicate long scalar to be vector 512 class ReplicateLNode : public VectorNode { 513 public: 514 ReplicateLNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {} 515 virtual int Opcode() const; 516 }; 517 518 //------------------------------ReplicateFNode--------------------------------- 519 // Replicate float scalar to be vector 520 class ReplicateFNode : public VectorNode { 521 public: 522 ReplicateFNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {} 523 virtual int Opcode() const; 524 }; 525 526 //------------------------------ReplicateDNode--------------------------------- 527 // Replicate double scalar to be vector 528 class ReplicateDNode : public VectorNode { 529 public: 530 ReplicateDNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {} 531 virtual int Opcode() const; 532 }; 533 534 //========================Pack_Scalars_into_a_Vector=========================== 535 536 //------------------------------PackNode--------------------------------------- 537 // Pack parent class (not for code generation). 538 class PackNode : public VectorNode { 539 public: 540 PackNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {} 541 PackNode(Node* in1, Node* n2, const TypeVect* vt) : VectorNode(in1, n2, vt) {} 542 virtual int Opcode() const; 543 544 void add_opd(Node* n) { 545 add_req(n); 546 } 547 548 // Create a binary tree form for Packs. [lo, hi) (half-open) range 549 PackNode* binary_tree_pack(int lo, int hi); 550 551 static PackNode* make(Node* s, uint vlen, BasicType bt); 552 }; 553 554 //------------------------------PackBNode-------------------------------------- 555 // Pack byte scalars into vector 556 class PackBNode : public PackNode { 557 public: 558 PackBNode(Node* in1, const TypeVect* vt) : PackNode(in1, vt) {} 559 virtual int Opcode() const; 560 }; 561 562 //------------------------------PackSNode-------------------------------------- 563 // Pack short scalars into a vector 564 class PackSNode : public PackNode { 565 public: 566 PackSNode(Node* in1, const TypeVect* vt) : PackNode(in1, vt) {} 567 PackSNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {} 568 virtual int Opcode() const; 569 }; 570 571 //------------------------------PackINode-------------------------------------- 572 // Pack integer scalars into a vector 573 class PackINode : public PackNode { 574 public: 575 PackINode(Node* in1, const TypeVect* vt) : PackNode(in1, vt) {} 576 PackINode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {} 577 virtual int Opcode() const; 578 }; 579 580 //------------------------------PackLNode-------------------------------------- 581 // Pack long scalars into a vector 582 class PackLNode : public PackNode { 583 public: 584 PackLNode(Node* in1, const TypeVect* vt) : PackNode(in1, vt) {} 585 PackLNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {} 586 virtual int Opcode() const; 587 }; 588 589 //------------------------------Pack2LNode------------------------------------- 590 // Pack 2 long scalars into a vector 591 class Pack2LNode : public PackNode { 592 public: 593 Pack2LNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {} 594 virtual int Opcode() const; 595 }; 596 597 //------------------------------PackFNode-------------------------------------- 598 // Pack float scalars into vector 599 class PackFNode : public PackNode { 600 public: 601 PackFNode(Node* in1, const TypeVect* vt) : PackNode(in1, vt) {} 602 PackFNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {} 603 virtual int Opcode() const; 604 }; 605 606 //------------------------------PackDNode-------------------------------------- 607 // Pack double scalars into a vector 608 class PackDNode : public PackNode { 609 public: 610 PackDNode(Node* in1, const TypeVect* vt) : PackNode(in1, vt) {} 611 PackDNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {} 612 virtual int Opcode() const; 613 }; 614 615 //------------------------------Pack2DNode------------------------------------- 616 // Pack 2 double scalars into a vector 617 class Pack2DNode : public PackNode { 618 public: 619 Pack2DNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {} 620 virtual int Opcode() const; 621 }; 622 623 624 //========================Extract_Scalar_from_Vector=========================== 625 626 //------------------------------ExtractNode------------------------------------ 627 // Extract a scalar from a vector at position "pos" 628 class ExtractNode : public Node { 629 public: 630 ExtractNode(Node* src, ConINode* pos) : Node(NULL, src, (Node*)pos) { 631 assert(in(2)->get_int() >= 0, "positive constants"); 632 } 633 virtual int Opcode() const; 634 uint pos() const { return in(2)->get_int(); } 635 636 static Node* make(Node* v, uint position, BasicType bt); 637 }; 638 639 //------------------------------ExtractBNode----------------------------------- 640 // Extract a byte from a vector at position "pos" 641 class ExtractBNode : public ExtractNode { 642 public: 643 ExtractBNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {} 644 virtual int Opcode() const; 645 virtual const Type *bottom_type() const { return TypeInt::INT; } 646 virtual uint ideal_reg() const { return Op_RegI; } 647 }; 648 649 //------------------------------ExtractUBNode---------------------------------- 650 // Extract a boolean from a vector at position "pos" 651 class ExtractUBNode : public ExtractNode { 652 public: 653 ExtractUBNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {} 654 virtual int Opcode() const; 655 virtual const Type *bottom_type() const { return TypeInt::INT; } 656 virtual uint ideal_reg() const { return Op_RegI; } 657 }; 658 659 //------------------------------ExtractCNode----------------------------------- 660 // Extract a char from a vector at position "pos" 661 class ExtractCNode : public ExtractNode { 662 public: 663 ExtractCNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {} 664 virtual int Opcode() const; 665 virtual const Type *bottom_type() const { return TypeInt::INT; } 666 virtual uint ideal_reg() const { return Op_RegI; } 667 }; 668 669 //------------------------------ExtractSNode----------------------------------- 670 // Extract a short from a vector at position "pos" 671 class ExtractSNode : public ExtractNode { 672 public: 673 ExtractSNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {} 674 virtual int Opcode() const; 675 virtual const Type *bottom_type() const { return TypeInt::INT; } 676 virtual uint ideal_reg() const { return Op_RegI; } 677 }; 678 679 //------------------------------ExtractINode----------------------------------- 680 // Extract an int from a vector at position "pos" 681 class ExtractINode : public ExtractNode { 682 public: 683 ExtractINode(Node* src, ConINode* pos) : ExtractNode(src, pos) {} 684 virtual int Opcode() const; 685 virtual const Type *bottom_type() const { return TypeInt::INT; } 686 virtual uint ideal_reg() const { return Op_RegI; } 687 }; 688 689 //------------------------------ExtractLNode----------------------------------- 690 // Extract a long from a vector at position "pos" 691 class ExtractLNode : public ExtractNode { 692 public: 693 ExtractLNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {} 694 virtual int Opcode() const; 695 virtual const Type *bottom_type() const { return TypeLong::LONG; } 696 virtual uint ideal_reg() const { return Op_RegL; } 697 }; 698 699 //------------------------------ExtractFNode----------------------------------- 700 // Extract a float from a vector at position "pos" 701 class ExtractFNode : public ExtractNode { 702 public: 703 ExtractFNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {} 704 virtual int Opcode() const; 705 virtual const Type *bottom_type() const { return Type::FLOAT; } 706 virtual uint ideal_reg() const { return Op_RegF; } 707 }; 708 709 //------------------------------ExtractDNode----------------------------------- 710 // Extract a double from a vector at position "pos" 711 class ExtractDNode : public ExtractNode { 712 public: 713 ExtractDNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {} 714 virtual int Opcode() const; 715 virtual const Type *bottom_type() const { return Type::DOUBLE; } 716 virtual uint ideal_reg() const { return Op_RegD; } 717 }; 718 719 #endif // SHARE_VM_OPTO_VECTORNODE_HPP