Request for reviews (L): 6823354: Add intrinsics for{Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}()
Vladimir Kozlov
Vladimir.Kozlov at Sun.COM
Tue May 5 08:38:48 PDT 2009
Christian Thalinger wrote:
>> x86_32.ad - Why you did not remove TEMP dst? Do you need it?
>>
>> + effect(TEMP dst
>
> I think I kept it because I'm not sure if one register of a long
> register pair can be the same as the dst register. Can it?
Yes, you are right, it is needed.
>
>> connode.cpp - new Ideal methods should be Value methods since
>> it is the value transformation and it misses checks for Top:
>>
>> const Type* CountLeadingZerosINode::Value( PhaseTransform *phase ) const {
>> const Type *t = phase->type( in(1) );
>> if( t == Type::TOP ) return Type::TOP;
>> const TypeInt *ti = t->isa_int();
>> if (ti && ti->is_con()) {
>
> I see. I'm currently trying to change that but I have some problems.
> Could you explain a little how Value() is supposed to work?
What problems do you have?
Look on, for example, ConvL2INode::Value(). And your code:
const Type* CountLeadingZerosINode::Value( PhaseTransform *phase ) const {
const Type *t = phase->type( in(1) );
if( t == Type::TOP ) return Type::TOP;
const TypeInt *ti = t->isa_int();
if (ti && ti->is_con()) {
jint i = ti->get_con();
// HD, Figure 5-6
if (i == 0)
return TypeInt::make(BitsPerInt);
jint n = 1;
unsigned int x = i;
if (x >> 16 == 0) { n += 16; x <<= 16; }
if (x >> 24 == 0) { n += 8; x <<= 8; }
if (x >> 28 == 0) { n += 4; x <<= 4; }
if (x >> 30 == 0) { n += 2; x <<= 2; }
n -= x >> 31;
return TypeInt::make(n);
}
return bottom_type();
}
Vladimir
More information about the hotspot-compiler-dev
mailing list