This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: mips64 inline question
Richard Henderson <rth@redhat.com> writes:
> On Wed, Jan 23, 2002 at 03:46:27PM -0800, d p chang wrote:
> > The code in question is in delay.h as:
> >
> > extern __inline__ void __udelay(unsigned long usecs, unsigned long lpj)
> > {
> > unsigned long lo;
> >
> > usecs *= 0x00068db8bac710cbUL; /* 2**64 / (1000000 / HZ) */
> > __asm__ ("dmultu\t%2,%3"
> > :"=h" (usecs), "=l" (lo)
> > :"r" (usecs),"r" (lpj));
> > __delay(hi);
> > }
>
> This should work. You should provide a complete compilable
> example that shows the problem.
ok, first I configured my cross compiler like this (just in case this
is the root of my prolblems):
../../../gcc/configure
--target=mips64-linux --host=i686-linux --build=i686-linux
--prefix=/home/dpc/src/cross-mips
--with-as=/home/dpc/src/cross-mips/bin/mips64-linux-as
--with-ld=/home/dpc/src/cross-mips/bin/mips64-linux-ld
--enable-languages=c,c++ --disable-multilib --disable-nls
--disable-shared --enable-newlib
The simple test I used was this:
static __inline__ void __udelay(unsigned long usecs, unsigned long lpj)
{
unsigned long lo;
#if 0
// doesn't work
__asm__ ("dmultu\t%2,%3"
:"=h" (usecs), "=l" (lo)
:"r" (usecs),"r" (lpj));
#else
// seems to generate the code i expect
{
unsigned long hi;
__asm__ ("dmultu\t%2,%3 ; mfhi %0 ; mflo %1"
: "=r" (hi), "=r" (lo)
: "r" (usecs),"r" (lpj)
: "hi", "lo");
}
#endif
}
int
main(int argc, char** argv)
{
__udelay(1313, 0x1313);
return 0;
}