< prev index next >

src/hotspot/share/opto/subnode.cpp

Print this page
rev 47825 : Support vectorization of sqrt for float


1578   for( DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++ ) {
1579     Node* use = fast_out(i);
1580     if (use->is_CountedLoopEnd()) {
1581       return true;
1582     }
1583   }
1584   return false;
1585 }
1586 
1587 //=============================================================================
1588 //------------------------------Value------------------------------------------
1589 // Compute sqrt
1590 const Type* SqrtDNode::Value(PhaseGVN* phase) const {
1591   const Type *t1 = phase->type( in(1) );
1592   if( t1 == Type::TOP ) return Type::TOP;
1593   if( t1->base() != Type::DoubleCon ) return Type::DOUBLE;
1594   double d = t1->getd();
1595   if( d < 0.0 ) return Type::DOUBLE;
1596   return TypeD::make( sqrt( d ) );
1597 }











1578   for( DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++ ) {
1579     Node* use = fast_out(i);
1580     if (use->is_CountedLoopEnd()) {
1581       return true;
1582     }
1583   }
1584   return false;
1585 }
1586 
1587 //=============================================================================
1588 //------------------------------Value------------------------------------------
1589 // Compute sqrt
1590 const Type* SqrtDNode::Value(PhaseGVN* phase) const {
1591   const Type *t1 = phase->type( in(1) );
1592   if( t1 == Type::TOP ) return Type::TOP;
1593   if( t1->base() != Type::DoubleCon ) return Type::DOUBLE;
1594   double d = t1->getd();
1595   if( d < 0.0 ) return Type::DOUBLE;
1596   return TypeD::make( sqrt( d ) );
1597 }
1598 
1599 const Type* SqrtFNode::Value(PhaseGVN* phase) const {
1600   const Type *t1 = phase->type( in(1) );
1601   if( t1 == Type::TOP ) return Type::TOP;
1602   if( t1->base() != Type::FloatCon ) return Type::FLOAT;
1603   float f = t1->getf();
1604   if( f < 0.0f ) return Type::FLOAT;
1605   return TypeF::make( (float)sqrt( (double)f ) );
1606 }
< prev index next >