@samitouri / QOSamiQemu / commits / 784b01c77d

target/arm: Split vector-type.h from cpu.h

We want to be able to reference ARMVectorType etc from common code, so move it out of cpu.h. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20260522220306.235200-23-richard.henderson@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Richard Henderson committed May 22, 2026 at 15:02 UTC 784b01c77dcec5ffb9284d119dc19abdb91c38f2
2 files changed +45 -37
target/arm/cpu.h
+1 -37
@@ -35,6 +35,7 @@
35 #include "target/arm/cpu-sysregs.h"
36 #include "target/arm/mmuidx.h"
37 #include "hw/intc/arm_gicv5_types.h"
38 +#include "target/arm/vector-type.h"
39
40 #define EXCP_UDEF 1 /* undefined instruction */
41 #define EXCP_SWI 2 /* software interrupt */
@@ -140,43 +141,6 @@ typedef struct ARMGenericTimer {
141 uint64_t ctl; /* Timer Control register */
142 } ARMGenericTimer;
143
143 -/* Define a maximum sized vector register.
144 - * For 32-bit, this is a 128-bit NEON/AdvSIMD register.
145 - * For 64-bit, this is a 2048-bit SVE register.
146 - *
147 - * Note that the mapping between S, D, and Q views of the register bank
148 - * differs between AArch64 and AArch32.
149 - * In AArch32:
150 - * Qn = regs[n].d[1]:regs[n].d[0]
151 - * Dn = regs[n / 2].d[n & 1]
152 - * Sn = regs[n / 4].d[n % 4 / 2],
153 - * bits 31..0 for even n, and bits 63..32 for odd n
154 - * (and regs[16] to regs[31] are inaccessible)
155 - * In AArch64:
156 - * Zn = regs[n].d[*]
157 - * Qn = regs[n].d[1]:regs[n].d[0]
158 - * Dn = regs[n].d[0]
159 - * Sn = regs[n].d[0] bits 31..0
160 - * Hn = regs[n].d[0] bits 15..0
161 - *
162 - * This corresponds to the architecturally defined mapping between
163 - * the two execution states, and means we do not need to explicitly
164 - * map these registers when changing states.
165 - *
166 - * Align the data for use with TCG host vector operations.
167 - */
168 -
169 -#define ARM_MAX_VQ 16
170 -
171 -typedef struct ARMVectorReg {
172 - uint64_t d[2 * ARM_MAX_VQ] QEMU_ALIGNED(16);
173 -} ARMVectorReg;
174 -
175 -/* In AArch32 mode, predicate registers do not exist at all. */
176 -typedef struct ARMPredicateReg {
177 - uint64_t p[DIV_ROUND_UP(2 * ARM_MAX_VQ, 8)] QEMU_ALIGNED(16);
178 -} ARMPredicateReg;
179 -
144 /* In AArch32 mode, PAC keys do not exist at all. */
145 typedef struct ARMPACKey {
146 uint64_t lo, hi;
target/arm/vector-type.h new
+44
@@ -0,0 +1,44 @@
1 +/* SPDX-License-Identifier: GPL-2.0-or-later */
2 +
3 +#ifndef TARGET_ARM_VECTOR_TYPE_H
4 +#define TARGET_ARM_VECTOR_TYPE_H
5 +
6 +/*
7 + * Define a maximum sized vector register.
8 + * For 32-bit, this is a 128-bit NEON/AdvSIMD register.
9 + * For 64-bit, this is a 2048-bit SVE register.
10 + *
11 + * Note that the mapping between S, D, and Q views of the register bank
12 + * differs between AArch64 and AArch32.
13 + * In AArch32:
14 + * Qn = regs[n].d[1]:regs[n].d[0]
15 + * Dn = regs[n / 2].d[n & 1]
16 + * Sn = regs[n / 4].d[n % 4 / 2],
17 + * bits 31..0 for even n, and bits 63..32 for odd n
18 + * (and regs[16] to regs[31] are inaccessible)
19 + * In AArch64:
20 + * Zn = regs[n].d[*]
21 + * Qn = regs[n].d[1]:regs[n].d[0]
22 + * Dn = regs[n].d[0]
23 + * Sn = regs[n].d[0] bits 31..0
24 + * Hn = regs[n].d[0] bits 15..0
25 + *
26 + * This corresponds to the architecturally defined mapping between
27 + * the two execution states, and means we do not need to explicitly
28 + * map these registers when changing states.
29 + *
30 + * Align the data for use with TCG host vector operations.
31 + */
32 +
33 +#define ARM_MAX_VQ 16
34 +
35 +typedef struct ARMVectorReg {
36 + uint64_t d[2 * ARM_MAX_VQ] QEMU_ALIGNED(16);
37 +} ARMVectorReg;
38 +
39 +/* In AArch32 mode, predicate registers do not exist at all. */
40 +typedef struct ARMPredicateReg {
41 + uint64_t p[DIV_ROUND_UP(2 * ARM_MAX_VQ, 8)] QEMU_ALIGNED(16);
42 +} ARMPredicateReg;
43 +
44 +#endif