From patchwork Wed Jan 15 21:51:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Stump X-Patchwork-Id: 311308 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 827D82C007A for ; Thu, 16 Jan 2014 08:51:50 +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 :content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; q=dns; s= default; b=c1KuVrvP54e03y8kAPFRhuRR12BVEOrbg9dc3Syn7BMB31NTLeMqL Uz3ZQSJC6QuTBXlhjJR4+8nl/pCHcXznjK5hWEJMxXqGnuMlVofEJgyM29KxyPpk f3RdxhPkKmAtvQNP34zW1eRda1UspA5Q/PmMl2tie/Q2BSt8JZmYLs= 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 :content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=default; bh=jeBS329rrmekcAA/AZAz5IMl5Fw=; b=gVxq8LhuFI3uX2RoGBSdbmxVowTq YXXduMGbtcB/jXI66LDZr6aWC3FuTYjPyWm2tiX6R0OyUfWt2PvJhIqZXHOXsRHK ptyqfnD+8CMJU/4E0u+mONkKA5nxvHbnsPid+L4ee7hcl92AWB5Lux1c9o7un1I4 fwA5wkM/lctSLns= Received: (qmail 18752 invoked by alias); 15 Jan 2014 21:51:43 -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 18741 invoked by uid 89); 15 Jan 2014 21:51:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: qmta14.emeryville.ca.mail.comcast.net Received: from qmta14.emeryville.ca.mail.comcast.net (HELO qmta14.emeryville.ca.mail.comcast.net) (76.96.27.212) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 15 Jan 2014 21:51:42 +0000 Received: from omta20.emeryville.ca.mail.comcast.net ([76.96.30.87]) by qmta14.emeryville.ca.mail.comcast.net with comcast id EJHX1n0041smiN4AEMrhye; Wed, 15 Jan 2014 21:51:41 +0000 Received: from up.mrs.kithrup.com ([24.4.193.8]) by omta20.emeryville.ca.mail.comcast.net with comcast id EMrf1n00d0BKwT48gMrg5g; Wed, 15 Jan 2014 21:51:40 +0000 Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Subject: Re: [wide-int] resolve bootstrap issue From: Mike Stump In-Reply-To: <874n56k2le.fsf@sandifor-thinkpad.stglab.manchester.uk.ibm.com> Date: Wed, 15 Jan 2014 13:51:39 -0800 Cc: "gcc-patches\@gcc.gnu.org Patches" Message-Id: <8186E313-3627-46CA-9301-44AAC5F14D99@comcast.net> References: <925647AB-F4A2-484B-8CDA-010C0DE847BF@comcast.net> <874n56k2le.fsf@sandifor-thinkpad.stglab.manchester.uk.ibm.com> To: Richard Sandiford X-IsSubscribed: yes On Jan 14, 2014, at 7:25 AM, Richard Sandiford wrote: > Mike Stump writes: >> diff --git a/gcc/expmed.c b/gcc/expmed.c >> index ce063eb..720d8c1 100644 >> --- a/gcc/expmed.c >> +++ b/gcc/expmed.c >> @@ -4963,6 +4963,7 @@ make_tree (tree type, rtx x) >> return t; >> >> case CONST_DOUBLE: >> + gcc_assert (HOST_BITS_PER_WIDE_INT * 2 <= MAX_BITSIZE_MODE_ANY_INT); >> if (TARGET_SUPPORTS_WIDE_INT == 0 && GET_MODE (x) == VOIDmode) >> t = wide_int_to_tree (type, >> wide_int::from_array (&CONST_DOUBLE_LOW (x), 2, > > I think this would be better as a STATIC_ASSERT. The cost should be the same in generated code. The C folks can read and understand the gcc_assert easier, and the static property of the check we don't make any use of. I could change it, but there are 0 of these in *.c presently, and I think we want to tread lightly on those folks that know and like C, and don't want gcc to be `different' for no good reason. That said, if people think it would be good to use it, I'd be happy to change it. >> @@ -1440,10 +1442,10 @@ real_to_integer (const REAL_VALUE_TYPE *r, bool *fail, int precision) >> } >> #endif >> w = SIGSZ * HOST_BITS_PER_LONG + words * HOST_BITS_PER_WIDE_INT; >> - result = wide_int::from_array >> + tmp = real_int::from_array >> (val, (w + HOST_BITS_PER_WIDE_INT - 1) / HOST_BITS_PER_WIDE_INT, w); >> - result = wi::lrshift (result, (words * HOST_BITS_PER_WIDE_INT) - exp); >> - result = wide_int::from (result, precision, UNSIGNED); >> + tmp = wi::lrshift (tmp, (words * HOST_BITS_PER_WIDE_INT) - exp); >> + result = wide_int::from (tmp, precision, UNSIGNED); > > Why did you need the ? It was supposed to work without. The code in question needs something that is max int + max significand real in size, we made the max int smaller (smaller than this quantity on x86) so, this code needs a special wide int that is bigger. The type is free as vrp uses the same type. As for why Kenny choose this method, I'd defer to him. >> diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c >> index 00b5439..7c21afa 100644 >> --- a/gcc/simplify-rtx.c >> +++ b/gcc/simplify-rtx.c >> @@ -5384,6 +5384,7 @@ simplify_immed_subreg (enum machine_mode outermode, rtx op, >> tmp[u] = buf; >> base += HOST_BITS_PER_WIDE_INT; >> } >> + gcc_assert (GET_MODE_PRECISION (outer_submode) <= MAX_BITSIZE_MODE_ANY_INT); >> r = wide_int::from_array (tmp, units, >> GET_MODE_PRECISION (outer_submode)); >> elems[elem] = immed_wide_int_const (r, outer_submode); > > Long line. Fixed: Thanks for the review. Index: simplify-rtx.c =================================================================== --- simplify-rtx.c (revision 206601) +++ simplify-rtx.c (working copy) @@ -5384,7 +5384,8 @@ simplify_immed_subreg (enum machine_mode tmp[u] = buf; base += HOST_BITS_PER_WIDE_INT; } - gcc_assert (GET_MODE_PRECISION (outer_submode) <= MAX_BITSIZE_MODE_ANY_INT); + gcc_assert (GET_MODE_PRECISION (outer_submode) + <= MAX_BITSIZE_MODE_ANY_INT); r = wide_int::from_array (tmp, units, GET_MODE_PRECISION (outer_submode)); elems[elem] = immed_wide_int_const (r, outer_submode);