From patchwork Wed Aug 10 12:40:04 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: 657688 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 3s8W3c3vl0z9syB for ; Wed, 10 Aug 2016 22:41:14 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=xaCCEScd; 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=D5P9n2prBpLrBqzb 1EkoOGyRK1xA7ziBbV1HazPhD91/BUQgPA1+ig8Z8RLBNkW3RxwDlkyLaDSXUIZZ zg9yXWDs8JbbUZnU9t2C6jjU4rABPz36ifZ8isvPbqEDlxuquFfW9rPZBxg06SzP rHeNoYEevKlnnJY7OfLo6+ZzaQs= 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=32J0CKSc1AitxPgGQjK7Wt LILLM=; b=xaCCEScdUnBoEL2FSqbGKZjIjFt8ozYTWcDV/hKNnmXqjnH7rOyeVk RlL2bdvmUuFC6eJja5EaRX2h2fH1tsx6SNvWgTTSzcKDxrOReoixmzgNuT6Eyv2T +YnsGv294Cdk/jfIn/efdT6P2um0wHnnP5jbKCcEGSg0zVyOkLfUE= Received: (qmail 106824 invoked by alias); 10 Aug 2016 12:41:03 -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 106803 invoked by uid 89); 10 Aug 2016 12:41:02 -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=ay, stdinth, UD:stdint.h, uint16_t X-HELO: eusmtp01.atmel.com Received: from eusmtp01.atmel.com (HELO eusmtp01.atmel.com) (212.144.249.243) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 10 Aug 2016 12:40:51 +0000 Received: from HNOCHT02.corp.atmel.com (10.145.133.41) by eusmtp01.atmel.com (10.145.145.31) with Microsoft SMTP Server (TLS) id 14.3.235.1; Wed, 10 Aug 2016 14:40:42 +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; Wed, 10 Aug 2016 14:40:46 +0200 References: <8760rqi5d1.fsf@atmel.com> <87oa53gu46.fsf@atmel.com> <4ad6cb77-ce42-d5da-d39c-4d3ac0d14e58@redhat.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: <4ad6cb77-ce42-d5da-d39c-4d3ac0d14e58@redhat.com> Date: Wed, 10 Aug 2016 18:10:04 +0530 Message-ID: <874m6slrvf.fsf@atmel.com> MIME-Version: 1.0 X-IsSubscribed: yes Bernd Schmidt writes: > On 08/08/2016 05:26 PM, Senthil Kumar Selvaraj wrote: > >> 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? > >> - 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); > > Actually SYMBOL_REF should also be CONSTANT_P. For integers it looks > like it'll pass VOIDmode to find_valid_class_1 and just return NO_REGS. > which I suppose is OK. > > Would you mind removing the SYMBOL_REF test and retesting? Ok with that > change. Bootstrapped and reg tested below patch with same setup as above - no regressions showed up. Committed patch to trunk. Ok for backport to 6.x and 5.x branches as well? Regards Senthil gcc/ChangeLog 2016-08-10 Senthil Kumar Selvaraj PR target/71873 * reload.c (push_reload): Compute subreg_in_class for subregs of constants and plus expressions. Remove special handling of SYMBOL_REFs. gcc/testsuite/ChangeLog 2016-08-10 Senthil Kumar Selvaraj PR target/71873 * gcc.target/avr/pr71873.c: New test. Index: gcc/reload.c =================================================================== --- gcc/reload.c (revision 239318) +++ gcc/reload.c (working copy) @@ -1141,7 +1141,8 @@ SUBREG_BYTE (in), GET_MODE (in)), REGNO (SUBREG_REG (in))); - else if (GET_CODE (SUBREG_REG (in)) == SYMBOL_REF) + else if (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; + } + } +}