Mercurial > hg > graal-jvmci-8
diff 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 |
line wrap: on
line diff
--- a/src/share/vm/opto/mulnode.cpp Tue Apr 29 19:45:22 2008 -0700 +++ b/src/share/vm/opto/mulnode.cpp Wed May 07 08:06:46 2008 -0700 @@ -365,6 +365,25 @@ } //============================================================================= +//------------------------------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. // For the logical operations the ring's MUL is really a logical AND function.