x86 Intrinsics for fma in Math Library
Andrew Haley
aph at redhat.com
Wed Aug 3 22:02:37 UTC 2016
On 03/08/16 22:37, Deshpande, Vivek R wrote:
> I can do that along with rest of the suggested changes in the patch.
> Could you please also give me some more information on using #ifdef __STDC_IEC_559__
Maybe do this:
//------------------------------Value------------------------------------------
const Type* FmaDNode::Value(PhaseGVN* phase) const {
#ifndef __STDC_IEC_559__
return Type::DOUBLE;
#else
const Type *t1 = phase->type(in(1));
if (t1 == Type::TOP) return Type::TOP;
if (t1->base() != Type::DoubleCon) return Type::DOUBLE;
const Type *t2 = phase->type(in(2));
if (t2 == Type::TOP) return Type::TOP;
if (t2->base() != Type::DoubleCon) return Type::DOUBLE;
const Type *t3 = phase->type(in(3));
if (t3 == Type::TOP) return Type::TOP;
if (t3->base() != Type::DoubleCon) return Type::DOUBLE;
double d1 = t1->getd();
double d2 = t2->getd();
double d3 = t3->getd();
return TypeD::make(fma(d1, d2, d3));
#endif
}
Perhaps this is too simple, and you should return TOP if any of the
operands are of type TOP; I'm not sure.
But the point is that if __STDC_IEC_559__ is defined, then you are
guaranteed that the libm fma() is the same as Java fma().
Andrew.
More information about the hotspot-compiler-dev
mailing list