x86 Intrinsics for fma in Math Library

Vladimir Kozlov vladimir.kozlov at oracle.com
Thu Jul 21 17:18:04 UTC 2016

Good suggestion. Need a test to confirm "correct" results matching result of assembler instruction.


On 7/21/16 3:01 AM, Andrew Haley wrote:
> 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.
> Andrew.

More information about the hotspot-compiler-dev mailing list