From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23586 invoked by alias); 12 Nov 2015 12:04:12 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 23572 invoked by uid 89); 12 Nov 2015 12:04:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-io0-f175.google.com Received: from mail-io0-f175.google.com (HELO mail-io0-f175.google.com) (209.85.223.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 12 Nov 2015 12:04:10 +0000 Received: by iofh3 with SMTP id h3so62605863iof.3 for ; Thu, 12 Nov 2015 04:04:08 -0800 (PST) X-Received: by 10.107.163.79 with SMTP id m76mr15612640ioe.109.1447329848077; Thu, 12 Nov 2015 04:04:08 -0800 (PST) Received: from msticlxl57.ims.intel.com (jfdmzpr03-ext.jf.intel.com. [134.134.139.72]) by smtp.gmail.com with ESMTPSA id 90sm4878422ioq.29.2015.11.12.04.04.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Nov 2015 04:04:07 -0800 (PST) Date: Thu, 12 Nov 2015 12:04:00 -0000 From: Ilya Enkovich To: gcc-patches@gcc.gnu.org Subject: [PATCH, PR tree-optimization/PR68305] Support masked COND_EXPR in SLP Message-ID: <20151112120340.GB51435@msticlxl57.ims.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2015-11/txt/msg01500.txt.bz2 Hi, This patch fixes a way operand is chosen by its num for COND_EXPR. Bootstrapped and regtested on x86_64-unknown-linux-gnu. OK for trunk? Thanks, Ilya -- gcc/ 2015-11-12 Ilya Enkovich PR tree-optimization/68305 * tree-vect-slp.c (vect_get_constant_vectors): Support COND_EXPR with SSA_NAME as a condition. gcc/testsuite/ 2015-11-12 Ilya Enkovich PR tree-optimization/68305 * gcc.dg/vect/pr68305.c: New test. diff --git a/gcc/testsuite/gcc.dg/vect/pr68305.c b/gcc/testsuite/gcc.dg/vect/pr68305.c new file mode 100644 index 0000000..fde3db7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr68305.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-O3" } */ +/* { dg-additional-options "-mavx2" { target avx_runtime } } */ + +int a, b; + +void +fn1 () +{ + int c, d; + for (; b; b++) + a = a ^ !c ^ !d; +} diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 9d97140..9402474 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -2738,18 +2738,20 @@ vect_get_constant_vectors (tree op, slp_tree slp_node, switch (code) { case COND_EXPR: - if (op_num == 0 || op_num == 1) - { - tree cond = gimple_assign_rhs1 (stmt); + { + tree cond = gimple_assign_rhs1 (stmt); + if (TREE_CODE (cond) == SSA_NAME) + op = gimple_op (stmt, op_num + 1); + else if (op_num == 0 || op_num == 1) op = TREE_OPERAND (cond, op_num); - } - else - { - if (op_num == 2) - op = gimple_assign_rhs2 (stmt); - else - op = gimple_assign_rhs3 (stmt); - } + else + { + if (op_num == 2) + op = gimple_assign_rhs2 (stmt); + else + op = gimple_assign_rhs3 (stmt); + } + } break; case CALL_EXPR: