From 1b09d0d96f083bf01446789172bcb82c28b238ac Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Tue, 2 Mar 2021 11:52:57 -0500 Subject: [PATCH] target/arm: Move neon_element_offset to translate.c This will shortly have users outside of translate-neon.c.inc. Backports 7ec85c02833f4264840c6ed78b749443a7b4ffe0 --- qemu/target/arm/translate-neon.inc.c | 19 ------------------- qemu/target/arm/translate.c | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/qemu/target/arm/translate-neon.inc.c b/qemu/target/arm/translate-neon.inc.c index b342b0ad..358aa98c 100644 --- a/qemu/target/arm/translate-neon.inc.c +++ b/qemu/target/arm/translate-neon.inc.c @@ -60,25 +60,6 @@ static inline int neon_3same_fp_size(DisasContext *s, int x) #include "decode-neon-ls.inc.c" #include "decode-neon-shared.inc.c" -/* Return the offset of a 2**SIZE piece of a NEON register, at index ELE, - * where 0 is the least significant end of the register. - */ -static inline long -neon_element_offset(int reg, int element, MemOp size) -{ - int element_size = 1 << size; - int ofs = element * element_size; -#ifdef HOST_WORDS_BIGENDIAN - /* Calculate the offset assuming fully little-endian, - * then XOR to account for the order of the 8-byte units. - */ - if (element_size < 8) { - ofs ^= 8 - element_size; - } -#endif - return neon_full_reg_offset(reg) + ofs; -} - static void neon_load_element(DisasContext *s, TCGv_i32 var, int reg, int ele, MemOp mop) { TCGContext *tcg_ctx = s->uc->tcg_ctx; diff --git a/qemu/target/arm/translate.c b/qemu/target/arm/translate.c index e82a3a16..6c0f87fa 100644 --- a/qemu/target/arm/translate.c +++ b/qemu/target/arm/translate.c @@ -1146,6 +1146,25 @@ static long neon_full_reg_offset(unsigned reg) return offsetof(CPUARMState, vfp.zregs[reg >> 1].d[reg & 1]); } +/* Return the offset of a 2**SIZE piece of a NEON register, at index ELE, + * where 0 is the least significant end of the register. + */ +static inline long +neon_element_offset(int reg, int element, MemOp size) +{ + int element_size = 1 << size; + int ofs = element * element_size; +#ifdef HOST_WORDS_BIGENDIAN + /* Calculate the offset assuming fully little-endian, + * then XOR to account for the order of the 8-byte units. + */ + if (element_size < 8) { + ofs ^= 8 - element_size; + } +#endif + return neon_full_reg_offset(reg) + ofs; +} + static inline long vfp_reg_offset(bool dp, unsigned reg) { if (dp) {