From patchwork Wed Jan 27 07:33:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liang Li X-Patchwork-Id: 8130971 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0B7DABEEE5 for ; Wed, 27 Jan 2016 07:38:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6B22520274 for ; Wed, 27 Jan 2016 07:38:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B2B9820218 for ; Wed, 27 Jan 2016 07:38:39 +0000 (UTC) Received: from localhost ([::1]:48428 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOKgY-0003Px-Uu for patchwork-qemu-devel@patchwork.kernel.org; Wed, 27 Jan 2016 02:38:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50836) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOKgO-0003Oo-Kv for qemu-devel@nongnu.org; Wed, 27 Jan 2016 02:38:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aOKgL-0004HT-EA for qemu-devel@nongnu.org; Wed, 27 Jan 2016 02:38:28 -0500 Received: from mga02.intel.com ([134.134.136.20]:3346) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOKgL-0004HF-8K for qemu-devel@nongnu.org; Wed, 27 Jan 2016 02:38:25 -0500 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 26 Jan 2016 23:38:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,354,1449561600"; d="scan'208";a="899146405" Received: from ll.sh.intel.com (HELO localhost) ([10.239.13.27]) by orsmga002.jf.intel.com with ESMTP; 26 Jan 2016 23:38:21 -0800 From: Liang Li To: qemu-devel@nongnu.org Date: Wed, 27 Jan 2016 15:33:53 +0800 Message-Id: <1453880034-25076-2-git-send-email-liang.z.li@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1453880034-25076-1-git-send-email-liang.z.li@intel.com> References: <1453880034-25076-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.20 Cc: peter.maydell@linaro.org, quintela@redhat.com, Liang Li , 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 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Suggested-by: Peter Maydell Signed-off-by: Liang Li --- 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