From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:59598) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UK2rA-0002Kv-27 for qemu-devel@nongnu.org; Mon, 25 Mar 2013 04:34:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UK2r8-0004or-JK for qemu-devel@nongnu.org; Mon, 25 Mar 2013 04:34:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11214) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UK2r8-0004og-Bj for qemu-devel@nongnu.org; Mon, 25 Mar 2013 04:34:14 -0400 Message-ID: <51500C46.5090508@redhat.com> Date: Mon, 25 Mar 2013 10:35:18 +0200 From: Orit Wasserman MIME-Version: 1.0 References: <1363956370-23681-1-git-send-email-pl@kamp.de> <1363956370-23681-2-git-send-email-pl@kamp.de> In-Reply-To: <1363956370-23681-2-git-send-email-pl@kamp.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCHv4 1/9] move vector definitions to qemu-common.h List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Lieven Cc: Stefan Hajnoczi , Paolo Bonzini , qemu-devel@nongnu.org, quintela@redhat.com On 03/22/2013 02:46 PM, Peter Lieven wrote: > 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 7754ee2..e76ade3 100644 > --- a/include/qemu-common.h > +++ b/include/qemu-common.h > @@ -448,4 +448,28 @@ int uleb128_decode_small(const uint8_t *in, uint32_t *n); > > void hexdump(const char *buf, FILE *fp, const char *prefix, size_t size); > > +/* 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) This is new macro please move it to a separate patch Orit > +#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 >