https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116649
--- Comment #7 from Segher Boessenkool <segher at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #5)
> (In reply to Segher Boessenkool from comment #3)
> > There are way more places we could usefully generate set[n]bc[r] insns. For
> > example, consider
> >
> > int f(int a, int b, int x) { return a < b ? x+5 : x+6; }
> >
> > We currently generate a branchy thing for that, I actually expected an isel
> > thing, but we could likely do better with setbc even.
> >
> > So if you find anything more, please let us know!
>
> The factoring out `x+*` out of the conditional is recorded as PR 89018 (and
> a few others); but the other part converting from isel to setbc might be a
> different issue.
setbc is a variant of isel, it is an isel between 0 and 1, so it van be used
to do an isel between x and x+1, or between x+5 and x+6 like my example here.
I don't think generic code will do that (and we probably do not want it to
either), but target code could try some things. Like, when doing an isel it
could try to see if it can do better even.
It is all marginal, but a lot of small steps gets you there in the end :-)