[PATCH] D142602: [X86] Expand transform (icmp eq/ne (ABS A), C) -> (and/or (icmp eq/ne A, C), (icmp eq/ne A, -C))
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 11 09:36:04 PST 2023
RKSimon added inline comments.
================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:53461
+ ConvertToLogicOpOfSETCC =
+ CInt.isPowerOf2() && !CInt.isMinSignedValue();
+ }
----------------
goldstein.w.n wrote:
> RKSimon wrote:
> > Doesn't this need to apply to the vector cases as well?
> > Doesn't this need to apply to the vector cases as well?
>
> No, for the scalar case we have a little hack to handle `(X == Pow2C || X == -Pow2C)` which is the only case this is really worth it.
>
> For the vector case if there is no fast `abs` its preferable for an arbitrary `C` to do `X == C || X == -C` as opposed to `Abs(X) == Abs(C)`.
In which case, could we move the isConstOrConstSplat check inside the isScalarInteger test and replace the -CInt with getNode() / FoldConstantArithmetic() ?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142602/new/
https://reviews.llvm.org/D142602
More information about the llvm-commits
mailing list