[RISCV] Add more SHXADD isel patterns.
authorCraig Topper <craig.topper@sifive.com>
Sun, 3 Jul 2022 06:11:14 +0000 (23:11 -0700)
committerCraig Topper <craig.topper@sifive.com>
Sun, 3 Jul 2022 06:11:22 +0000 (23:11 -0700)
commit7e4ab9d5b8b855602c602fe0908afcf078ce3f20
tree9df65e529a535a3ca2b20aa674e3a9e80103b948
parent7788b0c09754312445fb5296d9042740aa781880
[RISCV] Add more SHXADD isel patterns.

This handles the code we get for

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

The shift right and the shl will get DAG combined into
(shl (and X, 0xfffffffe), 1). We have custom isel to match the
shl+and, but with Zba the (add (shl X, 1), Y) part will get
matched and leave the and to be iseled by itself. This commit
adds a larger pattern that includes the and.
llvm/lib/Target/RISCV/RISCVInstrInfoZb.td
llvm/test/CodeGen/RISCV/rv64zba.ll