From edae732810b3796b86a24937d83c2f44ee56180b Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Wed, 3 Mar 2021 18:29:29 -0500 Subject: [PATCH] target/arm: Move general-use constant expanders up in translate.c The constant-expander functions like negate, plus_2, etc, are generally useful; move them up in translate.c so we can use them in the VFP/Neon decoders as well as in the A32/T32/T16 decoders. Backports f7ed0c9433e7c5c157d2e6235eb5c8b93234a71a --- qemu/target/arm/translate.c | 46 ++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/qemu/target/arm/translate.c b/qemu/target/arm/translate.c index 8c0c2414..ff7a0ed6 100644 --- a/qemu/target/arm/translate.c +++ b/qemu/target/arm/translate.c @@ -103,6 +103,30 @@ static void arm_gen_condlabel(DisasContext *s) } } +/* + * Constant expanders for the decoders. + */ + +static int negate(DisasContext *s, int x) +{ + return -x; +} + +static int plus_2(DisasContext *s, int x) +{ + return x + 2; +} + +static int times_2(DisasContext *s, int x) +{ + return x * 2; +} + +static int times_4(DisasContext *s, int x) +{ + return x * 4; +} + /* Flags for the disas_set_da_iss info argument: * lower bits hold the Rt register number, higher bits are flags. */ @@ -5257,29 +5281,9 @@ static void arm_skip_unless(DisasContext *s, uint32_t cond) } /* - * Constant expanders for the decoders. + * Constant expanders used by T16/T32 decode */ -static int negate(DisasContext *s, int x) -{ - return -x; -} - -static int plus_2(DisasContext *s, int x) -{ - return x + 2; -} - -static int times_2(DisasContext *s, int x) -{ - return x * 2; -} - -static int times_4(DisasContext *s, int x) -{ - return x * 4; -} - /* Return only the rotation part of T32ExpandImm. */ static int t32_expandimm_rot(DisasContext *s, int x) {