aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/powerpc/ppc-get-timebase.c
blob: 9de8929af1efdfb46dbc9b7f991dd5dd03cc0578 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* { dg-do run { target { powerpc*-*-* } } } */

/* Test if __builtin_ppc_get_timebase () is compatible with the current
   processor and if it's changing between reads.  A read failure might indicate
   a Power ISA or binutils change.  */

#include <inttypes.h>

int
main (void)
{
  uint64_t t = __builtin_ppc_get_timebase ();
  int j;

  for (j = 0; j < 1000000; j++)
    if (t != __builtin_ppc_get_timebase ())
      return 0;

  return 1;
}