summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/ppc-mftb.c
diff options
context:
space:
mode:
authordje <dje@138bc75d-0d04-0410-961f-82ee72b054a4>2012-09-19 19:08:00 +0000
committerdje <dje@138bc75d-0d04-0410-961f-82ee72b054a4>2012-09-19 19:08:00 +0000
commit77ff7cbfe77156dc41943effa80948572fe383fa (patch)
tree9570cfd73f6fb3e572664a17fc612bd66e2af134 /gcc/testsuite/gcc.target/powerpc/ppc-mftb.c
parent6154c460f7a0d6249bbaf5ebdc2ee7015fe2e24d (diff)
downloadgcc-77ff7cbfe77156dc41943effa80948572fe383fa.tar.gz
2012-09-19 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
* gcc.target/powerpc/ppc-get-timebase.c: New file. * gcc.target/powerpc/ppc-mftb.c: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@191492 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.target/powerpc/ppc-mftb.c')
-rw-r--r--gcc/testsuite/gcc.target/powerpc/ppc-mftb.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-mftb.c b/gcc/testsuite/gcc.target/powerpc/ppc-mftb.c
new file mode 100644
index 00000000000..f64e45d1dad
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/ppc-mftb.c
@@ -0,0 +1,18 @@
+/* { dg-do run { target { powerpc*-*-* } } } */
+
+/* Test if __builtin_ppc_mftb () is compatible with the current processor and
+ if it's changing between reads. A read failure might indicate a Power
+ ISA or binutils change. */
+
+int
+main (void)
+{
+ unsigned long t = __builtin_ppc_mftb ();
+ int j;
+
+ for (j = 0; j < 1000000; j++)
+ if (t != __builtin_ppc_mftb ())
+ return 0;
+
+ return 1;
+}