[llvm] [X86] Use BSR passthrough behaviour to fold (CMOV (BSR ?, X), Y, (X == 0)) -> (BSR Y, X) (PR #143662)
Phoebe Wang via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 11 01:37:40 PDT 2025
================
@@ -49400,6 +49402,14 @@ static SDValue combineCMov(SDNode *N, SelectionDAG &DAG,
if (CC == X86::COND_E)
std::swap(Add, Const);
+ // TODO: ADD BSF support, but requires changes to the "REP BSF" CTTZ hack.
+ if (Subtarget.hasBitScanPassThrough() && Add.getOpcode() == X86ISD::BSR &&
----------------
phoebewang wrote:
Do we need to check `CC == X86::COND_E`?
https://github.com/llvm/llvm-project/pull/143662
More information about the llvm-commits
mailing list