summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2017-07-18 18:40:18 -1000
committerPeter Maydell <peter.maydell@linaro.org>2017-07-24 12:42:55 +0100
commit5dd8990841a9e331d9d4838a116291698208cbb6 (patch)
treee2d46bda2138d892ebb1ecc210696d88f739008a /configure
parentdf95f1a298a3e16c80293343143dcedbe7978f6c (diff)
downloadqemu-5dd8990841a9e331d9d4838a116291698208cbb6.tar.gz
util: Introduce include/qemu/cpuid.h
Clang 3.9 passes the CONFIG_AVX2_OPT configure test. However, the supplied <cpuid.h> does not contain the bit_AVX2 define that we use when detecting whether the routine can be enabled. Introduce a qemu-specific header that uses the compiler's definition of __cpuid et al, but supplies any missing bit_* definitions needed. This avoids introducing any extra ifdefs to util/bufferiszero.c, and allows quite a few to be removed from tcg/i386/tcg-target.inc.c. Signed-off-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20170719044018.18063-1-rth@twiddle.net Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure43
1 files changed, 24 insertions, 19 deletions
diff --git a/configure b/configure
index 6b52e19ee3..987f59ba88 100755
--- a/configure
+++ b/configure
@@ -358,6 +358,7 @@ libusb=""
usb_redir=""
opengl=""
opengl_dmabuf="no"
+cpuid_h="no"
avx2_opt="no"
zlib="yes"
lzo=""
@@ -1931,24 +1932,6 @@ EOF
fi
fi
-##########################################
-# avx2 optimization requirement check
-
-cat > $TMPC << EOF
-#pragma GCC push_options
-#pragma GCC target("avx2")
-#include <cpuid.h>
-#include <immintrin.h>
-static int bar(void *a) {
- __m256i x = *(__m256i *)a;
- return _mm256_testz_si256(x, x);
-}
-int main(int argc, char *argv[]) { return bar(argv[0]); }
-EOF
-if compile_object "" ; then
- avx2_opt="yes"
-fi
-
#########################################
# zlib check
@@ -4646,7 +4629,6 @@ fi
########################################
# check if cpuid.h is usable.
-cpuid_h=no
cat > $TMPC << EOF
#include <cpuid.h>
int main(void) {
@@ -4668,6 +4650,29 @@ if compile_prog "" "" ; then
cpuid_h=yes
fi
+##########################################
+# avx2 optimization requirement check
+#
+# There is no point enabling this if cpuid.h is not usable,
+# since we won't be able to select the new routines.
+
+if test $cpuid_h = yes; then
+ cat > $TMPC << EOF
+#pragma GCC push_options
+#pragma GCC target("avx2")
+#include <cpuid.h>
+#include <immintrin.h>
+static int bar(void *a) {
+ __m256i x = *(__m256i *)a;
+ return _mm256_testz_si256(x, x);
+}
+int main(int argc, char *argv[]) { return bar(argv[0]); }
+EOF
+ if compile_object "" ; then
+ avx2_opt="yes"
+ fi
+fi
+
########################################
# check if __[u]int128_t is usable.