gcc/testsuite/gcc.target/powerpc/ppc-get-timebase.c
raw| 1 | /* { dg-do run { target { powerpc*-*-* } } } */ |
| 2 | |
| 3 | /* Test if __builtin_ppc_get_timebase () is compatible with the current |
| 4 | processor and if it's changing between reads. A read failure might indicate |
| 5 | a Power ISA or binutils change. */ |
| 6 | |
| 7 | #include <inttypes.h> |
| 8 | |
| 9 | int |
| 10 | main (void) |
| 11 | { |
| 12 | uint64_t t = __builtin_ppc_get_timebase (); |
| 13 | int j; |
| 14 | |
| 15 | for (j = 0; j < 1000000; j++) |
| 16 | if (t != __builtin_ppc_get_timebase ()) |
| 17 | return 0; |
| 18 | |
| 19 | return 1; |
| 20 | } |