[Pixman] [PATCH 5/5] vmx: fix pix_multiply for ppc64le

Oded Gabbay oded.gabbay at gmail.com
Tue Jun 16 08:28:02 PDT 2015


vec_mergeh/l operates differently for BE and LE, because of the order of
the vector elements (l->r in BE and r->l in LE).
To fix that, we simply need to swap between the input parameters, in case
we are working in LE.

Signed-off-by: Oded Gabbay <oded.gabbay at gmail.com>
---
 pixman/pixman-vmx.c | 37 +++++++++++++++++++++++++++++--------
 1 file changed, 29 insertions(+), 8 deletions(-)

diff --git a/pixman/pixman-vmx.c b/pixman/pixman-vmx.c
index 80dd868..66d6d7c 100644
--- a/pixman/pixman-vmx.c
+++ b/pixman/pixman-vmx.c
@@ -57,12 +57,22 @@ pix_multiply (vector unsigned int p, vector unsigned int a)
 
     /* unpack to short */
     hi = (vector unsigned short)
-	vec_mergeh ((vector unsigned char)AVV (0),
-		    (vector unsigned char)p);
+#ifdef _LITTLE_ENDIAN
+    vec_mergeh ((vector unsigned char) p,
+            (vector unsigned char) AVV (0));
+#else
+    vec_mergeh ((vector unsigned char)AVV (0),
+            (vector unsigned char)p);
+#endif
 
     mod = (vector unsigned short)
-	vec_mergeh ((vector unsigned char)AVV (0),
-		    (vector unsigned char)a);
+#ifdef _LITTLE_ENDIAN
+    vec_mergeh ((vector unsigned char) a,
+            (vector unsigned char) AVV (0));
+#else
+    vec_mergeh ((vector unsigned char)AVV (0),
+            (vector unsigned char)a);
+#endif
 
     hi = vec_mladd (hi, mod, (vector unsigned short)
                     AVV (0x0080, 0x0080, 0x0080, 0x0080,
@@ -74,11 +84,22 @@ pix_multiply (vector unsigned int p, vector unsigned int a)
 
     /* unpack to short */
     lo = (vector unsigned short)
-	vec_mergel ((vector unsigned char)AVV (0),
-		    (vector unsigned char)p);
+#ifdef _LITTLE_ENDIAN
+    vec_mergel ((vector unsigned char) p,
+            (vector unsigned char) AVV (0));
+#else
+    vec_mergel ((vector unsigned char)AVV (0),
+            (vector unsigned char)p);
+#endif
+
     mod = (vector unsigned short)
-	vec_mergel ((vector unsigned char)AVV (0),
-		    (vector unsigned char)a);
+#ifdef _LITTLE_ENDIAN
+    vec_mergel ((vector unsigned char) a,
+            (vector unsigned char) AVV (0));
+#else
+    vec_mergel ((vector unsigned char)AVV (0),
+            (vector unsigned char)a);
+#endif
 
     lo = vec_mladd (lo, mod, (vector unsigned short)
                     AVV (0x0080, 0x0080, 0x0080, 0x0080,
-- 
2.4.3



More information about the Pixman mailing list