mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-22 03:54:33 +02:00
6603011: RFE: Optimize long division
Transform long division by constant into multiply Reviewed-by: never, kvn
This commit is contained in:
parent
bb7ccea4ff
commit
72313bcf20
7 changed files with 483 additions and 207 deletions
|
@ -364,6 +364,25 @@ const Type *MulDNode::mul_ring(const Type *t0, const Type *t1) const {
|
|||
return TypeD::make( t0->getd() * t1->getd() );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//------------------------------Value------------------------------------------
|
||||
const Type *MulHiLNode::Value( PhaseTransform *phase ) const {
|
||||
// Either input is TOP ==> the result is TOP
|
||||
const Type *t1 = phase->type( in(1) );
|
||||
const Type *t2 = phase->type( in(2) );
|
||||
if( t1 == Type::TOP ) return Type::TOP;
|
||||
if( t2 == Type::TOP ) return Type::TOP;
|
||||
|
||||
// Either input is BOTTOM ==> the result is the local BOTTOM
|
||||
const Type *bot = bottom_type();
|
||||
if( (t1 == bot) || (t2 == bot) ||
|
||||
(t1 == Type::BOTTOM) || (t2 == Type::BOTTOM) )
|
||||
return bot;
|
||||
|
||||
// It is not worth trying to constant fold this stuff!
|
||||
return TypeLong::LONG;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//------------------------------mul_ring---------------------------------------
|
||||
// Supplied function returns the product of the inputs IN THE CURRENT RING.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue