[PATCH] D132771: [RISCV] Apply DeMorgan to (beqz (and/or (seteq), (xor Z, 1))) to remove the xor.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 29 12:10:40 PDT 2022
craig.topper 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).
----------------
reames wrote:
> 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?
Yes. My thought was that the name only makes sense if the Xor opcode check is also in it.
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