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