diff options
author | Peter Maydell | 2020-11-19 22:55:57 +0100 |
---|---|---|
committer | Peter Maydell | 2020-12-10 12:44:55 +0100 |
commit | f7ed0c9433e7c5c157d2e6235eb5c8b93234a71a (patch) | |
tree | 5163fd95991909aaeec479a3957b0da390588bfd /target/arm/translate.c | |
parent | target/arm: Refactor M-profile VMSR/VMRS handling (diff) | |
download | qemu-f7ed0c9433e7c5c157d2e6235eb5c8b93234a71a.tar.gz qemu-f7ed0c9433e7c5c157d2e6235eb5c8b93234a71a.tar.xz qemu-f7ed0c9433e7c5c157d2e6235eb5c8b93234a71a.zip |
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.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20201119215617.29887-9-peter.maydell@linaro.org
Diffstat (limited to 'target/arm/translate.c')
-rw-r--r-- | target/arm/translate.c | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/target/arm/translate.c b/target/arm/translate.c index 47a1a5739c..f5acd32e76 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -109,6 +109,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. */ @@ -5177,29 +5201,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) { |