From patchwork Fri Mar 15 15:50:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Lieven X-Patchwork-Id: 228155 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7636A2C00B7 for ; Sat, 16 Mar 2013 06:31:38 +1100 (EST) Received: from localhost ([::1]:38657 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGaLo-0007WU-Lg for incoming@patchwork.ozlabs.org; Fri, 15 Mar 2013 15:31:36 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58250) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGXDy-0001ku-7v for qemu-devel@nongnu.org; Fri, 15 Mar 2013 12:11:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UGXDm-0006IZ-4O for qemu-devel@nongnu.org; Fri, 15 Mar 2013 12:11:18 -0400 Received: from [2a02:248:0:30:223:aeff:fefe:7f1c] (port=48341 helo=dns.kamp-intra.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGXDl-0006HZ-Tv for qemu-devel@nongnu.org; Fri, 15 Mar 2013 12:11:06 -0400 Received: from lieven-pc.kamp-intra.net (lieven-pc.kamp-intra.net [172.21.12.60]) by dns.kamp-intra.net (Postfix) with ESMTP id 82A3F206E6; Fri, 15 Mar 2013 16:51:52 +0100 (CET) Received: by lieven-pc.kamp-intra.net (Postfix, from userid 1000) id 740FD61314; Fri, 15 Mar 2013 16:51:52 +0100 (CET) From: Peter Lieven To: qemu-devel@nongnu.org Date: Fri, 15 Mar 2013 16:50:10 +0100 Message-Id: <1363362619-3190-2-git-send-email-pl@kamp.de> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1363362619-3190-1-git-send-email-pl@kamp.de> References: <1363362619-3190-1-git-send-email-pl@kamp.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2a02:248:0:30:223:aeff:fefe:7f1c X-Mailman-Approved-At: Fri, 15 Mar 2013 15:28:40 -0400 Cc: Peter Lieven Subject: [Qemu-devel] [PATCHv2 1/9] move vector definitions to qemu-common.h X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org vector optimizations will now be used at various places not just in is_dup_page() in arch_init.c this patch also adds a zero splat vector. Signed-off-by: Peter Lieven Reviewed-by: Eric Blake --- arch_init.c | 20 -------------------- include/qemu-common.h | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/arch_init.c b/arch_init.c index 98e2bc6..1b71912 100644 --- a/arch_init.c +++ b/arch_init.c @@ -114,26 +114,6 @@ const uint32_t arch_type = QEMU_ARCH; #define RAM_SAVE_FLAG_CONTINUE 0x20 #define RAM_SAVE_FLAG_XBZRLE 0x40 -#ifdef __ALTIVEC__ -#include -#define VECTYPE vector unsigned char -#define SPLAT(p) vec_splat(vec_ld(0, p), 0) -#define ALL_EQ(v1, v2) vec_all_eq(v1, v2) -/* altivec.h may redefine the bool macro as vector type. - * Reset it to POSIX semantics. */ -#undef bool -#define bool _Bool -#elif defined __SSE2__ -#include -#define VECTYPE __m128i -#define SPLAT(p) _mm_set1_epi8(*(p)) -#define ALL_EQ(v1, v2) (_mm_movemask_epi8(_mm_cmpeq_epi8(v1, v2)) == 0xFFFF) -#else -#define VECTYPE unsigned long -#define SPLAT(p) (*(p) * (~0UL / 255)) -#define ALL_EQ(v1, v2) ((v1) == (v2)) -#endif - static struct defconfig_file { const char *filename; diff --git a/include/qemu-common.h b/include/qemu-common.h index 5e13708..b59328f 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -442,4 +442,28 @@ int64_t pow2floor(int64_t value); int uleb128_encode_small(uint8_t *out, uint32_t n); int uleb128_decode_small(const uint8_t *in, uint32_t *n); +/* vector definitions */ +#ifdef __ALTIVEC__ +#include +#define VECTYPE vector unsigned char +#define SPLAT(p) vec_splat(vec_ld(0, p), 0) +#define ZERO_SPLAT vec_splat(vec_ld(0, 0), 0) +#define ALL_EQ(v1, v2) vec_all_eq(v1, v2) +/* altivec.h may redefine the bool macro as vector type. + * Reset it to POSIX semantics. */ +#undef bool +#define bool _Bool +#elif defined __SSE2__ +#include +#define VECTYPE __m128i +#define SPLAT(p) _mm_set1_epi8(*(p)) +#define ZERO_SPLAT _mm_setzero_si128() +#define ALL_EQ(v1, v2) (_mm_movemask_epi8(_mm_cmpeq_epi8(v1, v2)) == 0xFFFF) +#else +#define VECTYPE unsigned long +#define SPLAT(p) (*(p) * (~0UL / 255)) +#define ZERO_SPLAT 0x0UL +#define ALL_EQ(v1, v2) ((v1) == (v2)) +#endif + #endif