From patchwork Tue Oct 12 21:31:51 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Koning X-Patchwork-Id: 67619 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 5FFA1B6EED for ; Wed, 13 Oct 2010 08:32:00 +1100 (EST) Received: (qmail 1086 invoked by alias); 12 Oct 2010 21:31:59 -0000 Received: (qmail 1078 invoked by uid 22791); 12 Oct 2010 21:31:58 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from ausc60pc101.us.dell.com (HELO ausc60pc101.us.dell.com) (143.166.85.206) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 12 Oct 2010 21:31:54 +0000 X-Loopcount0: from 10.152.240.141 From: Paul Koning Subject: [RFC] WORDS_BIG_ENDIAN != BYTES_BIG_ENDIAN messes up subreg Date: Tue, 12 Oct 2010 17:31:51 -0400 Message-Id: <8CD69747-312C-4580-B85B-5252CAFCB29E@dell.com> To: gcc-patches Mime-Version: 1.0 (Apple Message framework v1081) 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 I just ran into an issue when BYTES_BIG_ENDIAN differs from WORDS_BIG_ENDIAN, which apparently at this point applies only to pdp11. The problem is that I end up with HI mode subreg references to odd bytes, which cause a gcc_assert. It appears to me that this patch is needed. I'm not all that confident about my analysis, but the change does cure the assert and as far as I can tell it won't affect other platforms. Also, it seems to make sense given the definition of what those macros do -- assuming I understood them correctly. Comments appreciated. paul Index: lower-subreg.c =================================================================== --- lower-subreg.c (revision 165191) +++ lower-subreg.c (working copy) @@ -1008,13 +1008,6 @@ offset2 = UNITS_PER_WORD * (1 - dest_reg_num); src_offset = UNITS_PER_WORD * src_reg_num; - if (WORDS_BIG_ENDIAN != BYTES_BIG_ENDIAN) - { - offset1 += UNITS_PER_WORD - 1; - offset2 += UNITS_PER_WORD - 1; - src_offset += UNITS_PER_WORD - 1; - } - start_sequence (); dest_reg = simplify_gen_subreg_concatn (word_mode, SET_DEST (set),