This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by PaoloS on May 13 2020, 8:55 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 ternary subset (zbt 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:55 AM
PaoloS updated this revision to Diff 277534.Jul 13 2020, 12:34 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.

Added pattern-matching for fslw, fsrw, fsri and fsriw
Added the correspondent tests.
Corrected the order of the patterns.

PaoloS edited the summary of this revision. (Show Details)Jul 14 2020, 6:58 AM
lewis-revill added inline comments.Jul 14 2020, 8:05 AM
llvm/test/CodeGen/RISCV/rv32Zbt.ll
152

Nitpick: See comment on first patch regarding these extra tests.

lewis-revill accepted this revision.Jul 14 2020, 8:11 AM

See nitpick, otherwise LGTM

This revision is now accepted and ready to land.Jul 14 2020, 8:11 AM
PaoloS marked 2 inline comments as done.Jul 14 2020, 10:24 AM
PaoloS added inline comments.
llvm/test/CodeGen/RISCV/rv32Zbt.ll
152

There is actually a small improvement of the code size made by some cmov instructions. But its quite small, so I'll comment it anyway.

PaoloS updated this revision to Diff 277926.Jul 14 2020, 11:44 AM
PaoloS marked an inline comment as done.

Added comments to inefficient tests.

This revision was automatically updated to reflect the committed changes.