From: Liang Li <liang.z.li@intel.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, quintela@redhat.com,
Liang Li <liang.z.li@intel.com>,
dgilbert@redhat.com, stefanha@redhat.com, amit.shah@redhat.com,
pbonzini@redhat.com, rth@twiddle.net
Subject: [Qemu-devel] [PATCH v5 1/2] configure: detect ifunc and avx2 attribute
Date: Wed, 27 Jan 2016 15:33:53 +0800 [thread overview]
Message-ID: <1453880034-25076-2-git-send-email-liang.z.li@intel.com> (raw)
In-Reply-To: <1453880034-25076-1-git-send-email-liang.z.li@intel.com>
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.
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Liang Li <liang.z.li@intel.com>
---
configure | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/configure b/configure
index 3506e44..a50dcf5 100755
--- a/configure
+++ b/configure
@@ -311,6 +311,7 @@ smartcard=""
libusb=""
usb_redir=""
opengl=""
+avx2_opt="no"
zlib="yes"
lzo=""
snappy=""
@@ -1832,6 +1833,21 @@ EOF
fi
##########################################
+# avx2 optimization requirement check
+
+cat > $TMPC << EOF
+static void bar(void) {}
+static void *bar_ifunc(void) {return (void*) bar;}
+static void foo(void) __attribute__((ifunc("bar_ifunc")));
+int main(void) { foo(); return 0; }
+EOF
+if compile_prog "-mavx2" "" ; then
+ if readelf --syms $TMPE |grep "IFUNC.*foo" >/dev/null 2>&1; then
+ avx2_opt="yes"
+ fi
+fi
+
+#########################################
# zlib check
if test "$zlib" != "no" ; then
@@ -4922,6 +4938,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"
@@ -5306,6 +5323,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
--
1.9.1
next prev parent reply other threads:[~2016-01-27 7:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-27 7:33 [Qemu-devel] [PATCH v5 0/2] add avx2 instruction optimization Liang Li
2016-01-27 7:33 ` Liang Li [this message]
2016-01-27 7:33 ` [Qemu-devel] [PATCH v5 2/2] cutils: " Liang Li
2016-01-27 14:20 ` [Qemu-devel] [PATCH v5 0/2] " Paolo Bonzini
2016-02-22 6:23 ` Li, Liang Z
2016-02-22 6:40 ` Amit Shah
2016-02-22 6:47 ` 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=1453880034-25076-2-git-send-email-liang.z.li@intel.com \
--to=liang.z.li@intel.com \
--cc=amit.shah@redhat.com \
--cc=dgilbert@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).