This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add support for BITREVERSE for RVP
AbandonedPublic

Authored by Jim on Jun 4 2021, 5:18 AM.

Details

Summary

Customized lower BITREVERSE to bitrevi.

Diff Detail

Event Timeline

Jim created this revision.Jun 4 2021, 5:18 AM
Jim requested review of this revision.Jun 4 2021, 5:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 4 2021, 5:18 AM
jrtc27 added inline comments.Jun 4 2021, 5:23 AM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
2025

This will cause you to not assert for BSWAP when only RVP is enabled

2031–2034

Is BITREVI or bitmanip's REV better? Why do two extensions need to define the same instruction differently; can there not be a common sub-extension implemented by both (e.g. just the REV form of GREV), like how scalar crypto is using parts of bitmanip?

jrtc27 added a comment.Jun 4 2021, 5:26 AM

I do not think RVP needs its own subdirectory for CodeGen tests. RVV has one because the extension is massive, but RVP is comparatively small. It should be like all the others. Especially since I think we should be testing interesting combinations of extensions for various tests (e.g. bitmanip + P for things like this).

craig.topper added inline comments.Jun 4 2021, 3:57 PM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
2031–2034

It looks BITREVI reverses a range of bits while GREVI reverses nibbles, bytes, words, dwords, etc.?

I think you can also handle i32 bitreverse on RV64 by limiting the BITREVI range to the lower 32 bits? I would like to see that handled in this patch since we handle i32 with GREVIW.

We should probably do i8/i16 for this too, but we don't do it for GREVI so I'm less concerned about matching it.

Jim added a comment.Jun 6 2021, 4:08 AM

I do not think RVP needs its own subdirectory for CodeGen tests. RVV has one because the extension is massive, but RVP is comparatively small. It should be like all the others. Especially since I think we should be testing interesting combinations of extensions for various tests (e.g. bitmanip + P for things like this).

I am ongoing to move RVP tests out of its own subdirectory and add tests for the combination of bitmanip + P.

Jim abandoned this revision.Jun 15 2021, 6:31 AM

Merge this patch into D103689.