From patchwork Sat Aug 24 20:46:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kenneth Zadeck X-Patchwork-Id: 269669 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 7B11F2C00A4 for ; Sun, 25 Aug 2013 06:46:17 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type; q=dns; s=default; b=hbH8jpdB+w5cuwArB XjYC+BITMY/9RQJUvwCaW99J5nhApq5SwJz7pjAdzXlOvWdT/evk5+DbO0APCOc8 zExm5OabRhHd34zAGqLkiK0yagZeghNIkceWq/bOuFFKWVp9cDBp/JgY8LZp6fW6 mTcHoMY91mG+4unz1MD8jJiIeo= 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 :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type; s=default; bh=q/J815cRaXMI37Fm/54o9GN KR94=; b=YHIc0Bf2aGVtgdfQqNgBuWcU8EHtX0v5u22F2z/nojCW3iyojTGQaYd 2ypXy8m386Q49XqXm1Djwk3dxI1K2RdGTWejlyjIRVDMbWrCu9Rx13xiGrgznqTf bBnHVP+52CpgEYOM03wGtmegWDCYTuXo2rh6tU2Sp6GkjWpHxBKI= Received: (qmail 11457 invoked by alias); 24 Aug 2013 20:46:11 -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 11447 invoked by uid 89); 24 Aug 2013 20:46:10 -0000 X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE autolearn=ham version=3.3.2 Received: from mail-ie0-f177.google.com (HELO mail-ie0-f177.google.com) (209.85.223.177) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sat, 24 Aug 2013 20:46:10 +0000 Received: by mail-ie0-f177.google.com with SMTP id e14so2883893iej.36 for ; Sat, 24 Aug 2013 13:46:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type; bh=bOU21ybL1x2AHBBlDSMlbpVhk9eSFpR313VbwEO/KjI=; b=NVAFgI901YrEisOEMcAKxK7rWk8oBiLtQ8F2wv5Us3vHdnn14n4lHjrBlmp6/jhFDY D8kEfq3RoYTMThaAtxs5pdDE/I7upOdvIh2tDQ91SyjPurK0LUNaUBqpWu5WBgIEvi0K 63aLxSqJdfsw/TJ7dTfDPB20SHPwubTUe7DSEpHt6MALQS5U/0832F8iUEuULe+di0W4 gkVYIhqyLMGjBcj9ja6mONUBhoqtUgjkB451unH06eOVpYB0MnJpTs5UPCrILEh4/mK9 GjEX6g1HCE3l7clIKnRLJ/2tk80m9E3Uvy37torCBE+HLtAnrVBfCUqeglM6apBF1MUu nFJQ== X-Gm-Message-State: ALoCoQmKcnfqlijlji9VjTW6YyOX3oPC2g+jeHtZ8MVollyhPk4v5Nqsu+2X9i7rtJmq/AAqCB39 X-Received: by 10.43.61.199 with SMTP id wx7mr3592186icb.14.1377377168687; Sat, 24 Aug 2013 13:46:08 -0700 (PDT) Received: from moria.site (pool-98-113-157-218.nycmny.fios.verizon.net. [98.113.157.218]) by mx.google.com with ESMTPSA id b5sm6646218igm.3.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 24 Aug 2013 13:46:08 -0700 (PDT) Message-ID: <52191B8E.3060209@naturalbridge.com> Date: Sat, 24 Aug 2013 16:46:06 -0400 From: Kenneth Zadeck User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: rguenther@suse.de, gcc-patches , Mike Stump , r.sandiford@uk.ibm.com, rdsandiford@googlemail.com Subject: Re: wide-int branch now up for public comment and review References: <520A9DCC.6080609@naturalbridge.com> <87ppt4e9hg.fsf@talisman.default> <5217CB03.6010400@naturalbridge.com> <878uzre7y3.fsf@talisman.default> In-Reply-To: <878uzre7y3.fsf@talisman.default> X-Virus-Found: No >>> The patch goes for (1) but (2) seems better to me, for a few reasons: >>> >>> * As above, constants coming from rtl are already in the right form, >>> so if you create a wide_int from an rtx and only query it, no explicit >>> extension is needed. >>> >>> * Things like logical operations and right shifts naturally preserve >>> the sign-extended form, so only a subset of write operations need >>> to take special measures. >> right now the internals of wide-int do not keep the bits above the >> precision clean. as you point out this could be fixed by changing >> lshift, add, sub, mul, div (and anything else i have forgotten about) >> and removing the code that cleans this up on exit. I actually do not >> really care which way we go here but if we do go on keeping the bits >> clean above the precision inside wide-int, we are going to have to clean >> the bits in the constructors from rtl, or fix some/a lot of bugs. >> >> But if you want to go with the stay clean plan you have to start clean, >> so at the rtl level this means copying. and it is the not copying trick >> that pushed me in the direction we went. >> >> At the tree level, this is not an issue. There are no constructors for >> tree-csts that do not have a type and before we copy the rep from the >> wide-int to the tree, we clean the top bits. (BTW - If i had to guess >> what the bug is with the missing messages on the mips port, it would be >> because the front ends HAD a bad habit of creating constants that did >> not fit into a type and then later checking to see if there were any >> interesting bits above the precision in the int-cst. This now does not >> work because we clean out those top bits on construction but it would >> not surprise me if we missed the fixed point constant path.) So at the >> tree level, we could easily go either way here, but there is a cost at >> the rtl level with doing (2). > TBH, I think we should do (2) and fix whatever bugs you saw with invalid > rtx constants. > luckily (or perhaps unluckily) if you try the test it fails pretty quickly - building gcclib on the x86-64. I have enclosed a patch to check this. you can try it your self and see if you really think this is right path. good luck, i fear you may need it. on the other hand, if it is just a few quick bugs, then i will agree that (2) is right path. kenny Index: gcc/wide-int.cc =================================================================== --- gcc/wide-int.cc (revision 201968) +++ gcc/wide-int.cc (working copy) @@ -171,6 +171,10 @@ wide_int_ro::from_rtx (const rtx_mode_t case CONST_INT: result.val[0] = INTVAL (x); result.len = 1; + + if (prec != HOST_BITS_PER_WIDE_INT) + gcc_assert (result.val[0] == sext_hwi (result.val[0], prec)); + #ifdef DEBUG_WIDE_INT debug_wh ("wide_int:: %s = from_rtx ("HOST_WIDE_INT_PRINT_HEX")\n", result, INTVAL (x));