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

8346235: RISC-V: Optimize bitwise AND with mask values #22752

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

RealFYang
Copy link
Member

@RealFYang RealFYang commented Dec 15, 2024

Hi, please review this small optimization and cleanup change.

This optimizes bitwise AND with immediate mask values like 0xFFFF and 0xFFFFFFFF. Currently, we do andi for these cases emitting 3 or 4 instructions repectively. These are effectively zero extensions and could be reduced to 1 or 2 instructions repectively depending on whether Zba and Zbb extensions are available.

This also renames existing assembler routines zero_extend/sign_extend to zext/sext. This will be more consistent with mnemonic names like sext.h and zext.h for zero/sign extension as specified by the RISC-V bit-manipulation spec. The various callsites look better to me after the renaming as the old names are much longer than other basic instructions.

Testing: tier1-3 and gtest:all are clean on Premier-P550 SBC running Ubuntu-24.04.


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-8346235: RISC-V: Optimize bitwise AND with mask values (Enhancement - P4)

Reviewers

Reviewers without OpenJDK IDs

  • @Abu2rkii (no known openjdk.org user name / role)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 22752

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 15, 2024

👋 Welcome back fyang! 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

openjdk bot commented Dec 15, 2024

@RealFYang This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8346235: RISC-V: Optimize bitwise AND with mask values

Reviewed-by: gcao, rehn, fjiang

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 7 new commits pushed to the master branch:

  • 32c8195: 8345801: C2: Clean up include statements to speed up compilation when touching type.hpp
  • 9286018: 8345322: RISC-V: Add concurrent gtests for cmpxchg variants
  • 4fc43b0: 8345770: javadoc: API documentation builds are not always reproducible
  • ee1c5ad: 8345975: Update SAP SE copyright year to 2024 where it was missed
  • 3518b4b: 8344171: Clone and initialize Assertion Predicates in order instead of in reverse-order
  • c88e081: 8346160: Fix -Wzero-as-null-pointer-constant warnings from explicit casts
  • ab1dbd4: 8346202: Correct typo in SQLPermission

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk
Copy link

openjdk bot commented Dec 15, 2024

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

  • hotspot

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 hotspot hotspot-dev@openjdk.org label Dec 15, 2024
@RealFYang RealFYang marked this pull request as ready for review December 15, 2024 07:13
@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 15, 2024
@mlbridge
Copy link

mlbridge bot commented Dec 15, 2024

Webrevs

Copy link
Member

@feilongjiang feilongjiang left a comment

Choose a reason for hiding this comment

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

Looks good!

src/hotspot/cpu/riscv/macroAssembler_riscv.cpp Outdated Show resolved Hide resolved
Copy link
Member

@zifeihan zifeihan left a comment

Choose a reason for hiding this comment

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

Looks good to me.
And tier1 passed on SOPHON SG2042 (release)

@RealFYang
Copy link
Member Author

RealFYang commented Dec 16, 2024

@feilongjiang @zifeihan : Thanks for having a look!

Since this removes an unnecessary UseZbb check [1] which was introduced by https://bugs.openjdk.org/browse/JDK-8320069, @robehn : could you please confirm that?

[1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp#L5856

Copy link
Contributor

@robehn robehn left a comment

Choose a reason for hiding this comment

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

Thanks!

Suggest:
/reviewer remove Abu2rkii
And report?

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Dec 16, 2024
@openjdk
Copy link

openjdk bot commented Dec 16, 2024

@robehn Only the author (@RealFYang) is allowed to issue the reviewer command.

@RealFYang
Copy link
Member Author

/reviewer remove Abu2rkii

@openjdk
Copy link

openjdk bot commented Dec 16, 2024

@RealFYang Could not parse Abu2rkii as a valid reviewer.
Syntax: /reviewer (credit|remove) [@user | openjdk-user]+. For example:

  • /reviewer credit @openjdk-bot
  • /reviewer credit duke
  • /reviewer credit @user1 @user2

@RealFYang
Copy link
Member Author

/reviewer remove @Abu2rkii

@openjdk
Copy link

openjdk bot commented Dec 16, 2024

@RealFYang Could not parse @Abu2rkii as a valid reviewer.
Syntax: /reviewer (credit|remove) [@user | openjdk-user]+. For example:

  • /reviewer credit @openjdk-bot
  • /reviewer credit duke
  • /reviewer credit @user1 @user2

@robehn
Copy link
Contributor

robehn commented Dec 16, 2024

Sorry, maybe you don't need to :)

@RealFYang
Copy link
Member Author

Sorry, maybe you don't need to :)

I don't think reviewers without OpenJDK IDs will be listed in the git commit message. So we should be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot hotspot-dev@openjdk.org ready Pull request is ready to be integrated rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

5 participants