[x264-devel] ppc: Add compatibility macros for vec_xxpermdi

Luca Barbato git at videolan.org
Tue Aug 7 00:05:42 CEST 2018


x264 | branch: master | Luca Barbato <lu_zero at gentoo.org> | Thu Jul 12 10:41:22 2018 +0200| [62dcebbce2c3f34998aeb2ea76b89f51306e78e9] | committer: Henrik Gramner

ppc: Add compatibility macros for vec_xxpermdi

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

 common/ppc/ppccommon.h | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/common/ppc/ppccommon.h b/common/ppc/ppccommon.h
index 40f152a9..f0e736e1 100644
--- a/common/ppc/ppccommon.h
+++ b/common/ppc/ppccommon.h
@@ -304,3 +304,34 @@ p2 += i2;
         vec_st(vec_perm(_e, _v, _m), off, _dst);           \
     } while( 0 )
 #endif
+
+// vec_xxpermdi is quite useful but some version of clang do not expose it
+#if !HAVE_VSX || (defined(__clang__) && __clang_major__ < 6)
+static const vec_u8_t xxpermdi0_perm = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
+                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
+                                         0x14, 0x15, 0x16, 0x17 };
+static const vec_u8_t xxpermdi1_perm = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
+                                         0x06, 0x07, 0x18, 0x19, 0x1A, 0x1B,
+                                         0x1C, 0x1D, 0x1E, 0x1F };
+static const vec_u8_t xxpermdi2_perm = { 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
+                                         0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13,
+                                         0x14, 0x15, 0x16, 0x17 };
+static const vec_u8_t xxpermdi3_perm = { 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
+                                         0x0E, 0x0F, 0x18, 0x19, 0x1A, 0x1B,
+                                         0x1C, 0x1D, 0x1E, 0x1F };
+#define xxpermdi(a, b, c) vec_perm(a, b, xxpermdi##c##_perm)
+#elif (defined(__GNUC__) && (__GNUC__ > 6 || (__GNUC__ == 6 && __GNUC_MINOR__ >= 3))) || \
+      (defined(__clang__) && __clang_major__ >= 7)
+#define xxpermdi(a, b, c) vec_xxpermdi(a, b, c)
+#endif
+
+// vec_xxpermdi has its endianness bias exposed in early gcc and clang
+#ifdef WORDS_BIGENDIAN
+#ifndef xxpermdi
+#define xxpermdi(a, b, c) vec_xxpermdi(a, b, c)
+#endif
+#else
+#ifndef xxpermdi
+#define xxpermdi(a, b, c) vec_xxpermdi(b, a, ((c >> 1) | (c & 1) << 1) ^ 3)
+#endif
+#endif



More information about the x264-devel mailing list