This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/15516] assembly snippets for nano second resolution wall clock time
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 May 2004 14:02:42 -0000
- Subject: [Bug libfortran/15516] assembly snippets for nano second resolution wall clock time
- References: <20040518132755.15516.avle@ii.uib.no>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-18 14:02 -------
Confirmed, and here is the PPC32 one too (but I do not know how to get the timebase frequency):
Note (long needs to be really a 32bit value and I also wrote this from memory):
unsigned long long GetTimebase(void)
{
unsigned long low;
unsigned long high;
unsinged long high1;
do
{
asm volatile ("mftbu %0":"=r"(high));
asm volatile ("mftb %0":"=r"(low));
asm volatile ("mftbu %0":"=r"(high1));
} while (high != high1);
return ((unsigned long long)high)<<32ULL|(unsigned long long) low;
}
PPC64 (easier as mftb gives the full timebase register for 64bit processors):
unsigned long long GetTimebase(void)
{
unsigned long long timebase;
asm volatile ("mftb %0":"=r"(timebase));
return timebase;
}
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-05-18 14:02:39
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15516