Skip to content

8305728: RISC-V: Use bexti instruction to do single-bit testing#13368

Closed
feilongjiang wants to merge 1 commit intoopenjdk:masterfrom
feilongjiang:test_bit
Closed

8305728: RISC-V: Use bexti instruction to do single-bit testing#13368
feilongjiang wants to merge 1 commit intoopenjdk:masterfrom
feilongjiang:test_bit

Conversation

@feilongjiang
Copy link
Member

@feilongjiang feilongjiang commented Apr 6, 2023

Current RISC-V port tests bit masks with andi instruction. But for those mask values not in the range of simm12 (andi
only accepts sign-extended 12-bit immediate [1]), we need an extra temp register (t0 as default for andi) to store the mask value [2].
Since we now support Zbs extension of Bit-Manipulation, we have a more convenient way to test power-of-two bit
masks with the single instruction bexti [3] without any temp register.

  1. https://github.com/riscv/riscv-isa-manual/blob/f6b8d5c7d2dcd935b48689a337c8f5bc2be4b5e5/src/rv32.tex#L519-L521
  2. void MacroAssembler::andi(Register Rd, Register Rn, int64_t imm, Register tmp) {
    if (is_simm12(imm)) {
    and_imm12(Rd, Rn, imm);
    } else {
    assert_different_registers(Rn, tmp);
    mv(tmp, imm);
    andr(Rd, Rn, tmp);
    }
    }
  3. https://github.com/riscv/riscv-bitmanip/blob/main/bitmanip/insns/bexti.adoc

Testing:

  • hotspot_tier1, jdk_tier1 on QEMU-User w/ and w/o UseZbs (release build)
  • tier1-3 tests on unmatched board w/o UseZbs (release build)

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-8305728: RISC-V: Use bexti instruction to do single-bit testing

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 13368

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

Using diff file

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

Webrev

Link to Webrev Comment

@feilongjiang feilongjiang marked this pull request as draft April 6, 2023 00:52
@feilongjiang feilongjiang changed the title Add test_bit for power of 2 bit mask testing RISC-V: Add test_bit for power of 2 bit mask testing Apr 6, 2023
@bridgekeeper
Copy link

bridgekeeper bot commented Apr 6, 2023

👋 Welcome back fjiang! 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 Apr 6, 2023

@feilongjiang The following labels will be automatically applied to this pull request:

  • hotspot
  • shenandoah

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

@openjdk openjdk bot added hotspot hotspot-dev@openjdk.org shenandoah shenandoah-dev@openjdk.org labels Apr 6, 2023
@feilongjiang feilongjiang force-pushed the test_bit branch 4 times, most recently from a7e55f8 to 7517992 Compare April 6, 2023 13:46
@feilongjiang
Copy link
Member Author

/label remove shenandoah

@openjdk openjdk bot removed the shenandoah shenandoah-dev@openjdk.org label Apr 7, 2023
@openjdk
Copy link

openjdk bot commented Apr 7, 2023

@feilongjiang
The shenandoah label was successfully removed.

@feilongjiang feilongjiang changed the title RISC-V: Add test_bit for power of 2 bit mask testing 8305728: RISC-V: Add test_bit for power-of-two bit mask testing Apr 7, 2023
@feilongjiang feilongjiang changed the title 8305728: RISC-V: Add test_bit for power-of-two bit mask testing 8305728: RISC-V: Use bexti instruction to do single-bit testing Apr 7, 2023
@feilongjiang feilongjiang marked this pull request as ready for review April 7, 2023 04:23
@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 7, 2023
@mlbridge
Copy link

mlbridge bot commented Apr 7, 2023

Webrevs

@feilongjiang
Copy link
Member Author

/label remove hotspot
/label add hotspot-compiler

@openjdk openjdk bot removed the hotspot hotspot-dev@openjdk.org label Apr 10, 2023
@openjdk
Copy link

openjdk bot commented Apr 10, 2023

@feilongjiang
The hotspot label was successfully removed.

@openjdk openjdk bot added the hotspot-compiler hotspot-compiler-dev@openjdk.org label Apr 10, 2023
@openjdk
Copy link

openjdk bot commented Apr 10, 2023

@feilongjiang
The hotspot-compiler label was successfully added.

Copy link
Member

@RealFYang RealFYang 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. Thanks.

@openjdk
Copy link

openjdk bot commented Apr 10, 2023

@feilongjiang 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:

8305728: RISC-V: Use bexti instruction to do single-bit testing

Reviewed-by: fyang, yzhu

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 30 new commits pushed to 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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@RealFYang) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 10, 2023
Copy link

@yhzhu20 yhzhu20 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.

@feilongjiang
Copy link
Member Author

hotspot/jdk tier2-3 are also good w/ UseZbs on QEMU-User with release build.
@yhzhu20 @RealFYang -- Thank you all for the review!
/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Apr 11, 2023
@openjdk
Copy link

openjdk bot commented Apr 11, 2023

@feilongjiang
Your change (at version aed3038) is now ready to be sponsored by a Committer.

@RealFYang
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented Apr 11, 2023

Going to push as commit 1375130.
Since your change was applied there have been 30 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Apr 11, 2023
@openjdk openjdk bot closed this Apr 11, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Apr 11, 2023
@openjdk
Copy link

openjdk bot commented Apr 11, 2023

@RealFYang @feilongjiang Pushed as commit 1375130.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@feilongjiang feilongjiang deleted the test_bit branch April 11, 2023 03:57
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 integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants