src/share/vm/opto/superword.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6340864 Sdiff src/share/vm/opto

src/share/vm/opto/superword.cpp

Print this page




1383 // Create a vector operand for the nodes in pack p for operand: in(opd_idx)
1384 Node* SuperWord::vector_opd(Node_List* p, int opd_idx) {
1385   Node* p0 = p->at(0);
1386   uint vlen = p->size();
1387   Node* opd = p0->in(opd_idx);
1388 
1389   bool same_opd = true;
1390   for (uint i = 1; i < vlen; i++) {
1391     Node* pi = p->at(i);
1392     Node* in = pi->in(opd_idx);
1393     if (opd != in) {
1394       same_opd = false;
1395       break;
1396     }
1397   }
1398 
1399   if (same_opd) {
1400     if (opd->is_Vector() || opd->is_LoadVector()) {
1401       return opd; // input is matching vector
1402     }












1403     assert(!opd->is_StoreVector(), "such vector is not expected here");
1404     // Convert scalar input to vector with the same number of elements as
1405     // p0's vector. Use p0's type because size of operand's container in
1406     // vector should match p0's size regardless operand's size.
1407     const Type* p0_t = velt_type(p0);
1408     VectorNode* vn = VectorNode::scalar2vector(_phase->C, opd, vlen, p0_t);
1409 
1410     _phase->_igvn.register_new_node_with_optimizer(vn);
1411     _phase->set_ctrl(vn, _phase->get_ctrl(opd));
1412 #ifdef ASSERT
1413     if (TraceNewVectors) {
1414       tty->print("new Vector node: ");
1415       vn->dump();
1416     }
1417 #endif
1418     return vn;
1419   }
1420 
1421   // Insert pack operation
1422   BasicType bt = velt_basic_type(p0);


1701 // Example:  char a,b,c;  a = b + c;
1702 // Normally the type of the add is integer, but for packed character
1703 // operations the type of the add needs to be char.
1704 void SuperWord::compute_vector_element_type() {
1705 #ifndef PRODUCT
1706   if (TraceSuperWord && Verbose)
1707     tty->print_cr("\ncompute_velt_type:");
1708 #endif
1709 
1710   // Initial type
1711   for (int i = 0; i < _block.length(); i++) {
1712     Node* n = _block.at(i);
1713     set_velt_type(n, container_type(n));
1714   }
1715 
1716   // Propagate narrowed type backwards through operations
1717   // that don't depend on higher order bits
1718   for (int i = _block.length() - 1; i >= 0; i--) {
1719     Node* n = _block.at(i);
1720     // Only integer types need be examined
1721     if (n->bottom_type()->isa_int()) {

1722       uint start, end;
1723       vector_opd_range(n, &start, &end);
1724       const Type* vt = velt_type(n);
1725 
1726       for (uint j = start; j < end; j++) {
1727         Node* in  = n->in(j);
1728         // Don't propagate through a type conversion
1729         if (n->bottom_type() != in->bottom_type())
1730           continue;
1731         switch(in->Opcode()) {
1732         case Op_AddI:    case Op_AddL:
1733         case Op_SubI:    case Op_SubL:
1734         case Op_MulI:    case Op_MulL:
1735         case Op_AndI:    case Op_AndL:
1736         case Op_OrI:     case Op_OrL:
1737         case Op_XorI:    case Op_XorL:
1738         case Op_LShiftI: case Op_LShiftL:
1739         case Op_CMoveI:  case Op_CMoveL:
1740           if (in_bb(in)) {
1741             bool same_type = true;
1742             for (DUIterator_Fast kmax, k = in->fast_outs(kmax); k < kmax; k++) {
1743               Node *use = in->fast_out(k);
1744               if (!in_bb(use) || !same_velt_type(use, n)) {
1745                 same_type = false;
1746                 break;
1747               }
1748             }
1749             if (same_type) {
1750               set_velt_type(in, vt);
1751             }
1752           }
1753         }
1754       }
1755     }
1756   }
1757 #ifndef PRODUCT
1758   if (TraceSuperWord && Verbose) {
1759     for (int i = 0; i < _block.length(); i++) {
1760       Node* n = _block.at(i);
1761       velt_type(n)->dump();
1762       tty->print("\t");
1763       n->dump();
1764     }
1765   }
1766 #endif
1767 }
1768 
1769 //------------------------------memory_alignment---------------------------
1770 // Alignment within a vector memory reference
1771 int SuperWord::memory_alignment(MemNode* s, int iv_adjust_in_bytes) {
1772   SWPointer p(s, this);
1773   if (!p.valid()) {




1383 // Create a vector operand for the nodes in pack p for operand: in(opd_idx)
1384 Node* SuperWord::vector_opd(Node_List* p, int opd_idx) {
1385   Node* p0 = p->at(0);
1386   uint vlen = p->size();
1387   Node* opd = p0->in(opd_idx);
1388 
1389   bool same_opd = true;
1390   for (uint i = 1; i < vlen; i++) {
1391     Node* pi = p->at(i);
1392     Node* in = pi->in(opd_idx);
1393     if (opd != in) {
1394       same_opd = false;
1395       break;
1396     }
1397   }
1398 
1399   if (same_opd) {
1400     if (opd->is_Vector() || opd->is_LoadVector()) {
1401       return opd; // input is matching vector
1402     }
1403     if (!VectorNode::needs_vector_input(p0, opd_idx)) {
1404       // no vector is needed (shifts count)
1405       if (!opd->is_Con()) {
1406         assert(opd->bottom_type()->isa_int(), "int type only");
1407         // Move int value to xmm register
1408         Node* in = new (_phase->C, 2) MoveI2FNode(opd);
1409         _phase->_igvn.register_new_node_with_optimizer(in);
1410         _phase->set_ctrl(in, _phase->get_ctrl(opd));
1411         opd = in;
1412       }
1413       return opd;
1414     }
1415     assert(!opd->is_StoreVector(), "such vector is not expected here");
1416     // Convert scalar input to vector with the same number of elements as
1417     // p0's vector. Use p0's type because size of operand's container in
1418     // vector should match p0's size regardless operand's size.
1419     const Type* p0_t = velt_type(p0);
1420     VectorNode* vn = VectorNode::scalar2vector(_phase->C, opd, vlen, p0_t);
1421 
1422     _phase->_igvn.register_new_node_with_optimizer(vn);
1423     _phase->set_ctrl(vn, _phase->get_ctrl(opd));
1424 #ifdef ASSERT
1425     if (TraceNewVectors) {
1426       tty->print("new Vector node: ");
1427       vn->dump();
1428     }
1429 #endif
1430     return vn;
1431   }
1432 
1433   // Insert pack operation
1434   BasicType bt = velt_basic_type(p0);


1713 // Example:  char a,b,c;  a = b + c;
1714 // Normally the type of the add is integer, but for packed character
1715 // operations the type of the add needs to be char.
1716 void SuperWord::compute_vector_element_type() {
1717 #ifndef PRODUCT
1718   if (TraceSuperWord && Verbose)
1719     tty->print_cr("\ncompute_velt_type:");
1720 #endif
1721 
1722   // Initial type
1723   for (int i = 0; i < _block.length(); i++) {
1724     Node* n = _block.at(i);
1725     set_velt_type(n, container_type(n));
1726   }
1727 
1728   // Propagate narrowed type backwards through operations
1729   // that don't depend on higher order bits
1730   for (int i = _block.length() - 1; i >= 0; i--) {
1731     Node* n = _block.at(i);
1732     // Only integer types need be examined
1733     const Type* vt = velt_type(n);
1734     if (vt->basic_type() == T_INT) {
1735       uint start, end;
1736       vector_opd_range(n, &start, &end);
1737       const Type* vt = velt_type(n);
1738 
1739       for (uint j = start; j < end; j++) {
1740         Node* in  = n->in(j);
1741         // Don't propagate through a type conversion
1742         if (in_bb(in) && velt_type(in)->basic_type() == T_INT) {











1743           bool same_type = true;
1744           for (DUIterator_Fast kmax, k = in->fast_outs(kmax); k < kmax; k++) {
1745             Node *use = in->fast_out(k);
1746             if (!in_bb(use) || !same_velt_type(use, n)) {
1747               same_type = false;
1748               break;
1749             }
1750           }
1751           if (same_type) {
1752             set_velt_type(in, vt);
1753           }
1754         }

1755       }
1756     }
1757   }
1758 #ifndef PRODUCT
1759   if (TraceSuperWord && Verbose) {
1760     for (int i = 0; i < _block.length(); i++) {
1761       Node* n = _block.at(i);
1762       velt_type(n)->dump();
1763       tty->print("\t");
1764       n->dump();
1765     }
1766   }
1767 #endif
1768 }
1769 
1770 //------------------------------memory_alignment---------------------------
1771 // Alignment within a vector memory reference
1772 int SuperWord::memory_alignment(MemNode* s, int iv_adjust_in_bytes) {
1773   SWPointer p(s, this);
1774   if (!p.valid()) {


src/share/vm/opto/superword.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File