6805724: ModLNode::Ideal() generates functionally incorrect graph when divisor is any (2^k-1) constant

C2, ModLNode::Ideal() generates functionally incorrect graph when divisor is any (2^k-1) constant.

Reviewed-by: rasbold
This commit is contained in:
Christian Thalinger 2009-02-16 07:19:26 -08:00
parent a2ed00b650
commit dd25f39709
3 changed files with 89 additions and 1 deletions

View file

@ -907,6 +907,14 @@ inline int exact_log2(intptr_t x) {
return log2_intptr(x);
}
//* the argument must be exactly a power of 2
inline int exact_log2_long(jlong x) {
#ifdef ASSERT
if (!is_power_of_2_long(x)) basic_fatal("x must be a power of 2");
#endif
return log2_long(x);
}
// returns integer round-up to the nearest multiple of s (s must be a power of two)
inline intptr_t round_to(intptr_t x, uintx s) {