changeset 7688:160d5c1ae60a libavcodec

ARM: add prefetch function using ARMv5 PLD instruction
author mru
date Mon, 25 Aug 2008 02:29:04 +0000
parents e5b5a9af1b68
children 3c57663cdafd
files armv4l/dsputil_arm.c
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/armv4l/dsputil_arm.c	Mon Aug 25 01:59:06 2008 +0000
+++ b/armv4l/dsputil_arm.c	Mon Aug 25 02:29:04 2008 +0000
@@ -203,6 +203,19 @@
 }
 #endif
 
+#ifdef HAVE_ARMV5TE
+static void prefetch_arm(void *mem, int stride, int h)
+{
+    asm volatile(
+        "1:              \n\t"
+        "subs %0, %0, #1 \n\t"
+        "pld  [%1]       \n\t"
+        "add  %1, %1, %2 \n\t"
+        "bgt  1b         \n\t"
+        : "+r"(h), "+r"(mem) : "r"(stride));
+}
+#endif
+
 int mm_support(void)
 {
     return ENABLE_IWMMXT * MM_IWMMXT;
@@ -279,6 +292,10 @@
     c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_arm; //OK
     c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_arm;
 
+#ifdef HAVE_ARMV5TE
+    c->prefetch = prefetch_arm;
+#endif
+
 #ifdef HAVE_IWMMXT
     dsputil_init_iwmmxt(c, avctx);
 #endif