Message ID | 1443667126-6257-2-git-send-email-rth@twiddle.net |
---|---|
State | New |
Headers | show |
diff --git a/target-tilegx/simd_helper.c b/target-tilegx/simd_helper.c index b931929..774def4 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; }
This will tidy up lots of cases where we'll want to replicate a byte across the 8 elements of the word. Signed-off-by: Richard Henderson <rth@twiddle.net> --- target-tilegx/simd_helper.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)