JDK-8273058 : [macos]UnsignedMultiplyHigh is not implemented as an intrinsic
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 18
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: os_x
  • CPU: x86_64
  • Submitted: 2021-08-26
  • Updated: 2022-05-24
  • Resolved: 2022-05-24
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 18
18Resolved
Related Reports
Duplicate :  
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
JDK 18 build 11 
macOS 10.14.6
Intel Core i7

A DESCRIPTION OF THE PROBLEM :
Computing the upper 64 bits can be easily computed in java with multiplies, adds and shifts on long data. However it cannot be done nearly as efficiently as what the underlying CPUs can do. x64 and ARM cpus can compute the high 64 bits in the same amount of time it takes to calculate the lower 64 bits of a 128 bit product. 

Math.unsignedMultiplyHigh is primarily needed for performance reasons. However in the current version of JDK 18 Math.unsignedMultiplyHigh performs poorly. It should have performance that is comparable to its signed version Math.multiplyHigh.

Using JMH the time to execute is
09     regular 64 bit multiply
13     Math.multiplyHigh
22     Math.unsignedMultiplyHigh

Running with -XX:+UnlockDiagnosticVMOptions -XX:+PrintIntrinsics only the following is reported (no intrinsic for unsignedMultipleHigh).
       java.lang.Math::multiplyHigh (86 bytes)   (intrinsic)


Note: Bug (JDK-8188044) shows that this was supposed to be fixed and delivered in JDK 18 build 5 and is now closed. This was tested on JDK18 build 11



Comments
The issue has been addresses and solved in JDK-8275167
23-05-2022

Moved to JDK to get further evaluations.
27-08-2021