From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9904 invoked by alias); 5 Jun 2009 15:36:54 -0000 Received: (qmail 9896 invoked by uid 22791); 5 Jun 2009 15:36:53 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-bw0-f224.google.com (HELO mail-bw0-f224.google.com) (209.85.218.224) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 05 Jun 2009 15:36:41 +0000 Received: by bwz24 with SMTP id 24so1798029bwz.8 for ; Fri, 05 Jun 2009 08:36:38 -0700 (PDT) Received: by 10.103.226.20 with SMTP id d20mr2298039mur.8.1244216198507; Fri, 05 Jun 2009 08:36:38 -0700 (PDT) Received: from ?192.168.2.99? (cpc2-cmbg8-0-0-cust61.cmbg.cable.ntl.com [82.6.108.62]) by mx.google.com with ESMTPS id e9sm386636muf.2.2009.06.05.08.36.37 (version=SSLv3 cipher=RC4-MD5); Fri, 05 Jun 2009 08:36:37 -0700 (PDT) Message-ID: <4A293E50.4010301@gmail.com> Date: Fri, 05 Jun 2009 15:36:00 -0000 From: Dave Korn User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: fearyourself CC: "gcc@gcc.gnu.org" Subject: Re: Expanding a load instruction References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2009-06/txt/msg00103.txt.bz2 fearyourself wrote: > In the instruction set of my architecture, the offsets of a half-load > (HImode) have to be multiples of 2. However, if I set up a structure > in a certain way, the compiler will generate: > > (mem/s/j:HI (plus:DI (reg:DI 134 [ ivtmp.23 ]) > (const_int 1 [0x1])) [0 .geno+0 S2 A16]) > > As the memory operand for the load. > > Now, one solution I am going to try to fix this is to use > define_expand and add a move into another register before this load > and then load from that register (thus removing the offset of 1). > > My question is: Is that how it should be done or is there another solution? This looks like what you need: -- Macro: STRICT_ALIGNMENT Define this macro to be the value 1 if instructions will fail to work if given data not on the nominal alignment. If instructions will merely go slower in that case, define this macro as 0. cheers, DaveK