src/share/vm/opto/addnode.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/opto

src/share/vm/opto/addnode.cpp

Print this page
rev 10168 : 8003585: strength reduce or eliminate range checks for power-of-two sized arrays
Summary: change ((x & m) u<= m) to always true and ((x & (m - 1)) u< m) into (m > 0)
Reviewed-by: kvn, roland
rev 10222 : 8149745: C2 should optimize long accumulations in a counted loop
summary: Look for parallel iv for long adds
Reviewed-by:


 217       (t1 == Type::BOTTOM) || (t2 == Type::BOTTOM) )
 218     return bot;
 219 
 220   // Check for an addition involving the additive identity
 221   const Type *tadd = add_of_identity( t1, t2 );
 222   if( tadd ) return tadd;
 223 
 224   return add_ring(t1,t2);               // Local flavor of type addition
 225 }
 226 
 227 //------------------------------add_identity-----------------------------------
 228 // Check for addition of the identity
 229 const Type *AddNode::add_of_identity( const Type *t1, const Type *t2 ) const {
 230   const Type *zero = add_id();  // The additive identity
 231   if( t1->higher_equal( zero ) ) return t2;
 232   if( t2->higher_equal( zero ) ) return t1;
 233 
 234   return NULL;
 235 }
 236 










 237 
 238 //=============================================================================
 239 //------------------------------Idealize---------------------------------------
 240 Node *AddINode::Ideal(PhaseGVN *phase, bool can_reshape) {
 241   Node* in1 = in(1);
 242   Node* in2 = in(2);
 243   int op1 = in1->Opcode();
 244   int op2 = in2->Opcode();
 245   // Fold (con1-x)+con2 into (con1+con2)-x
 246   if ( op1 == Op_AddI && op2 == Op_SubI ) {
 247     // Swap edges to try optimizations below
 248     in1 = in2;
 249     in2 = in(1);
 250     op1 = op2;
 251     op2 = in2->Opcode();
 252   }
 253   if( op1 == Op_SubI ) {
 254     const Type *t_sub1 = phase->type( in1->in(1) );
 255     const Type *t_2    = phase->type( in2        );
 256     if( t_sub1->singleton() && t_2->singleton() && t_sub1 != Type::TOP && t_2 != Type::TOP )




 217       (t1 == Type::BOTTOM) || (t2 == Type::BOTTOM) )
 218     return bot;
 219 
 220   // Check for an addition involving the additive identity
 221   const Type *tadd = add_of_identity( t1, t2 );
 222   if( tadd ) return tadd;
 223 
 224   return add_ring(t1,t2);               // Local flavor of type addition
 225 }
 226 
 227 //------------------------------add_identity-----------------------------------
 228 // Check for addition of the identity
 229 const Type *AddNode::add_of_identity( const Type *t1, const Type *t2 ) const {
 230   const Type *zero = add_id();  // The additive identity
 231   if( t1->higher_equal( zero ) ) return t2;
 232   if( t2->higher_equal( zero ) ) return t1;
 233 
 234   return NULL;
 235 }
 236 
 237 AddNode* AddNode::make(BasicType bt, Node *in1, Node *in2) {
 238   switch(bt) {
 239   case T_INT:         return new AddINode(in1, in2);
 240   case T_LONG:        return new AddLNode(in1, in2);
 241   case T_FLOAT:       return new AddFNode(in1, in2);
 242   case T_DOUBLE:      return new AddDNode(in1, in2);
 243   }
 244   fatal("Bad basic type %s", type2name(bt));
 245   return NULL;
 246 }
 247 
 248 //=============================================================================
 249 //------------------------------Idealize---------------------------------------
 250 Node *AddINode::Ideal(PhaseGVN *phase, bool can_reshape) {
 251   Node* in1 = in(1);
 252   Node* in2 = in(2);
 253   int op1 = in1->Opcode();
 254   int op2 = in2->Opcode();
 255   // Fold (con1-x)+con2 into (con1+con2)-x
 256   if ( op1 == Op_AddI && op2 == Op_SubI ) {
 257     // Swap edges to try optimizations below
 258     in1 = in2;
 259     in2 = in(1);
 260     op1 = op2;
 261     op2 = in2->Opcode();
 262   }
 263   if( op1 == Op_SubI ) {
 264     const Type *t_sub1 = phase->type( in1->in(1) );
 265     const Type *t_2    = phase->type( in2        );
 266     if( t_sub1->singleton() && t_2->singleton() && t_sub1 != Type::TOP && t_2 != Type::TOP )


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