[x264-devel] ppc: Fix the pre-VSX vec_vsx_st() fallback macro

Alexandra Hájková git at videolan.org
Tue Jan 24 21:14:11 CET 2017


x264 | branch: master | Alexandra Hájková <alexandra at khirnov.net> | Sat Jan 21 12:34:49 2017 +0000| [97eaef2ab82a46d13ea5e00270712d6475fbe42b] | committer: Henrik Gramner

ppc: Fix the pre-VSX vec_vsx_st() fallback macro

It would previously only work correctly with 8-bit data types.

Fixes compilation with --disable-vsx.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=97eaef2ab82a46d13ea5e00270712d6475fbe42b
---

 common/ppc/ppccommon.h | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/common/ppc/ppccommon.h b/common/ppc/ppccommon.h
index 07e371c..28359ac 100644
--- a/common/ppc/ppccommon.h
+++ b/common/ppc/ppccommon.h
@@ -267,15 +267,16 @@ p2 += i2;
     vec_perm(vec_ld(off, src), vec_ld(off + 15, src), vec_lvsl(off, src))
 
 #undef vec_vsx_st
-#define vec_vsx_st(v, off, dst)                           \
-    do {                                                  \
-        vec_u8_t _v = (vec_u8_t)(v);                      \
-        vec_u8_t _a = vec_ld(off, dst);                   \
-        vec_u8_t _b = vec_ld(off + 15, dst);              \
-        vec_u8_t _e = vec_perm(_b, _a, vec_lvsl(0, dst)); \
-        vec_u8_t _m = vec_lvsr(0, dst);                   \
-                                                          \
-        vec_st(vec_perm(_v, _e, _m), off + 15, dst);      \
-        vec_st(vec_perm(_e, _v, _m), off, dst);           \
+#define vec_vsx_st(v, off, dst)                            \
+    do {                                                   \
+        uint8_t *_dst = (uint8_t*)(dst);                   \
+        vec_u8_t _v = (vec_u8_t)(v);                       \
+        vec_u8_t _a = vec_ld(off, _dst);                   \
+        vec_u8_t _b = vec_ld(off + 15, _dst);              \
+        vec_u8_t _e = vec_perm(_b, _a, vec_lvsl(0, _dst)); \
+        vec_u8_t _m = vec_lvsr(0, _dst);                   \
+                                                           \
+        vec_st(vec_perm(_v, _e, _m), off + 15, _dst);      \
+        vec_st(vec_perm(_e, _v, _m), off, _dst);           \
     } while( 0 )
 #endif



More information about the x264-devel mailing list