All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Liang Li <liang.z.li@intel.com>, qemu-devel@nongnu.org
Cc: quintela@redhat.com, mst@redhat.com, dgilbert@redhat.com,
	stefanha@redhat.com, amit.shah@redhat.com, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [v3 1/3] cutils: add avx2 instruction optimization
Date: Tue, 8 Dec 2015 08:09:46 -0800	[thread overview]
Message-ID: <566700CA.1080408@twiddle.net> (raw)
In-Reply-To: <1449576535-3369-2-git-send-email-liang.z.li@intel.com>

On 12/08/2015 04:08 AM, Liang Li wrote:
> +++ b/util/buffer-zero-avx2.c
> @@ -0,0 +1,54 @@
> +#include "qemu-common.h"
> +
> +#if defined CONFIG_IFUNC && defined CONFIG_AVX2
> +#include <immintrin.h>
> +#define AVX2_VECTYPE        __m256i
> +#define AVX2_SPLAT(p)       _mm256_set1_epi8(*(p))
> +#define AVX2_ALL_EQ(v1, v2) \
> +    (_mm256_movemask_epi8(_mm256_cmpeq_epi8(v1, v2)) == 0xFFFFFFFF)
> +#define AVX2_VEC_OR(v1, v2) (_mm256_or_si256(v1, v2))
> +
> +inline bool
> +can_use_buffer_find_nonzero_offset_avx2(const void *buf, size_t len)
> +{
> +    return (len % (BUFFER_FIND_NONZERO_OFFSET_UNROLL_FACTOR
> +                   * sizeof(AVX2_VECTYPE)) == 0
> +            && ((uintptr_t) buf) % sizeof(AVX2_VECTYPE) == 0);
> +}

I'm not keen on adding a new file for this.  You ought to be able to use
__attribute__((target("-mavx2"))) on any compiler that supports the
command-line option.  Which means you can do this all in one file with static
functions.

Nor am I keen on marking a function inline when we know it must be out-of-line
because of the ifunc usage.


r~

  reply	other threads:[~2015-12-08 16:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-08 12:08 [Qemu-devel] [v3 0/3] add avx2 instruction optimization Liang Li
2015-12-08 12:08 ` [Qemu-devel] [v3 1/3] cutils: " Liang Li
2015-12-08 16:09   ` Richard Henderson [this message]
2015-12-09  9:32     ` Li, Liang Z
2015-12-09 14:57       ` Richard Henderson
2015-12-10  1:10         ` Li, Liang Z
2015-12-10  9:03         ` Paolo Bonzini
2015-12-10  9:22           ` Li, Liang Z
2015-12-10  9:51             ` Paolo Bonzini
2015-12-08 12:08 ` [Qemu-devel] [v3 2/3] configure: detect ifunc attribute Liang Li
2015-12-08 12:08 ` [Qemu-devel] [v3 3/3] configure: add options to config avx2 Liang Li
2015-12-08 12:54   ` Peter Maydell
2015-12-08 14:18     ` Li, Liang Z

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=566700CA.1080408@twiddle.net \
    --to=rth@twiddle.net \
    --cc=amit.shah@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=liang.z.li@intel.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=stefanha@redhat.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.