[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 05/14] tcg/arm: Examine QEMU_TCG_DEBUG environment variable
From: |
Richard Henderson |
Subject: |
[PATCH v3 05/14] tcg/arm: Examine QEMU_TCG_DEBUG environment variable |
Date: |
Wed, 18 Aug 2021 11:29:03 -1000 |
Use the environment variable to test an older ISA from
the one supported by the host.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/arm/tcg-target.h | 8 +++++++-
tcg/arm/tcg-target.c.inc | 32 ++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h
index f41b809554..e47720a85b 100644
--- a/tcg/arm/tcg-target.h
+++ b/tcg/arm/tcg-target.h
@@ -28,9 +28,15 @@
extern int arm_arch;
+#ifdef CONFIG_DEBUG_TCG
+#define use_armv5t_instructions (arm_arch >= 5)
+#define use_armv6_instructions (arm_arch >= 6)
+#define use_armv7_instructions (arm_arch >= 7)
+#else
#define use_armv5t_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)
+#endif
#undef TCG_TARGET_STACK_GROWSUP
#define TCG_TARGET_INSN_UNIT_SIZE 4
@@ -83,7 +89,7 @@ typedef enum {
#else
extern bool use_idiv_instructions;
#endif
-#ifdef __ARM_NEON__
+#if defined(__ARM_NEON__) && !defined(CONFIG_DEBUG_TCG)
#define use_neon_instructions 1
#else
extern bool use_neon_instructions;
diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc
index 87df812bb5..0c7e4f8411 100644
--- a/tcg/arm/tcg-target.c.inc
+++ b/tcg/arm/tcg-target.c.inc
@@ -2455,6 +2455,38 @@ static void tcg_target_init(TCGContext *s)
}
}
+ /*
+ * For debugging/testing purposes, allow the ISA to be reduced
+ * (but not extended) from the set detected above.
+ */
+#ifdef CONFIG_DEBUG_TCG
+ {
+ char *opt = g_strdup(getenv("QEMU_TCG_DEBUG"));
+ if (opt) {
+ for (char *o = strtok(opt, ","); o ; o = strtok(NULL, ",")) {
+ if (o[0] == 'v' &&
+ o[1] >= '4' &&
+ o[1] <= '0' + arm_arch &&
+ o[2] == 0) {
+ arm_arch = o[1] - '0';
+ continue;
+ }
+ if (strcmp(o, "!neon") == 0) {
+ use_neon_instructions = false;
+ continue;
+ }
+ if (strcmp(o, "help") == 0) {
+ printf("QEMU_TCG_DEBUG=<opt>{,<opt>} where <opt> is\n"
+ " v<N> select ARMv<N>\n"
+ " !neon disable ARM NEON\n");
+ exit(0);
+ }
+ }
+ g_free(opt);
+ }
+ }
+#endif
+
tcg_target_available_regs[TCG_TYPE_I32] = ALL_GENERAL_REGS;
tcg_target_call_clobber_regs = 0;
--
2.25.1
- [PATCH v3 00/14] tcg/arm: Unaligned access and other cleanup, Richard Henderson, 2021/08/18
- [PATCH v3 01/14] tcg/arm: Remove fallback definition of __ARM_ARCH, Richard Henderson, 2021/08/18
- [PATCH v3 03/14] tcg/arm: Simplify use_armvt5_instructions, Richard Henderson, 2021/08/18
- [PATCH v3 04/14] tcg/arm: Support armv4t in tcg_out_goto and tcg_out_call, Richard Henderson, 2021/08/18
- [PATCH v3 05/14] tcg/arm: Examine QEMU_TCG_DEBUG environment variable,
Richard Henderson <=
- [PATCH v3 06/14] tcg/arm: Support unaligned access for softmmu, Richard Henderson, 2021/08/18
- [PATCH v3 07/14] tcg/arm: Split out tcg_out_ldstm, Richard Henderson, 2021/08/18
- [PATCH v3 02/14] tcg/arm: Standardize on tcg_out_<branch>_{reg,imm}, Richard Henderson, 2021/08/18
- [PATCH v3 08/14] tcg/arm: Simplify usage of encode_imm, Richard Henderson, 2021/08/18