From patchwork Tue Sep 28 22:01:57 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: DJ Delorie X-Patchwork-Id: 66029 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 A9EFDB7121 for ; Wed, 29 Sep 2010 08:02:18 +1000 (EST) Received: (qmail 6369 invoked by alias); 28 Sep 2010 22:02:13 -0000 Received: (qmail 6355 invoked by uid 22791); 28 Sep 2010 22:02:12 -0000 X-SWARE-Spam-Status: No, hits=-4.7 required=5.0 tests=AWL, BAYES_50, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 28 Sep 2010 22:02:07 +0000 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o8SM25Bt017159 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 28 Sep 2010 18:02:05 -0400 Received: from greed.delorie.com (ovpn-112-30.phx2.redhat.com [10.3.112.30]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o8SM1xdf030057 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 28 Sep 2010 18:02:03 -0400 Received: from greed.delorie.com (greed.delorie.com [127.0.0.1] (may be forged)) by greed.delorie.com (8.14.3/8.14.3) with ESMTP id o8SM1v0k032305 for ; Tue, 28 Sep 2010 18:01:57 -0400 Received: (from dj@localhost) by greed.delorie.com (8.14.3/8.14.3/Submit) id o8SM1vwN032302; Tue, 28 Sep 2010 18:01:57 -0400 Date: Tue, 28 Sep 2010 18:01:57 -0400 Message-Id: <201009282201.o8SM1vwN032302@greed.delorie.com> From: DJ Delorie To: gcc-patches@gcc.gnu.org Subject: [m32c patch] fix PR 45800 - subregs of volatile mem 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 Committed. 2010-09-28 DJ Delorie PR target/45800 * config/m32c/m32c.c (m32c_subreg): Force adjustment of subregs of volatile MEMs. Index: gcc/config/m32c/m32c.c =================================================================== --- gcc/config/m32c/m32c.c (revision 164704) +++ gcc/config/m32c/m32c.c (working copy) @@ -3314,13 +3314,25 @@ m32c_subreg (enum machine_mode outer, && GET_CODE (XEXP (x, 0)) == MEM && (GET_CODE (XEXP (XEXP (x, 0), 0)) == PRE_DEC || GET_CODE (XEXP (XEXP (x, 0), 0)) == POST_INC)) return gen_rtx_MEM (outer, XEXP (XEXP (x, 0), 0)); if (GET_CODE (x) != REG) - return simplify_gen_subreg (outer, x, inner, byte); + { + rtx r = simplify_gen_subreg (outer, x, inner, byte); + if (GET_CODE (r) == SUBREG + && GET_CODE (x) == MEM + && MEM_VOLATILE_P (x)) + { + /* Volatile MEMs don't get simplified, but we need them to + be. We are little endian, so the subreg byte is the + offset. */ + r = adjust_address (x, outer, byte); + } + return r; + } r = REGNO (x); if (r >= FIRST_PSEUDO_REGISTER || r == AP_REGNO) return simplify_gen_subreg (outer, x, inner, byte); if (IS_MEM_REGNO (r))