[PATCH] D53230: [RISCV] Introduce codegen patterns for RV64M-only instructions

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 7 15:32:23 PST 2019


efriedma added inline comments.


================
Comment at: lib/Target/RISCV/RISCVInstrInfoM.td:57
+def : Pat<(sdiv (sexti32 GPR:$rs1), (sexti32 GPR:$rs2)),
+          (DIVW GPR:$rs1, GPR:$rs2)>;
+def : Pat<(sext_inreg (sdiv (sexti32 GPR:$rs1),
----------------
Are you sure `(sdiv (sexti32 GPR:$rs1), (sexti32 GPR:$rs2))` is sufficient?  I think it returns the wrong result for something like `INT_MIN/-1` (which should be a positive 64-bit value).

The pattern where the result is sign-extended is fine, I think.  And the corresponding "REMW" pattern is also fine.


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

https://reviews.llvm.org/D53230





More information about the llvm-commits mailing list