From patchwork Tue Feb 12 22:31:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Miller X-Patchwork-Id: 220001 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 935FA2C0090 for ; Wed, 13 Feb 2013 09:32:02 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1361313122; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: Message-Id:To:Cc:Subject:From:In-Reply-To:References: Mime-Version:Content-Type:Content-Transfer-Encoding:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=J1wCUubZ9sZWTtmowvixfCZ5oEE=; b=OLhMQc7Ixi1V/Nl3eUrI6rMCcCIQcCsdGrkcIZG/SloEEESWIly4592r6v1feI 05Eqw58+nMjLDew7sxreXv3IMYXCG+vOBh45AjwrIU/09mt4kHVuwNh8wrSHOWA/ u7e+O2n96c7Cjko+WvU+uKFsmXiNoTCmKPPhx0k4NHRNc= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Date:Message-Id:To:Cc:Subject:From:In-Reply-To:References:Mime-Version:Content-Type:Content-Transfer-Encoding:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=SDdzuV7Gg2HAMu62r7+OXKUIYkVOMi95NhyiWuSkCZZ/B74vPW5fnZUwhgjNdP sucTSrVrbJy+FnUjrWr+PQf2tQFGuiUNXUrFgphjUhE6hRu1C+S0ODceBc38EHod IxoHc2hgBMWzHqbz1chN0lt5X2jx/AwDx+uAYsbQkQKgA=; Received: (qmail 7078 invoked by alias); 12 Feb 2013 22:31:59 -0000 Received: (qmail 7059 invoked by uid 22791); 12 Feb 2013 22:31:58 -0000 X-SWARE-Spam-Status: No, hits=-3.1 required=5.0 tests=AWL, BAYES_00, KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from shards.monkeyblade.net (HELO shards.monkeyblade.net) (149.20.54.216) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 12 Feb 2013 22:31:53 +0000 Received: from localhost (cpe-66-108-118-205.nyc.res.rr.com [66.108.118.205]) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 4CA30583E00; Tue, 12 Feb 2013 14:31:56 -0800 (PST) Date: Tue, 12 Feb 2013 17:31:46 -0500 (EST) Message-Id: <20130212.173146.281298392845155966.davem@davemloft.net> To: rdsandiford@googlemail.com Cc: gcc@gcc.gnu.org, jakub@redhat.com, ebotcazou@adacore.com, gcc-patches@gcc.gnu.org Subject: Re: expansion of vector shifts... From: David Miller In-Reply-To: <20121116.003305.2180726158176000063.davem@redhat.com> References: <20121027.052901.128093230202064296.davem@davemloft.net> <87fw4xk2jm.fsf@talisman.home> <20121116.003305.2180726158176000063.davem@redhat.com> Mime-Version: 1.0 X-IsSubscribed: yes 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 From: David Miller Date: Fri, 16 Nov 2012 00:33:05 -0500 (EST) > From: Richard Sandiford > Date: Mon, 29 Oct 2012 10:14:53 +0000 > >> ...given that the code is like you say written: >> >> if (SHIFT_COUNT_TRUNCATED) >> { >> if (CONST_INT_P (op1) >> ... >> else if (GET_CODE (op1) == SUBREG >> && subreg_lowpart_p (op1) >> && INTEGRAL_MODE_P (GET_MODE (SUBREG_REG (op1)))) >> op1 = SUBREG_REG (op1); >> } >> >> INTEGRAL_MODE_P (GET_MODE (op1)) might be better than an explicit >> VECTOR_MODE_P check. The code really doesn't make sense for anything >> other than integers. >> >> (It amounts to the same thing in practice, of course...) > > Agreed, I've just committed the following. Thanks! > > ==================== > Fix gcc.c-torture/compile/pr53410-2.c on sparc. > > * expmed.c (expand_shift_1): Don't strip non-integral SUBREGs. This is broken on sparc again, although I'm confused about how this has happened. The suggestion was to use INTEGRAL_MODE_P as the test, so what's there in expand_shift_1() is: else if (GET_CODE (op1) == SUBREG && subreg_lowpart_p (op1) && INTEGRAL_MODE_P (GET_MODE (SUBREG_REG (op1))) && INTEGRAL_MODE_P (GET_MODE (op1))) op1 = SUBREG_REG (op1); but INTEGRAL_MODE_P accepts vectors. This is really confusing because I was absolutely sure I re-ran the test case with the fix I committed and it didn't crash any more. Maybe what we really mean to do here is check both op1 and SUBREG_REG (op1) against SCALAR_INT_MODE_P instead of INTEGRAL_MODE_P? Something like this: gcc/ 2013-02-12 David S. Miller * expmed.c (expand_shift_1): Only strip scalar integer subregs. diff --git a/gcc/expmed.c b/gcc/expmed.c index 4a6ddb0..954a360 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -2116,8 +2116,8 @@ expand_shift_1 (enum tree_code code, enum machine_mode mode, rtx shifted, % GET_MODE_BITSIZE (mode)); else if (GET_CODE (op1) == SUBREG && subreg_lowpart_p (op1) - && INTEGRAL_MODE_P (GET_MODE (SUBREG_REG (op1))) - && INTEGRAL_MODE_P (GET_MODE (op1))) + && SCALAR_INT_MODE_P (GET_MODE (SUBREG_REG (op1))) + && SCALAR_INT_MODE_P (GET_MODE (op1))) op1 = SUBREG_REG (op1); }