[RISCV] Only combine (or (GREVI x, shamt), x) -> GORCI if shamt is a power of 2.
authorCraig Topper <craig.topper@sifive.com>
Mon, 30 Nov 2020 15:06:32 +0000 (07:06 -0800)
committerCraig Topper <craig.topper@sifive.com>
Mon, 30 Nov 2020 16:10:39 +0000 (08:10 -0800)
commitcbbd7021f176d1344fb4d71d492ccc6017f98151
tree92810de3760ed078b710f08b90465aa7932bb111
parent4db1de3a77939c0ec409e4e2c01f27be639f20a3
[RISCV] Only combine (or (GREVI x, shamt), x) -> GORCI if shamt is a power of 2.

GORCI performs an OR between each stage. So we need to ensure only
one stage is active before doing this combine.

Initial attempts at finding a test case for this failed due to
the order things get combined. It's most likely that we'll form
one stage of GREVI then combine to GORCI before the two stages of
GREVI are able to be formed and combined with each other to form
a multi stage GREVI.

Differential Revision: https://reviews.llvm.org/D92289
llvm/lib/Target/RISCV/RISCVISelLowering.cpp