[PATCH] D149481: [TargetLowering] Don't use ISD::SELECT_CC in expandFP_TO_INT_SAT.

Sergei Barannikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 1 16:09:15 PDT 2023


barannikov88 added a comment.

In D149481#4311028 <https://reviews.llvm.org/D149481#4311028>, @efriedma wrote:

>> Why is SELECT_CC a thing at all?
>
> On targets where compare instructions modify a flag register, "SELECT" and "BRCOND" aren't really the natural representation; it effectively makes `x != 0` a special case.  SELECT_CC and BR_CC represent the combination of a comparison followed by a branch.

FWIW on such targets neither of these are natural. CC versions are just slightly
easier to lower (saves a couple lines of code).
I wish these nodes were not there when I started bringing up a new backend
and that I didn't read the comments saying "CC" versions are more natural.
This would save me quite a lot of time.

> That said, a lot of of targets with a flag register prefer to to custom-lower SETCC anyway, so maybe it's not as useful today.

These nodes are just a redundancy (like a "not x" compared to "xor x, ~0").
I'm glad RISC-V doesn't use them, even though BR_CC is pertty much natural.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149481



More information about the llvm-commits mailing list