From patchwork Tue Nov 10 02:51:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Liang Z" X-Patchwork-Id: 542100 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id A84261402C2 for ; Tue, 10 Nov 2015 13:59:09 +1100 (AEDT) Received: from localhost ([::1]:57063 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zvz9H-0007nq-Tg for incoming@patchwork.ozlabs.org; Mon, 09 Nov 2015 21:59:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51753) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zvz7y-0005qD-8p for qemu-devel@nongnu.org; Mon, 09 Nov 2015 21:57:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zvz7t-0001lC-5J for qemu-devel@nongnu.org; Mon, 09 Nov 2015 21:57:46 -0500 Received: from mga03.intel.com ([134.134.136.65]:56874) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zvz7t-0001kO-0C for qemu-devel@nongnu.org; Mon, 09 Nov 2015 21:57:41 -0500 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 09 Nov 2015 18:57:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,268,1444719600"; d="scan'208";a="597281074" Received: from ll.sh.intel.com (HELO localhost) ([10.239.13.27]) by FMSMGA003.fm.intel.com with ESMTP; 09 Nov 2015 18:57:39 -0800 From: Liang Li To: qemu-devel@nongnu.org Date: Tue, 10 Nov 2015 10:51:47 +0800 Message-Id: <1447123907-26750-3-git-send-email-liang.z.li@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1447123907-26750-1-git-send-email-liang.z.li@intel.com> References: <1447123907-26750-1-git-send-email-liang.z.li@intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.65 Cc: quintela@redhat.com, Liang Li , mst@redhat.com, amit.shah@redhat.com, pbonzini@redhat.com Subject: [Qemu-devel] [v2 2/2] configure: add options to config avx2 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add the '--enable-avx2' & '--disable-avx2' option so as to config the AVX2 instruction optimization. By default, avx2 optimization is enabled, if '--disable-avx2' is not set, configure will detect if the compiler can support AVX2 option, if yes, AVX2 optimization is eabled, else disabled. Signed-off-by: Liang Li --- configure | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/configure b/configure index 42e57c0..4d81be2 100755 --- a/configure +++ b/configure @@ -310,6 +310,7 @@ smartcard="" libusb="" usb_redir="" opengl="" +avx2="yes" zlib="yes" lzo="" snappy="" @@ -1057,6 +1058,10 @@ for opt do ;; --enable-usb-redir) usb_redir="yes" ;; + --disable-avx2) avx2="no" + ;; + --enable-avx2) avx2="yes" + ;; --disable-zlib-test) zlib="no" ;; --disable-lzo) lzo="no" @@ -1373,6 +1378,7 @@ disabled with --disable-FEATURE, default is enabled if available: smartcard smartcard support (libcacard) libusb libusb (for usb passthrough) usb-redir usb network redirection support + avx2 support of avx2 instruction lzo support of lzo compression library snappy support of snappy compression library bzip2 support of bzip2 compression library @@ -1809,6 +1815,24 @@ EOF fi fi +######################################## +# avx2 check + +if test "$avx2" != "no" ; then + cat > $TMPC << EOF +int main(void) { return 0; } +EOF + if compile_prog "" "-mavx2" ; then + avx2="yes" + else + avx2="no" + fi +fi + +if test "$avx2" = "yes" ; then + avx2_cflags=" -mavx2" +fi + ########################################## # zlib check @@ -4782,6 +4806,7 @@ echo "libssh2 support $libssh2" echo "TPM passthrough $tpm_passthrough" echo "QOM debugging $qom_cast_debug" echo "vhdx $vhdx" +echo "avx2 support $avx2" echo "lzo support $lzo" echo "snappy support $snappy" echo "bzip2 support $bzip2" @@ -5166,6 +5191,10 @@ if test "$opengl" = "yes" ; then echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak fi +if test "$avx2" = "yes" ; then + echo "AVX2_CFLAGS=$avx2_cflags" >> $config_host_mak +fi + if test "$lzo" = "yes" ; then echo "CONFIG_LZO=y" >> $config_host_mak fi