JDK-8282541 : AArch64: Auto-vectorize Math.round API
Type:Enhancement
Component:hotspot
Sub-Component:compiler
Affected Version:19
Priority:P4
Status:Resolved
Resolution:Fixed
OS:generic
CPU:aarch64
Submitted:2022-03-02
Updated:2022-04-26
Resolved:2022-04-26
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.
A pull request was submitted for review.
URL: https://git.openjdk.java.net/jdk/pull/8204
Date: 2022-04-12 13:26:02 +0000
12-04-2022
I don't think it will pay off to auto-vectorize Math.round() on AArch64 using same technique as JDK-8279508. This calculates floor() by changing the FPU rounding mode to roundTowardNegative, adding 0.5, converting to two's complement integer, then changing the rounding mode back to default. However, I've tried some AArch64 implementations and the cost of a floating-point rounding mode change is too high to make this technique economical: it can take substantially longer than the round() operation. In one case it can take ten times as long.
However, while doing this work I have discovered a nice short sequence for the scalar floor() operation. Paradoxically however, this makes the vectorized round() operation even less attractive. It may be possible to make a vectorized version of that; I'm looking at it.