[PATCH] D145299: [X86] Generate better code for std::bit_ceil

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 5 05:06:34 PST 2023


spatel added a comment.

As noted in previous comments, it's hard to reliably pattern-match a sequence that is this long. We are missing several potential canonicalizations in IR, and I see at least one possible variant that is shorter in IR:
https://alive2.llvm.org/ce/z/CkQ433

We probably want to form the umax variant in IR based on it being one less instruction. If a target has a umax instruction (and ctlz), then that's probably going to be the best in codegen.

So this patch should wait until the IR questions are resolved, but at first glance, it seems like we will need D144451 <https://reviews.llvm.org/D144451>, more codegen conversions, and several IR patches.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145299



More information about the llvm-commits mailing list