summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2019-02-25 21:03:15 +0100
committerCornelia Huck <cohuck@redhat.com>2019-03-04 11:49:31 +0100
commit27197fec128d5ee97ec060f99b95df2c48668783 (patch)
treeb9d5ac50d8f30b561adf42991626ceb37651412f
parentffdd8ebb79a6533913a1fbcf0aa12ef107842202 (diff)
downloadfocaccia-qemu-27197fec128d5ee97ec060f99b95df2c48668783.tar.gz
focaccia-qemu-27197fec128d5ee97ec060f99b95df2c48668783.zip
s390x/tcg: Factor out vec_full_reg_offset()
We'll use that a lot along with gvec helpers, to calculate the start
address of a vector.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190225200318.16102-5-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
-rw-r--r--target/s390x/translate.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/target/s390x/translate.c b/target/s390x/translate.c
index 6647a67998..933bf29331 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_8 - 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)