[llvm] [X86] Use BSR passthrough behaviour to fold (CMOV (BSR ?, X), Y, (X == 0)) -> (BSR Y, X) (PR #143662)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 12 01:37:38 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 &&
----------------
RKSimon wrote:
No, this is just for COND_E/NE and the arg swap above canonicalizes to handle both - test coverage for both cases is in place.
https://github.com/llvm/llvm-project/pull/143662
More information about the llvm-commits
mailing list