Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recognize @IntrinsicCandidate java.lang.Math.multiplyHigh #17861

Merged
merged 1 commit into from Aug 31, 2023

Conversation

jmesyou
Copy link
Contributor

@jmesyou jmesyou commented Jul 26, 2023

java.lang.Math.multiplyHigh has been an intrinsic candidate in the Java class library since JDK17. There is a single opcode which implements the functionality of multiplyHigh. This provides an opportunity to simplify calls to multiplyHigh much like other Math methods (abs, min, max, etc).

This commit adds the following:

  • The recognition of java.lang.Math.multiplyHigh as a recognized method.
  • The replacement of calls to java.lang.Math.multiplyHigh with a single lmulh node as part of RecognizedCallTransformer

Copy link
Contributor

@jdmpapin jdmpapin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were you able to observe the transformation occurring? I think both of the below two problems would independently prevent it

runtime/compiler/env/j9method.cpp Outdated Show resolved Hide resolved
@jmesyou
Copy link
Contributor Author

jmesyou commented Jul 26, 2023

You are right, I was wondering why I didn't see this transform happening after I opened the PR and was about to mark this WIP. I'll push the changes to enable them.

@jmesyou jmesyou requested a review from jdmpapin July 26, 2023 22:29
@jmesyou
Copy link
Contributor Author

jmesyou commented Jul 26, 2023

I can confirm the transformation happens now!

@jmesyou
Copy link
Contributor Author

jmesyou commented Aug 1, 2023

Waiting on #17892

java.lang.Math.multiplyHigh has been an intrinsic candidate
in the Java class library since JDK17. There is a single
opcode which implements the functionality of multiplyHigh.
This provides an opportunity to simplify calls to multiplyHigh
much like other Math methods (abs, min, max, etc).

This commit adds the following:

+ The recognition of java.lang.Math.multiplyHigh as a
recognized method.
+ The replacement of calls to java.lang.Math.multiplyHigh
with a single lmulh node as part of RecognizedCallTransformer

Signed-off-by: James You <james.you@protonmail.com>
@jmesyou
Copy link
Contributor Author

jmesyou commented Aug 30, 2023

@jdmpapin , ready for another pass!

@jdmpapin
Copy link
Contributor

Jenkins test sanity all jdk21

@jdmpapin jdmpapin merged commit 022a2a4 into eclipse-openj9:master Aug 31, 2023
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants