[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PATCH v1 03/33] s390x: Add one temporary vector register i
From: |
David Hildenbrand |
Subject: |
[qemu-s390x] [PATCH v1 03/33] s390x: Add one temporary vector register in CPU state for TCG |
Date: |
Tue, 26 Feb 2019 12:38:45 +0100 |
We sometimes want to work on a temporary vector register instead of the
actual destination, because source and destination might overlap. An
alternative would be loading the vector into two i64 variables, but than
separate handling for accessing the vector elements would be needed.
This is easier. Add one for now as that seems to be enough.
Signed-off-by: David Hildenbrand <address@hidden>
---
target/s390x/cpu.h | 11 +++++++++++
target/s390x/translate.c | 3 +++
2 files changed, 14 insertions(+)
diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
index cb6d77053a..a8dc0b2b83 100644
--- a/target/s390x/cpu.h
+++ b/target/s390x/cpu.h
@@ -67,6 +67,17 @@ struct CPUS390XState {
* vregs[0][0] -> vregs[15][0] are 16 floating point registers
*/
CPU_DoubleU vregs[32][2]; /* vector registers */
+#ifdef CONFIG_TCG
+#define TMP_VREG_0 33
+ /*
+ * Temporary vector registers used while processing vector instructions
+ * in TCG. This is helpful e.g. when source and destination registers
+ * overlap for certain instructions in translate functions. Content valid
+ * only within execution of one translated block, therefore no migration is
+ * needed. Resets don't mather, but has to be properly aligned.
+ */
+ CPU_DoubleU tmp_vregs[1][2];
+#endif
uint32_t aregs[16]; /* access registers */
uint8_t riccb[64]; /* runtime instrumentation control */
uint64_t gscb[4]; /* guarded storage control */
diff --git a/target/s390x/translate.c b/target/s390x/translate.c
index d52c02c572..8733d19182 100644
--- a/target/s390x/translate.c
+++ b/target/s390x/translate.c
@@ -147,6 +147,9 @@ void s390x_translate_init(void)
static inline int vec_full_reg_offset(uint8_t reg)
{
+ if (reg == TMP_VREG_0) {
+ return offsetof(CPUS390XState, tmp_vregs[0][0].d);
+ }
g_assert(reg < 32);
return offsetof(CPUS390XState, vregs[reg][0].d);
}
--
2.17.2
- Re: [qemu-s390x] [Qemu-devel] [PATCH v1 01/33] s390x/tcg: Define vector instruction formats, (continued)
- [qemu-s390x] [PATCH v1 02/33] s390x/tcg: Check vector register instructions at central point, David Hildenbrand, 2019/02/26
- [qemu-s390x] [PATCH v1 03/33] s390x: Add one temporary vector register in CPU state for TCG,
David Hildenbrand <=
- [qemu-s390x] [PATCH v1 09/33] s390x/tcg: Implement VECTOR LOAD AND REPLICATE, David Hildenbrand, 2019/02/26
- [qemu-s390x] [PATCH v1 10/33] s390x/tcg: Implement VECTOR LOAD ELEMENT, David Hildenbrand, 2019/02/26
- [qemu-s390x] [PATCH v1 04/33] s390x/tcg: Utilities for vector instruction helpers, David Hildenbrand, 2019/02/26
- [qemu-s390x] [PATCH v1 11/33] s390x/tcg: Implement VECTOR LOAD ELEMENT IMMEDIATE, David Hildenbrand, 2019/02/26
- [qemu-s390x] [PATCH v1 17/33] s390x/tcg: Implement VECTOR LOAD VR FROM GRS DISJOINT, David Hildenbrand, 2019/02/26