comparison src/share/vm/opto/mulnode.cpp @ 145:f3de1255b035

6603011: RFE: Optimize long division Summary: Transform long division by constant into multiply Reviewed-by: never, kvn
author rasbold
date Wed, 07 May 2008 08:06:46 -0700
parents a61af66fc99e
children d1605aabd0a1
comparison
equal deleted inserted replaced
132:60b728ec77c1 145:f3de1255b035
363 // We must be adding 2 double constants. 363 // We must be adding 2 double constants.
364 return TypeD::make( t0->getd() * t1->getd() ); 364 return TypeD::make( t0->getd() * t1->getd() );
365 } 365 }
366 366
367 //============================================================================= 367 //=============================================================================
368 //------------------------------Value------------------------------------------
369 const Type *MulHiLNode::Value( PhaseTransform *phase ) const {
370 // Either input is TOP ==> the result is TOP
371 const Type *t1 = phase->type( in(1) );
372 const Type *t2 = phase->type( in(2) );
373 if( t1 == Type::TOP ) return Type::TOP;
374 if( t2 == Type::TOP ) return Type::TOP;
375
376 // Either input is BOTTOM ==> the result is the local BOTTOM
377 const Type *bot = bottom_type();
378 if( (t1 == bot) || (t2 == bot) ||
379 (t1 == Type::BOTTOM) || (t2 == Type::BOTTOM) )
380 return bot;
381
382 // It is not worth trying to constant fold this stuff!
383 return TypeLong::LONG;
384 }
385
386 //=============================================================================
368 //------------------------------mul_ring--------------------------------------- 387 //------------------------------mul_ring---------------------------------------
369 // Supplied function returns the product of the inputs IN THE CURRENT RING. 388 // Supplied function returns the product of the inputs IN THE CURRENT RING.
370 // For the logical operations the ring's MUL is really a logical AND function. 389 // For the logical operations the ring's MUL is really a logical AND function.
371 // This also type-checks the inputs for sanity. Guaranteed never to 390 // This also type-checks the inputs for sanity. Guaranteed never to
372 // be passed a TOP or BOTTOM type, these are filtered out by pre-check. 391 // be passed a TOP or BOTTOM type, these are filtered out by pre-check.