[PATCH] D116727: [RISCV] Supplement SH*ADDUW instructions pattern

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 6 09:02:15 PST 2022


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVInstrInfoZb.td:1039
           (SH3ADDUW GPR:$rs1, GPR:$rs2)>;
+def : Pat<(i64 (add (mul (and GPR:$rs1, 0xFFFFFFFF), (i64 2)), non_imm12:$rs2)),
+          (SH1ADDUW GPR:$rs1, GPR:$rs2)>;
----------------
jacquesguan wrote:
> Does the InstCombine canonicalize `mul X, 2` to `shl X, 1`? 
InstCombine and DAGCombine both canonicalize mul by power 2 to shifts.


================
Comment at: llvm/test/CodeGen/RISCV/rv64zba.ll:210
 
+define i64 @sh1adduw_3(i64 %0, i64 %1) {
+; RV64I-LABEL: sh1adduw_3:
----------------
These tests cases pass without your change


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116727/new/

https://reviews.llvm.org/D116727



More information about the llvm-commits mailing list