From: Sergei Shtylyov <sshtylyov@mvista.com>
To: loody <miloody@gmail.com>
Cc: gcc-help <gcc-help@gcc.gnu.org>,
Linux MIPS Mailing List <linux-mips@linux-mips.org>
Subject: Re: Fwd: about udelay in mips
Date: Thu, 27 Jan 2011 14:28:15 +0300 [thread overview]
Message-ID: <4D4156CF.1040909@mvista.com> (raw)
In-Reply-To: <AANLkTim+Dy1_MFoMcXK3aPCKUcz6hpJY7B5kKY_nXNnP@mail.gmail.com>
Hello.
On 27-01-2011 12:20, loody wrote:
> hi all:
> I guess there seems be some differences about
> "unsigned long long" and "ull" so I forward the letter to gcc-help.
> If my guess is correct, what are the differences between them and why
> "unsigned long long" cannot let compiler compile the 64-bits
> operations as I want?
Probably because in 2.6.30 you only cast the result of 32-bit multiplies
to 64 bits. In the 2.6.33 kernel, the mutliplies are 64-bit as the
0x000010c7ull constant is 64-bit...
> thanks a lot,
> miloody
> I found my kernel will compile udelay(xx) as zero no matter what xx I filled in.
> below are the dis-assemblies:
> (as you can see the v0 = v1 = zero.)
> My version is 2.6.30.9:
> void __udelay(unsigned long us)
> {
> unsigned int lpj = current_cpu_data.udelay_val;
>
> __delay(((unsigned long long)(us * 0x000010c7 * HZ * lpj)) >> 32);
> 80306ed0: 00001821 move v1,zero
> 80306ed4: 00601021 move v0,v1
> #include<asm/compiler.h>
> #include<asm/war.h>
>
> inline void __delay(unsigned int loops)
> {
> __asm__ __volatile__ (
> 80306ed8: 1440ffff bnez v0,80306ed8 <__udelay+0x8>
> 80306edc: 2442ffff addiu v0,v0,-1
> void __udelay(unsigned long us)
> I have double checked the __delay source code of 2.6.33.4
> and the dis-assemblies:
> void __udelay(unsigned long us)
> {
> unsigned int lpj = current_cpu_data.udelay_val;
>
> __delay((us * 0x000010c7ull * HZ * lpj) >> 32);
> 802f7310: 3c02804f lui v0,0x804f
> 802f7314: 8c429360 lw v0,-27808(v0)
> 802f7318: 3c050010 lui a1,0x10
> 802f731c: 34a56256 ori a1,a1,0x6256
> 802f7320: 00450019 multu v0,a1
> 802f7324: 00002821 move a1,zero
> 802f7328: 00001012 mflo v0
> 802f732c: 00001810 mfhi v1
> 802f7330: 00a20018 mult a1,v0
> 802f7334: 70640000 madd v1,a0
> 802f7338: 00003012 mflo a2
> 802f733c: 00440019 multu v0,a0
> 802f7340: 00001810 mfhi v1
> 802f7344: 00c31021 addu v0,a2,v1
> #include<asm/compiler.h>
> #include<asm/war.h>
>
> inline void __delay(unsigned int loops)
> {
> __asm__ __volatile__ (
> 802f7348: 1440ffff bnez v0,802f7348 <__udelay+0x38>
> 802f734c: 2442ffff addiu v0,v0,-1
> void __udelay(unsigned long us)
> {
> unsigned int lpj = current_cpu_data.udelay_val;
>
> __delay((us * 0x000010c7ull * HZ * lpj)>> 32);
> }
> 802f7350: 03e00008 jr ra
WBR, Sergei
next prev parent reply other threads:[~2011-01-27 11:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-13 10:02 about udelay in mips loody
2011-01-14 5:31 ` wu zhangjin
2011-01-16 14:38 ` loody
2011-01-16 14:38 ` loody
2011-01-16 15:08 ` Geert Uytterhoeven
2011-01-16 16:34 ` wu zhangjin
[not found] ` <AANLkTi=zfr5YuwBCcvH2Jas50UxnUtvzp_CDyN25sT5h@mail.gmail.com>
2011-01-19 14:23 ` loody
2011-01-19 14:23 ` loody
2011-01-27 9:20 ` Fwd: " loody
2011-01-27 11:28 ` Sergei Shtylyov [this message]
2011-01-27 12:28 ` loody
2011-01-27 21:35 ` Ian Lance Taylor
2011-01-27 21:42 ` Maciej W. Rozycki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D4156CF.1040909@mvista.com \
--to=sshtylyov@mvista.com \
--cc=gcc-help@gcc.gnu.org \
--cc=linux-mips@linux-mips.org \
--cc=miloody@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox