[PATCH] D151750: [DAGCombine] `select_cc seteq X, 0, 0, cttz_zero_undef(X) -> and(cttz(X), sizeof(X) - 1)`

Mikhail Gudim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 8 13:00:34 PDT 2023


mgudim added a comment.

> Does the issue exist on other targets?

Right, sorry. Didn't think about it.  My guess would be that `select_cc` is at least as expensive as `and`. I see two alternatives:
(1) Introduce a target hook - `isAndCheaperThanSelectCC` which defaults to `false` but is `true` on `RISCV` (maybe in the presence of some extensions).
(2) Make this `RISCV` specific

What do you think?


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

https://reviews.llvm.org/D151750



More information about the llvm-commits mailing list