[PATCH] D155328: [RISCV] Add a DAG combine for (czero_eq X, (xor Y, 1)) -> (czero_ne X, Y) if Y is 0 or 1.

Mikhail Gudim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 14 13:58:33 PDT 2023


mgudim added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:12728
+    return SDValue();
+
   case RISCVISD::SELECT_CC: {
----------------
mgudim wrote:
> craig.topper wrote:
> > craig.topper wrote:
> > > mgudim wrote:
> > > > Why not express this using pattern?
> > > I'm not sure what you mean.
> > Do you mean an isel pattern in tablegen? I'd need a PatFrag or ComplexPattern to call MaskValueIsZero. So there doesn't seem to be any advantage.
> def : Pat<(XLenVT (riscv_czero_eqz GPR:$rs1, (xor GPR:$rc, 1))),
>           (CZERO_NEZ GPR:$rs1, GPR:$rc)>;
> 
right. Got it, thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155328



More information about the llvm-commits mailing list