[MPlayer-dev-eng] [PATCH 5/6] tools: loongson add fastmemcpy test bench

周晓勇 zhouxiaoyong at loongson.cn
Wed Sep 2 12:07:38 CEST 2015


>From fa31a593c04608d4d4d89661b61029522d94cfaa Mon Sep 17 00:00:00 2001
From: ZhouXiaoyong <zhouxiaoyong at loongson.cn>
Date: Thu, 20 Aug 2015 17:28:01 +0800
Subject: [PATCH 5/6] tools: loongson add fastmemcpy test bench


Signed-off-by: ZhouXiaoyong <zhouxiaoyong at loongson.cn>
---
 TOOLS/fastmem_mmi.sh    |  3 +++
 TOOLS/fastmemcpybench.c | 23 +++++++++++++++++++++++
 2 files changed, 26 insertions(+)


diff --git a/TOOLS/fastmem_mmi.sh b/TOOLS/fastmem_mmi.sh
new file mode 100755
index 0000000..75d7441
--- /dev/null
+++ b/TOOLS/fastmem_mmi.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+gcc fastmemcpybench.c -o fastmemcpybench -static -L.. -I.. -march=loongson3a -O2 -g
diff --git a/TOOLS/fastmemcpybench.c b/TOOLS/fastmemcpybench.c
index 1acfe50..4cb41db 100644
--- a/TOOLS/fastmemcpybench.c
+++ b/TOOLS/fastmemcpybench.c
@@ -115,6 +115,12 @@
 #include "libvo/aclib_template.c"
 #endif
 
+#ifdef ARCH_LOONGSON
+#undef RENAME
+#define RENAME(a) a ## _MMI
+#include "libvo/aclib_template.c"
+#endif
+
 //#define ARR_SIZE 100000
 #define ARR_SIZE (1024*768*2)
 
@@ -219,7 +225,24 @@ int main(void)
     printf(name "CPU clocks=%llu = %dus  (%5.3ffps)  %5.1fMB/s\n", v2-v1, t, \
            100000000.0f / (float)t, (float)ARR_SIZE*95.36743f / (float)t);
 
+#define testblock_loongson(func, name)                                       \
+    t  = GetTimer();                                                         \
+    for (i = 0; i < 100; i++)                                                \
+        func(marr1, marr2, ARR_SIZE - 16);                                   \
+    t  = GetTimer() - t;                                                     \
+    /* ARR_SIZE*100 / (1024*1024) / (t/1000000) = ARR_SIZE*95.36743 / t */   \
+    printf(name "CPU clocks=%dus  (%5.3ffps)  %5.1fMB/s\n", t, \
+           100000000.0f / (float)t, (float)ARR_SIZE*95.36743f / (float)t);
+
+#if ARCH_LOONGSON
+    testblock_loongson(memcpy, "libc:   ");
+#else
     testblock(memcpy, "libc:   ");
+#endif
+
+#if ARCH_LOONGSON
+    testblock_loongson(fast_memcpy_MMI, "MMI:    ");
+#endif
 
 #if HAVE_MMX
     testblock(fast_memcpy_MMX, "MMX:    ");
-- 
2.1.4



More information about the MPlayer-dev-eng mailing list