[RISCV] Add more SHXADD patterns.
authorCraig Topper <craig.topper@sifive.com>
Mon, 4 Jul 2022 04:07:25 +0000 (21:07 -0700)
committerCraig Topper <craig.topper@sifive.com>
Mon, 4 Jul 2022 04:57:05 +0000 (21:57 -0700)
commitd36e09cfe5914b246e4469cd972f67d35d80bf9c
tree2b6e0e3c8a39bc6530477d7cb7e37da6a0196399
parent8eb4dcb737479ba105db2ffc83e9f62a7f3f7fb3
[RISCV] Add more SHXADD patterns.

This handles the code we get for this.

int foo(unsigned x, int *y) {
    return y[x >> 3];
}

The srl and shl implied by the array index will be combined to
form (srl (and X, C2), C1). We need to reverse this get to back
the shl to fold into SHXADD.
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
llvm/test/CodeGen/RISCV/rv64zba.ll