Integrated: 8265917: Different values computed by C2 and interpreter/C1 for Math.pow(x, 2.0) on x86_32

Jie Fu jiefu at openjdk.java.net
Wed Apr 28 03:14:55 UTC 2021


On Sun, 25 Apr 2021 11:39:43 GMT, Jie Fu <jiefu at openjdk.org> wrote:

> Hi all,
> 
> C2 may produce different results for Math.pow(x, 2.0) compared with interpreter/C1 on x86_32.
> 
> E.g., for Math.pow(1.0 / 2047, 2.0):
> 
> interpreter: 2.38651580386563E-7 
>          C2: 2.3865158038656307E-7
> 
> 
> The reason is that C2 will replace Math.pow(x, 2.0) with x*x.
> However, there is no such optimization for interpreter/C1 on x86_32.
> 
> The fix just disables C2's opt for Math.pow(x, 2.0) on x86_32 since nobody (or very few people) would run x86_32.
> And we don't have a plan to implement such opt on x86_32.
> 
> Another reason to fix this bug is that we need this patch to extend C2's opt for Math.pow(x, 0.5) on other platforms.
> 
> Thanks.
> Best regards,
> Jie

This pull request has now been integrated.

Changeset: 889d2466
Author:    Jie Fu <jiefu at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/889d246681e937af1fa8d97f683c49043ddf2eda
Stats:     66 lines in 2 files changed: 66 ins; 0 del; 0 mod

8265917: Different values computed by C2 and interpreter/C1 for Math.pow(x, 2.0) on x86_32

Reviewed-by: kvn, thartmann

-------------

PR: https://git.openjdk.java.net/jdk/pull/3677


More information about the hotspot-compiler-dev mailing list