@samitouri / QOSamiQemu / commits / 3d215929fa

target/arm: Move tile_vslice_{index, offset} to vec_internal.h

Move in preparation for being used outside sme_helper.c. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20260618041517.573469-2-richard.henderson@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Richard Henderson committed Jun 17, 2026 at 21:15 UTC 3d215929fad81582aa644b4b6e8d76c8b000da5c
2 files changed +31 -33
target/arm/tcg/sme_helper.c
-33
@@ -64,39 +64,6 @@ void helper_sme_zero(CPUARMState *env, uint32_t imm, uint32_t svl)
64 }
65 }
66
67 -
68 -/*
69 - * When considering the ZA storage as an array of elements of
70 - * type T, the index within that array of the Nth element of
71 - * a vertical slice of a tile can be calculated like this,
72 - * regardless of the size of type T. This is because the tiles
73 - * are interleaved, so if type T is size N bytes then row 1 of
74 - * the tile is N rows away from row 0. The division by N to
75 - * convert a byte offset into an array index and the multiplication
76 - * by N to convert from vslice-index-within-the-tile to
77 - * the index within the ZA storage cancel out.
78 - */
79 -#define tile_vslice_index(i) ((i) * sizeof(ARMVectorReg))
80 -
81 -/*
82 - * When doing byte arithmetic on the ZA storage, the element
83 - * byteoff bytes away in a tile vertical slice is always this
84 - * many bytes away in the ZA storage, regardless of the
85 - * size of the tile element, assuming that byteoff is a multiple
86 - * of the element size. Again this is because of the interleaving
87 - * of the tiles. For instance if we have 1 byte per element then
88 - * each row of the ZA storage has one byte of the vslice data,
89 - * and (counting from 0) byte 8 goes in row 8 of the storage
90 - * at offset (8 * row-size-in-bytes).
91 - * If we have 8 bytes per element then each row of the ZA storage
92 - * has 8 bytes of the data, but there are 8 interleaved tiles and
93 - * so byte 8 of the data goes into row 1 of the tile,
94 - * which is again row 8 of the storage, so the offset is still
95 - * (8 * row-size-in-bytes). Similarly for other element sizes.
96 - */
97 -#define tile_vslice_offset(byteoff) ((byteoff) * sizeof(ARMVectorReg))
98 -
99 -
67 /*
68 * Move Zreg vector to ZArray column.
69 */
target/arm/tcg/vec_internal.h
+31
@@ -55,6 +55,37 @@ typedef struct CPUArchState CPUARMState;
55 #define H8(x) (x)
56 #define H1_8(x) (x)
57
58 +/*
59 + * When considering the ZA storage as an array of elements of
60 + * type T, the index within that array of the Nth element of
61 + * a vertical slice of a tile can be calculated like this,
62 + * regardless of the size of type T. This is because the tiles
63 + * are interleaved, so if type T is size N bytes then row 1 of
64 + * the tile is N rows away from row 0. The division by N to
65 + * convert a byte offset into an array index and the multiplication
66 + * by N to convert from vslice-index-within-the-tile to
67 + * the index within the ZA storage cancel out.
68 + */
69 +#define tile_vslice_index(i) ((i) * sizeof(ARMVectorReg))
70 +
71 +/*
72 + * When doing byte arithmetic on the ZA storage, the element
73 + * byteoff bytes away in a tile vertical slice is always this
74 + * many bytes away in the ZA storage, regardless of the
75 + * size of the tile element, assuming that byteoff is a multiple
76 + * of the element size. Again this is because of the interleaving
77 + * of the tiles. For instance if we have 1 byte per element then
78 + * each row of the ZA storage has one byte of the vslice data,
79 + * and (counting from 0) byte 8 goes in row 8 of the storage
80 + * at offset (8 * row-size-in-bytes).
81 + * If we have 8 bytes per element then each row of the ZA storage
82 + * has 8 bytes of the data, but there are 8 interleaved tiles and
83 + * so byte 8 of the data goes into row 1 of the tile,
84 + * which is again row 8 of the storage, so the offset is still
85 + * (8 * row-size-in-bytes). Similarly for other element sizes.
86 + */
87 +#define tile_vslice_offset(byteoff) ((byteoff) * sizeof(ARMVectorReg))
88 +
89 /*
90 * Expand active predicate bits to bytes, for byte elements.
91 */