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 //------------------------------AddVLNode-------------------------------------- 94 // Vector add long 95 class AddVLNode : public VectorNode { 96 public: 97 AddVLNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1, in2, vt) {} 98 virtual int Opcode() const; 99 }; 100 101 //------------------------------AddVFNode-------------------------------------- 102 // Vector add float 103 class AddVFNode : public VectorNode { 104 public: 105 AddVFNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1, in2, vt) {} 106 virtual int Opcode() const; 107 }; 108 109 //------------------------------AddVDNode-------------------------------------- 110 // Vector add double 111 class AddVDNode : public VectorNode { 112 public: 113 AddVDNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1, in2, vt) {} 114 virtual int Opcode() const; 115 }; 116 117 //------------------------------ReductionNode------------------------------------ 118 // Perform reduction of a vector 119 class ReductionNode : public Node { 120 public: 121 ReductionNode(Node *ctrl, Node* in1, Node* in2) : Node(ctrl, in1, in2) {} 122 123 static ReductionNode* make(int opc, Node *ctrl, Node* in1, Node* in2, BasicType bt); 124 static int opcode(int opc, BasicType bt); 125 static bool implemented(int opc, uint vlen, BasicType bt); 126 }; 127 128 //------------------------------AddReductionVINode-------------------------------------- 129 // Vector add int as a reduction 130 class AddReductionVINode : public ReductionNode { 131 public: 132 AddReductionVINode(Node * ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} 133 virtual int Opcode() const; 134 virtual const Type* bottom_type() const { return TypeInt::INT; } 135 virtual uint ideal_reg() const { return Op_RegI; } 136 }; 137 138 //------------------------------AddReductionVLNode-------------------------------------- 139 // Vector add long as a reduction 140 class AddReductionVLNode : public ReductionNode { 141 public: 142 AddReductionVLNode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} 143 virtual int Opcode() const; 144 virtual const Type* bottom_type() const { return TypeLong::LONG; } 145 virtual uint ideal_reg() const { return Op_RegL; } 146 }; 147 148 //------------------------------AddReductionVFNode-------------------------------------- 149 // Vector add float as a reduction 150 class AddReductionVFNode : public ReductionNode { 151 public: 152 AddReductionVFNode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} 153 virtual int Opcode() const; 154 virtual const Type* bottom_type() const { return Type::FLOAT; } 155 virtual uint ideal_reg() const { return Op_RegF; } 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 //------------------------------MulVLNode-------------------------------------- 233 // Vector multiply long 234 class MulVLNode : public VectorNode { 235 public: 236 MulVLNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1, in2, vt) {} 237 virtual int Opcode() const; 238 }; 239 240 //------------------------------MulVFNode-------------------------------------- 241 // Vector multiply float 242 class MulVFNode : public VectorNode { 243 public: 244 MulVFNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1, in2, vt) {} 245 virtual int Opcode() const; 246 }; 247 248 //------------------------------MulVDNode-------------------------------------- 249 // Vector multiply double 250 class MulVDNode : public VectorNode { 251 public: 252 MulVDNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1, in2, vt) {} 253 virtual int Opcode() const; 254 }; 255 256 //------------------------------MulReductionVINode-------------------------------------- 257 // Vector multiply int as a reduction 258 class MulReductionVINode : public ReductionNode { 259 public: 260 MulReductionVINode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} 261 virtual int Opcode() const; 262 virtual const Type* bottom_type() const { return TypeInt::INT; } 263 virtual uint ideal_reg() const { return Op_RegI; } 264 }; 265 266 //------------------------------MulReductionVLNode-------------------------------------- 267 // Vector multiply int as a reduction 268 class MulReductionVLNode : public ReductionNode { 269 public: 270 MulReductionVLNode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} 271 virtual int Opcode() const; 272 virtual const Type* bottom_type() const { return TypeLong::LONG; } 273 virtual uint ideal_reg() const { return Op_RegI; } 274 }; 275 276 //------------------------------MulReductionVFNode-------------------------------------- 277 // Vector multiply float as a reduction 278 class MulReductionVFNode : public ReductionNode { 279 public: 280 MulReductionVFNode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} 281 virtual int Opcode() const; 282 virtual const Type* bottom_type() const { return Type::FLOAT; } 283 virtual uint ideal_reg() const { return Op_RegF; } 284 }; 285 286 //------------------------------MulReductionVDNode-------------------------------------- 287 // Vector multiply double as a reduction 288 class MulReductionVDNode : public ReductionNode { 289 public: 290 MulReductionVDNode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} 291 virtual int Opcode() const; 292 virtual const Type* bottom_type() const { return Type::DOUBLE; } 293 virtual uint ideal_reg() const { return Op_RegD; } 294 }; 295 296 //------------------------------DivVFNode-------------------------------------- 297 // Vector divide float 298 class DivVFNode : public VectorNode { 299 public: 300 DivVFNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 301 virtual int Opcode() const; 302 }; 303 304 //------------------------------DivVDNode-------------------------------------- 305 // Vector Divide double 306 class DivVDNode : public VectorNode { 307 public: 308 DivVDNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 309 virtual int Opcode() const; 310 }; 311 312 //------------------------------LShiftVBNode----------------------------------- 313 // Vector left shift bytes 314 class LShiftVBNode : public VectorNode { 315 public: 316 LShiftVBNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 317 virtual int Opcode() const; 318 }; 319 320 //------------------------------LShiftVSNode----------------------------------- 321 // Vector left shift shorts 322 class LShiftVSNode : public VectorNode { 323 public: 324 LShiftVSNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 325 virtual int Opcode() const; 326 }; 327 328 //------------------------------LShiftVINode----------------------------------- 329 // Vector left shift ints 330 class LShiftVINode : public VectorNode { 331 public: 332 LShiftVINode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 333 virtual int Opcode() const; 334 }; 335 336 //------------------------------LShiftVLNode----------------------------------- 337 // Vector left shift longs 338 class LShiftVLNode : public VectorNode { 339 public: 340 LShiftVLNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 341 virtual int Opcode() const; 342 }; 343 344 //------------------------------RShiftVBNode----------------------------------- 345 // Vector right arithmetic (signed) shift bytes 346 class RShiftVBNode : public VectorNode { 347 public: 348 RShiftVBNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 349 virtual int Opcode() const; 350 }; 351 352 //------------------------------RShiftVSNode----------------------------------- 353 // Vector right arithmetic (signed) shift shorts 354 class RShiftVSNode : public VectorNode { 355 public: 356 RShiftVSNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 357 virtual int Opcode() const; 358 }; 359 360 //------------------------------RShiftVINode----------------------------------- 361 // Vector right arithmetic (signed) shift ints 362 class RShiftVINode : public VectorNode { 363 public: 364 RShiftVINode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 365 virtual int Opcode() const; 366 }; 367 368 //------------------------------RShiftVLNode----------------------------------- 369 // Vector right arithmetic (signed) shift longs 370 class RShiftVLNode : public VectorNode { 371 public: 372 RShiftVLNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 373 virtual int Opcode() const; 374 }; 375 376 //------------------------------URShiftVBNode---------------------------------- 377 // Vector right logical (unsigned) shift bytes 378 class URShiftVBNode : public VectorNode { 379 public: 380 URShiftVBNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 381 virtual int Opcode() const; 382 }; 383 384 //------------------------------URShiftVSNode---------------------------------- 385 // Vector right logical (unsigned) shift shorts 386 class URShiftVSNode : public VectorNode { 387 public: 388 URShiftVSNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 389 virtual int Opcode() const; 390 }; 391 392 //------------------------------URShiftVINode---------------------------------- 393 // Vector right logical (unsigned) shift ints 394 class URShiftVINode : public VectorNode { 395 public: 396 URShiftVINode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 397 virtual int Opcode() const; 398 }; 399 400 //------------------------------URShiftVLNode---------------------------------- 401 // Vector right logical (unsigned) shift longs 402 class URShiftVLNode : public VectorNode { 403 public: 404 URShiftVLNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 405 virtual int Opcode() const; 406 }; 407 408 //------------------------------LShiftCntVNode--------------------------------- 409 // Vector left shift count 410 class LShiftCntVNode : public VectorNode { 411 public: 412 LShiftCntVNode(Node* cnt, const TypeVect* vt) : VectorNode(cnt,vt) {} 413 virtual int Opcode() const; 414 virtual uint ideal_reg() const { return Matcher::vector_shift_count_ideal_reg(vect_type()->length_in_bytes()); } 415 }; 416 417 //------------------------------RShiftCntVNode--------------------------------- 418 // Vector right shift count 419 class RShiftCntVNode : public VectorNode { 420 public: 421 RShiftCntVNode(Node* cnt, const TypeVect* vt) : VectorNode(cnt,vt) {} 422 virtual int Opcode() const; 423 virtual uint ideal_reg() const { return Matcher::vector_shift_count_ideal_reg(vect_type()->length_in_bytes()); } 424 }; 425 426 427 //------------------------------AndVNode--------------------------------------- 428 // Vector and integer 429 class AndVNode : public VectorNode { 430 public: 431 AndVNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 432 virtual int Opcode() const; 433 }; 434 435 //------------------------------OrVNode--------------------------------------- 436 // Vector or integer 437 class OrVNode : public VectorNode { 438 public: 439 OrVNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 440 virtual int Opcode() const; 441 }; 442 443 //------------------------------XorVNode--------------------------------------- 444 // Vector xor integer 445 class XorVNode : public VectorNode { 446 public: 447 XorVNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 448 virtual int Opcode() const; 449 }; 450 451 //================================= M E M O R Y =============================== 452 453 //------------------------------LoadVectorNode--------------------------------- 454 // Load Vector from memory 455 class LoadVectorNode : public LoadNode { 456 public: 457 LoadVectorNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const TypeVect* vt) 458 : LoadNode(c, mem, adr, at, vt, MemNode::unordered) { 459 init_class_id(Class_LoadVector); 460 } 461 462 const TypeVect* vect_type() const { return type()->is_vect(); } 463 uint length() const { return vect_type()->length(); } // Vector length 464 465 virtual int Opcode() const; 466 467 virtual uint ideal_reg() const { return Matcher::vector_ideal_reg(memory_size()); } 468 virtual BasicType memory_type() const { return T_VOID; } 469 virtual int memory_size() const { return vect_type()->length_in_bytes(); } 470 471 virtual int store_Opcode() const { return Op_StoreVector; } 472 473 static LoadVectorNode* make(int opc, Node* ctl, Node* mem, 474 Node* adr, const TypePtr* atyp, uint vlen, BasicType bt); 475 }; 476 477 //------------------------------StoreVectorNode-------------------------------- 478 // Store Vector to memory 479 class StoreVectorNode : public StoreNode { 480 public: 481 StoreVectorNode(Node* c, Node* mem, Node* adr, const TypePtr* at, Node* val) 482 : StoreNode(c, mem, adr, at, val, MemNode::unordered) { 483 assert(val->is_Vector() || val->is_LoadVector(), "sanity"); 484 init_class_id(Class_StoreVector); 485 } 486 487 const TypeVect* vect_type() const { return in(MemNode::ValueIn)->bottom_type()->is_vect(); } 488 uint length() const { return vect_type()->length(); } // Vector length 489 490 virtual int Opcode() const; 491 492 virtual uint ideal_reg() const { return Matcher::vector_ideal_reg(memory_size()); } 493 virtual BasicType memory_type() const { return T_VOID; } 494 virtual int memory_size() const { return vect_type()->length_in_bytes(); } 495 496 static StoreVectorNode* make(int opc, Node* ctl, Node* mem, 497 Node* adr, const TypePtr* atyp, Node* val, 498 uint vlen); 499 }; 500 501 502 //=========================Promote_Scalar_to_Vector============================ 503 504 //------------------------------ReplicateBNode--------------------------------- 505 // Replicate byte scalar to be vector 506 class ReplicateBNode : public VectorNode { 507 public: 508 ReplicateBNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {} 509 virtual int Opcode() const; 510 }; 511 512 //------------------------------ReplicateSNode--------------------------------- 513 // Replicate short scalar to be vector 514 class ReplicateSNode : public VectorNode { 515 public: 516 ReplicateSNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {} 517 virtual int Opcode() const; 518 }; 519 520 //------------------------------ReplicateINode--------------------------------- 521 // Replicate int scalar to be vector 522 class ReplicateINode : public VectorNode { 523 public: 524 ReplicateINode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {} 525 virtual int Opcode() const; 526 }; 527 528 //------------------------------ReplicateLNode--------------------------------- 529 // Replicate long scalar to be vector 530 class ReplicateLNode : public VectorNode { 531 public: 532 ReplicateLNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {} 533 virtual int Opcode() const; 534 }; 535 536 //------------------------------ReplicateFNode--------------------------------- 537 // Replicate float scalar to be vector 538 class ReplicateFNode : public VectorNode { 539 public: 540 ReplicateFNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {} 541 virtual int Opcode() const; 542 }; 543 544 //------------------------------ReplicateDNode--------------------------------- 545 // Replicate double scalar to be vector 546 class ReplicateDNode : public VectorNode { 547 public: 548 ReplicateDNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {} 549 virtual int Opcode() const; 550 }; 551 552 //========================Pack_Scalars_into_a_Vector=========================== 553 554 //------------------------------PackNode--------------------------------------- 555 // Pack parent class (not for code generation). 556 class PackNode : public VectorNode { 557 public: 558 PackNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {} 559 PackNode(Node* in1, Node* n2, const TypeVect* vt) : VectorNode(in1, n2, vt) {} 560 virtual int Opcode() const; 561 562 void add_opd(Node* n) { 563 add_req(n); 564 } 565 566 // Create a binary tree form for Packs. [lo, hi) (half-open) range 567 PackNode* binary_tree_pack(int lo, int hi); 568 569 static PackNode* make(Node* s, uint vlen, BasicType bt); 570 }; 571 572 //------------------------------PackBNode-------------------------------------- 573 // Pack byte scalars into vector 574 class PackBNode : public PackNode { 575 public: 576 PackBNode(Node* in1, const TypeVect* vt) : PackNode(in1, vt) {} 577 virtual int Opcode() const; 578 }; 579 580 //------------------------------PackSNode-------------------------------------- 581 // Pack short scalars into a vector 582 class PackSNode : public PackNode { 583 public: 584 PackSNode(Node* in1, const TypeVect* vt) : PackNode(in1, vt) {} 585 PackSNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {} 586 virtual int Opcode() const; 587 }; 588 589 //------------------------------PackINode-------------------------------------- 590 // Pack integer scalars into a vector 591 class PackINode : public PackNode { 592 public: 593 PackINode(Node* in1, const TypeVect* vt) : PackNode(in1, vt) {} 594 PackINode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {} 595 virtual int Opcode() const; 596 }; 597 598 //------------------------------PackLNode-------------------------------------- 599 // Pack long scalars into a vector 600 class PackLNode : public PackNode { 601 public: 602 PackLNode(Node* in1, const TypeVect* vt) : PackNode(in1, vt) {} 603 PackLNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {} 604 virtual int Opcode() const; 605 }; 606 607 //------------------------------Pack2LNode------------------------------------- 608 // Pack 2 long scalars into a vector 609 class Pack2LNode : public PackNode { 610 public: 611 Pack2LNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {} 612 virtual int Opcode() const; 613 }; 614 615 //------------------------------PackFNode-------------------------------------- 616 // Pack float scalars into vector 617 class PackFNode : public PackNode { 618 public: 619 PackFNode(Node* in1, const TypeVect* vt) : PackNode(in1, vt) {} 620 PackFNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {} 621 virtual int Opcode() const; 622 }; 623 624 //------------------------------PackDNode-------------------------------------- 625 // Pack double scalars into a vector 626 class PackDNode : public PackNode { 627 public: 628 PackDNode(Node* in1, const TypeVect* vt) : PackNode(in1, vt) {} 629 PackDNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {} 630 virtual int Opcode() const; 631 }; 632 633 //------------------------------Pack2DNode------------------------------------- 634 // Pack 2 double scalars into a vector 635 class Pack2DNode : public PackNode { 636 public: 637 Pack2DNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {} 638 virtual int Opcode() const; 639 }; 640 641 642 //========================Extract_Scalar_from_Vector=========================== 643 644 //------------------------------ExtractNode------------------------------------ 645 // Extract a scalar from a vector at position "pos" 646 class ExtractNode : public Node { 647 public: 648 ExtractNode(Node* src, ConINode* pos) : Node(NULL, src, (Node*)pos) { 649 assert(in(2)->get_int() >= 0, "positive constants"); 650 } 651 virtual int Opcode() const; 652 uint pos() const { return in(2)->get_int(); } 653 654 static Node* make(Node* v, uint position, BasicType bt); 655 }; 656 657 //------------------------------ExtractBNode----------------------------------- 658 // Extract a byte from a vector at position "pos" 659 class ExtractBNode : public ExtractNode { 660 public: 661 ExtractBNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {} 662 virtual int Opcode() const; 663 virtual const Type *bottom_type() const { return TypeInt::INT; } 664 virtual uint ideal_reg() const { return Op_RegI; } 665 }; 666 667 //------------------------------ExtractUBNode---------------------------------- 668 // Extract a boolean from a vector at position "pos" 669 class ExtractUBNode : public ExtractNode { 670 public: 671 ExtractUBNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {} 672 virtual int Opcode() const; 673 virtual const Type *bottom_type() const { return TypeInt::INT; } 674 virtual uint ideal_reg() const { return Op_RegI; } 675 }; 676 677 //------------------------------ExtractCNode----------------------------------- 678 // Extract a char from a vector at position "pos" 679 class ExtractCNode : public ExtractNode { 680 public: 681 ExtractCNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {} 682 virtual int Opcode() const; 683 virtual const Type *bottom_type() const { return TypeInt::INT; } 684 virtual uint ideal_reg() const { return Op_RegI; } 685 }; 686 687 //------------------------------ExtractSNode----------------------------------- 688 // Extract a short from a vector at position "pos" 689 class ExtractSNode : public ExtractNode { 690 public: 691 ExtractSNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {} 692 virtual int Opcode() const; 693 virtual const Type *bottom_type() const { return TypeInt::INT; } 694 virtual uint ideal_reg() const { return Op_RegI; } 695 }; 696 697 //------------------------------ExtractINode----------------------------------- 698 // Extract an int from a vector at position "pos" 699 class ExtractINode : public ExtractNode { 700 public: 701 ExtractINode(Node* src, ConINode* pos) : ExtractNode(src, pos) {} 702 virtual int Opcode() const; 703 virtual const Type *bottom_type() const { return TypeInt::INT; } 704 virtual uint ideal_reg() const { return Op_RegI; } 705 }; 706 707 //------------------------------ExtractLNode----------------------------------- 708 // Extract a long from a vector at position "pos" 709 class ExtractLNode : public ExtractNode { 710 public: 711 ExtractLNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {} 712 virtual int Opcode() const; 713 virtual const Type *bottom_type() const { return TypeLong::LONG; } 714 virtual uint ideal_reg() const { return Op_RegL; } 715 }; 716 717 //------------------------------ExtractFNode----------------------------------- 718 // Extract a float from a vector at position "pos" 719 class ExtractFNode : public ExtractNode { 720 public: 721 ExtractFNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {} 722 virtual int Opcode() const; 723 virtual const Type *bottom_type() const { return Type::FLOAT; } 724 virtual uint ideal_reg() const { return Op_RegF; } 725 }; 726 727 //------------------------------ExtractDNode----------------------------------- 728 // Extract a double from a vector at position "pos" 729 class ExtractDNode : public ExtractNode { 730 public: 731 ExtractDNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {} 732 virtual int Opcode() const; 733 virtual const Type *bottom_type() const { return Type::DOUBLE; } 734 virtual uint ideal_reg() const { return Op_RegD; } 735 }; 736 737 #endif // SHARE_VM_OPTO_VECTORNODE_HPP