Transform `(icmp eq/ne Abs(A), Pow2)` -> `(and/or (icmp eq/ne A,Pow2), (icmp eq/ne...
authorNoah Goldstein <goldstein.w.n@gmail.com>
Tue, 14 Feb 2023 01:40:18 +0000 (19:40 -0600)
committerNoah Goldstein <goldstein.w.n@gmail.com>
Wed, 15 Feb 2023 00:59:04 +0000 (18:59 -0600)
commit8b5c3902475b3c23ea87e58bc87541f543782e54
treebb02146d1a5d25079be05c69959f3b8ea32e95a6
parent54a9e992c84cc4b1668329494f4355e7d0b8e470
Transform `(icmp eq/ne Abs(A), Pow2)` -> `(and/or (icmp eq/ne A,Pow2), (icmp eq/ne A,-Pow2))`

Only if Abs(A) has one use, in which case the `(and/or (icmp eq/ne
A,Pow2), (icmp eq/ne A,-Pow2))` can be optimized in
`DAGCombiner::foldAndOrOfSETCC`.

Alive Links:
EQ: https://alive2.llvm.org/ce/z/gTxSgV
NE: https://alive2.llvm.org/ce/z/MUf57Y

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D142345
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/icmp-pow2-logic-npow2.ll