[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
Sun Feb 5 09:29:53 PST 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:53461
+          ConvertToLogicOpOfSETCC =
+              CInt.isPowerOf2() && !CInt.isMinSignedValue();
+        }
----------------
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)`.


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