All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Lieven <pl@kamp.de>
Cc: Orit Wasserman <owasserm@redhat.com>,
	Stefan Hajnoczi <stefanha@gmail.com>,
	qemu-devel@nongnu.org, quintela@redhat.com
Subject: Re: [Qemu-devel] [PATCHv5 02/10] add a zero splat vector to qemu-common.h
Date: Tue, 26 Mar 2013 11:14:05 +0100	[thread overview]
Message-ID: <515174ED.9020407@redhat.com> (raw)
In-Reply-To: <1364291919-19563-3-git-send-email-pl@kamp.de>

Il 26/03/2013 10:58, Peter Lieven ha scritto:
> Signed-off-by: Peter Lieven <pl@kamp.de>
> ---
>  include/qemu-common.h |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/include/qemu-common.h b/include/qemu-common.h
> index d7ad3a7..9022646 100644
> --- a/include/qemu-common.h
> +++ b/include/qemu-common.h
> @@ -453,6 +453,7 @@ void hexdump(const char *buf, FILE *fp, const char *prefix, size_t size);
>  #include <altivec.h>
>  #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. */
> @@ -462,10 +463,12 @@ void hexdump(const char *buf, FILE *fp, const char *prefix, size_t size);
>  #include <emmintrin.h>
>  #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

C trivia of the day: this can be written simply as

   (VECTYPE) {0}

Yes, it works even with unsigned long. :)  It is a C99 compound literal.

Paolo

  reply	other threads:[~2013-03-26 10:14 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-26  9:58 [Qemu-devel] [PATCHv5 00/10] buffer_is_zero / migration optimizations Peter Lieven
2013-03-26  9:58 ` [Qemu-devel] [PATCHv5 01/10] move vector definitions to qemu-common.h Peter Lieven
2013-03-26  9:58 ` [Qemu-devel] [PATCHv5 02/10] add a zero splat vector " Peter Lieven
2013-03-26 10:14   ` Paolo Bonzini [this message]
2013-03-26 10:17     ` Peter Lieven
2013-03-26 10:17       ` Paolo Bonzini
2013-03-26 10:18         ` Peter Lieven
2013-03-26  9:58 ` [Qemu-devel] [PATCHv5 03/10] cutils: add a function to find non-zero content in a buffer Peter Lieven
2013-03-26 10:38   ` Juan Quintela
2013-03-26 10:42     ` Peter Lieven
2013-03-26 10:41   ` Juan Quintela
2013-03-26  9:58 ` [Qemu-devel] [PATCHv5 04/10] buffer_is_zero: use vector optimizations if possible Peter Lieven
2013-03-26  9:58 ` [Qemu-devel] [PATCHv5 05/10] bitops: unroll while loop in find_next_bit() Peter Lieven
2013-03-26  9:58 ` [Qemu-devel] [PATCHv5 06/10] migration: search for zero instead of dup pages Peter Lieven
2013-04-05 19:23   ` Kevin Wolf
2013-04-05 20:00     ` Paolo Bonzini
2013-04-05 21:44       ` Peter Lieven
2013-04-05 22:06       ` Peter Lieven
2013-04-08  8:38         ` Paolo Bonzini
2013-04-08  9:25           ` Peter Lieven
2013-04-08 10:33             ` Paolo Bonzini
2013-04-08  8:33     ` Peter Lieven
2013-04-08  8:39       ` Peter Lieven
2013-04-08  8:49       ` Kevin Wolf
2013-04-08  8:50         ` Peter Lieven
2013-03-26  9:58 ` [Qemu-devel] [PATCHv5 07/10] migration: add an indicator for bulk state of ram migration Peter Lieven
2013-03-26  9:58 ` [Qemu-devel] [PATCHv5 08/10] migration: do not sent zero pages in bulk stage Peter Lieven
2013-03-26  9:58 ` [Qemu-devel] [PATCHv5 09/10] migration: do not search dirty " Peter Lieven
2013-03-26  9:58 ` [Qemu-devel] [PATCHv5 10/10] migration: use XBZRLE only after " Peter Lieven
2013-03-26 10:46 ` [Qemu-devel] [PATCHv5 00/10] buffer_is_zero / migration optimizations Juan Quintela
2013-03-26 11:02   ` Peter Lieven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=515174ED.9020407@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=owasserm@redhat.com \
    --cc=pl@kamp.de \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=stefanha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.