aboutsummaryrefslogtreecommitdiff
path: root/target-tilegx
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2015-09-21 17:27:11 -0700
committerRichard Henderson <rth@twiddle.net>2015-10-07 20:01:41 +1100
commit055130107683c3b199c1848a25e5e2c568230cbf (patch)
tree9c6aab50d077161aad2bdee27491c201bf3c4cd9 /target-tilegx
parent5fdb4671b08e0d1631447e81348b2b50a6b85bf7 (diff)
downloadqemu-055130107683c3b199c1848a25e5e2c568230cbf.zip
qemu-055130107683c3b199c1848a25e5e2c568230cbf.tar.gz
qemu-055130107683c3b199c1848a25e5e2c568230cbf.tar.bz2
target-tilegx: Tidy simd_helper.c
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>
Diffstat (limited to 'target-tilegx')
-rw-r--r--target-tilegx/simd_helper.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/target-tilegx/simd_helper.c b/target-tilegx/simd_helper.c
index b931929..f573f9b 100644
--- a/target-tilegx/simd_helper.c
+++ b/target-tilegx/simd_helper.c
@@ -23,12 +23,16 @@
#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;
}