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

src/share/vm/opto/mulnode.cpp

Print this page
rev 10222 : 8149745: C2 should optimize long accumulations in a counted loop
summary: Look for parallel iv for long adds
Reviewed-by:


 153     const Type *zero = add_id();        // The multiplicative zero
 154     if( t1->higher_equal( zero ) ) return zero;
 155     if( t2->higher_equal( zero ) ) return zero;
 156   }
 157 
 158   // Either input is BOTTOM ==> the result is the local BOTTOM
 159   if( t1 == Type::BOTTOM || t2 == Type::BOTTOM )
 160     return bottom_type();
 161 
 162 #if defined(IA32)
 163   // Can't trust native compilers to properly fold strict double
 164   // multiplication with round-to-zero on this platform.
 165   if (op == Op_MulD && phase->C->method()->is_strict()) {
 166     return TypeD::DOUBLE;
 167   }
 168 #endif
 169 
 170   return mul_ring(t1,t2);            // Local flavor of type multiplication
 171 }
 172 










 173 
 174 //=============================================================================
 175 //------------------------------Ideal------------------------------------------
 176 // Check for power-of-2 multiply, then try the regular MulNode::Ideal
 177 Node *MulINode::Ideal(PhaseGVN *phase, bool can_reshape) {
 178   // Swap constant to right
 179   jint con;
 180   if ((con = in(1)->find_int_con(0)) != 0) {
 181     swap_edges(1, 2);
 182     // Finish rest of method to use info in 'con'
 183   } else if ((con = in(2)->find_int_con(0)) == 0) {
 184     return MulNode::Ideal(phase, can_reshape);
 185   }
 186 
 187   // Now we have a constant Node on the right and the constant in con
 188   if( con == 0 ) return NULL;   // By zero is handled by Value call
 189   if( con == 1 ) return NULL;   // By one  is handled by Identity call
 190 
 191   // Check for negative constant; if so negate the final result
 192   bool sign_flip = false;




 153     const Type *zero = add_id();        // The multiplicative zero
 154     if( t1->higher_equal( zero ) ) return zero;
 155     if( t2->higher_equal( zero ) ) return zero;
 156   }
 157 
 158   // Either input is BOTTOM ==> the result is the local BOTTOM
 159   if( t1 == Type::BOTTOM || t2 == Type::BOTTOM )
 160     return bottom_type();
 161 
 162 #if defined(IA32)
 163   // Can't trust native compilers to properly fold strict double
 164   // multiplication with round-to-zero on this platform.
 165   if (op == Op_MulD && phase->C->method()->is_strict()) {
 166     return TypeD::DOUBLE;
 167   }
 168 #endif
 169 
 170   return mul_ring(t1,t2);            // Local flavor of type multiplication
 171 }
 172 
 173 MulNode* MulNode::make(BasicType bt, Node *in1, Node *in2) {
 174   switch(bt) {
 175   case T_INT:         return new MulINode(in1, in2);
 176   case T_LONG:        return new MulLNode(in1, in2);
 177   case T_FLOAT:       return new MulFNode(in1, in2);
 178   case T_DOUBLE:      return new MulDNode(in1, in2);
 179   }
 180   fatal("Bad basic type %s", type2name(bt));
 181   return NULL;
 182 }
 183 
 184 //=============================================================================
 185 //------------------------------Ideal------------------------------------------
 186 // Check for power-of-2 multiply, then try the regular MulNode::Ideal
 187 Node *MulINode::Ideal(PhaseGVN *phase, bool can_reshape) {
 188   // Swap constant to right
 189   jint con;
 190   if ((con = in(1)->find_int_con(0)) != 0) {
 191     swap_edges(1, 2);
 192     // Finish rest of method to use info in 'con'
 193   } else if ((con = in(2)->find_int_con(0)) == 0) {
 194     return MulNode::Ideal(phase, can_reshape);
 195   }
 196 
 197   // Now we have a constant Node on the right and the constant in con
 198   if( con == 0 ) return NULL;   // By zero is handled by Value call
 199   if( con == 1 ) return NULL;   // By one  is handled by Identity call
 200 
 201   // Check for negative constant; if so negate the final result
 202   bool sign_flip = false;


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