[Pixman] [PATCH 2/5] vmx: adjust macros when loading vectors on ppc64le
Oded Gabbay
oded.gabbay at gmail.com
Tue Jun 16 08:27:59 PDT 2015
From: Fernando Seiti Furusato <ferseiti at linux.vnet.ibm.com>
Replaced usage of vec_lvsl to direct unaligned assignment
operation (=). That is because, according to Power ABI Specification,
the usage of lvsl is deprecated on ppc64le.
Changed COMPUTE_SHIFT_{MASK,MASKS,MASKC} macro usage to no-op for powerpc
little endian since unaligned access is supported on ppc64le.
Signed-off-by: Fernando Seiti Furusato <ferseiti at linux.vnet.ibm.com>
---
pixman/pixman-vmx.c | 54 ++++++++++++++++++++++++++++++++++++++---------------
1 file changed, 39 insertions(+), 15 deletions(-)
diff --git a/pixman/pixman-vmx.c b/pixman/pixman-vmx.c
index 23537f6..7e5eca7 100644
--- a/pixman/pixman-vmx.c
+++ b/pixman/pixman-vmx.c
@@ -136,6 +136,7 @@ over (vector unsigned int src,
over (pix_multiply (src, mask), \
pix_multiply (srca, mask), dest)
+#ifndef _LITTLE_ENDIAN
#define COMPUTE_SHIFT_MASK(source) \
source ## _mask = vec_lvsl (0, source);
@@ -151,23 +152,46 @@ over (vector unsigned int src,
* Note: tmp3 and tmp4 must remain untouched!
*/
-#define LOAD_VECTORS(dest, source) \
- tmp1 = (typeof(tmp1))vec_ld (0, source); \
- tmp2 = (typeof(tmp2))vec_ld (15, source); \
- v ## source = (typeof(v ## source)) \
- vec_perm (tmp1, tmp2, source ## _mask); \
+#define LOAD_VECTORS(dest, source) \
+ tmp1 = (typeof(tmp1))vec_ld (0, source); \
+ tmp2 = (typeof(tmp2))vec_ld (15, source); \
+ v ## source = (typeof(v ## source)) \
+ vec_perm (tmp1, tmp2, source ## _mask); \
v ## dest = (typeof(v ## dest))vec_ld (0, dest);
-#define LOAD_VECTORSC(dest, source, mask) \
- tmp1 = (typeof(tmp1))vec_ld (0, source); \
- tmp2 = (typeof(tmp2))vec_ld (15, source); \
- v ## source = (typeof(v ## source)) \
- vec_perm (tmp1, tmp2, source ## _mask); \
- tmp1 = (typeof(tmp1))vec_ld (0, mask); \
- v ## dest = (typeof(v ## dest))vec_ld (0, dest); \
- tmp2 = (typeof(tmp2))vec_ld (15, mask); \
- v ## mask = (typeof(v ## mask)) \
- vec_perm (tmp1, tmp2, mask ## _mask);
+#define LOAD_VECTORSC(dest, source, mask) \
+ tmp1 = (typeof(tmp1))vec_ld (0, source); \
+ tmp2 = (typeof(tmp2))vec_ld (15, source); \
+ v ## source = (typeof(v ## source)) \
+ vec_perm (tmp1, tmp2, source ## _mask); \
+ tmp1 = (typeof(tmp1))vec_ld (0, mask); \
+ v ## dest = (typeof(v ## dest))vec_ld (0, dest); \
+ tmp2 = (typeof(tmp2))vec_ld (15, mask); \
+ v ## mask = (typeof(v ## mask)) \
+ vec_perm (tmp1, tmp2, mask ## _mask);
+#else
+
+/* Now the COMPUTE_SHIFT_{MASK, MASKS, MASKC} below are just no-op.
+ * They are defined that way because little endian altivec can do unaligned
+ * reads natively and have no need for constructing the permutation pattern
+ * variables.
+ */
+#define COMPUTE_SHIFT_MASK(source)
+
+#define COMPUTE_SHIFT_MASKS(dest, source)
+
+#define COMPUTE_SHIFT_MASKC(dest, source, mask)
+
+# define LOAD_VECTORS(dest, source) \
+ v ## source = *((typeof(v ## source)*)source); \
+ v ## dest = *((typeof(v ## dest)*)dest);
+
+# define LOAD_VECTORSC(dest, source, mask) \
+ v ## source = *((typeof(v ## source)*)source); \
+ v ## dest = *((typeof(v ## dest)*)dest); \
+ v ## mask = *((typeof(v ## mask)*)mask);
+
+#endif /* _LITTLE_ENDIAN */
#define LOAD_VECTORSM(dest, source, mask) \
LOAD_VECTORSC (dest, source, mask) \
--
2.4.3
More information about the Pixman
mailing list