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: mips64 inline question



To followup to my own question

d p chang <weasel@meer.net> writes:

> 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);
> }

I've gotten around this (the kernel compile is still running, but the
.s looks ok) w/ this:

        __asm__ ("dmultu\t%2,%3 ; mfhi %0 ; mflo %1"
                 : "=r" (hi), "=r" (lo)
                 : "r" (usecs), "r" (lpj)
                 : "hi", "lo");

The clobbering of hi/lo is what I'm wondering about here. The whole
expression does clobber, but do I need anything else to be safe?

\p


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]