From patchwork Tue Mar 22 12:30:05 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Froyd X-Patchwork-Id: 87907 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 E1DBAB6F7C for ; Tue, 22 Mar 2011 23:30:20 +1100 (EST) Received: (qmail 12455 invoked by alias); 22 Mar 2011 12:30:16 -0000 Received: (qmail 12435 invoked by uid 22791); 22 Mar 2011 12:30:14 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 22 Mar 2011 12:30:09 +0000 Received: (qmail 25144 invoked from network); 22 Mar 2011 12:30:07 -0000 Received: from unknown (HELO codesourcery.com) (froydnj@127.0.0.2) by mail.codesourcery.com with ESMTPA; 22 Mar 2011 12:30:07 -0000 Date: Tue, 22 Mar 2011 08:30:05 -0400 From: Nathan Froyd To: gcc-patches@gcc.gnu.org Subject: [PATCH] use W_TYPE_SIZE more in libgcc Message-ID: <20110322123003.GA6010@nightcrawler> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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 There are several places in libgcc where the expression 'sizeof (Wtype) * BITS_PER_UNIT' is used. We have a perfectly good expression, W_TYPE_SIZE, for this; the patch below replaces the sizeof expression with W_TYPE_SIZE. Tested on x86_64-unknown-linux-gnu. I think this counts as obvious, so I will be committing it in the absence of comments. -Nathan * libgcc2.c (__lshrdi3, __ashldi3, __ashrdi3): Use W_TYPE_SIZE. (__ffsDI2): Likewise. Index: gcc/libgcc2.c =================================================================== --- gcc/libgcc2.c (revision 171278) +++ gcc/libgcc2.c (working copy) @@ -407,7 +407,7 @@ __lshrdi3 (DWtype u, shift_count_type b) return u; const DWunion uu = {.ll = u}; - const shift_count_type bm = (sizeof (Wtype) * BITS_PER_UNIT) - b; + const shift_count_type bm = W_TYPE_SIZE - b; DWunion w; if (bm <= 0) @@ -435,7 +435,7 @@ __ashldi3 (DWtype u, shift_count_type b) return u; const DWunion uu = {.ll = u}; - const shift_count_type bm = (sizeof (Wtype) * BITS_PER_UNIT) - b; + const shift_count_type bm = W_TYPE_SIZE - b; DWunion w; if (bm <= 0) @@ -463,13 +463,13 @@ __ashrdi3 (DWtype u, shift_count_type b) return u; const DWunion uu = {.ll = u}; - const shift_count_type bm = (sizeof (Wtype) * BITS_PER_UNIT) - b; + const shift_count_type bm = W_TYPE_SIZE - b; DWunion w; if (bm <= 0) { /* w.s.high = 1..1 or 0..0 */ - w.s.high = uu.s.high >> (sizeof (Wtype) * BITS_PER_UNIT - 1); + w.s.high = uu.s.high >> (W_TYPE_SIZE - 1); w.s.low = uu.s.high >> -bm; } else @@ -534,7 +534,7 @@ __ffsDI2 (DWtype u) if (uu.s.low != 0) word = uu.s.low, add = 0; else if (uu.s.high != 0) - word = uu.s.high, add = BITS_PER_UNIT * sizeof (Wtype); + word = uu.s.high, add = W_TYPE_SIZE; else return 0;