[PATCH] D132771: [RISCV] Apply DeMorgan to (beqz (and/or (seteq), (xor Z, 1))) to remove the xor.

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 29 12:04:33 PDT 2022


reames added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:9165
+
+  // If the condition is an And, SimplifyDemandedBits may have changed
+  // (xor Z, 1) to (not Z).
----------------
craig.topper wrote:
> reames wrote:
> > This bit of logic seems like it's getting repeated a bunch, can we factor out a utility?  Something like matchLogicalNot?
> Just the constant value checking? I don't think `matchLogicalNot` is a good name for that. I'm not sure what a good name is. `isOneOrAllOnes` with a bool for `AllowAllOnes`?
I was thinking to fold the masked value check in as well.  The think we're trying for is to match the logical not of a boolean Z right?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132771



More information about the llvm-commits mailing list