From patchwork Fri Dec 4 15:00:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Enkovich X-Patchwork-Id: 552739 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E87B91402E2 for ; Sat, 5 Dec 2015 02:01:37 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=p86gqKJ/; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=erWwUxPtYSuLWkn3l vZUn05rAJYGb0kYf2UfsrDDDCvvcLekMtZMqImQmXdCkfwY9gGH2HHkIU9QHCP72 U2zlLrEYaAOUBugucuwAVoM9a4VJE8dvA+rg7xR6+Oc5SOAxt9epd5nk2am+wEhq jHj3GVD3UGJA/b/tcbq6i3e2SY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=default; bh=l5xsNQaP8EwaDlpoXe65nbP GQys=; b=p86gqKJ/46CpftcsFbEaCfkYIisZvy+fyvexKD+ULpCecgmTZwtGBoG M2euyW71Z4GUdefk3IGgSfKJsxO1N37cpvABcvRor1f5O1G5qaqXFiN74Myj9ORN 01CXzt7OrSbqG91rQfPoZbKKn9MkS/Ufixe3A5F5/DkccyJql7mM= Received: (qmail 44718 invoked by alias); 4 Dec 2015 15:01:29 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 44708 invoked by uid 89); 4 Dec 2015 15:01:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ig0-f175.google.com Received: from mail-ig0-f175.google.com (HELO mail-ig0-f175.google.com) (209.85.213.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 04 Dec 2015 15:01:28 +0000 Received: by igl9 with SMTP id 9so34492799igl.0 for ; Fri, 04 Dec 2015 07:01:26 -0800 (PST) X-Received: by 10.50.160.33 with SMTP id xh1mr4291987igb.25.1449241286130; Fri, 04 Dec 2015 07:01:26 -0800 (PST) Received: from msticlxl57.ims.intel.com (irdmzpr01-ext.ir.intel.com. [192.198.151.36]) by smtp.gmail.com with ESMTPSA id rv1sm1519909igb.15.2015.12.04.07.01.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Dec 2015 07:01:25 -0800 (PST) Date: Fri, 4 Dec 2015 18:00:59 +0300 From: Ilya Enkovich To: Richard Biener Cc: GCC Patches Subject: Re: [PATCH] Avoid false vector mask conversion Message-ID: <20151204150059.GB41884@msticlxl57.ims.intel.com> References: <20151112160843.GG51435@msticlxl57.ims.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes On 02 Dec 16:27, Richard Biener wrote: > On Wed, Dec 2, 2015 at 4:24 PM, Ilya Enkovich wrote: > > > > The problem is that conversion is supposed to be handled by > > vectorizable_conversion, > > but it fails to because it is not actually a conversion. I suppose it > > may be handled > > in vectorizable_assignment but I chose this pattern because it's meant > > to handle mask > > conversion issues. > > I think it's always better to avoid patterns if you can. > > Richard. > Here is a variant with vectorizable_assignment change. Bootstrapped and regtested on x86_64-unknown-linux-gnu. Does it look better? Thanks, Ilya --- gcc/ 2015-12-04 Ilya Enkovich * tree-vect-stmts.c (vectorizable_assignment): Support useless boolean conversion. diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 3b078da..2cdbb04 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -4229,7 +4229,12 @@ vectorizable_assignment (gimple *stmt, gimple_stmt_iterator *gsi, /* But a conversion that does not change the bit-pattern is ok. */ && !((TYPE_PRECISION (TREE_TYPE (scalar_dest)) > TYPE_PRECISION (TREE_TYPE (op))) - && TYPE_UNSIGNED (TREE_TYPE (op)))) + && TYPE_UNSIGNED (TREE_TYPE (op))) + /* Conversion between boolean types of different sizes is + a simple assignment in case their vectypes are same + boolean vectors. */ + && (!VECTOR_BOOLEAN_TYPE_P (vectype) + || !VECTOR_BOOLEAN_TYPE_P (vectype_in))) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,