public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/52252] An opportunity for x86 gcc vectorizer (gain up to 3 times)
Date: Wed, 15 Feb 2012 11:55:00 -0000	[thread overview]
Message-ID: <bug-52252-4-6M3UOlzyES@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-52252-4@http.gcc.gnu.org/bugzilla/>

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.


  reply	other threads:[~2012-02-15 11:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-14 22:42 [Bug c/52252] New: " evstupac at gmail dot com
2012-02-15 11:55 ` rguenth at gcc dot gnu.org [this message]
2012-02-29 12:34 ` [Bug tree-optimization/52252] " evstupac at gmail dot com
2012-07-13  8:48 ` rguenth at gcc dot gnu.org
2014-02-11 14:27 ` evstupac at gmail dot com
2014-05-07 12:11 ` kyukhin at gcc dot gnu.org
2014-06-11  8:38 ` kyukhin at gcc dot gnu.org
2014-06-18  7:47 ` kyukhin at gcc dot gnu.org
2023-08-31  7:07 ` rguenth at gcc dot gnu.org
2023-11-28  6:06 ` pinskia at gcc dot gnu.org
2023-11-28 10:55 ` rguenther at suse dot de
2023-11-28 22:24 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-52252-4-6M3UOlzyES@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).