All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Liang Li <liang.z.li@intel.com>, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, mst@redhat.com, rth7680@gmail.com,
	dgilbert@redhat.com, quintela@redhat.com, stefanha@redhat.com,
	amit.shah@redhat.com, rth@twiddle.net
Subject: Re: [Qemu-devel] [PATCH v4 1/2] configure: detect ifunc and avx2 attribute
Date: Wed, 20 Jan 2016 10:50:59 +0100	[thread overview]
Message-ID: <569F5883.2090608@redhat.com> (raw)
In-Reply-To: <1453280742-20718-2-git-send-email-liang.z.li@intel.com>



On 20/01/2016 10:05, Liang Li wrote:
> Detect if the compiler can support the ifun and avx2, if so, set
> CONFIG_AVX2_OPT which will be used to turn on the avx2 instruction
> optimization.
> 
> Signed-off-by: Liang Li <liang.z.li@intel.com>
> ---
>  configure | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/configure b/configure
> index 44ac9ab..b7f4661 100755
> --- a/configure
> +++ b/configure
> @@ -310,6 +310,7 @@ smartcard=""
>  libusb=""
>  usb_redir=""
>  opengl=""
> +avx2_opt=""
>  zlib="yes"
>  lzo=""
>  snappy=""
> @@ -1827,6 +1828,20 @@ EOF
>  fi
>  
>  ##########################################
> +# avx2 optimization requirement check
> +
> +cat > $TMPC << EOF
> +static void bar(void) {}

Might be nicer to use "void *" and return an actual function name:

static void bar(void) {}
static void *bar_ifunc(void) { return (void *)bar; }
void foo(void) __attribute__((ifunc("bar_ifunc")));

And also you probably should use "readelf --syms ... | grep IFUNC.*foo"
to check that the attribute was not ignored.

Paolo


> +static void foo(void) __attribute__((ifunc("bar")));
> +int main(void) { foo(); return 0; }
> +EOF
> +if compile_prog "" "-mavx2" ; then
> +    avx2_opt="yes"
> +else
> +    avx2_opt="no"
> +fi
> +
> +#########################################
>  # zlib check
>  
>  if test "$zlib" != "no" ; then
> @@ -4855,6 +4870,7 @@ echo "bzip2 support     $bzip2"
>  echo "NUMA host support $numa"
>  echo "tcmalloc support  $tcmalloc"
>  echo "jemalloc support  $jemalloc"
> +echo "avx2 optimization $avx2_opt"
>  
>  if test "$sdl_too_old" = "yes"; then
>  echo "-> Your SDL version is too old - please upgrade to have SDL support"
> @@ -5236,6 +5252,10 @@ if test "$opengl" = "yes" ; then
>    echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak
>  fi
>  
> +if test "$avx2_opt" = "yes" ; then
> +  echo "CONFIG_AVX2_OPT=y" >> $config_host_mak
> +fi
> +
>  if test "$lzo" = "yes" ; then
>    echo "CONFIG_LZO=y" >> $config_host_mak
>  fi
> 

  reply	other threads:[~2016-01-20  9:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-20  9:05 [Qemu-devel] [PATCH v4 0/3] add avx2 instruction optimization Liang Li
2016-01-20  9:05 ` [Qemu-devel] [PATCH v4 1/2] configure: detect ifunc and avx2 attribute Liang Li
2016-01-20  9:50   ` Paolo Bonzini [this message]
2016-01-20 10:43     ` Li, Liang Z
2016-01-20  9:05 ` [Qemu-devel] [PATCH v4 2/2] cutils: add avx2 instruction optimization Liang Li
2016-01-20  9:46   ` Paolo Bonzini
2016-01-20 10:22 ` [Qemu-devel] [PATCH v4 0/3] " 陈博
2016-01-20 15:25   ` Eric Blake

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=569F5883.2090608@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=liang.z.li@intel.com \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=rth7680@gmail.com \
    --cc=rth@twiddle.net \
    --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.