From patchwork Tue Mar 8 11:32:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Shah X-Patchwork-Id: 594040 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 4DBCD140327 for ; Tue, 8 Mar 2016 22:34:50 +1100 (AEDT) Received: from localhost ([::1]:33877 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adFua-0002v2-8L for incoming@patchwork.ozlabs.org; Tue, 08 Mar 2016 06:34:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adFsp-0008Mx-MV for qemu-devel@nongnu.org; Tue, 08 Mar 2016 06:33:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1adFso-000557-Mn for qemu-devel@nongnu.org; Tue, 08 Mar 2016 06:32:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42471) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adFso-00054z-Go for qemu-devel@nongnu.org; Tue, 08 Mar 2016 06:32:58 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 2D9C8A2882; Tue, 8 Mar 2016 11:32:58 +0000 (UTC) Received: from localhost (ovpn-113-65.phx2.redhat.com [10.3.113.65]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u28BWubh011318; Tue, 8 Mar 2016 06:32:57 -0500 From: Amit Shah To: Peter Maydell Date: Tue, 8 Mar 2016 17:02:33 +0530 Message-Id: <99f2dbd34328771b12dee782ebccda1c25b4c23b.1457436688.git.amit.shah@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Amit Shah , liang.z.li@intel.com, qemu list , "Dr. David Alan Gilbert" , Juan Quintela Subject: [Qemu-devel] [PULL 2/3] 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Liang Li 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 Message-Id: <1457416397-26671-2-git-send-email-liang.z.li@intel.com> Signed-off-by: Amit Shah --- configure | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/configure b/configure index 0c0472a..2b32876 100755 --- a/configure +++ b/configure @@ -280,6 +280,7 @@ libusb="" usb_redir="" opengl="" opengl_dmabuf="no" +avx2_opt="no" zlib="yes" lzo="" snappy="" @@ -1773,6 +1774,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 @@ -4790,6 +4806,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" @@ -5178,6 +5195,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