Skip to content

8309636: C2: Optimize ModD to ModL when operands are integral numbers#30474

Open
krk wants to merge 1 commit intoopenjdk:masterfrom
krk:opt-drem-8309636
Open

8309636: C2: Optimize ModD to ModL when operands are integral numbers#30474
krk wants to merge 1 commit intoopenjdk:masterfrom
krk:opt-drem-8309636

Conversation

@krk
Copy link
Copy Markdown

@krk krk commented Mar 27, 2026

drem calls fmod (slow) even when both operands are integer-valued doubles, which is common for values derived from int/long conversions.

When the divisor is a constant integer-valued double, replace drem with ModL. If the dividend is provably integral, the replacement is unconditional. Otherwise, a speculative guard checks integrality at runtime and falls back to fmod.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8309636: C2: Optimize ModD to ModL when operands are integral numbers (Enhancement - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/30474/head:pull/30474
$ git checkout pull/30474

Update a local copy of the PR:
$ git checkout pull/30474
$ git pull https://git.openjdk.org/jdk.git pull/30474/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 30474

View PR using the GUI difftool:
$ git pr show -t 30474

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/30474.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper bot commented Mar 27, 2026

👋 Welcome back krk! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link
Copy Markdown

openjdk bot commented Mar 27, 2026

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added the hotspot-compiler hotspot-compiler-dev@openjdk.org label Mar 27, 2026
@openjdk
Copy link
Copy Markdown

openjdk bot commented Mar 27, 2026

@krk The following label will be automatically applied to this pull request:

  • hotspot-compiler

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the rfr Pull request is ready for review label Mar 27, 2026
@mlbridge
Copy link
Copy Markdown

mlbridge bot commented Mar 27, 2026

Webrevs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot-compiler hotspot-compiler-dev@openjdk.org rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

1 participant