From patchwork Mon Aug 8 15:26:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Senthil Kumar Selvaraj X-Patchwork-Id: 656799 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 3s7Lqv4NLBz9s8x for ; Tue, 9 Aug 2016 01:27:07 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=JTaMuiGm; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :references:from:to:cc:subject:in-reply-to:date:message-id :mime-version:content-type; q=dns; s=default; b=nFhtndpnDomxF9Ek tfO3nevay1BUBfccIUab2L9OXjVImy+JGns7iG30KxWc0BpmkO9co1YALiILZZ0b k+arRge7XPnQFs5x/m6R2mp1cs4dhM+/YZjYMP4CRieAup5b70X4JWdZGe1J7EJO tiOPc4DMWS+hbRqgmVFm87QNsF8= 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 :references:from:to:cc:subject:in-reply-to:date:message-id :mime-version:content-type; s=default; bh=IQNQVCfRXa2C62Pu4yrinm dGLXI=; b=JTaMuiGm/Ik4tRK/N3ldlzKlf5k1dRIp21ERXNzDUyUT0zVL6FdOWl ThqFrl3MLDbxnpOtuE1OWMtJcco9IT6qAANOq8UMZ522yzISUa3FxDBlYr/XI9+9 iIX+JfXqfEwSkswfO3EhGRX+/qmjf+f9/6TxjrDsA+4OpY4gIrPhY= Received: (qmail 114616 invoked by alias); 8 Aug 2016 15:27:00 -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 114607 invoked by uid 89); 8 Aug 2016 15:26:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=BAYES_00, KAM_ASCII_DIVIDERS, RP_MATCHES_RCVD, SPF_PASS autolearn=no version=3.3.2 spammy=symbol_ref, SYMBOL_REF, ay, 4.7 X-HELO: eusmtp01.atmel.com Received: from eusmtp01.atmel.com (HELO eusmtp01.atmel.com) (212.144.249.242) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 08 Aug 2016 15:26:49 +0000 Received: from HNOCHT02.corp.atmel.com (10.145.133.41) by eusmtp01.atmel.com (10.145.145.30) with Microsoft SMTP Server (TLS) id 14.3.235.1; Mon, 8 Aug 2016 17:26:44 +0200 Received: from jaguar.atmel.com (10.145.133.18) by HNOCHT02.corp.atmel.com (10.145.133.41) with Microsoft SMTP Server (TLS) id 14.3.235.1; Mon, 8 Aug 2016 17:26:43 +0200 References: <8760rqi5d1.fsf@atmel.com> User-agent: mu4e 0.9.17; emacs 24.5.1 From: Senthil Kumar Selvaraj To: Bernd Schmidt CC: "gcc-patches@gcc.gnu.org" Subject: Re: [Patch, tentative, reload] Make push_reload work with more types of subregs? In-Reply-To: Date: Mon, 8 Aug 2016 20:56:01 +0530 Message-ID: <87oa53gu46.fsf@atmel.com> MIME-Version: 1.0 X-IsSubscribed: yes Bernd Schmidt writes: > On 07/28/2016 09:33 AM, Senthil Kumar Selvaraj wrote: >> >> Is there a reason why only REG and SYMBOL_REFs get valid >> subreg_in_class? I tried extending it handle constants and PLUS >> expressions, and it fixes PR 71873. It also fixes a another >> bug that was a work around for the reload failure (PR 64452) - that >> had a plus expression instead of the const. >> >> Reg testing on avr and x86_64 did not show any new failures. Is this >> the right way to fix this? > > I think it looks quite plausible. Note that testing x86_64 on trunk will > not do anything - it is no longer using reload. Could you go back to an > older branch (4.7 I think is the last one using reload) and retest > x86_64 with that, for better test coverage? I picked out the commit where you'd added SYMBOL_REF handling (rev #190252), and patched that with the below code. Bootstrapped and regtested on x86_64-pc-linux - the results were identical with and without the patch. Is this good enough for trunk? Regards Senthil gcc/ChangeLog: 2016-08-08 Senthil Kumar Selvaraj PR reload/71873 * reload.c (push_reload): Compute subreg_in_class for subregs of constants and plus expressions. gcc/testsuite/ChangeLog: 2016-08-08 Senthil Kumar Selvaraj * gcc.target/avr/pr71873.c: New test. Index: gcc/reload.c =================================================================== --- gcc/reload.c (revision 239239) +++ gcc/reload.c (working copy) @@ -1141,7 +1141,9 @@ SUBREG_BYTE (in), GET_MODE (in)), REGNO (SUBREG_REG (in))); - else if (GET_CODE (SUBREG_REG (in)) == SYMBOL_REF) + else if (GET_CODE (SUBREG_REG (in)) == SYMBOL_REF + || CONSTANT_P (SUBREG_REG (in)) + || GET_CODE (SUBREG_REG (in)) == PLUS) subreg_in_class = find_valid_class_1 (inmode, GET_MODE (SUBREG_REG (in)), rclass); Index: gcc/testsuite/gcc.target/avr/pr71873.c =================================================================== --- gcc/testsuite/gcc.target/avr/pr71873.c (nonexistent) +++ gcc/testsuite/gcc.target/avr/pr71873.c (working copy) @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-options "-Os -fcaller-saves" } */ + +#include + +typedef struct { + uint8_t x; + uint32_t y; +} A; + +A a; + +extern int bar(int); +extern int foo (char *s, ...); + +extern uint8_t param; +extern uint8_t h,m,s,ld,lm; +extern uint16_t d; + +void gps_parse_string(int z) +{ + while (bar(z)) + { + switch (param) + { + case 0: foo("a", &h, &m, &s, &d); break; + case 1: foo("d", &ld, &lm, &a.y); break; + } + } +}