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


Dear all,

I've moved forward on this issue. Again, the problem is not that the
data is not aligned but that the compiler tries to generate this
instruction:

(set (reg:HI 141) (mem/s/j:HI (plus:DI (reg:DI 134 [ ivtmp.23 ])
         (const_int 1 [0x1])) [0 <variable>.geno+0 S2 A16]))

And, in my target architecture, this is not authorized. I want to
transform this into:

(set (reg:DI 135) (plus:DI (reg:DI 134 [ ivtmp.23 ])
         (const_int 1 [0x1])) [0 <variable>.geno+0 S2 A16]))
(set (reg:HI 141) (mem/s/j:HI (reg:DI 135))


I've tried playing with define_expand, I can detect this problem, I
can emit my first move and then the second but for some reason, the
compiler reassembles them back together.

Any ideas why I am getting that? Am I doing anything wrong? After I
expand this, I use the DONE macro...
Thanks,
Jc

On Fri, Jun 5, 2009 at 1:17 PM, Jean Christophe
Beyler<jean.christophe.beyler@gmail.com> wrote:
> It's already at 1 actually. The problem isn't really that the data
> itself is unaligned but that the offset of the load must be a power of
> 2 (multiple of 2 for a HI mode, multiple of 4 for a SI, ...).
>
> Therefore, that macro does not seem to apply to me (and it's already at 1!).
>
> Thanks, I'm continuing to look into this issue,
> Jc
>
> On Fri, Jun 5, 2009 at 11:48 AM, Dave Korn
> <dave.korn.cygwin@googlemail.com> wrote:
>> 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]