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 //------------------------------SqrtVDNode-------------------------------------- 313 // Vector Sqrt double 314 class SqrtVDNode : public VectorNode { 315 public: 316 SqrtVDNode(Node* in, const TypeVect* vt) : VectorNode(in,vt) {} 317 virtual int Opcode() const; 318 }; 319 320 //------------------------------LShiftVBNode----------------------------------- 321 // Vector left shift bytes 322 class LShiftVBNode : public VectorNode { 323 public: 324 LShiftVBNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 325 virtual int Opcode() const; 326 }; 327 328 //------------------------------LShiftVSNode----------------------------------- 329 // Vector left shift shorts 330 class LShiftVSNode : public VectorNode { 331 public: 332 LShiftVSNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 333 virtual int Opcode() const; 334 }; 335 336 //------------------------------LShiftVINode----------------------------------- 337 // Vector left shift ints 338 class LShiftVINode : public VectorNode { 339 public: 340 LShiftVINode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 341 virtual int Opcode() const; 342 }; 343 344 //------------------------------LShiftVLNode----------------------------------- 345 // Vector left shift longs 346 class LShiftVLNode : public VectorNode { 347 public: 348 LShiftVLNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 349 virtual int Opcode() const; 350 }; 351 352 //------------------------------RShiftVBNode----------------------------------- 353 // Vector right arithmetic (signed) shift bytes 354 class RShiftVBNode : public VectorNode { 355 public: 356 RShiftVBNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 357 virtual int Opcode() const; 358 }; 359 360 //------------------------------RShiftVSNode----------------------------------- 361 // Vector right arithmetic (signed) shift shorts 362 class RShiftVSNode : public VectorNode { 363 public: 364 RShiftVSNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 365 virtual int Opcode() const; 366 }; 367 368 //------------------------------RShiftVINode----------------------------------- 369 // Vector right arithmetic (signed) shift ints 370 class RShiftVINode : public VectorNode { 371 public: 372 RShiftVINode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 373 virtual int Opcode() const; 374 }; 375 376 //------------------------------RShiftVLNode----------------------------------- 377 // Vector right arithmetic (signed) shift longs 378 class RShiftVLNode : public VectorNode { 379 public: 380 RShiftVLNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 381 virtual int Opcode() const; 382 }; 383 384 //------------------------------URShiftVBNode---------------------------------- 385 // Vector right logical (unsigned) shift bytes 386 class URShiftVBNode : public VectorNode { 387 public: 388 URShiftVBNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 389 virtual int Opcode() const; 390 }; 391 392 //------------------------------URShiftVSNode---------------------------------- 393 // Vector right logical (unsigned) shift shorts 394 class URShiftVSNode : public VectorNode { 395 public: 396 URShiftVSNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 397 virtual int Opcode() const; 398 }; 399 400 //------------------------------URShiftVINode---------------------------------- 401 // Vector right logical (unsigned) shift ints 402 class URShiftVINode : public VectorNode { 403 public: 404 URShiftVINode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 405 virtual int Opcode() const; 406 }; 407 408 //------------------------------URShiftVLNode---------------------------------- 409 // Vector right logical (unsigned) shift longs 410 class URShiftVLNode : public VectorNode { 411 public: 412 URShiftVLNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 413 virtual int Opcode() const; 414 }; 415 416 //------------------------------LShiftCntVNode--------------------------------- 417 // Vector left shift count 418 class LShiftCntVNode : public VectorNode { 419 public: 420 LShiftCntVNode(Node* cnt, const TypeVect* vt) : VectorNode(cnt,vt) {} 421 virtual int Opcode() const; 422 virtual uint ideal_reg() const { return Matcher::vector_shift_count_ideal_reg(vect_type()->length_in_bytes()); } 423 }; 424 425 //------------------------------RShiftCntVNode--------------------------------- 426 // Vector right shift count 427 class RShiftCntVNode : public VectorNode { 428 public: 429 RShiftCntVNode(Node* cnt, const TypeVect* vt) : VectorNode(cnt,vt) {} 430 virtual int Opcode() const; 431 virtual uint ideal_reg() const { return Matcher::vector_shift_count_ideal_reg(vect_type()->length_in_bytes()); } 432 }; 433 434 435 //------------------------------AndVNode--------------------------------------- 436 // Vector and integer 437 class AndVNode : public VectorNode { 438 public: 439 AndVNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 440 virtual int Opcode() const; 441 }; 442 443 //------------------------------OrVNode--------------------------------------- 444 // Vector or integer 445 class OrVNode : public VectorNode { 446 public: 447 OrVNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 448 virtual int Opcode() const; 449 }; 450 451 //------------------------------XorVNode--------------------------------------- 452 // Vector xor integer 453 class XorVNode : public VectorNode { 454 public: 455 XorVNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} 456 virtual int Opcode() const; 457 }; 458 459 //================================= M E M O R Y =============================== 460 461 //------------------------------LoadVectorNode--------------------------------- 462 // Load Vector from memory 463 class LoadVectorNode : public LoadNode { 464 public: 465 LoadVectorNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const TypeVect* vt, ControlDependency control_dependency = LoadNode::DependsOnlyOnTest) 466 : LoadNode(c, mem, adr, at, vt, MemNode::unordered, control_dependency) { 467 init_class_id(Class_LoadVector); 468 } 469 470 const TypeVect* vect_type() const { return type()->is_vect(); } 471 uint length() const { return vect_type()->length(); } // Vector length 472 473 virtual int Opcode() const; 474 475 virtual uint ideal_reg() const { return Matcher::vector_ideal_reg(memory_size()); } 476 virtual BasicType memory_type() const { return T_VOID; } 477 virtual int memory_size() const { return vect_type()->length_in_bytes(); } 478 479 virtual int store_Opcode() const { return Op_StoreVector; } 480 481 static LoadVectorNode* make(int opc, Node* ctl, Node* mem, 482 Node* adr, const TypePtr* atyp, 483 uint vlen, BasicType bt, 484 ControlDependency control_dependency = LoadNode::DependsOnlyOnTest); 485 }; 486 487 //------------------------------StoreVectorNode-------------------------------- 488 // Store Vector to memory 489 class StoreVectorNode : public StoreNode { 490 public: 491 StoreVectorNode(Node* c, Node* mem, Node* adr, const TypePtr* at, Node* val) 492 : StoreNode(c, mem, adr, at, val, MemNode::unordered) { 493 assert(val->is_Vector() || val->is_LoadVector(), "sanity"); 494 init_class_id(Class_StoreVector); 495 } 496 497 const TypeVect* vect_type() const { return in(MemNode::ValueIn)->bottom_type()->is_vect(); } 498 uint length() const { return vect_type()->length(); } // Vector length 499 500 virtual int Opcode() const; 501 502 virtual uint ideal_reg() const { return Matcher::vector_ideal_reg(memory_size()); } 503 virtual BasicType memory_type() const { return T_VOID; } 504 virtual int memory_size() const { return vect_type()->length_in_bytes(); } 505 506 static StoreVectorNode* make(int opc, Node* ctl, Node* mem, 507 Node* adr, const TypePtr* atyp, Node* val, 508 uint vlen); 509 }; 510 511 512 //=========================Promote_Scalar_to_Vector============================ 513 514 //------------------------------ReplicateBNode--------------------------------- 515 // Replicate byte scalar to be vector 516 class ReplicateBNode : public VectorNode { 517 public: 518 ReplicateBNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {} 519 virtual int Opcode() const; 520 }; 521 522 //------------------------------ReplicateSNode--------------------------------- 523 // Replicate short scalar to be vector 524 class ReplicateSNode : public VectorNode { 525 public: 526 ReplicateSNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {} 527 virtual int Opcode() const; 528 }; 529 530 //------------------------------ReplicateINode--------------------------------- 531 // Replicate int scalar to be vector 532 class ReplicateINode : public VectorNode { 533 public: 534 ReplicateINode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {} 535 virtual int Opcode() const; 536 }; 537 538 //------------------------------ReplicateLNode--------------------------------- 539 // Replicate long scalar to be vector 540 class ReplicateLNode : public VectorNode { 541 public: 542 ReplicateLNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {} 543 virtual int Opcode() const; 544 }; 545 546 //------------------------------ReplicateFNode--------------------------------- 547 // Replicate float scalar to be vector 548 class ReplicateFNode : public VectorNode { 549 public: 550 ReplicateFNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {} 551 virtual int Opcode() const; 552 }; 553 554 //------------------------------ReplicateDNode--------------------------------- 555 // Replicate double scalar to be vector 556 class ReplicateDNode : public VectorNode { 557 public: 558 ReplicateDNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {} 559 virtual int Opcode() const; 560 }; 561 562 //========================Pack_Scalars_into_a_Vector=========================== 563 564 //------------------------------PackNode--------------------------------------- 565 // Pack parent class (not for code generation). 566 class PackNode : public VectorNode { 567 public: 568 PackNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {} 569 PackNode(Node* in1, Node* n2, const TypeVect* vt) : VectorNode(in1, n2, vt) {} 570 virtual int Opcode() const; 571 572 void add_opd(Node* n) { 573 add_req(n); 574 } 575 576 // Create a binary tree form for Packs. [lo, hi) (half-open) range 577 PackNode* binary_tree_pack(int lo, int hi); 578 579 static PackNode* make(Node* s, uint vlen, BasicType bt); 580 }; 581 582 //------------------------------PackBNode-------------------------------------- 583 // Pack byte scalars into vector 584 class PackBNode : public PackNode { 585 public: 586 PackBNode(Node* in1, const TypeVect* vt) : PackNode(in1, vt) {} 587 virtual int Opcode() const; 588 }; 589 590 //------------------------------PackSNode-------------------------------------- 591 // Pack short scalars into a vector 592 class PackSNode : public PackNode { 593 public: 594 PackSNode(Node* in1, const TypeVect* vt) : PackNode(in1, vt) {} 595 PackSNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {} 596 virtual int Opcode() const; 597 }; 598 599 //------------------------------PackINode-------------------------------------- 600 // Pack integer scalars into a vector 601 class PackINode : public PackNode { 602 public: 603 PackINode(Node* in1, const TypeVect* vt) : PackNode(in1, vt) {} 604 PackINode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {} 605 virtual int Opcode() const; 606 }; 607 608 //------------------------------PackLNode-------------------------------------- 609 // Pack long scalars into a vector 610 class PackLNode : public PackNode { 611 public: 612 PackLNode(Node* in1, const TypeVect* vt) : PackNode(in1, vt) {} 613 PackLNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {} 614 virtual int Opcode() const; 615 }; 616 617 //------------------------------Pack2LNode------------------------------------- 618 // Pack 2 long scalars into a vector 619 class Pack2LNode : public PackNode { 620 public: 621 Pack2LNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {} 622 virtual int Opcode() const; 623 }; 624 625 //------------------------------PackFNode-------------------------------------- 626 // Pack float scalars into vector 627 class PackFNode : public PackNode { 628 public: 629 PackFNode(Node* in1, const TypeVect* vt) : PackNode(in1, vt) {} 630 PackFNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {} 631 virtual int Opcode() const; 632 }; 633 634 //------------------------------PackDNode-------------------------------------- 635 // Pack double scalars into a vector 636 class PackDNode : public PackNode { 637 public: 638 PackDNode(Node* in1, const TypeVect* vt) : PackNode(in1, vt) {} 639 PackDNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {} 640 virtual int Opcode() const; 641 }; 642 643 //------------------------------Pack2DNode------------------------------------- 644 // Pack 2 double scalars into a vector 645 class Pack2DNode : public PackNode { 646 public: 647 Pack2DNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {} 648 virtual int Opcode() const; 649 }; 650 651 652 //========================Extract_Scalar_from_Vector=========================== 653 654 //------------------------------ExtractNode------------------------------------ 655 // Extract a scalar from a vector at position "pos" 656 class ExtractNode : public Node { 657 public: 658 ExtractNode(Node* src, ConINode* pos) : Node(NULL, src, (Node*)pos) { 659 assert(in(2)->get_int() >= 0, "positive constants"); 660 } 661 virtual int Opcode() const; 662 uint pos() const { return in(2)->get_int(); } 663 664 static Node* make(Node* v, uint position, BasicType bt); 665 }; 666 667 //------------------------------ExtractBNode----------------------------------- 668 // Extract a byte from a vector at position "pos" 669 class ExtractBNode : public ExtractNode { 670 public: 671 ExtractBNode(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 //------------------------------ExtractUBNode---------------------------------- 678 // Extract a boolean from a vector at position "pos" 679 class ExtractUBNode : public ExtractNode { 680 public: 681 ExtractUBNode(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 //------------------------------ExtractCNode----------------------------------- 688 // Extract a char from a vector at position "pos" 689 class ExtractCNode : public ExtractNode { 690 public: 691 ExtractCNode(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 //------------------------------ExtractSNode----------------------------------- 698 // Extract a short from a vector at position "pos" 699 class ExtractSNode : public ExtractNode { 700 public: 701 ExtractSNode(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 //------------------------------ExtractINode----------------------------------- 708 // Extract an int from a vector at position "pos" 709 class ExtractINode : public ExtractNode { 710 public: 711 ExtractINode(Node* src, ConINode* pos) : ExtractNode(src, pos) {} 712 virtual int Opcode() const; 713 virtual const Type *bottom_type() const { return TypeInt::INT; } 714 virtual uint ideal_reg() const { return Op_RegI; } 715 }; 716 717 //------------------------------ExtractLNode----------------------------------- 718 // Extract a long from a vector at position "pos" 719 class ExtractLNode : public ExtractNode { 720 public: 721 ExtractLNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {} 722 virtual int Opcode() const; 723 virtual const Type *bottom_type() const { return TypeLong::LONG; } 724 virtual uint ideal_reg() const { return Op_RegL; } 725 }; 726 727 //------------------------------ExtractFNode----------------------------------- 728 // Extract a float from a vector at position "pos" 729 class ExtractFNode : public ExtractNode { 730 public: 731 ExtractFNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {} 732 virtual int Opcode() const; 733 virtual const Type *bottom_type() const { return Type::FLOAT; } 734 virtual uint ideal_reg() const { return Op_RegF; } 735 }; 736 737 //------------------------------ExtractDNode----------------------------------- 738 // Extract a double from a vector at position "pos" 739 class ExtractDNode : public ExtractNode { 740 public: 741 ExtractDNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {} 742 virtual int Opcode() const; 743 virtual const Type *bottom_type() const { return Type::DOUBLE; } 744 virtual uint ideal_reg() const { return Op_RegD; } 745 }; 746 747 #endif // SHARE_VM_OPTO_VECTORNODE_HPP