x86 Intrinsics for fma in Math Library

Andrew Haley aph at redhat.com
Thu Jul 21 10:01:52 UTC 2016

On 20/07/16 21:08, Vladimir Kozlov wrote:
> The only thing is worrying me is a constant folding (when all arguments 
> are constants) in C2 which uses libm fma() method (in subnode.cpp):
> return TypeD::make(fma(d1, d2, d3));
> It may produce different result than vfmadd231sd instruction so I would 
> like to remove this optimization (leave only TOP checks).

This would be a shame.  We could leave the optimization in,
but guard it with

#ifdef __STDC_IEC_559__

That would guarantee that fma() is compliant with IEC 559, and the
C language specification says:

F.9.10.1 The fma functions

- fma(x, y, z) computes xy + z, correctly rounded once.


More information about the hotspot-compiler-dev mailing list