From patchwork Mon Aug 1 23:30:23 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 107829 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]) by ozlabs.org (Postfix) with SMTP id EDB8FB70F5 for ; Tue, 2 Aug 2011 09:30:45 +1000 (EST) Received: (qmail 5219 invoked by alias); 1 Aug 2011 23:30:43 -0000 Received: (qmail 5202 invoked by uid 22791); 1 Aug 2011 23:30:41 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from acsinet15.oracle.com (HELO acsinet15.oracle.com) (141.146.126.227) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 01 Aug 2011 23:30:27 +0000 Received: from rtcsinet22.oracle.com (rtcsinet22.oracle.com [66.248.204.30]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p71NUM3X020837 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 1 Aug 2011 23:30:24 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by rtcsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p71NULOc025767 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 1 Aug 2011 23:30:22 GMT Received: from abhmt118.oracle.com (abhmt118.oracle.com [141.146.116.70]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p71NUGPQ013192; Mon, 1 Aug 2011 18:30:16 -0500 Received: from [192.168.1.4] (/79.53.13.39) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 01 Aug 2011 16:30:15 -0700 Message-ID: <4E37370F.2020702@oracle.com> Date: Tue, 02 Aug 2011 01:30:23 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: "Joseph S. Myers" , Richard Guenther Subject: [PATCH] bootstrap/49914 X-IsSubscribed: yes 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 Hi, I bootstrapped and I'm currently finishing testing on x86_64-linux the below. Is it Ok for mainline? Thanks, Paolo. /////////////////////// 2011-08-02 Paolo Carlini PR bootstrap/49914 * fold-const.c (fold_plusminus_mult_expr): Use abs_hwi instead of abs. * tree-ssa-math-opts.c (gimple_expand_builtin_pow): Likewise. * tree-ssa-loop-prefetch.c (prune_ref_by_group_reuse): Likewise. Index: fold-const.c =================================================================== --- fold-const.c (revision 177075) +++ fold-const.c (working copy) @@ -7037,8 +7037,7 @@ fold_plusminus_mult_expr (location_t loc, enum tre int11 = TREE_INT_CST_LOW (arg11); /* Move min of absolute values to int11. */ - if ((int01 >= 0 ? int01 : -int01) - < (int11 >= 0 ? int11 : -int11)) + if (abs_hwi (int01) < abs_hwi (int11)) { tmp = int01, int01 = int11, int11 = tmp; alt0 = arg00, arg00 = arg10, arg10 = alt0; @@ -7048,7 +7047,7 @@ fold_plusminus_mult_expr (location_t loc, enum tre else maybe_same = arg11; - if (exact_log2 (abs (int11)) > 0 && int01 % int11 == 0 + if (exact_log2 (abs_hwi (int11)) > 0 && int01 % int11 == 0 /* The remainder should not be a constant, otherwise we end up folding i * 4 + 2 to (i * 2 + 1) * 2 which has increased the number of multiplications necessary. */ Index: tree-ssa-math-opts.c =================================================================== --- tree-ssa-math-opts.c (revision 177075) +++ tree-ssa-math-opts.c (working copy) @@ -1231,7 +1231,7 @@ gimple_expand_builtin_pow (gimple_stmt_iterator *g /* Attempt to fold powi(arg0, abs(n/2)) into multiplies. If not possible or profitable, give up. Skip the degenerate case when n is 1 or -1, where the result is always 1. */ - if (abs (n) != 1) + if (abs_hwi (n) != 1) { powi_x_ndiv2 = gimple_expand_builtin_powi (gsi, loc, arg0, abs(n/2)); if (!powi_x_ndiv2) @@ -1242,7 +1242,7 @@ gimple_expand_builtin_pow (gimple_stmt_iterator *g result of the optimal multiply sequence just calculated. */ sqrt_arg0 = build_and_insert_call (gsi, loc, &target, sqrtfn, arg0); - if (abs (n) == 1) + if (abs_hwi (n) == 1) result = sqrt_arg0; else result = build_and_insert_binop (gsi, loc, target, MULT_EXPR, @@ -1284,10 +1284,10 @@ gimple_expand_builtin_pow (gimple_stmt_iterator *g /* Attempt to fold powi(arg0, abs(n/3)) into multiplies. If not possible or profitable, give up. Skip the degenerate case when abs(n) < 3, where the result is always 1. */ - if (abs (n) >= 3) + if (abs_hwi (n) >= 3) { powi_x_ndiv3 = gimple_expand_builtin_powi (gsi, loc, arg0, - abs (n / 3)); + abs_hwi (n / 3)); if (!powi_x_ndiv3) return NULL_TREE; } @@ -1297,14 +1297,14 @@ gimple_expand_builtin_pow (gimple_stmt_iterator *g either cbrt(x) or cbrt(x) * cbrt(x). */ cbrt_x = build_and_insert_call (gsi, loc, &target, cbrtfn, arg0); - if (abs (n) % 3 == 1) + if (abs_hwi (n) % 3 == 1) powi_cbrt_x = cbrt_x; else powi_cbrt_x = build_and_insert_binop (gsi, loc, target, MULT_EXPR, cbrt_x, cbrt_x); /* Multiply the two subexpressions, unless powi(x,abs(n)/3) = 1. */ - if (abs (n) < 3) + if (abs_hwi (n) < 3) result = powi_cbrt_x; else result = build_and_insert_binop (gsi, loc, target, MULT_EXPR, Index: tree-ssa-loop-prefetch.c =================================================================== --- tree-ssa-loop-prefetch.c (revision 177075) +++ tree-ssa-loop-prefetch.c (working copy) @@ -1,5 +1,6 @@ /* Array prefetching. - Copyright (C) 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2005, 2007, 2008, 2009, 2010, 2011 + Free Software Foundation, Inc. This file is part of GCC. @@ -794,7 +795,7 @@ prune_ref_by_group_reuse (struct mem_ref *ref, str prefetch_before = (hit_from - delta_r + step - 1) / step; /* Do not reduce prefetch_before if we meet beyond cache size. */ - if (prefetch_before > (unsigned) abs (L2_CACHE_SIZE_BYTES / step)) + if (prefetch_before > (unsigned) abs_hwi (L2_CACHE_SIZE_BYTES / step)) prefetch_before = PREFETCH_ALL; if (prefetch_before < ref->prefetch_before) ref->prefetch_before = prefetch_before;