[Pixman] [PATCH 3/5] vmx: encapsulate the temporary variables inside the macros

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


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

diff --git a/pixman/pixman-vmx.c b/pixman/pixman-vmx.c
index 7e5eca7..de3e787 100644
--- a/pixman/pixman-vmx.c
+++ b/pixman/pixman-vmx.c
@@ -153,13 +153,18 @@ over (vector unsigned int src,
  */
 
 #define LOAD_VECTORS(dest, 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))           \
     vec_perm (tmp1, tmp2, source ## _mask);       \
-    v ## dest = (typeof(v ## dest))vec_ld (0, dest);
+    v ## dest = (typeof(v ## dest))vec_ld (0, dest);    \
+} 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))           \
@@ -168,7 +173,8 @@ over (vector unsigned int src,
     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);
+    vec_perm (tmp1, tmp2, mask ## _mask);       \
+} while (0);
 #else
 
 /* Now the COMPUTE_SHIFT_{MASK, MASKS, MASKC} below are just no-op.
@@ -208,7 +214,7 @@ vmx_combine_over_u_no_mask (uint32_t *      dest,
 {
     int i;
     vector unsigned int vdest, vsrc;
-    vector unsigned char tmp1, tmp2, src_mask;
+    vector unsigned char src_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -258,7 +264,7 @@ vmx_combine_over_u_mask (uint32_t *      dest,
 {
     int i;
     vector unsigned int vdest, vsrc, vmask;
-    vector unsigned char tmp1, tmp2, src_mask, mask_mask;
+    vector unsigned char src_mask, mask_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -329,7 +335,7 @@ vmx_combine_over_reverse_u_no_mask (uint32_t *      dest,
 {
     int i;
     vector unsigned int vdest, vsrc;
-    vector unsigned char tmp1, tmp2, src_mask;
+    vector unsigned char src_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -377,7 +383,7 @@ vmx_combine_over_reverse_u_mask (uint32_t *      dest,
 {
     int i;
     vector unsigned int vdest, vsrc, vmask;
-    vector unsigned char tmp1, tmp2, src_mask, mask_mask;
+    vector unsigned char src_mask, mask_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -445,7 +451,7 @@ vmx_combine_in_u_no_mask (uint32_t *      dest,
 {
     int i;
     vector unsigned int vdest, vsrc;
-    vector unsigned char tmp1, tmp2, src_mask;
+    vector unsigned char src_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -490,7 +496,7 @@ vmx_combine_in_u_mask (uint32_t *      dest,
 {
     int i;
     vector unsigned int vdest, vsrc, vmask;
-    vector unsigned char tmp1, tmp2, src_mask, mask_mask;
+    vector unsigned char src_mask, mask_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -555,7 +561,7 @@ vmx_combine_in_reverse_u_no_mask (uint32_t *      dest,
 {
     int i;
     vector unsigned int vdest, vsrc;
-    vector unsigned char tmp1, tmp2, src_mask;
+    vector unsigned char src_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -602,7 +608,7 @@ vmx_combine_in_reverse_u_mask (uint32_t *      dest,
 {
     int i;
     vector unsigned int vdest, vsrc, vmask;
-    vector unsigned char tmp1, tmp2, src_mask, mask_mask;
+    vector unsigned char src_mask, mask_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -669,7 +675,7 @@ vmx_combine_out_u_no_mask (uint32_t *      dest,
 {
     int i;
     vector unsigned int vdest, vsrc;
-    vector unsigned char tmp1, tmp2, src_mask;
+    vector unsigned char src_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -716,7 +722,7 @@ vmx_combine_out_u_mask (uint32_t *      dest,
 {
     int i;
     vector unsigned int vdest, vsrc, vmask;
-    vector unsigned char tmp1, tmp2, src_mask, mask_mask;
+    vector unsigned char src_mask, mask_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -781,7 +787,7 @@ vmx_combine_out_reverse_u_no_mask (uint32_t *      dest,
 {
     int i;
     vector unsigned int vdest, vsrc;
-    vector unsigned char tmp1, tmp2, src_mask;
+    vector unsigned char src_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -829,7 +835,7 @@ vmx_combine_out_reverse_u_mask (uint32_t *      dest,
 {
     int i;
     vector unsigned int vdest, vsrc, vmask;
-    vector unsigned char tmp1, tmp2, src_mask, mask_mask;
+    vector unsigned char src_mask, mask_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -896,7 +902,7 @@ vmx_combine_atop_u_no_mask (uint32_t *      dest,
 {
     int i;
     vector unsigned int vdest, vsrc;
-    vector unsigned char tmp1, tmp2, src_mask;
+    vector unsigned char src_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -948,7 +954,7 @@ vmx_combine_atop_u_mask (uint32_t *      dest,
 {
     int i;
     vector unsigned int vdest, vsrc, vmask;
-    vector unsigned char tmp1, tmp2, src_mask, mask_mask;
+    vector unsigned char src_mask, mask_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -1024,7 +1030,7 @@ vmx_combine_atop_reverse_u_no_mask (uint32_t *      dest,
 {
     int i;
     vector unsigned int vdest, vsrc;
-    vector unsigned char tmp1, tmp2, src_mask;
+    vector unsigned char src_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -1076,7 +1082,7 @@ vmx_combine_atop_reverse_u_mask (uint32_t *      dest,
 {
     int i;
     vector unsigned int vdest, vsrc, vmask;
-    vector unsigned char tmp1, tmp2, src_mask, mask_mask;
+    vector unsigned char src_mask, mask_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -1152,7 +1158,7 @@ vmx_combine_xor_u_no_mask (uint32_t *      dest,
 {
     int i;
     vector unsigned int vdest, vsrc;
-    vector unsigned char tmp1, tmp2, src_mask;
+    vector unsigned char src_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -1204,7 +1210,7 @@ vmx_combine_xor_u_mask (uint32_t *      dest,
 {
     int i;
     vector unsigned int vdest, vsrc, vmask;
-    vector unsigned char tmp1, tmp2, src_mask, mask_mask;
+    vector unsigned char src_mask, mask_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -1280,7 +1286,7 @@ vmx_combine_add_u_no_mask (uint32_t *      dest,
 {
     int i;
     vector unsigned int vdest, vsrc;
-    vector unsigned char tmp1, tmp2, src_mask;
+    vector unsigned char src_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -1326,7 +1332,7 @@ vmx_combine_add_u_mask (uint32_t *      dest,
 {
     int i;
     vector unsigned int vdest, vsrc, vmask;
-    vector unsigned char tmp1, tmp2, src_mask, mask_mask;
+    vector unsigned char src_mask, mask_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -1394,7 +1400,7 @@ vmx_combine_src_ca (pixman_implementation_t *imp,
 {
     int i;
     vector unsigned int vdest, vsrc, vmask;
-    vector unsigned char tmp1, tmp2, mask_mask, src_mask;
+    vector unsigned char src_mask, mask_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -1444,7 +1450,7 @@ vmx_combine_over_ca (pixman_implementation_t *imp,
 {
     int i;
     vector unsigned int vdest, vsrc, vmask;
-    vector unsigned char tmp1, tmp2, mask_mask, src_mask;
+    vector unsigned char src_mask, mask_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -1502,7 +1508,7 @@ vmx_combine_over_reverse_ca (pixman_implementation_t *imp,
 {
     int i;
     vector unsigned int vdest, vsrc, vmask;
-    vector unsigned char tmp1, tmp2, mask_mask, src_mask;
+    vector unsigned char src_mask, mask_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -1558,7 +1564,7 @@ vmx_combine_in_ca (pixman_implementation_t *imp,
 {
     int i;
     vector unsigned int vdest, vsrc, vmask;
-    vector unsigned char tmp1, tmp2, mask_mask, src_mask;
+    vector unsigned char src_mask, mask_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -1612,7 +1618,7 @@ vmx_combine_in_reverse_ca (pixman_implementation_t *imp,
 {
     int i;
     vector unsigned int vdest, vsrc, vmask;
-    vector unsigned char tmp1, tmp2, mask_mask, src_mask;
+    vector unsigned char mask_mask, src_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -1667,7 +1673,7 @@ vmx_combine_out_ca (pixman_implementation_t *imp,
 {
     int i;
     vector unsigned int vdest, vsrc, vmask;
-    vector unsigned char tmp1, tmp2, mask_mask, src_mask;
+    vector unsigned char mask_mask, src_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -1724,7 +1730,7 @@ vmx_combine_out_reverse_ca (pixman_implementation_t *imp,
 {
     int i;
     vector unsigned int vdest, vsrc, vmask;
-    vector unsigned char tmp1, tmp2, mask_mask, src_mask;
+    vector unsigned char mask_mask, src_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -1781,7 +1787,7 @@ vmx_combine_atop_ca (pixman_implementation_t *imp,
 {
     int i;
     vector unsigned int vdest, vsrc, vmask, vsrca;
-    vector unsigned char tmp1, tmp2, mask_mask, src_mask;
+    vector unsigned char mask_mask, src_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -1847,7 +1853,7 @@ vmx_combine_atop_reverse_ca (pixman_implementation_t *imp,
 {
     int i;
     vector unsigned int vdest, vsrc, vmask;
-    vector unsigned char tmp1, tmp2, mask_mask, src_mask;
+    vector unsigned char mask_mask, src_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -1910,7 +1916,7 @@ vmx_combine_xor_ca (pixman_implementation_t *imp,
 {
     int i;
     vector unsigned int vdest, vsrc, vmask;
-    vector unsigned char tmp1, tmp2, mask_mask, src_mask;
+    vector unsigned char mask_mask, src_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
@@ -1973,7 +1979,7 @@ vmx_combine_add_ca (pixman_implementation_t *imp,
 {
     int i;
     vector unsigned int vdest, vsrc, vmask;
-    vector unsigned char tmp1, tmp2, mask_mask, src_mask;
+    vector unsigned char mask_mask, src_mask;
 
     while (width && ((uintptr_t)dest & 15))
     {
-- 
2.4.3



More information about the Pixman mailing list