JDK-8276673 : Optimize abs operations in C2 compiler
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 17,18
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2021-11-05
  • Updated: 2024-04-05
  • Resolved: 2022-01-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 19
19 b06Fixed
Related Reports
Relates :  
Relates :  
Description
In current SLP, the vectorization of Math.abs() with char type is intentionally disabled after JDK-8261022 because it generates incorrect result before.

But in Java semantics, as the char type is always non-negative, we could actually translate Math.abs(char) to a no-op by adding a no-op IR and matching rules somehow.

We can consider re-enable Math.abs() vectorization with char type.
Comments
For the record, this change seems to significantly improve Renaissance scala-kmeans at least on AArch64.
05-04-2024

Changeset: c6196662 Author: Fei Gao <fgao@openjdk.org> Committer: Jie Fu <jiefu@openjdk.org> Date: 2022-01-17 02:16:45 +0000 URL: https://git.openjdk.java.net/jdk/commit/c6196662b8a15276916badd333291057980a6552
17-01-2022