https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67438
--- Comment #15 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Yuri Rumyantsev from comment #11)
> Richard proposed to use the same simplification for min/max operations but
> in original test-case nested min/max operation (min(x,min(y,z)) or multi
> operand min/max (min(x,y,z)) are not recognized by gcc (Note that icc does
> such transformation) and so this won't help since we have the same register
> pressure issue:
> c = ~r;
> m = ~g;
> y = ~b;
> k = min(c, m, y);
> *out++ = c - k;
> *out++ = m - k;
> *out++ = y - k;
> *out++ = k;
This is now recognized since GCC 13 (by r13-1950-g9bb19e143cfe88 and improved
for GCC 14 by r14-337-gc43819a9b4cdaa).
Now there is a missing MIN/MAX detection still:
int f(int a, int b, int c)
{
int at = ~a;
int bt = ~b;
int ct = ~c;
int t = a < b ? at : bt;
return t;
}
Which is not detected until phiopt4. I will file a bug about that.
I think once that is fixed I think we might be able to remove the single_use
again.