< prev index next >

hotspot/src/share/vm/opto/superword.hpp

Print this page
rev 7350 : 8078497: C2's superword optimization causes unaligned memory accesses
Summary: Prevent vectorization of memory operations with different invariant offsets if unaligned memory accesses are not allowed.
Reviewed-by: kvn


  24 #ifndef SHARE_VM_OPTO_SUPERWORD_HPP
  25 #define SHARE_VM_OPTO_SUPERWORD_HPP
  26 
  27 #include "opto/connode.hpp"
  28 #include "opto/loopnode.hpp"
  29 #include "opto/node.hpp"
  30 #include "opto/phaseX.hpp"
  31 #include "opto/vectornode.hpp"
  32 #include "utilities/growableArray.hpp"
  33 
  34 //
  35 //                  S U P E R W O R D   T R A N S F O R M
  36 //
  37 // SuperWords are short, fixed length vectors.
  38 //
  39 // Algorithm from:
  40 //
  41 // Exploiting SuperWord Level Parallelism with
  42 //   Multimedia Instruction Sets
  43 // by
  44 //   Samuel Larsen and Saman Amarasighe
  45 //   MIT Laboratory for Computer Science
  46 // date
  47 //   May 2000
  48 // published in
  49 //   ACM SIGPLAN Notices
  50 //   Proceedings of ACM PLDI '00,  Volume 35 Issue 5
  51 //
  52 // Definition 3.1 A Pack is an n-tuple, <s1, ...,sn>, where
  53 // s1,...,sn are independent isomorphic statements in a basic
  54 // block.
  55 //
  56 // Definition 3.2 A PackSet is a set of Packs.
  57 //
  58 // Definition 3.3 A Pair is a Pack of size two, where the
  59 // first statement is considered the left element, and the
  60 // second statement is considered the right element.
  61 
  62 class SWPointer;
  63 class OrderedPair;
  64 


 415   void init();
 416 
 417   // print methods
 418   void print_packset();
 419   void print_pack(Node_List* p);
 420   void print_bb();
 421   void print_stmt(Node* s);
 422   char* blank(uint depth);
 423 };
 424 
 425 
 426 //------------------------------SWPointer---------------------------
 427 // Information about an address for dependence checking and vector alignment
 428 class SWPointer VALUE_OBJ_CLASS_SPEC {
 429  protected:
 430   MemNode*   _mem;     // My memory reference node
 431   SuperWord* _slp;     // SuperWord class
 432 
 433   Node* _base;         // NULL if unsafe nonheap reference
 434   Node* _adr;          // address pointer
 435   jint  _scale;        // multipler for iv (in bytes), 0 if no loop iv
 436   jint  _offset;       // constant offset (in bytes)
 437   Node* _invar;        // invariant offset (in bytes), NULL if none
 438   bool  _negate_invar; // if true then use: (0 - _invar)
 439 
 440   PhaseIdealLoop* phase() { return _slp->phase(); }
 441   IdealLoopTree*  lpt()   { return _slp->lpt(); }
 442   PhiNode*        iv()    { return _slp->iv();  } // Induction var
 443 
 444   bool invariant(Node* n) {
 445     Node *n_c = phase()->get_ctrl(n);
 446     return !lpt()->is_member(phase()->get_loop(n_c));
 447   }
 448 
 449   // Match: k*iv + offset
 450   bool scaled_iv_plus_offset(Node* n);
 451   // Match: k*iv where k is a constant that's not zero
 452   bool scaled_iv(Node* n);
 453   // Match: offset is (k [+/- invariant])
 454   bool offset_plus_k(Node* n, bool negate = false);
 455 




  24 #ifndef SHARE_VM_OPTO_SUPERWORD_HPP
  25 #define SHARE_VM_OPTO_SUPERWORD_HPP
  26 
  27 #include "opto/connode.hpp"
  28 #include "opto/loopnode.hpp"
  29 #include "opto/node.hpp"
  30 #include "opto/phaseX.hpp"
  31 #include "opto/vectornode.hpp"
  32 #include "utilities/growableArray.hpp"
  33 
  34 //
  35 //                  S U P E R W O R D   T R A N S F O R M
  36 //
  37 // SuperWords are short, fixed length vectors.
  38 //
  39 // Algorithm from:
  40 //
  41 // Exploiting SuperWord Level Parallelism with
  42 //   Multimedia Instruction Sets
  43 // by
  44 //   Samuel Larsen and Saman Amarasinghe
  45 //   MIT Laboratory for Computer Science
  46 // date
  47 //   May 2000
  48 // published in
  49 //   ACM SIGPLAN Notices
  50 //   Proceedings of ACM PLDI '00,  Volume 35 Issue 5
  51 //
  52 // Definition 3.1 A Pack is an n-tuple, <s1, ...,sn>, where
  53 // s1,...,sn are independent isomorphic statements in a basic
  54 // block.
  55 //
  56 // Definition 3.2 A PackSet is a set of Packs.
  57 //
  58 // Definition 3.3 A Pair is a Pack of size two, where the
  59 // first statement is considered the left element, and the
  60 // second statement is considered the right element.
  61 
  62 class SWPointer;
  63 class OrderedPair;
  64 


 415   void init();
 416 
 417   // print methods
 418   void print_packset();
 419   void print_pack(Node_List* p);
 420   void print_bb();
 421   void print_stmt(Node* s);
 422   char* blank(uint depth);
 423 };
 424 
 425 
 426 //------------------------------SWPointer---------------------------
 427 // Information about an address for dependence checking and vector alignment
 428 class SWPointer VALUE_OBJ_CLASS_SPEC {
 429  protected:
 430   MemNode*   _mem;     // My memory reference node
 431   SuperWord* _slp;     // SuperWord class
 432 
 433   Node* _base;         // NULL if unsafe nonheap reference
 434   Node* _adr;          // address pointer
 435   jint  _scale;        // multiplier for iv (in bytes), 0 if no loop iv
 436   jint  _offset;       // constant offset (in bytes)
 437   Node* _invar;        // invariant offset (in bytes), NULL if none
 438   bool  _negate_invar; // if true then use: (0 - _invar)
 439 
 440   PhaseIdealLoop* phase() { return _slp->phase(); }
 441   IdealLoopTree*  lpt()   { return _slp->lpt(); }
 442   PhiNode*        iv()    { return _slp->iv();  } // Induction var
 443 
 444   bool invariant(Node* n) {
 445     Node *n_c = phase()->get_ctrl(n);
 446     return !lpt()->is_member(phase()->get_loop(n_c));
 447   }
 448 
 449   // Match: k*iv + offset
 450   bool scaled_iv_plus_offset(Node* n);
 451   // Match: k*iv where k is a constant that's not zero
 452   bool scaled_iv(Node* n);
 453   // Match: offset is (k [+/- invariant])
 454   bool offset_plus_k(Node* n, bool negate = false);
 455 


< prev index next >