diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2021-04-30 14:27:28 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2021-05-10 13:24:09 +0100 |
commit | b5aa664679510645fa01f55590db60ca2657f7fc (patch) | |
tree | 4512336b125d1ed9bc2a13509c817cd027260661 /target/arm/translate.h | |
parent | eb849d8fd542329b299be5a894d7e272eed16a49 (diff) |
target/arm: Move constant expanders to translate.h
Some of the constant expanders defined in translate.c are generically
useful and will be used by the separate C files for VFP and Neon once
they are created; move the expander definitions to translate.h.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20210430132740.10391-2-peter.maydell@linaro.org
Diffstat (limited to 'target/arm/translate.h')
-rw-r--r-- | target/arm/translate.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/target/arm/translate.h b/target/arm/translate.h index ccf60c96d8..b5b2161959 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -118,6 +118,30 @@ extern TCGv_i32 cpu_NF, cpu_ZF, cpu_CF, cpu_VF; extern TCGv_i64 cpu_exclusive_addr; extern TCGv_i64 cpu_exclusive_val; +/* + * Constant expanders for the decoders. + */ + +static inline int negate(DisasContext *s, int x) +{ + return -x; +} + +static inline int plus_2(DisasContext *s, int x) +{ + return x + 2; +} + +static inline int times_2(DisasContext *s, int x) +{ + return x * 2; +} + +static inline int times_4(DisasContext *s, int x) +{ + return x * 4; +} + static inline int arm_dc_feature(DisasContext *dc, int feature) { return (dc->features & (1ULL << feature)) != 0; |