[PATCH] D142602: [X86] Expand transform (icmp eq/ne (ABS A), C) -> (and/or (icmp eq/ne A, C), (icmp eq/ne A, -C))

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 11 14:17:23 PST 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:53461
+          ConvertToLogicOpOfSETCC =
+              CInt.isPowerOf2() && !CInt.isMinSignedValue();
+        }
----------------
RKSimon wrote:
> 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() ?
What do you mean by this? As in don't go through APInt to get the value of C/-C? Is there an issue how with it is now?


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