changeset 342:02c938e7a087 libavutil

Blackfin - read_time primitive note this primitive currently uses a union to concatenate 2x32bit registers because of poor compiler support around DImode and asm.
author mhoffman
date Wed, 13 Jun 2007 11:09:07 +0000
parents 53126d45b095
children f21d1907d47c
files common.h
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/common.h	Tue Jun 12 18:50:50 2007 +0000
+++ b/common.h	Wed Jun 13 11:09:07 2007 +0000
@@ -267,7 +267,7 @@
         }\
     }
 
-#if defined(ARCH_X86) || defined(ARCH_POWERPC)
+#if defined(ARCH_X86) || defined(ARCH_POWERPC) || defined(ARCH_BFIN)
 #if defined(ARCH_X86_64)
 static inline uint64_t read_time(void)
 {
@@ -286,6 +286,19 @@
         );
         return l;
 }
+#elif ARCH_BFIN
+static inline uint64_t read_time(void)
+{
+    union {
+        struct {
+            unsigned lo;
+            unsigned hi;
+        } p;
+        unsigned long long c;
+    } t;
+    asm volatile ("%0=cycles; %1=cycles2;" : "=d" (t.p.lo), "=d" (t.p.hi));
+    return t.c;
+}
 #else //FIXME check ppc64
 static inline uint64_t read_time(void)
 {