[PATCH] D145890: [InstCombine] Generate better code for std::bit_floor from libstdc++

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 26 15:41:42 PDT 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:3323
+      !match(FalseVal,
+             m_OneUse(m_Shl(m_One(), m_OneUse(m_Sub(m_SpecificInt(BitWidth),
+                                                    m_Value(CTLZ)))))) ||
----------------
Instead of matching exact `BitWidth` can you implement this more generically: https://alive2.llvm.org/ce/z/q2hCjC

`1 << (C - ctlz(X >> 1))` -> `((1 << (C-1)) >> ctlz(X)`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145890/new/

https://reviews.llvm.org/D145890



More information about the llvm-commits mailing list