Add 469782 to NEWS
[valgrind.git] / none / tests / ppc32 / bug139050-ppc32.c
blobca54bc33a1d0d4bd119bc287f584a7b718269305
2 #include <stdio.h>
3 #include <assert.h>
5 typedef unsigned long long int ULong;
6 typedef unsigned int UInt;
8 static ULong GetCPU_ClockCyclesSinceStartup(void)
9 {
10 UInt uTimeBaseLow;
11 UInt uTimeBaseHigh;
12 UInt uCheck;
13 __asm__ __volatile__("1: mfspr %0,269\n\t"
14 " mfspr %1,268\n\t"
15 " mfspr %2,269\n\t"
16 " cmpw %2, %0\n\t"
17 " bne 1b"
18 : "=r" (uTimeBaseHigh),
19 "=r" (uTimeBaseLow),
20 "=r" (uCheck)
21 : /*in*/
22 : /*trash*/ "cr0","cr7" );
24 return (((ULong)(uTimeBaseHigh) << 32) | uTimeBaseLow);
27 int main(int argc, char** argv)
29 ULong cys = GetCPU_ClockCyclesSinceStartup();
30 /* implausible that machine has been up less than 4G cycles */
31 assert(cys > (1ULL << 32));
32 printf("success\n");
33 return 0;