x86 Intrinsics for fma in Math Library

Deshpande, Vivek R vivek.r.deshpande at intel.com
Mon Aug 15 20:29:32 UTC 2016


Hi All

I have updated the patch with suggested changes.
Please find the webrevs at this location:
http://cr.openjdk.java.net/~vdeshpande/FMA/8154122/hotspot/webrev.01/
and
http://cr.openjdk.java.net/~vdeshpande/FMA/8154122/jdk/webrev.01/

Regards,
Vivek

-----Original Message-----
From: Andrew Haley [mailto:aph at redhat.com] 
Sent: Wednesday, August 03, 2016 3:03 PM
To: Deshpande, Vivek R; Vladimir Kozlov; hotspot-compiler-dev at openjdk.java.net
Subject: Re: x86 Intrinsics for fma in Math Library

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