From patchwork Wed Dec 8 14:28:53 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 74722 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 04C55B70A4 for ; Thu, 9 Dec 2010 01:29:05 +1100 (EST) Received: (qmail 13508 invoked by alias); 8 Dec 2010 14:29:03 -0000 Received: (qmail 13499 invoked by uid 22791); 8 Dec 2010 14:29:02 -0000 X-SWARE-Spam-Status: No, hits=-3.4 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 08 Dec 2010 14:28:55 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) by mx2.suse.de (Postfix) with ESMTP id 57F8887567 for ; Wed, 8 Dec 2010 15:28:53 +0100 (CET) Date: Wed, 8 Dec 2010 15:28:53 +0100 (CET) From: Richard Guenther To: gcc-patches@gcc.gnu.org Subject: [PATCH] Speedup copy_reference_ops_from_ref Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 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 This halves the time spent in copy_reference_ops_from_ref for infcodes.c. The trick is to use a shift when dividing/multiplying by BITS_PER_UNIT as done elsewhere. I'll apply this after bootstrapping and testing on x86_64-unknown-linux-gnu. Thanks, Richard. 2010-12-08 Richard Guenther * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Use a shift instead of a division to divide by BITS_PER_UNIT. Index: gcc/tree-ssa-sccvn.c =================================================================== --- gcc/tree-ssa-sccvn.c (revision 167583) +++ gcc/tree-ssa-sccvn.c (working copy) @@ -644,10 +644,11 @@ copy_reference_ops_from_ref (tree ref, V { double_int off = double_int_add (tree_to_double_int (this_offset), - double_int_sdiv + double_int_rshift (tree_to_double_int (bit_offset), - uhwi_to_double_int (BITS_PER_UNIT), - TRUNC_DIV_EXPR)); + BITS_PER_UNIT == 8 + ? 3 : exact_log2 (BITS_PER_UNIT), + HOST_BITS_PER_DOUBLE_INT, true)); if (double_int_fits_in_shwi_p (off)) temp.off = off.low; }