From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13935 invoked by alias); 4 Sep 2014 13:00:40 -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 13924 invoked by uid 89); 4 Sep 2014 13:00:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-we0-f176.google.com Received: from mail-we0-f176.google.com (HELO mail-we0-f176.google.com) (74.125.82.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 04 Sep 2014 13:00:38 +0000 Received: by mail-we0-f176.google.com with SMTP id q59so10139255wes.21 for ; Thu, 04 Sep 2014 06:00:35 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.194.221.74 with SMTP id qc10mr5764826wjc.39.1409835634572; Thu, 04 Sep 2014 06:00:34 -0700 (PDT) Received: by 10.194.20.69 with HTTP; Thu, 4 Sep 2014 06:00:34 -0700 (PDT) In-Reply-To: <5407DF57.2040902@linaro.org> References: <53FEDF34.4090605@linaro.org> <5407DF57.2040902@linaro.org> Date: Thu, 04 Sep 2014 13:00:00 -0000 Message-ID: Subject: Re: [PATCH 2/2] Enable elimination of zext/sext From: Richard Biener To: Kugan Cc: Uros Bizjak , "gcc-patches@gcc.gnu.org" , Jakub Jelinek Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2014-09/txt/msg00338.txt.bz2 On Thu, Sep 4, 2014 at 5:41 AM, Kugan w= rote: >>> I added this part of the code (in cfgexpand.c) to handle binary/unary/.. >>> gimple operations and used the LHS value range to infer the assigned >>> value range. I will revert this part of the code as this is wrong. >>> >>> I dont think checking promoted_mode for temp will be necessary here as >>> convert_move will handle it correctly if promoted_mode is set for temp. >>> >>> Thus, I will reimplement setting promoted_mode to temp (in >>> expand_expr_real_2) based on the gimple statement content on RHS. i.e. >>> by looking at the RHS operands and its value ranges and by calculating >>> the resulting value range. Does this sound OK to you. >> >> No, this sounds backward again and won't work because those operands >> again could be just truncated - thus you can't rely on their value-range. >> >> What you would need is VRP computing value-ranges in the promoted >> mode from the start (and it doesn't do that). > > > Hi Richard, > > Here is an attempt to do the value range computation in promoted_mode's > type when it is overflowing. Bootstrapped on x86-84. Err - I think you misunderstood this as a suggestion to do this ;) value-ranges should be computed according to the type not according to the (promoted) mode. Otherwise we will miss optimization opportunities. Richard. > Based on your feedback, I will do more testing on this. > > Thanks for your time, > Kugan > > =EF=BB=BFgcc/ChangeLog: > > 2014-09-04 Kugan Vivekanandarajah > > * tree-ssa-ccp.c (ccp_finalize): Adjust the nonzero_bits precisio= n to > the type. > (evaluate_stmt): Likewise. > * tree-ssanames.c (set_range_info): Adjust if the precision of st= ored > value range is different. > * tree-vrp.c (normalize_int_cst_precision): New function. > (set_value_range): Add assert to check precision. > (set_and_canonicalize_value_range): Call normalize_int_cst_precis= ion > on min and max. > (promoted_type): New function. > (promote_unary_vr): Likewise. > (promote_binary_vr): Likewise. > (extract_range_from_binary_expr_1): Adjust type to match value ra= nge. > Store value ranges in promoted type if they overflow. > (extract_range_from_unary_expr_1): Likewise. > (adjust_range_with_scev): Call normalize_int_cst_precision > on min and max. > (vrp_visit_assignment_or_call): Likewise. > (simplify_bit_ops_using_ranges): Adjust the value range precision. > (test_for_singularity): Likewise. > (simplify_stmt_for_jump_threading): Likewise. > (extract_range_from_assert): Likewise.