[Bug middle-end/67438] [6 Regression] ~X op ~Y pattern relocation causes loop performance degradation on 32bit x86
rguenther at suse dot de
gcc-bugzilla@gcc.gnu.org
Tue Nov 17 15:16:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67438
--- Comment #10 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 17 Nov 2015, ysrumyan at gmail dot com wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67438
>
> --- Comment #9 from Yuri Rumyantsev <ysrumyan at gmail dot com> ---
> It looks like such transformation is profitable if only def statements have a
> single use, i.e. it looks reasonable for
> if (255 - a) > (255 -b) /* a,b have char type. */
> but it does not look reasonable for attached test-case since after it we missed
> min/max recognition, namely,
>
> c = 255 - r; /* c has mulitple uses! */
> m = 255 - g; /* likewise. */
> y = 255 - b; /* likewise. */
> if (c < m)
> k = MIN (c, y);
> else
> k = MIN (m, y);
> *write++ = c - k;
Looks like we are missing the corresponding pattern for MIN/MAX
instead.
MIN (~X, ~Y) -> ~MAX (X, Y)
MAX (~X, ~Y) -> ~MIN (X, Y)
(for minmax (min max)
maxmin (max min)
(simplify
(minmax (bit_not @0) (bit_not @1))
(bit_not (maxmin @0 @1))))
maybe that helps. I notice a missed optimization to combine
the test with the two MINs on the GIMPLE level anyway.
More information about the Gcc-bugs
mailing list