[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 9/9] tcg-arm: Use AT_PLATFORM to detect the host
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH v2 9/9] tcg-arm: Use AT_PLATFORM to detect the host ISA |
Date: |
Wed, 26 Jun 2013 13:52:09 -0700 |
With this we can generate armv7 insns even when the OS compiles for a
lower common denominator. The macros are arranged so that when we do
compile for a given ISA, all of the runtime checks for that ISA are
optimized away.
Signed-off-by: Richard Henderson <address@hidden>
---
tcg/arm/tcg-target.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/tcg/arm/tcg-target.c b/tcg/arm/tcg-target.c
index 763b173..a46d2e0 100644
--- a/tcg/arm/tcg-target.c
+++ b/tcg/arm/tcg-target.c
@@ -41,9 +41,11 @@
# endif
#endif
-#define use_armv5_instructions (__ARM_ARCH >= 5)
-#define use_armv6_instructions (__ARM_ARCH >= 6)
-#define use_armv7_instructions (__ARM_ARCH >= 7)
+static int arm_arch = __ARM_ARCH;
+
+#define use_armv5_instructions (__ARM_ARCH >= 5 || arm_arch >= 5)
+#define use_armv6_instructions (__ARM_ARCH >= 6 || arm_arch >= 6)
+#define use_armv7_instructions (__ARM_ARCH >= 7 || arm_arch >= 7)
#ifndef use_idiv_instructions
bool use_idiv_instructions;
@@ -2022,12 +2024,22 @@ static const TCGTargetOpDef arm_op_defs[] = {
static void tcg_target_init(TCGContext *s)
{
-#if defined(CONFIG_GETAUXVAL) && !defined(use_idiv_instructions)
+#if defined(CONFIG_GETAUXVAL)
+ /* Only probe for the platform and capabilities if we havn't already
+ determined maximum values at compile time. */
+# if !defined(use_idiv_instructions)
{
unsigned long hwcap = getauxval(AT_HWCAP);
use_idiv_instructions = hwcap & (HWCAP_ARM_IDIVA | HWCAP_ARM_IDIVT);
}
-#endif
+# endif
+ if (__ARM_ARCH < 7) {
+ const char *pl = (const char *)getauxval(AT_PLATFORM);
+ if (pl != NULL && pl[0] == 'v' && pl[1] >= '4' && pl[1] <= '9') {
+ arm_arch = pl[1] - '0';
+ }
+ }
+#endif /* GETAUXVAL */
tcg_regset_set32(tcg_target_available_regs[TCG_TYPE_I32], 0, 0xffff);
tcg_regset_set32(tcg_target_call_clobber_regs, 0,
--
1.8.1.4
- [Qemu-devel] [PATCH v2 0/9] tcg: remainder and arm runtime detection, Richard Henderson, 2013/06/26
- [Qemu-devel] [PATCH v2 1/9] tcg: Split rem requirement from div requirement, Richard Henderson, 2013/06/26
- [Qemu-devel] [PATCH v2 2/9] tcg-arm: Don't implement rem, Richard Henderson, 2013/06/26
- [Qemu-devel] [PATCH v2 3/9] tcg-ppc: Don't implement rem, Richard Henderson, 2013/06/26
- [Qemu-devel] [PATCH v2 4/9] tcg-ppc64: Don't implement rem, Richard Henderson, 2013/06/26
- [Qemu-devel] [PATCH v2 5/9] tcg: Allow non-constant control macros, Richard Henderson, 2013/06/26
- [Qemu-devel] [PATCH v2 6/9] tcg: Simplify logic using TCG_OPF_NOT_PRESENT, Richard Henderson, 2013/06/26
- [Qemu-devel] [PATCH v2 7/9] tcg-arm: Make use of conditional availability of opcodes for divide, Richard Henderson, 2013/06/26
- [Qemu-devel] [PATCH v2 8/9] tcg-arm: Simplify logic in detecting the ARM ISA in use, Richard Henderson, 2013/06/26
- [Qemu-devel] [PATCH v2 9/9] tcg-arm: Use AT_PLATFORM to detect the host ISA,
Richard Henderson <=