summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Li <liang.z.li@intel.com>2016-03-08 13:53:16 +0800
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 19:49:36 -0600
commit418b755ad531ac8e83dc220a2e00b5598f6630a7 (patch)
tree90138121717abcac5bfa51e32fdf8ce61a96e8e9
parent60c9ae2da6e9e7ba68c4a965d840068477dbabfa (diff)
downloadhqemu-418b755ad531ac8e83dc220a2e00b5598f6630a7.zip
hqemu-418b755ad531ac8e83dc220a2e00b5598f6630a7.tar.gz
configure: detect ifunc and avx2 attribute
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> Message-Id: <1457416397-26671-2-git-send-email-liang.z.li@intel.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
-rwxr-xr-xconfigure21
1 files changed, 21 insertions, 0 deletions
diff --git a/configure b/configure
index 1b8e673..ba4bd8d 100755
--- a/configure
+++ b/configure
@@ -280,6 +280,7 @@ libusb=""
usb_redir=""
opengl=""
opengl_dmabuf="no"
+avx2_opt="no"
zlib="yes"
lzo=""
snappy=""
@@ -1797,6 +1798,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
@@ -4814,6 +4830,7 @@ echo "bzip2 support $bzip2"
echo "NUMA host support $numa"
echo "tcmalloc support $tcmalloc"
echo "jemalloc support $jemalloc"
+echo "avx2 optimization $avx2_opt"
echo "LLVM enabled $llvm (version `llvm-config --version`)"
if test "$libopencsd" != ""; then
@@ -5207,6 +5224,10 @@ if test "$opengl" = "yes" ; then
fi
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
OpenPOWER on IntegriCloud