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   VectorNode(Node* n1, Node* n2, Node* n3, const TypeVect* vt) : TypeNode(vt, 4) {
  48     init_class_id(Class_Vector);
  49     init_req(1, n1);
  50     init_req(2, n2);
  51     init_req(3, n3);
  52   }
  53 
  54   const TypeVect* vect_type() const { return type()->is_vect(); }
  55   uint length() const { return vect_type()->length(); } // Vector length
  56   uint length_in_bytes() const { return vect_type()->length_in_bytes(); }
  57 
  58   virtual int Opcode() const;
  59 
  60   virtual uint ideal_reg() const { return Matcher::vector_ideal_reg(vect_type()->length_in_bytes()); }
  61 
  62   static VectorNode* scalar2vector(Node* s, uint vlen, const Type* opd_t);
  63   static VectorNode* shift_count(Node* shift, Node* cnt, uint vlen, BasicType bt);
  64   static VectorNode* make(int opc, Node* n1, Node* n2, uint vlen, BasicType bt);
  65 
  66   static int  opcode(int opc, BasicType bt);
  67   static bool implemented(int opc, uint vlen, BasicType bt);
  68   static bool is_shift(Node* n);
  69   static bool is_invariant_vector(Node* n);
  70   // [Start, end) half-open range defining which operands are vectors
  71   static void vector_operands(Node* n, uint* start, uint* end);
  72 };
  73 
  74 //===========================Vector=ALU=Operations=============================
  75 
  76 //------------------------------AddVBNode--------------------------------------
  77 // Vector add byte
  78 class AddVBNode : public VectorNode {
  79  public:
  80   AddVBNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
  81   virtual int Opcode() const;
  82 };
  83 
  84 //------------------------------AddVSNode--------------------------------------
  85 // Vector add char/short
  86 class AddVSNode : public VectorNode {
  87  public:
  88   AddVSNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
  89   virtual int Opcode() const;
  90 };
  91 
  92 //------------------------------AddVINode--------------------------------------
  93 // Vector add int
  94 class AddVINode : public VectorNode {
  95  public:
  96   AddVINode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
  97   virtual int Opcode() const;
  98 };
  99 
 100 //------------------------------AddVLNode--------------------------------------
 101 // Vector add long
 102 class AddVLNode : public VectorNode {
 103 public:
 104   AddVLNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1, in2, vt) {}
 105   virtual int Opcode() const;
 106 };
 107 
 108 //------------------------------AddVFNode--------------------------------------
 109 // Vector add float
 110 class AddVFNode : public VectorNode {
 111 public:
 112   AddVFNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1, in2, vt) {}
 113   virtual int Opcode() const;
 114 };
 115 
 116 //------------------------------AddVDNode--------------------------------------
 117 // Vector add double
 118 class AddVDNode : public VectorNode {
 119 public:
 120   AddVDNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1, in2, vt) {}
 121   virtual int Opcode() const;
 122 };
 123 
 124 //------------------------------ReductionNode------------------------------------
 125 // Perform reduction of a vector
 126 class ReductionNode : public Node {
 127  public:
 128   ReductionNode(Node *ctrl, Node* in1, Node* in2) : Node(ctrl, in1, in2) {}
 129 
 130   static ReductionNode* make(int opc, Node *ctrl, Node* in1, Node* in2, BasicType bt);
 131   static int  opcode(int opc, BasicType bt);
 132   static bool implemented(int opc, uint vlen, BasicType bt);
 133 };
 134 
 135 //------------------------------AddReductionVINode--------------------------------------
 136 // Vector add int as a reduction
 137 class AddReductionVINode : public ReductionNode {
 138 public:
 139   AddReductionVINode(Node * ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {}
 140   virtual int Opcode() const;
 141   virtual const Type* bottom_type() const { return TypeInt::INT; }
 142   virtual uint ideal_reg() const { return Op_RegI; }
 143 };
 144 
 145 //------------------------------AddReductionVLNode--------------------------------------
 146 // Vector add long as a reduction
 147 class AddReductionVLNode : public ReductionNode {
 148 public:
 149   AddReductionVLNode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {}
 150   virtual int Opcode() const;
 151   virtual const Type* bottom_type() const { return TypeLong::LONG; }
 152   virtual uint ideal_reg() const { return Op_RegL; }
 153 };
 154 
 155 //------------------------------AddReductionVFNode--------------------------------------
 156 // Vector add float as a reduction
 157 class AddReductionVFNode : public ReductionNode {
 158 public:
 159   AddReductionVFNode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {}
 160   virtual int Opcode() const;
 161   virtual const Type* bottom_type() const { return Type::FLOAT; }
 162   virtual uint ideal_reg() const { return Op_RegF; }
 163 };
 164 
 165 //------------------------------AddReductionVDNode--------------------------------------
 166 // Vector add double as a reduction
 167 class AddReductionVDNode : public ReductionNode {
 168 public:
 169   AddReductionVDNode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {}
 170   virtual int Opcode() const;
 171   virtual const Type* bottom_type() const { return Type::DOUBLE; }
 172   virtual uint ideal_reg() const { return Op_RegD; }
 173 };
 174 
 175 //------------------------------SubVBNode--------------------------------------
 176 // Vector subtract byte
 177 class SubVBNode : public VectorNode {
 178  public:
 179   SubVBNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
 180   virtual int Opcode() const;
 181 };
 182 
 183 //------------------------------SubVSNode--------------------------------------
 184 // Vector subtract short
 185 class SubVSNode : public VectorNode {
 186  public:
 187   SubVSNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
 188   virtual int Opcode() const;
 189 };
 190 
 191 //------------------------------SubVINode--------------------------------------
 192 // Vector subtract int
 193 class SubVINode : public VectorNode {
 194  public:
 195   SubVINode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
 196   virtual int Opcode() const;
 197 };
 198 
 199 //------------------------------SubVLNode--------------------------------------
 200 // Vector subtract long
 201 class SubVLNode : public VectorNode {
 202  public:
 203   SubVLNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
 204   virtual int Opcode() const;
 205 };
 206 
 207 //------------------------------SubVFNode--------------------------------------
 208 // Vector subtract float
 209 class SubVFNode : public VectorNode {
 210  public:
 211   SubVFNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
 212   virtual int Opcode() const;
 213 };
 214 
 215 //------------------------------SubVDNode--------------------------------------
 216 // Vector subtract double
 217 class SubVDNode : public VectorNode {
 218  public:
 219   SubVDNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
 220   virtual int Opcode() const;
 221 };
 222 
 223 //------------------------------MulVSNode--------------------------------------
 224 // Vector multiply short
 225 class MulVSNode : public VectorNode {
 226  public:
 227   MulVSNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
 228   virtual int Opcode() const;
 229 };
 230 
 231 //------------------------------MulVINode--------------------------------------
 232 // Vector multiply int
 233 class MulVINode : public VectorNode {
 234  public:
 235   MulVINode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
 236   virtual int Opcode() const;
 237 };
 238 
 239 //------------------------------MulVLNode--------------------------------------
 240 // Vector multiply long
 241 class MulVLNode : public VectorNode {
 242 public:
 243   MulVLNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1, in2, vt) {}
 244   virtual int Opcode() const;
 245 };
 246 
 247 //------------------------------MulVFNode--------------------------------------
 248 // Vector multiply float
 249 class MulVFNode : public VectorNode {
 250 public:
 251   MulVFNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1, in2, vt) {}
 252   virtual int Opcode() const;
 253 };
 254 
 255 //------------------------------MulVDNode--------------------------------------
 256 // Vector multiply double
 257 class MulVDNode : public VectorNode {
 258 public:
 259   MulVDNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1, in2, vt) {}
 260   virtual int Opcode() const;
 261 };
 262 
 263 //------------------------------CMoveVDNode--------------------------------------
 264 // Vector multiply double
 265 class CMoveVDNode : public VectorNode {
 266 public:
 267   CMoveVDNode(Node* in1, Node* in2, Node* in3, const TypeVect* vt) : VectorNode(in1, in2, in3, vt) {}
 268   virtual int Opcode() const;
 269 };
 270 
 271 //------------------------------MulReductionVINode--------------------------------------
 272 // Vector multiply int as a reduction
 273 class MulReductionVINode : public ReductionNode {
 274 public:
 275   MulReductionVINode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {}
 276   virtual int Opcode() const;
 277   virtual const Type* bottom_type() const { return TypeInt::INT; }
 278   virtual uint ideal_reg() const { return Op_RegI; }
 279 };
 280 
 281 //------------------------------MulReductionVLNode--------------------------------------
 282 // Vector multiply int as a reduction
 283 class MulReductionVLNode : public ReductionNode {
 284 public:
 285   MulReductionVLNode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {}
 286   virtual int Opcode() const;
 287   virtual const Type* bottom_type() const { return TypeLong::LONG; }
 288   virtual uint ideal_reg() const { return Op_RegI; }
 289 };
 290 
 291 //------------------------------MulReductionVFNode--------------------------------------
 292 // Vector multiply float as a reduction
 293 class MulReductionVFNode : public ReductionNode {
 294 public:
 295   MulReductionVFNode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {}
 296   virtual int Opcode() const;
 297   virtual const Type* bottom_type() const { return Type::FLOAT; }
 298   virtual uint ideal_reg() const { return Op_RegF; }
 299 };
 300 
 301 //------------------------------MulReductionVDNode--------------------------------------
 302 // Vector multiply double as a reduction
 303 class MulReductionVDNode : public ReductionNode {
 304 public:
 305   MulReductionVDNode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {}
 306   virtual int Opcode() const;
 307   virtual const Type* bottom_type() const { return Type::DOUBLE; }
 308   virtual uint ideal_reg() const { return Op_RegD; }
 309 };
 310 
 311 //------------------------------DivVFNode--------------------------------------
 312 // Vector divide float
 313 class DivVFNode : public VectorNode {
 314  public:
 315   DivVFNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
 316   virtual int Opcode() const;
 317 };
 318 
 319 //------------------------------DivVDNode--------------------------------------
 320 // Vector Divide double
 321 class DivVDNode : public VectorNode {
 322  public:
 323   DivVDNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
 324   virtual int Opcode() const;
 325 };
 326 
 327 //------------------------------AbsVFNode--------------------------------------
 328 // Vector Abs float
 329 class AbsVFNode : public VectorNode {
 330  public:
 331   AbsVFNode(Node* in, const TypeVect* vt) : VectorNode(in,vt) {}
 332   virtual int Opcode() const;
 333 };
 334 
 335 //------------------------------AbsVDNode--------------------------------------
 336 // Vector Abs double
 337 class AbsVDNode : public VectorNode {
 338  public:
 339   AbsVDNode(Node* in, const TypeVect* vt) : VectorNode(in,vt) {}
 340   virtual int Opcode() const;
 341 };
 342 
 343 //------------------------------NegVFNode--------------------------------------
 344 // Vector Neg float
 345 class NegVFNode : public VectorNode {
 346  public:
 347   NegVFNode(Node* in, const TypeVect* vt) : VectorNode(in,vt) {}
 348   virtual int Opcode() const;
 349 };
 350 
 351 //------------------------------NegVDNode--------------------------------------
 352 // Vector Neg double
 353 class NegVDNode : public VectorNode {
 354  public:
 355   NegVDNode(Node* in, const TypeVect* vt) : VectorNode(in,vt) {}
 356   virtual int Opcode() const;
 357 };
 358 
 359 //------------------------------SqrtVDNode--------------------------------------
 360 // Vector Sqrt double
 361 class SqrtVDNode : public VectorNode {
 362  public:
 363   SqrtVDNode(Node* in, const TypeVect* vt) : VectorNode(in,vt) {}
 364   virtual int Opcode() const;
 365 };
 366 
 367 //------------------------------LShiftVBNode-----------------------------------
 368 // Vector left shift bytes
 369 class LShiftVBNode : public VectorNode {
 370  public:
 371   LShiftVBNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
 372   virtual int Opcode() const;
 373 };
 374 
 375 //------------------------------LShiftVSNode-----------------------------------
 376 // Vector left shift shorts
 377 class LShiftVSNode : public VectorNode {
 378  public:
 379   LShiftVSNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
 380   virtual int Opcode() const;
 381 };
 382 
 383 //------------------------------LShiftVINode-----------------------------------
 384 // Vector left shift ints
 385 class LShiftVINode : public VectorNode {
 386  public:
 387   LShiftVINode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
 388   virtual int Opcode() const;
 389 };
 390 
 391 //------------------------------LShiftVLNode-----------------------------------
 392 // Vector left shift longs
 393 class LShiftVLNode : public VectorNode {
 394  public:
 395   LShiftVLNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
 396   virtual int Opcode() const;
 397 };
 398 
 399 //------------------------------RShiftVBNode-----------------------------------
 400 // Vector right arithmetic (signed) shift bytes
 401 class RShiftVBNode : public VectorNode {
 402  public:
 403   RShiftVBNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
 404   virtual int Opcode() const;
 405 };
 406 
 407 //------------------------------RShiftVSNode-----------------------------------
 408 // Vector right arithmetic (signed) shift shorts
 409 class RShiftVSNode : public VectorNode {
 410  public:
 411   RShiftVSNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
 412   virtual int Opcode() const;
 413 };
 414 
 415 //------------------------------RShiftVINode-----------------------------------
 416 // Vector right arithmetic (signed) shift ints
 417 class RShiftVINode : public VectorNode {
 418  public:
 419   RShiftVINode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
 420   virtual int Opcode() const;
 421 };
 422 
 423 //------------------------------RShiftVLNode-----------------------------------
 424 // Vector right arithmetic (signed) shift longs
 425 class RShiftVLNode : public VectorNode {
 426  public:
 427   RShiftVLNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
 428   virtual int Opcode() const;
 429 };
 430 
 431 //------------------------------URShiftVBNode----------------------------------
 432 // Vector right logical (unsigned) shift bytes
 433 class URShiftVBNode : public VectorNode {
 434  public:
 435   URShiftVBNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
 436   virtual int Opcode() const;
 437 };
 438 
 439 //------------------------------URShiftVSNode----------------------------------
 440 // Vector right logical (unsigned) shift shorts
 441 class URShiftVSNode : public VectorNode {
 442  public:
 443   URShiftVSNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
 444   virtual int Opcode() const;
 445 };
 446 
 447 //------------------------------URShiftVINode----------------------------------
 448 // Vector right logical (unsigned) shift ints
 449 class URShiftVINode : public VectorNode {
 450  public:
 451   URShiftVINode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
 452   virtual int Opcode() const;
 453 };
 454 
 455 //------------------------------URShiftVLNode----------------------------------
 456 // Vector right logical (unsigned) shift longs
 457 class URShiftVLNode : public VectorNode {
 458  public:
 459   URShiftVLNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
 460   virtual int Opcode() const;
 461 };
 462 
 463 //------------------------------LShiftCntVNode---------------------------------
 464 // Vector left shift count
 465 class LShiftCntVNode : public VectorNode {
 466  public:
 467   LShiftCntVNode(Node* cnt, const TypeVect* vt) : VectorNode(cnt,vt) {}
 468   virtual int Opcode() const;
 469   virtual uint ideal_reg() const { return Matcher::vector_shift_count_ideal_reg(vect_type()->length_in_bytes()); }
 470 };
 471 
 472 //------------------------------RShiftCntVNode---------------------------------
 473 // Vector right shift count
 474 class RShiftCntVNode : public VectorNode {
 475  public:
 476   RShiftCntVNode(Node* cnt, const TypeVect* vt) : VectorNode(cnt,vt) {}
 477   virtual int Opcode() const;
 478   virtual uint ideal_reg() const { return Matcher::vector_shift_count_ideal_reg(vect_type()->length_in_bytes()); }
 479 };
 480 
 481 
 482 //------------------------------AndVNode---------------------------------------
 483 // Vector and integer
 484 class AndVNode : public VectorNode {
 485  public:
 486   AndVNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
 487   virtual int Opcode() const;
 488 };
 489 
 490 //------------------------------OrVNode---------------------------------------
 491 // Vector or integer
 492 class OrVNode : public VectorNode {
 493  public:
 494   OrVNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
 495   virtual int Opcode() const;
 496 };
 497 
 498 //------------------------------XorVNode---------------------------------------
 499 // Vector xor integer
 500 class XorVNode : public VectorNode {
 501  public:
 502   XorVNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
 503   virtual int Opcode() const;
 504 };
 505 
 506 //================================= M E M O R Y ===============================
 507 
 508 //------------------------------LoadVectorNode---------------------------------
 509 // Load Vector from memory
 510 class LoadVectorNode : public LoadNode {
 511  public:
 512   LoadVectorNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const TypeVect* vt, ControlDependency control_dependency = LoadNode::DependsOnlyOnTest)
 513     : LoadNode(c, mem, adr, at, vt, MemNode::unordered, control_dependency) {
 514     init_class_id(Class_LoadVector);
 515   }
 516 
 517   const TypeVect* vect_type() const { return type()->is_vect(); }
 518   uint length() const { return vect_type()->length(); } // Vector length
 519 
 520   virtual int Opcode() const;
 521 
 522   virtual uint ideal_reg() const  { return Matcher::vector_ideal_reg(memory_size()); }
 523   virtual BasicType memory_type() const { return T_VOID; }
 524   virtual int memory_size() const { return vect_type()->length_in_bytes(); }
 525 
 526   virtual int store_Opcode() const { return Op_StoreVector; }
 527 
 528   static LoadVectorNode* make(int opc, Node* ctl, Node* mem,
 529                               Node* adr, const TypePtr* atyp,
 530                               uint vlen, BasicType bt,
 531                               ControlDependency control_dependency = LoadNode::DependsOnlyOnTest);
 532   uint element_size(void) { return type2aelembytes(vect_type()->element_basic_type()); }
 533 };
 534 
 535 //------------------------------StoreVectorNode--------------------------------
 536 // Store Vector to memory
 537 class StoreVectorNode : public StoreNode {
 538  public:
 539   StoreVectorNode(Node* c, Node* mem, Node* adr, const TypePtr* at, Node* val)
 540     : StoreNode(c, mem, adr, at, val, MemNode::unordered) {
 541     assert(val->is_Vector() || val->is_LoadVector(), "sanity");
 542     init_class_id(Class_StoreVector);
 543   }
 544 
 545   const TypeVect* vect_type() const { return in(MemNode::ValueIn)->bottom_type()->is_vect(); }
 546   uint length() const { return vect_type()->length(); } // Vector length
 547 
 548   virtual int Opcode() const;
 549 
 550   virtual uint ideal_reg() const  { return Matcher::vector_ideal_reg(memory_size()); }
 551   virtual BasicType memory_type() const { return T_VOID; }
 552   virtual int memory_size() const { return vect_type()->length_in_bytes(); }
 553 
 554   static StoreVectorNode* make(int opc, Node* ctl, Node* mem,
 555                                Node* adr, const TypePtr* atyp, Node* val,
 556                                uint vlen);
 557 
 558   uint element_size(void) { return type2aelembytes(vect_type()->element_basic_type()); }
 559 };
 560 
 561 
 562 //=========================Promote_Scalar_to_Vector============================
 563 
 564 //------------------------------ReplicateBNode---------------------------------
 565 // Replicate byte scalar to be vector
 566 class ReplicateBNode : public VectorNode {
 567  public:
 568   ReplicateBNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {}
 569   virtual int Opcode() const;
 570 };
 571 
 572 //------------------------------ReplicateSNode---------------------------------
 573 // Replicate short scalar to be vector
 574 class ReplicateSNode : public VectorNode {
 575  public:
 576   ReplicateSNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {}
 577   virtual int Opcode() const;
 578 };
 579 
 580 //------------------------------ReplicateINode---------------------------------
 581 // Replicate int scalar to be vector
 582 class ReplicateINode : public VectorNode {
 583  public:
 584   ReplicateINode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {}
 585   virtual int Opcode() const;
 586 };
 587 
 588 //------------------------------ReplicateLNode---------------------------------
 589 // Replicate long scalar to be vector
 590 class ReplicateLNode : public VectorNode {
 591  public:
 592   ReplicateLNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {}
 593   virtual int Opcode() const;
 594 };
 595 
 596 //------------------------------ReplicateFNode---------------------------------
 597 // Replicate float scalar to be vector
 598 class ReplicateFNode : public VectorNode {
 599  public:
 600   ReplicateFNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {}
 601   virtual int Opcode() const;
 602 };
 603 
 604 //------------------------------ReplicateDNode---------------------------------
 605 // Replicate double scalar to be vector
 606 class ReplicateDNode : public VectorNode {
 607  public:
 608   ReplicateDNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {}
 609   virtual int Opcode() const;
 610 };
 611 
 612 //========================Pack_Scalars_into_a_Vector===========================
 613 
 614 //------------------------------PackNode---------------------------------------
 615 // Pack parent class (not for code generation).
 616 class PackNode : public VectorNode {
 617  public:
 618   PackNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {}
 619   PackNode(Node* in1, Node* n2, const TypeVect* vt) : VectorNode(in1, n2, vt) {}
 620   virtual int Opcode() const;
 621 
 622   void add_opd(Node* n) {
 623     add_req(n);
 624   }
 625 
 626   // Create a binary tree form for Packs. [lo, hi) (half-open) range
 627   PackNode* binary_tree_pack(int lo, int hi);
 628 
 629   static PackNode* make(Node* s, uint vlen, BasicType bt);
 630 };
 631 
 632 //------------------------------PackBNode--------------------------------------
 633 // Pack byte scalars into vector
 634 class PackBNode : public PackNode {
 635  public:
 636   PackBNode(Node* in1, const TypeVect* vt)  : PackNode(in1, vt) {}
 637   virtual int Opcode() const;
 638 };
 639 
 640 //------------------------------PackSNode--------------------------------------
 641 // Pack short scalars into a vector
 642 class PackSNode : public PackNode {
 643  public:
 644   PackSNode(Node* in1, const TypeVect* vt)  : PackNode(in1, vt) {}
 645   PackSNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {}
 646   virtual int Opcode() const;
 647 };
 648 
 649 //------------------------------PackINode--------------------------------------
 650 // Pack integer scalars into a vector
 651 class PackINode : public PackNode {
 652  public:
 653   PackINode(Node* in1, const TypeVect* vt)  : PackNode(in1, vt) {}
 654   PackINode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {}
 655   virtual int Opcode() const;
 656 };
 657 
 658 //------------------------------PackLNode--------------------------------------
 659 // Pack long scalars into a vector
 660 class PackLNode : public PackNode {
 661  public:
 662   PackLNode(Node* in1, const TypeVect* vt)  : PackNode(in1, vt) {}
 663   PackLNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {}
 664   virtual int Opcode() const;
 665 };
 666 
 667 //------------------------------Pack2LNode-------------------------------------
 668 // Pack 2 long scalars into a vector
 669 class Pack2LNode : public PackNode {
 670  public:
 671   Pack2LNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {}
 672   virtual int Opcode() const;
 673 };
 674 
 675 //------------------------------PackFNode--------------------------------------
 676 // Pack float scalars into vector
 677 class PackFNode : public PackNode {
 678  public:
 679   PackFNode(Node* in1, const TypeVect* vt)  : PackNode(in1, vt) {}
 680   PackFNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {}
 681   virtual int Opcode() const;
 682 };
 683 
 684 //------------------------------PackDNode--------------------------------------
 685 // Pack double scalars into a vector
 686 class PackDNode : public PackNode {
 687  public:
 688   PackDNode(Node* in1, const TypeVect* vt) : PackNode(in1, vt) {}
 689   PackDNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {}
 690   virtual int Opcode() const;
 691 };
 692 
 693 //------------------------------Pack2DNode-------------------------------------
 694 // Pack 2 double scalars into a vector
 695 class Pack2DNode : public PackNode {
 696  public:
 697   Pack2DNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {}
 698   virtual int Opcode() const;
 699 };
 700 
 701 
 702 //========================Extract_Scalar_from_Vector===========================
 703 
 704 //------------------------------ExtractNode------------------------------------
 705 // Extract a scalar from a vector at position "pos"
 706 class ExtractNode : public Node {
 707  public:
 708   ExtractNode(Node* src, ConINode* pos) : Node(NULL, src, (Node*)pos) {
 709     assert(in(2)->get_int() >= 0, "positive constants");
 710   }
 711   virtual int Opcode() const;
 712   uint  pos() const { return in(2)->get_int(); }
 713 
 714   static Node* make(Node* v, uint position, BasicType bt);
 715 };
 716 
 717 //------------------------------ExtractBNode-----------------------------------
 718 // Extract a byte from a vector at position "pos"
 719 class ExtractBNode : public ExtractNode {
 720  public:
 721   ExtractBNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {}
 722   virtual int Opcode() const;
 723   virtual const Type *bottom_type() const { return TypeInt::INT; }
 724   virtual uint ideal_reg() const { return Op_RegI; }
 725 };
 726 
 727 //------------------------------ExtractUBNode----------------------------------
 728 // Extract a boolean from a vector at position "pos"
 729 class ExtractUBNode : public ExtractNode {
 730  public:
 731   ExtractUBNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {}
 732   virtual int Opcode() const;
 733   virtual const Type *bottom_type() const { return TypeInt::INT; }
 734   virtual uint ideal_reg() const { return Op_RegI; }
 735 };
 736 
 737 //------------------------------ExtractCNode-----------------------------------
 738 // Extract a char from a vector at position "pos"
 739 class ExtractCNode : public ExtractNode {
 740  public:
 741   ExtractCNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {}
 742   virtual int Opcode() const;
 743   virtual const Type *bottom_type() const { return TypeInt::INT; }
 744   virtual uint ideal_reg() const { return Op_RegI; }
 745 };
 746 
 747 //------------------------------ExtractSNode-----------------------------------
 748 // Extract a short from a vector at position "pos"
 749 class ExtractSNode : public ExtractNode {
 750  public:
 751   ExtractSNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {}
 752   virtual int Opcode() const;
 753   virtual const Type *bottom_type() const { return TypeInt::INT; }
 754   virtual uint ideal_reg() const { return Op_RegI; }
 755 };
 756 
 757 //------------------------------ExtractINode-----------------------------------
 758 // Extract an int from a vector at position "pos"
 759 class ExtractINode : public ExtractNode {
 760  public:
 761   ExtractINode(Node* src, ConINode* pos) : ExtractNode(src, pos) {}
 762   virtual int Opcode() const;
 763   virtual const Type *bottom_type() const { return TypeInt::INT; }
 764   virtual uint ideal_reg() const { return Op_RegI; }
 765 };
 766 
 767 //------------------------------ExtractLNode-----------------------------------
 768 // Extract a long from a vector at position "pos"
 769 class ExtractLNode : public ExtractNode {
 770  public:
 771   ExtractLNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {}
 772   virtual int Opcode() const;
 773   virtual const Type *bottom_type() const { return TypeLong::LONG; }
 774   virtual uint ideal_reg() const { return Op_RegL; }
 775 };
 776 
 777 //------------------------------ExtractFNode-----------------------------------
 778 // Extract a float from a vector at position "pos"
 779 class ExtractFNode : public ExtractNode {
 780  public:
 781   ExtractFNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {}
 782   virtual int Opcode() const;
 783   virtual const Type *bottom_type() const { return Type::FLOAT; }
 784   virtual uint ideal_reg() const { return Op_RegF; }
 785 };
 786 
 787 //------------------------------ExtractDNode-----------------------------------
 788 // Extract a double from a vector at position "pos"
 789 class ExtractDNode : public ExtractNode {
 790  public:
 791   ExtractDNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {}
 792   virtual int Opcode() const;
 793   virtual const Type *bottom_type() const { return Type::DOUBLE; }
 794   virtual uint ideal_reg() const { return Op_RegD; }
 795 };
 796 
 797 //------------------------------SetVectMaskINode-------------------------------
 798 // Provide a mask for a vector predicate machine
 799 class SetVectMaskINode : public Node {
 800 public:
 801   SetVectMaskINode(Node *c, Node *in1) : Node(c, in1) {}
 802   virtual int Opcode() const;
 803   const Type *bottom_type() const { return TypeInt::INT; }
 804   virtual uint ideal_reg() const { return Op_RegI; }
 805   virtual const Type *Value(PhaseGVN *phase) const { return TypeInt::INT; }
 806 };
 807 
 808 #endif // SHARE_VM_OPTO_VECTORNODE_HPP