noinst_SCRIPTS = filter_stderr
EXTRA_DIST = $(noinst_SCRIPTS) \
+ bug139050-ppc32.stdout.exp bug139050-ppc32.stderr.exp \
+ bug139050-ppc32.vgtest \
ldstrev.stderr.exp ldstrev.stdout.exp ldstrev.vgtest \
lsw.stderr.exp lsw.stdout.exp lsw.vgtest \
jm-int.stderr.exp jm-int.stdout.exp jm-int.vgtest \
xlc_dbl_u32.stderr.exp xlc_dbl_u32.stdout.exp xlc_dbl_u32.vgtest
check_PROGRAMS = \
+ bug139050-ppc32 \
ldstrev lsw jm-insns mftocrf mcrfs round test_fx test_gx \
testVMX twi xlc_dbl_u32
--- /dev/null
+
+#include <stdio.h>
+#include <assert.h>
+
+typedef unsigned long long int ULong;
+typedef unsigned int UInt;
+
+static ULong GetCPU_ClockCyclesSinceStartup(void)
+ {
+ UInt uTimeBaseLow;
+ UInt uTimeBaseHigh;
+ UInt uCheck;
+ __asm__ __volatile__("1: mfspr %0,269\n\t"
+ " mfspr %1,268\n\t"
+ " mfspr %2,269\n\t"
+ " cmpw %2, %0\n\t"
+ " bne 1b"
+ : "=r" (uTimeBaseHigh),
+ "=r" (uTimeBaseLow),
+ "=r" (uCheck)
+ : /*in*/
+ : /*trash*/ "cr0","cr7" );
+
+ return (((ULong)(uTimeBaseHigh) << 32) | uTimeBaseLow);
+ }
+
+ int main(int argc, char** argv)
+ {
+ ULong cys = GetCPU_ClockCyclesSinceStartup();
+ /* implausible that machine has been up less than 4G cycles */
+ assert(cys > (1ULL << 32));
+ printf("success\n");
+ return 0;
+ }