This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add matching of codegen patterns to RISCV Bit Manipulation Zbp asm instructions
ClosedPublic

Authored by PaoloS on May 13 2020, 8:34 AM.

Details

Summary

This patch provides optimization of bit manipulation operations by enabling
the +experimental-b target feature.
It adds matching of single block patterns of instructions to specific bit-manip
instructions from the permutation subset (zbp subextension) of the experimental
B extension of RISC-V.
It adds also the correspondent codegen tests.

This patch is based on Clifford Wolf's proposal for the bit manipulation
extension of RISCV:
https://github.com/riscv/riscv-bitmanip/blob/master/bitmanip-0.92.pdf

Diff Detail

Event Timeline

PaoloS created this revision.May 13 2020, 8:34 AM
PaoloS updated this revision to Diff 276279.Jul 7 2020, 5:36 PM

Add missing pattern-matching for *w instructions.
Add tests.
Add both i32 and i64 code versions to both i32 and i64 test files.
Remove NOT labels from tests.

PaoloS updated this revision to Diff 277529.Jul 13 2020, 12:27 PM

Updated the test:

  • the tests have been updated from the top of all the sub-patches together so that they are exactly the same as they would be if updated with the whole final patch.
  • labels specific to the sub-extension have been added alongside the generic RISCVIB label (that activates all the sub-extensions) so that we can see how differently the patterns are matched with the specific subextension or with all of them together.
  • the tests will probably fail if run by checking out the commit of a subextension and if updated they'll change. These tests are designed to work with the final squashed patch.

Notice that rori takes over grevi on RV64 for the rotation as it is exactly the same, and because the activation of the Zbp subextension is eough to activate the "ZbbOrZbp" subextension.

PaoloS edited the summary of this revision. (Show Details)Jul 14 2020, 6:15 AM
This revision is now accepted and ready to land.Jul 14 2020, 8:09 AM
PaoloS updated this revision to Diff 277922.Jul 14 2020, 11:39 AM

Making sure the changes from patch zbb are maintained.

This revision was automatically updated to reflect the committed changes.