expanding movdi into 2 x movsi

Jan Hoogerbrugge hoogerbrugge@hotmail.com
Thu Apr 22 13:34:00 GMT 2004


Hi,

I don't define movdi in my target description and so far I had the 
impression that gcc was handling that for me by expanding a movdi into 2 
movsi's. However, this does not seem to work perfectly. The following case 
shows it:

struct O
{
        struct O *addr;
        long type;
};

extern struct O root;

struct O *foo()
{
        struct O y, z;

        z = *root.addr;

        z = *(z.addr);

        return z.addr;
}

The resulting code for the body is:

        .text
        .global _foo
_foo:
        .function
        ld32 r5 -> r5
        ijmpf r0 r2
        .endfunction

As you can see the reference to the global variable root has disappeared.

The problem disappears whenever I remove the type field from the struct. 
This makes that the struct becomes a SImode instead of a DImode. Also, it 
disappears whenever I rename the first assignment of z to y.

I this a gcc bug? Is there an easy workarond by defining a define_expand 
"movdi" that maps the move to 2 SImode moves? Any suggestions for a port 
where I can borrow some code from?

Jan

_________________________________________________________________
Hotmail en Messenger on the move 
http://www.msn.nl/communicatie/smsdiensten/hotmailsmsv2/



More information about the Gcc mailing list