From patchwork Wed Nov 10 16:55:45 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joern Rennecke X-Patchwork-Id: 70649 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 37AA7B70F9 for ; Thu, 11 Nov 2010 03:55:57 +1100 (EST) Received: (qmail 27237 invoked by alias); 10 Nov 2010 16:55:54 -0000 Received: (qmail 27131 invoked by uid 22791); 10 Nov 2010 16:55:52 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from c60.cesmail.net (HELO c60.cesmail.net) (216.154.195.49) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 10 Nov 2010 16:55:47 +0000 Received: from unknown (HELO epsilon2) ([192.168.1.60]) by c60.cesmail.net with ESMTP; 10 Nov 2010 11:55:45 -0500 Received: from 89.241.153.186 ([89.241.153.186]) by webmail.spamcop.net (Horde MIME library) with HTTP; Wed, 10 Nov 2010 11:55:45 -0500 Message-ID: <20101110115545.dguw6mjogg0owc0k-nzlynne@webmail.spamcop.net> Date: Wed, 10 Nov 2010 11:55:45 -0500 From: Joern Rennecke To: gcc-patches@gcc.gnu.org Subject: RFA: Fix middle-end/44769 MIME-Version: 1.0 User-Agent: Internet Messaging Program (IMP) H3 (4.1.4) 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 Bootstrapping on i686-pc-linux-gnu. We get the warnings for code that is dead, but the warnings get emitted anyways because we use effectively if (0) rather than #if 0. By assigning the shift count to a variable first, we can avoid the warning for the dead code. Although we could split the shift or use a conditional, that doesn't look that good an option here, because BITS_PER_WORD is not always a constant; for some targets, it depends on a gcc option. So far, we've evaluated BITS_PER_WORD in this piece of code twice. Using a split shift or a conditional, we'd evaluate it at least four times. Moreover, for a split shift count, we'd have the added awkwardness what to do to make it safe for future targets with add BITS_PER_WORD (not counting 36, 20 or 22 as odd in this context ;-). By assigning BITS_PER_UNIT to a variable first, we evaluate it only once. 2010-11-10 Joern Rennecke PR middle-end/44769 * final.c (split_double): Don't use BITS_PER_WORD directly in shift count. Index: final.c =================================================================== --- final.c (revision 166491) +++ final.c (working copy) @@ -3807,10 +3807,11 @@ split_double (rtx value, rtx *first, rtx Sign extend each half to HOST_WIDE_INT. */ unsigned HOST_WIDE_INT low, high; unsigned HOST_WIDE_INT mask, sign_bit, sign_extend; + unsigned bits_per_word = BITS_PER_WORD; /* Set sign_bit to the most significant bit of a word. */ sign_bit = 1; - sign_bit <<= BITS_PER_WORD - 1; + sign_bit <<= bits_per_word - 1; /* Set mask so that all bits of the word are set. We could have used 1 << BITS_PER_WORD instead of basing the @@ -3833,7 +3834,7 @@ split_double (rtx value, rtx *first, rtx /* Pick the higher word, shifted to the least significant bits, and sign-extend it. */ high = INTVAL (value); - high >>= BITS_PER_WORD - 1; + high >>= bits_per_word - 1; high >>= 1; high &= mask; if (high & sign_bit)