From patchwork Thu Jul 4 20:40:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 257020 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 457F42C009C for ; Fri, 5 Jul 2013 07:19:08 +1000 (EST) Received: from localhost ([::1]:57833 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UuqNc-00005W-9a for incoming@patchwork.ozlabs.org; Thu, 04 Jul 2013 16:43:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50793) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UuqLL-0004pv-LU for qemu-devel@nongnu.org; Thu, 04 Jul 2013 16:41:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UuqLI-0002N4-Lu for qemu-devel@nongnu.org; Thu, 04 Jul 2013 16:41:31 -0400 Received: from mail-pd0-x230.google.com ([2607:f8b0:400e:c02::230]:39123) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UuqLI-0002Mk-Ey for qemu-devel@nongnu.org; Thu, 04 Jul 2013 16:41:28 -0400 Received: by mail-pd0-f176.google.com with SMTP id t12so1367558pdi.35 for ; Thu, 04 Jul 2013 13:41:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=yohfzzYd10gRdxYTRyliMV1Jby3tCxZfXrFrVueXT3o=; b=Dq3UuVLZ8jKKNUfLhVO4Bw5g+0zuXW/BAQzeEHWnXLVjXRzAjIVoQ1uib6dsrhwDJ5 Jjs9Jf1ImjdHlN3psrwlkyJyyW6p4zxGSz2tfYjMKN/ScCvQ+QUqgDXX6EzZRAa5+zSo Hf+kiuLc+hKOiAHuI4NH1/mjS/0QE4s56w10m2WGgX+WtAUY7k5lX1PWngKXfZFJGnVC ZZ+V/tpXtTVxFdA5KOks5vVvLSgxHswWqkj/6UqX9wcVe7LzIW82ZMDdt0gys2pauco8 pAqC2mrHEOXLBeKLIE6fLBtU5sFSptGo8gWE1h//gD4GwLIsUdee2+1UppSws0Ge3Gzn KoZg== X-Received: by 10.66.37.43 with SMTP id v11mr8514796paj.108.1372970487684; Thu, 04 Jul 2013 13:41:27 -0700 (PDT) Received: from fremont.twiddle.net (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by mx.google.com with ESMTPSA id pb5sm4093184pbc.29.2013.07.04.13.41.26 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 04 Jul 2013 13:41:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 4 Jul 2013 13:40:57 -0700 Message-Id: <1372970462-10338-11-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1372970462-10338-1-git-send-email-rth@twiddle.net> References: <1372970462-10338-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c02::230 Cc: peter.maydell@linaro.org, aliguori@us.ibm.com Subject: [Qemu-devel] [PATCH v4 10/15] tcg-arm: Simplify logic in detecting the ARM ISA in use 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 GCC 4.8 defines a handy __ARM_ARCH symbol that we can use, which will make us nicely forward compatible with ARMv8 AArch32. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- tcg/arm/tcg-target.c | 62 +++++++++++++++++++--------------------------------- 1 file changed, 23 insertions(+), 39 deletions(-) diff --git a/tcg/arm/tcg-target.c b/tcg/arm/tcg-target.c index cfb9afb..fde1715 100644 --- a/tcg/arm/tcg-target.c +++ b/tcg/arm/tcg-target.c @@ -22,50 +22,34 @@ * THE SOFTWARE. */ -#if defined(__ARM_ARCH_7__) || \ - defined(__ARM_ARCH_7A__) || \ - defined(__ARM_ARCH_7EM__) || \ - defined(__ARM_ARCH_7M__) || \ - defined(__ARM_ARCH_7R__) -#define USE_ARMV7_INSTRUCTIONS +/* The __ARM_ARCH define is provided by gcc 4.8. Construct it otherwise. */ +#ifndef __ARM_ARCH +# if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \ + || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \ + || defined(__ARM_ARCH_7EM__) +# define __ARM_ARCH 7 +# elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \ + || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) \ + || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) +# define __ARM_ARCH 6 +# elif defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5E__) \ + || defined(__ARM_ARCH_5T__) || defined(__ARM_ARCH_5TE__) \ + || defined(__ARM_ARCH_5TEJ__) +# define __ARM_ARCH 5 +# else +# define __ARM_ARCH 4 +# endif #endif -#if defined(USE_ARMV7_INSTRUCTIONS) || \ - defined(__ARM_ARCH_6J__) || \ - defined(__ARM_ARCH_6K__) || \ - defined(__ARM_ARCH_6T2__) || \ - defined(__ARM_ARCH_6Z__) || \ - defined(__ARM_ARCH_6ZK__) -#define USE_ARMV6_INSTRUCTIONS -#endif - -#if defined(USE_ARMV6_INSTRUCTIONS) || \ - defined(__ARM_ARCH_5T__) || \ - defined(__ARM_ARCH_5TE__) || \ - defined(__ARM_ARCH_5TEJ__) -#define USE_ARMV5T_INSTRUCTIONS -#endif - -#ifdef USE_ARMV5T_INSTRUCTIONS -static const int use_armv5t_instructions = 1; +#if defined(__ARM_ARCH_5T__) \ + || defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_5TEJ__) +# define use_armv5t_instructions 1 #else -static const int use_armv5t_instructions = 0; +# define use_armv5t_instructions use_armv6_instructions #endif -#undef USE_ARMV5_INSTRUCTIONS -#ifdef USE_ARMV6_INSTRUCTIONS -static const int use_armv6_instructions = 1; -#else -static const int use_armv6_instructions = 0; -#endif -#undef USE_ARMV6_INSTRUCTIONS - -#ifdef USE_ARMV7_INSTRUCTIONS -static const int use_armv7_instructions = 1; -#else -static const int use_armv7_instructions = 0; -#endif -#undef USE_ARMV7_INSTRUCTIONS +#define use_armv6_instructions (__ARM_ARCH >= 6) +#define use_armv7_instructions (__ARM_ARCH >= 7) #ifndef use_idiv_instructions bool use_idiv_instructions;