shithub: dav1d

Download patch

ref: 2073ea115c332f0ca0c1ad0457e1a668ba3a9438
parent: 197032bd9bebaf193e6160b3343e56974229e77d
author: Luca Barbato <[email protected]>
date: Mon Jun 3 17:09:51 EDT 2019

checkasm: Add a readtime impl for ppc

--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -100,6 +100,8 @@
     { "AVX-512", "avx512", DAV1D_X86_CPU_FLAG_AVX512 },
 #elif ARCH_AARCH64 || ARCH_ARM
     { "NEON",    "neon",   DAV1D_ARM_CPU_FLAG_NEON },
+#elif ARCH_PPC64LE
+    { "VSX",     "vsx",    DAV1D_PPC_CPU_FLAG_VSX },
 #endif
     { 0 }
 };
--- a/tests/checkasm/checkasm.h
+++ b/tests/checkasm/checkasm.h
@@ -155,6 +155,24 @@
     return cycle_counter;
 }
 #define readtime readtime
+#elif ARCH_PPC64LE
+static inline uint64_t readtime(void) {
+    uint32_t tbu, tbl, temp;
+
+    __asm__ __volatile__(
+        "1:\n"
+        "mfspr %2,269\n"
+        "mfspr %0,268\n"
+        "mfspr %1,269\n"
+        "cmpw   %2,%1\n"
+        "bne    1b\n"
+    : "=r"(tbl), "=r"(tbu), "=r"(temp)
+    :
+    : "cc");
+
+    return (((uint64_t)tbu) << 32) | (uint64_t)tbl;
+}
+#define readtime readtime
 #endif
 
 /* Verifies that clobbered callee-saved registers