From patchwork Thu Aug 4 19:58:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prathamesh Kulkarni X-Patchwork-Id: 73311 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1570233qga; Thu, 4 Aug 2016 12:58:27 -0700 (PDT) X-Received: by 10.98.56.207 with SMTP id f198mr128742025pfa.83.1470340707532; Thu, 04 Aug 2016 12:58:27 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id i69si16073819pfj.269.2016.08.04.12.58.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Aug 2016 12:58:27 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-433263-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-433263-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-433263-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; q=dns; s=default; b=OCsVK5ac3TYh960jvL +z4x/vCHZUgjKH+n9QhB6IQMFLz1qJ1LcFdaQ68uDWrDCoZqHIeIIYavrmpV6LYP 06kk3iIqnzRcMu0iaL6Zmp6SnNMoYNkIWRN4BXhhk2KDjn6+DdSy3e746+m0jMKW NrRIm7VPlghNu0eHUX6gPEnnI= 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 :mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; s=default; bh=2UHslObhZ4tIfKToOf/cqvf1 Kkc=; b=RM3yIaMF6inA1K2PO8krI6e4tgIxjQMLhd9JJk/dzCXVQyIzkmMnZCu3 ZmbB72y2Si/H/PdPKBH5nAdJDrrg0sHu+6Zj0RS9JGkoPn2L/EJQR77vJe/IKdeF EzmZTXKeDo1HWbAfZLfVeCPoQ8BWFJwwwipXICQq7jkeBKwzvhg= Received: (qmail 28040 invoked by alias); 4 Aug 2016 19:58:16 -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 28025 invoked by uid 89); 4 Aug 2016 19:58:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-io0-f169.google.com Received: from mail-io0-f169.google.com (HELO mail-io0-f169.google.com) (209.85.223.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 04 Aug 2016 19:58:04 +0000 Received: by mail-io0-f169.google.com with SMTP id m101so280694279ioi.2 for ; Thu, 04 Aug 2016 12:58:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=OQMClWSbqaK9ccemW9MFUIUAUwlmABjpYln7D83kzbQ=; b=Yc366yxz1gAB+wtUUz3l39nmKtTpXUUaWrcXA6hKAPN7X9mD7UH4CKC59K4giOQn0+ 7RMJ+VwojOmgunvCsV9v+3A/iCpwjP0uiY4zf+29fo1RaWgDWlC9z/IYzeYkwQKSfR0b mIvrt3N9G7I4HV/pXWYSmZR762q83F41CsLqFmdugK7HZIgVCWupAseAXlZoouDZxphA V37xD0cM7r/sk+gxdxGY4XLyjVLI9h+GRdOq0cMRHpMNy5hn1kyGOJy3aiW8xoM4QoMx v2h9lvGnQGcZj0btxbl00GL9QP9EdvZZ3yPQuKVXl+6LF2BdOuUX+cIgdXdLNQFTQyo9 tZMg== X-Gm-Message-State: AEkoouv3Fymdf8ggaEEgDz0qICqvFuTN6//oc7gIXX+7xZh3neEY5OlnUWOY4luAq07x62rArsP7Ba2dx/5a24Vw X-Received: by 10.107.14.2 with SMTP id 2mr72169234ioo.181.1470340682687; Thu, 04 Aug 2016 12:58:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.208.18 with HTTP; Thu, 4 Aug 2016 12:58:02 -0700 (PDT) In-Reply-To: References: From: Prathamesh Kulkarni Date: Fri, 5 Aug 2016 01:28:02 +0530 Message-ID: Subject: Re: [tree-ssa-ccp] modify extend_mask to extend bits based on signop To: Richard Biener , gcc Patches X-IsSubscribed: yes Ah, the mail failed to be delivered to gcc-patches, sorry for the double-post. On 5 August 2016 at 01:26, Prathamesh Kulkarni wrote: > Hi, > Is the attached patch OK ? > Since we want to extend based on signop, I removed ORing with wi::mask(). > Bootstrap+test passes on x86_64-unknown-linux-gnu. > Cross-test in progress on arm*-*-* and aarch64*-*-*. > Ok for trunk ? > > Thanks, > Prathamesh 2016-08-04 Prathamesh Kulkarni * tree-ssa-ccp.c (extend_mask): New param sgn. Remove ORing with wi::mask. (get_default_value): Adjust call to extend_mask to pass sign. (evaluate_stmt): Likewise. diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index ae120a8..06e2905 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -234,10 +234,9 @@ debug_lattice_value (ccp_prop_value_t val) /* Extend NONZERO_BITS to a full mask, with the upper bits being set. */ static widest_int -extend_mask (const wide_int &nonzero_bits) +extend_mask (const wide_int &nonzero_bits, signop sgn) { - return (wi::mask (wi::get_precision (nonzero_bits), true) - | widest_int::from (nonzero_bits, UNSIGNED)); + return widest_int::from (nonzero_bits, sgn); } /* Compute a default value for variable VAR and store it in the @@ -287,7 +286,7 @@ get_default_value (tree var) { val.lattice_val = CONSTANT; val.value = build_zero_cst (TREE_TYPE (var)); - val.mask = extend_mask (nonzero_bits); + val.mask = extend_mask (nonzero_bits, TYPE_SIGN (TREE_TYPE (var))); } } } @@ -1937,7 +1936,7 @@ evaluate_stmt (gimple *stmt) { val.lattice_val = CONSTANT; val.value = build_zero_cst (TREE_TYPE (lhs)); - val.mask = extend_mask (nonzero_bits); + val.mask = extend_mask (nonzero_bits, TYPE_SIGN (TREE_TYPE (lhs))); is_constant = true; } else @@ -1948,7 +1947,8 @@ evaluate_stmt (gimple *stmt) if (nonzero_bits == 0) val.mask = 0; else - val.mask = val.mask & extend_mask (nonzero_bits); + val.mask = val.mask & extend_mask (nonzero_bits, + TYPE_SIGN (TREE_TYPE (lhs))); } } }