summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOded Gabbay <oded.gabbay@gmail.com>2015-06-25 15:59:57 +0300
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2015-07-02 10:04:41 +0300
commit2be523b20402b7c9f548ac33b8c0f0ed00156c64 (patch)
tree8c4d238cb2705266c910ba3b4d4c07bc3b3e712a
parent8d379ad88e208bed9697065f6911c9ef83d85276 (diff)
vmx: fix pix_multiply for ppc64le
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. v2: - replace _LITTLE_ENDIAN with WORDS_BIGENDIAN for consistency - fixed whitespaces and indentation issues Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-rw-r--r--pixman/pixman-vmx.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/pixman/pixman-vmx.c b/pixman/pixman-vmx.c
index c963c28..cef921f 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)
+#ifdef WORDS_BIGENDIAN
vec_mergeh ((vector unsigned char)AVV (0),
(vector unsigned char)p);
+#else
+ vec_mergeh ((vector unsigned char) p,
+ (vector unsigned char) AVV (0));
+#endif
mod = (vector unsigned short)
+#ifdef WORDS_BIGENDIAN
vec_mergeh ((vector unsigned char)AVV (0),
(vector unsigned char)a);
+#else
+ vec_mergeh ((vector unsigned char) a,
+ (vector unsigned char) AVV (0));
+#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)
+#ifdef WORDS_BIGENDIAN
vec_mergel ((vector unsigned char)AVV (0),
(vector unsigned char)p);
+#else
+ vec_mergel ((vector unsigned char) p,
+ (vector unsigned char) AVV (0));
+#endif
+
mod = (vector unsigned short)
+#ifdef WORDS_BIGENDIAN
vec_mergel ((vector unsigned char)AVV (0),
(vector unsigned char)a);
+#else
+ vec_mergel ((vector unsigned char) a,
+ (vector unsigned char) AVV (0));
+#endif
lo = vec_mladd (lo, mod, (vector unsigned short)
AVV (0x0080, 0x0080, 0x0080, 0x0080,