From 81bf5516c000d89a2fbc8da89bc6df0256032f0e Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Mon, 30 Sep 2013 12:15:06 +0300 Subject: Fix READ_PREFETCH_2048 so that it won't be optimized out, re-ordered or interleaved by compiler. Simplify generated code (no add). --- src/post/deinterlace/speedtools.h | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/post/deinterlace/speedtools.h b/src/post/deinterlace/speedtools.h index 94ab1918d..b4cddee6b 100644 --- a/src/post/deinterlace/speedtools.h +++ b/src/post/deinterlace/speedtools.h @@ -31,16 +31,21 @@ prefetchnta( pfetcha + 128 ); \ prefetchnta( pfetcha + 192 ); } +static inline unsigned int read_pf(volatile unsigned int *addr) +{ + return *addr; +} + #define READ_PREFETCH_2048(x) \ - { int *pfetcha = (int *) x; int pfetchtmp; \ - pfetchtmp = pfetcha[ 0 ] + pfetcha[ 16 ] + pfetcha[ 32 ] + pfetcha[ 48 ] + \ - pfetcha[ 64 ] + pfetcha[ 80 ] + pfetcha[ 96 ] + pfetcha[ 112 ] + \ - pfetcha[ 128 ] + pfetcha[ 144 ] + pfetcha[ 160 ] + pfetcha[ 176 ] + \ - pfetcha[ 192 ] + pfetcha[ 208 ] + pfetcha[ 224 ] + pfetcha[ 240 ]; \ - pfetcha += 256; \ - pfetchtmp = pfetcha[ 0 ] + pfetcha[ 16 ] + pfetcha[ 32 ] + pfetcha[ 48 ] + \ - pfetcha[ 64 ] + pfetcha[ 80 ] + pfetcha[ 96 ] + pfetcha[ 112 ] + \ - pfetcha[ 128 ] + pfetcha[ 144 ] + pfetcha[ 160 ] + pfetcha[ 176 ] + \ - pfetcha[ 192 ] + pfetcha[ 208 ] + pfetcha[ 224 ] + pfetcha[ 240 ]; } + { int * pfetcha = (int *) x; \ + read_pf(pfetcha); read_pf(pfetcha + 16); read_pf(pfetcha + 32); read_pf(pfetcha + 48); \ + read_pf(pfetcha + 64); read_pf(pfetcha + 80); read_pf(pfetcha + 96); read_pf(pfetcha + 112); \ + read_pf(pfetcha + 128); read_pf(pfetcha + 144); read_pf(pfetcha + 160); read_pf(pfetcha + 176); \ + read_pf(pfetcha + 192); read_pf(pfetcha + 208); read_pf(pfetcha + 224); read_pf(pfetcha + 240); \ + pfetcha += 256; \ + read_pf(pfetcha); read_pf(pfetcha + 16); read_pf(pfetcha + 32); read_pf(pfetcha + 48); \ + read_pf(pfetcha + 64); read_pf(pfetcha + 80); read_pf(pfetcha + 96); read_pf(pfetcha + 112); \ + read_pf(pfetcha + 128); read_pf(pfetcha + 144); read_pf(pfetcha + 160); read_pf(pfetcha + 176); \ + read_pf(pfetcha + 192); read_pf(pfetcha + 208); read_pf(pfetcha + 224); read_pf(pfetcha + 240); } #endif /* SPEEDTOOLS_H_INCLUDED */ -- cgit v1.2.3