This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Expanding a load instruction


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 <variable>.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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]