]> git.proxmox.com Git - mirror_qemu.git/commitdiff
target-tilegx: Tidy simd_helper.c
authorRichard Henderson <rth@twiddle.net>
Tue, 22 Sep 2015 00:27:11 +0000 (17:27 -0700)
committerRichard Henderson <rth@twiddle.net>
Wed, 7 Oct 2015 09:01:41 +0000 (20:01 +1100)
Using the V1 macro when we want to replicate a byte across
the 8 elements of the word.  Using deposit and extract for
manipulating specific elements.

Signed-off-by: Richard Henderson <rth@twiddle.net>
target-tilegx/simd_helper.c

index b9319292f3c822d895646fd473948504dd71359a..f573f9b51a16383a1f500a1b22f754103ea8d3b1 100644 (file)
 #include "exec/helper-proto.h"
 
 
+/* Broadcast a value to all elements of a vector.  */
+#define V1(X)      (((X) & 0xff) * 0x0101010101010101ull)
+
+
 uint64_t helper_v1shl(uint64_t a, uint64_t b)
 {
     uint64_t m;
 
     b &= 7;
-    m = 0x0101010101010101ULL * (0xff >> b);
+    m = V1(0xff >> b);
     return (a & m) << b;
 }
 
@@ -37,7 +41,7 @@ uint64_t helper_v1shru(uint64_t a, uint64_t b)
     uint64_t m;
 
     b &= 7;
-    m = 0x0101010101010101ULL * ((0xff << b) & 0xff);
+    m = V1(0xff << b);
     return (a & m) >> b;
 }
 
@@ -48,8 +52,7 @@ uint64_t helper_v1shrs(uint64_t a, uint64_t b)
 
     b &= 7;
     for (i = 0; i < 64; i += 8) {
-        int64_t ae = (int8_t)(a >> i);
-        r |= ((ae >> b) & 0xff) << i;
+        r = deposit64(r, i, 8, sextract64(a, i + b, 8 - b));
     }
     return r;
 }