RFR: 8353686: Optimize Math.cbrt for x86 64 bit platforms

Mohamed Issa duke at openjdk.org
Fri Apr 25 20:14:25 UTC 2025


The goal of this PR is to implement an x86_64 intrinsic for java.lang.Math.cbrt() using libm.

The results of all tests posted below were captured with an [Intel® Xeon 6761P](https://www.intel.com/content/www/us/en/products/sku/241842/intel-xeon-6761p-processor-336m-cache-2-50-ghz/specifications.html) using [OpenJDK v25-b15](https://github.com/openjdk/jdk/releases/tag/jdk-25%2B15) as the baseline version.

For performance data collected with the built in **cbrt** micro-benchmark, see the table below. Each result is the mean of 8 individual runs. Overall, the intrinsic provides a performance uplift of 41%.

| Benchmark        | Throughput with baseline (op/s) | Throughput with intrinsic (op/s) | Speedup |
| :----------------: | :----------------------------------: | :----------------------------------: | :---------: |
| MathBench.cbrt | 148242                                        | 209122                                        | 1.41x       |

Finally, the `jtreg:test/jdk/java/lang/Math/CubeRootTests.java` test passed with the changes.

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

Commit messages:
 - Change coeff_table alignment from 4 bytes to 16 bytes to conform with movapd instruction
 - Merge branch 'master' into user/missa-prime/cbrt
 - x86_64 intrinsic for cbrt using libm

Changes: https://git.openjdk.org/jdk/pull/24470/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24470&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8353686
  Stats: 466 lines in 26 files changed: 453 ins; 1 del; 12 mod
  Patch: https://git.openjdk.org/jdk/pull/24470.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24470/head:pull/24470

PR: https://git.openjdk.org/jdk/pull/24470


More information about the hotspot-dev mailing list