From patchwork Thu Sep 18 18:57:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schmidt X-Patchwork-Id: 390927 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 CA82B14016B for ; Fri, 19 Sep 2014 04:59:24 +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:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=ixzyrXoFcYmBKKICk nbUxTZIfnBW1xy6D+lvqqEf91UE+WVhQNKgBBr+gtvn7EfrPjSxWKmAcENpjNzwx QToJ3NVEIJI6T9ngt9QSDgVpzQNb/KLcH/v1MIwhOBf6Jr3tRo+loSPNvchEpZWv tXN6HYTWm4XJb85cD6us2KD6WM= 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:cc:subject:references :in-reply-to:content-type; s=default; bh=EnQf+r2jEaWcFHcE86i1w6F xUk0=; b=uq4i/JtBxj7LbFjr9iN2z/cLBqIIQnlKBo7l61hxboq/PC8xeYSI6XK 3tQEdN4EJs9Y3TRroUPVDsLdZpm4OPbWkjI4wVWAm9/TqEQB5PKN1xFBP/xmT7gn drZ5mk+0hRirfPadtDyL0Ulw2Pb7q5RFBFj4KoTWObooXjyZ/wEw= Received: (qmail 3769 invoked by alias); 18 Sep 2014 18:59:17 -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 3757 invoked by uid 89); 18 Sep 2014 18:59:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 18 Sep 2014 18:59:15 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1XUgv9-0001Uz-9G from Bernd_Schmidt@mentor.com ; Thu, 18 Sep 2014 11:59:11 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.181.6; Thu, 18 Sep 2014 19:59:09 +0100 Message-ID: <541B2B36.6070102@codesourcery.com> Date: Thu, 18 Sep 2014 20:57:58 +0200 From: Bernd Schmidt User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.8.0 MIME-Version: 1.0 To: Richard Biener CC: Steven Bosscher , GCC Patches Subject: Re: ptx preliminary rtl patches [3/4] References: <5411A31E.3030207@codesourcery.com> <5411C884.4090803@codesourcery.com> <5411CB7E.2040000@codesourcery.com> <5411CFA2.6030002@codesourcery.com> In-Reply-To: On 09/12/2014 10:04 AM, Richard Biener wrote: > On Thu, Sep 11, 2014 at 6:36 PM, Bernd Schmidt wrote: >> I strongly disagree. It's the same as for any other integer - there's one >> sign bit, and since there aren't any other bits, the number of sign bit >> copies is always exactly 1. > > I agree about that. But I fail to see what goes wrong with the existing > code in combine. Maybe the code simply doesn't work for > GET_MODE_PRECISION != GET_MODE_BITSIZE? I had to debug it again - the patch was a year old. This time I came to the conclusion that we're just using the wrong mode. We're trying to simplify (ne:BI (reg:HI x) (const_int 0)), and the code here was using BImode when calling num_sign_bit_copies for the register - what I think it wants to do is verify that the operand consists of all zeros or all ones. Digging a bit further I noticed that some of the cases around this code have a mode == GET_MODE (op0) test. These were added by rth in commit 3573fd048, which added BImode. It looks like this particular case slipped through the cracks. The easiest way to fix it is the below - bootstrapped and tested on x86_64-linux, ok if it also works with ptx? Bernd commit 3e1c88a4a16ccccc768e11fd56b881ed577fba33 Author: Bernd Schmidt Date: Tue Sep 16 21:04:55 2014 +0200 * combine.c (combine_simplify_rtx): In STORE_FLAG_VALUE == -1 case, also verify that mode is equal to the mode of op0. diff --git a/gcc/combine.c b/gcc/combine.c index 04863cb..efdd638 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -5801,10 +5801,11 @@ combine_simplify_rtx (rtx x, enum machine_mode op0_mode, int in_dest, ; else if (STORE_FLAG_VALUE == -1 - && new_code == NE && GET_MODE_CLASS (mode) == MODE_INT - && op1 == const0_rtx - && (num_sign_bit_copies (op0, mode) - == GET_MODE_PRECISION (mode))) + && new_code == NE && GET_MODE_CLASS (mode) == MODE_INT + && op1 == const0_rtx + && mode == GET_MODE (op0) + && (num_sign_bit_copies (op0, mode) + == GET_MODE_PRECISION (mode))) return gen_lowpart (mode, expand_compound_operation (op0));