Received: from eggs.gnu.org ([2001:4830:134:3::10]:40625) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhTmX-0003hA-Fc for qemu-devel@nongnu.org; Wed, 30 Sep 2015 22:39:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZhTmW-0007Uy-Dy for qemu-devel@nongnu.org; Wed, 30 Sep 2015 22:39:41 -0400 Received: from mail-pa0-x231.google.com ([2607:f8b0:400e:c03::231]:33557) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhTmW-0007UN-9E for qemu-devel@nongnu.org; Wed, 30 Sep 2015 22:39:40 -0400 Received: by pacex6 with SMTP id ex6so58847246pac.0 for ; Wed, 30 Sep 2015 19:39:39 -0700 (PDT) Sender: Richard Henderson From: Richard Henderson Date: Thu, 1 Oct 2015 12:38:33 +1000 Message-Id: <1443667126-6257-2-git-send-email-rth@twiddle.net> In-Reply-To: <1443667126-6257-1-git-send-email-rth@twiddle.net> References: <1443667126-6257-1-git-send-email-rth@twiddle.net> Subject: [Qemu-devel] [PATCH 01/14] target-tilegx: Use V1 in simd_helper.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: gang.chen.5i5j@gmail.com 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 --- target-tilegx/simd_helper.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; } -- 2.4.3