[PATCH] D122051: [RISCV] The immediate version of sgt/ugt lowering to slti/sltiu + xori

Ben Shi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 21 01:09:03 PDT 2022


benshi001 added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVInstrInfo.td:355
+// A 12-bit signed immediate sub one where the imm range will be [-2049, 2046].
+def simm12_sub1 : ImmLeaf<XLenVT,
+  [{return (isInt<12>(Imm) && Imm != 2047) || Imm == -2049;}]>;
----------------
benshi001 wrote:
> The zero value should be excluded, which is not needed to do `li`, and case just 
>  be used with the register `X0`.
I think

1. The form `(-2049 <= Imm && Imm < 0) || (0 < Imm && Imm <= 2046)` is more clear.

2. Do a further check that the imm node has only one use.


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

https://reviews.llvm.org/D122051



More information about the llvm-commits mailing list