http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52252
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-02-15
Component|target |tree-optimization
Version|unknown |4.7.0
Ever Confirmed|0 |1
Severity|normal |enhancement
--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-02-15
11:53:58 UTC ---
We fail to SLP vectorize this because of
6: Build SLP failed: different operation in stmt k_15 = MIN_EXPR <tmp_14,
y_13>;
thus,
out[0] = c - k;
out[1] = m - k;
out[2] = y - k;
out[3] = k;
isn't detected as equivalent to
out[0] = c - k;
out[1] = m - k;
out[2] = y - k;
out[3] = <magic> - k;
or
out[3] = k - 0;
whatever would be more suitable (the latter would fail to be detected as
induction I guess, the former would fail with a similar issue for the
definition of <magic>).
With
out[3] = y - k;
we fail with
6: Load permutation 0 1 2 2 1 1 1 1 0 0 0 0 2 2 2 2
6: Build SLP failed: unsupported load permutation *out_37 = D.1721_16;
we can vectorize
void convert_image(byte *in, byte *out, int size) {
int i;
for(i = 0; i < size; i++) {
byte r = in[0];
byte g = in[1];
byte b = in[2];
byte a = in[3];
byte c, m, y, k, z, tmp;
c = 255 - r;
m = 255 - g;
y = 255 - b;
z = 255 - a;
tmp = MIN(m, y);
k = MIN(c, tmp);
out[0] = c - k;
out[1] = m - k;
out[2] = y - k;
out[3] = z - k;
in += 4;
out += 4;
}
}
though.