From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9497 invoked by alias); 15 Feb 2012 11:55:00 -0000 Received: (qmail 9489 invoked by uid 22791); 15 Feb 2012 11:54:59 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_TM X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 15 Feb 2012 11:54:03 +0000 From: "rguenth at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Status Last reconfirmed Component Version Ever Confirmed Severity Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-02/txt/msg01536.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52252 Richard Guenther 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 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 ; 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] = - 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 ). 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.