From patchwork Sat Nov 9 10:57:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 289968 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 523062C00AD for ; Sat, 9 Nov 2013 21:57:22 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type; q=dns; s=default; b=KJqBRxeiBJeJ0YzUbnQ6e/AIJb6wXo9vE5Xvd09rxGdFCx4APG iKR5JrluTQWDkQbYscodyzizWmNaG6N5Rw2FTxCB2N8RYTOTUY794aaAtuenJaOx 95KEp7KOPjZX/wRnQKd5dpE9lFEb2YThNO4fKRwRKPvQ0o1WyKqxOu0IM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type; s= default; bh=5Fw8OUwxw1V9LTcvov9RsXrzG6c=; b=plgD9VP29auaUpyek+ks uEAgjZIoFMiRMVfvYXHwvQ6rQTa8nRiBx/a7hWojrBurmKCMrAarIHgBN/JZV/cf p5suiD+ZUGwPJbpzZYrJO0MSrTpUOqrRwYP6Np5yeDvYJY3k4FfxE2c9nIJc9TWE NXD1TBf3X6n9E4Mp3yAVVto= Received: (qmail 10909 invoked by alias); 9 Nov 2013 10:57:13 -0000 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 Received: (qmail 10900 invoked by uid 89); 9 Nov 2013 10:57:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=AWL, BAYES_20, FREEMAIL_FROM, RDNS_NONE, SPF_PASS, URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: mail-wi0-f175.google.com Received: from Unknown (HELO mail-wi0-f175.google.com) (209.85.212.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 09 Nov 2013 10:57:11 +0000 Received: by mail-wi0-f175.google.com with SMTP id hm11so417916wib.2 for ; Sat, 09 Nov 2013 02:57:02 -0800 (PST) X-Received: by 10.194.89.233 with SMTP id br9mr15435164wjb.15.1383994622616; Sat, 09 Nov 2013 02:57:02 -0800 (PST) Received: from localhost ([2.28.235.51]) by mx.google.com with ESMTPSA id ev4sm13968486wib.7.2013.11.09.02.57.01 for (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128/128); Sat, 09 Nov 2013 02:57:02 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, zadeck@naturalbridge.com, mikestump@comcast.net, rdsandiford@googlemail.com Cc: zadeck@naturalbridge.com, mikestump@comcast.net Subject: [wide-int] Use MAX_MODE_INT rather than mode_for_size Date: Sat, 09 Nov 2013 10:57:01 +0000 Message-ID: <87d2m9g7wi.fsf@talisman.default> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 "mode_for_size (MAX_BITSIZE_MODE_ANY_INT, MODE_INT, 0)" isn't safe because the widest mode might not have an integer counterpart. We can get the widest integer mode directly using MAX_MODE_INT. Tested on powerpc64-linux-gnu and by rerunning the assembly comparison. OK to install? Thanks, Richard Index: gcc/simplify-rtx.c =================================================================== --- gcc/simplify-rtx.c 2013-11-09 09:39:28.925815686 +0000 +++ gcc/simplify-rtx.c 2013-11-09 09:39:29.461819309 +0000 @@ -1619,7 +1619,7 @@ simplify_const_unary_operation (enum rtx a dangerous assumption as many times CONST_INTs are created and used with garbage in the bits outside of the precision of the implied mode of the const_int. */ - op_mode = mode_for_size (MAX_BITSIZE_MODE_ANY_INT, MODE_INT, 0); + op_mode = MAX_MODE_INT; } real_from_integer (&d, mode, std::make_pair (op, op_mode), SIGNED); @@ -1637,7 +1637,7 @@ simplify_const_unary_operation (enum rtx a dangerous assumption as many times CONST_INTs are created and used with garbage in the bits outside of the precision of the implied mode of the const_int. */ - op_mode = mode_for_size (MAX_BITSIZE_MODE_ANY_INT, MODE_INT, 0); + op_mode = MAX_MODE_INT; } real_from_integer (&d, mode, std::make_pair (op, op_mode), UNSIGNED);