This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: PowerPC code generation
On Wed, Jul 05, 2000 at 10:52:45PM +0200, Franz Sirl wrote:
> At 22:26 05.07.00, Geoff Keating wrote:
> >"David J Schinsing" <dxs@pt.com> writes:
> >
> > > What can I do to get gcc to generate byte-reversed loads and stores
> > > (like the lwbrx instruction, for example). Perhaps there's a way to define
> > > a structure so as to generate them?
> >
> >You can use asm statements, like
> >
> >asm ("lwbrx %0, 0, %1" : "=r"(result) : "r"(&input), "X"(input));
> >
> >at present, there is no way to have gcc generate such code without
> >using asm statements.
>
> Just out of interest, if I would implement __attribute__((little_endian))
> and __attribute__((big_endian)) for MEM's, basically the major work would
> be to create something like a "revmovsi" pattern in the .md and tell
> compiler how to use it, or? Which pass of the compiler would be responsible
> for that? reload?
The fundamental problem is that __attribute__ type definitions aren't
completely types, so for example you can't declare a pointer type to a
little_endian or big_endian type. Which also means things get messy for
whether judging things are of comparable type.... Jim Wilson, you had a
canonical list of problems with __attributes__ the last n times we looked into
this -- maybe you could post the list once again.
A more feasible approach is to add little_endian{2,4,8} and big_endian{2,4,8}
builtin functions, and optimize these on a machine basis.
--
Michael Meissner, Red Hat, Inc.
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work: meissner@redhat.com phone: +1 978-486-9304
Non-work: meissner@spectacle-pond.org fax: +1 978-692-4482