extern void * memcpy(void *, void *, int );
int test(char *from, char *to)
{
        memcpy(from,to,8);
}

Compilation:
mipsel-linux-gnu-gcc -O2 -EB -o test.o -c test.c
Gives output:
00000000 <test>:
   0:   88a20003        lwl     v0,3(a1)
   4:   88a30007        lwl     v1,7(a1)
   8:   98a20000        lwr     v0,0(a1)
   c:   98a30004        lwr     v1,4(a1)
  10:   a8820003        swl     v0,3(a0)
  14:   b8820000        swr     v0,0(a0)
  18:   a8830007        swl     v1,7(a0)
  1c:   03e00008        jr      ra
  20:   b8830004        swr     v1,4(a0)

And trying it with:
mips-sgi-irix5-gcc -O2 -EB -o test.o -c test.c
00000000 <test>:
   0:   88a20000        lwl     v0,0(a1)
   4:   88a30004        lwl     v1,4(a1)
   8:   98a20003        lwr     v0,3(a1)
   c:   98a30007        lwr     v1,7(a1)
  10:   a8820000        swl     v0,0(a0)
  14:   b8820003        swr     v0,3(a0)
  18:   a8830004        swl     v1,4(a0)
  1c:   03e00008        jr      ra
  20:   b8830007        swr     v1,7(a0)

The second way is the correct one (at least the hardware likes it more).

-- 
           Summary: Using mipsel to compile BigEndian -O2 does not work
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ondrap at penguin dot cz
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: gcc-4.0.1/configure --host=i686-pc-linux-gnu --
                    target=mipsel-lin
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: mipsel-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23824

Reply via email to