summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOded Gabbay <oded.gabbay@gmail.com>2015-07-02 11:04:20 +0300
committerOded Gabbay <oded.gabbay@gmail.com>2015-07-16 16:13:35 +0300
commit034149537be94862b43fb09699b8c2149bfe948d (patch)
tree162bbb92a8cd818f06b9690332bcfe86a9a7dc6c
parent744134025609a0a5805c2d3b4d34856eb75cb711 (diff)
vmx: add LOAD_VECTOR macro
This patch adds a macro for loading a single vector. It also make the other LOAD_VECTORx macros use this macro as a base so code would be re-used. In addition, I fixed minor coding style issues. Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com> Acked-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
-rw-r--r--pixman/pixman-vmx.c50
1 files changed, 24 insertions, 26 deletions
diff --git a/pixman/pixman-vmx.c b/pixman/pixman-vmx.c
index cef921f..880a19a 100644
--- a/pixman/pixman-vmx.c
+++ b/pixman/pixman-vmx.c
@@ -169,33 +169,29 @@ over (vector unsigned int src,
mask ## _mask = vec_lvsl (0, mask); \
source ## _mask = vec_lvsl (0, source);
-/* notice you have to declare temp vars...
- * Note: tmp3 and tmp4 must remain untouched!
- */
-
-#define LOAD_VECTORS(dest, source) \
-do { \
+#define LOAD_VECTOR(source) \
+do \
+{ \
vector unsigned char tmp1, tmp2; \
tmp1 = (typeof(tmp1))vec_ld (0, source); \
tmp2 = (typeof(tmp2))vec_ld (15, source); \
- v ## source = (typeof(v ## source)) \
+ v ## source = (typeof(v ## source)) \
vec_perm (tmp1, tmp2, source ## _mask); \
+} while (0)
+
+#define LOAD_VECTORS(dest, source) \
+do \
+{ \
+ LOAD_VECTOR(source); \
v ## dest = (typeof(v ## dest))vec_ld (0, dest); \
-} while (0);
+} while (0)
#define LOAD_VECTORSC(dest, source, mask) \
-do { \
- vector unsigned char tmp1, tmp2; \
- 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); \
-} while (0);
+do \
+{ \
+ LOAD_VECTORS(dest, source); \
+ LOAD_VECTOR(mask); \
+} while (0)
#define DECLARE_SRC_MASK_VAR vector unsigned char src_mask
#define DECLARE_MASK_MASK_VAR vector unsigned char mask_mask
@@ -213,14 +209,16 @@ do { \
#define COMPUTE_SHIFT_MASKC(dest, source, mask)
+# define LOAD_VECTOR(source) \
+ v ## source = *((typeof(v ## source)*)source);
+
# define LOAD_VECTORS(dest, source) \
- v ## source = *((typeof(v ## source)*)source); \
- v ## dest = *((typeof(v ## dest)*)dest);
+ LOAD_VECTOR(source); \
+ LOAD_VECTOR(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);
+ LOAD_VECTORS(dest, source); \
+ LOAD_VECTOR(mask); \
#define DECLARE_SRC_MASK_VAR
#define DECLARE_MASK_MASK_VAR
@@ -228,7 +226,7 @@ do { \
#endif /* WORDS_BIGENDIAN */
#define LOAD_VECTORSM(dest, source, mask) \
- LOAD_VECTORSC (dest, source, mask) \
+ LOAD_VECTORSC (dest, source, mask); \
v ## source = pix_multiply (v ## source, \
splat_alpha (v ## mask));