target/arm: Move neon_element_offset to translate.c

This will shortly have users outside of translate-neon.c.inc.

Backports 7ec85c02833f4264840c6ed78b749443a7b4ffe0
This commit is contained in:
Richard Henderson 2021-03-02 11:52:57 -05:00 committed by Lioncash
parent 8a20537e7f
commit 1b09d0d96f
2 changed files with 19 additions and 19 deletions

View file

@ -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;

View file

@ -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) {