[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PATCH v2 4/7] s390x/tcg: Factor out vec_full_reg_offset()
From: |
David Hildenbrand |
Subject: |
[qemu-s390x] [PATCH v2 4/7] s390x/tcg: Factor out vec_full_reg_offset() |
Date: |
Mon, 25 Feb 2019 21:03:15 +0100 |
We'll use that a lot along with gvec helpers, to calculate the start
address of a vector.
Reviewed-by: Thomas Huth <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: David Hildenbrand <address@hidden>
---
target/s390x/translate.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/target/s390x/translate.c b/target/s390x/translate.c
index 5e3955e4d7..6d36cfed2a 100644
--- a/target/s390x/translate.c
+++ b/target/s390x/translate.c
@@ -145,13 +145,18 @@ void s390x_translate_init(void)
}
}
+static inline int vec_full_reg_offset(uint8_t reg)
+{
+ g_assert(reg < 32);
+ return offsetof(CPUS390XState, vregs[reg][0].d);
+}
+
static inline int vec_reg_offset(uint8_t reg, uint8_t enr, TCGMemOp es)
{
/* Convert element size (es) - e.g. MO_U8 - to bytes */
const uint8_t bytes = 1 << es;
int offs = enr * bytes;
- g_assert(reg < 32);
/*
* vregs[n][0] is the lowest 8 byte and vregs[n][1] the highest 8 byte
* of the 16 byte vector, on both, little and big endian systems.
@@ -178,7 +183,7 @@ static inline int vec_reg_offset(uint8_t reg, uint8_t enr,
TCGMemOp es)
#ifndef HOST_WORDS_BIGENDIAN
offs ^= (8 - bytes);
#endif
- return offs + offsetof(CPUS390XState, vregs[reg][0].d);
+ return offs + vec_full_reg_offset(reg);
}
static inline int freg64_offset(uint8_t reg)
--
2.17.2
- [qemu-s390x] [PATCH v2 0/7] s390x/tcg: Cleanups and refactorings for vector instructions, David Hildenbrand, 2019/02/25
- [qemu-s390x] [PATCH v2 1/7] s390x/tcg: RXE has an optional M3 field, David Hildenbrand, 2019/02/25
- [qemu-s390x] [PATCH v2 4/7] s390x/tcg: Factor out vec_full_reg_offset(),
David Hildenbrand <=
- [qemu-s390x] [PATCH v2 5/7] s390x/tcg: Factor out gen_addi_and_wrap_i64() from get_address(), David Hildenbrand, 2019/02/25
- [qemu-s390x] [PATCH v2 6/7] s390x/tcg: Implement LOAD LENGTHENED short HFP to long HFP, David Hildenbrand, 2019/02/25
- [qemu-s390x] [PATCH v2 2/7] s390x/tcg: Simplify disassembler operands initialization, David Hildenbrand, 2019/02/25
- [qemu-s390x] [PATCH v2 7/7] s390x/tcg: Implement LOAD COUNT TO BLOCK BOUNDARY, David Hildenbrand, 2019/02/25
- Re: [qemu-s390x] [PATCH v2 0/7] s390x/tcg: Cleanups and refactorings for vector instructions, David Hildenbrand, 2019/02/25
- [qemu-s390x] [PATCH v2 3/7] s390x/tcg: Clarify terminology in vec_reg_offset(), David Hildenbrand, 2019/02/25
- Re: [qemu-s390x] [PATCH v2 0/7] s390x/tcg: Cleanups and refactorings for vector instructions, Cornelia Huck, 2019/02/26