xref: /openbmc/qemu/target/arm/tcg/translate-sme.c (revision ec08d9a51e6af3cd3edbdbf2ca6e97a1e2b5f0d1)
1f0984d40SFabiano Rosas /*
2f0984d40SFabiano Rosas  * AArch64 SME translation
3f0984d40SFabiano Rosas  *
4f0984d40SFabiano Rosas  * Copyright (c) 2022 Linaro, Ltd
5f0984d40SFabiano Rosas  *
6f0984d40SFabiano Rosas  * This library is free software; you can redistribute it and/or
7f0984d40SFabiano Rosas  * modify it under the terms of the GNU Lesser General Public
8f0984d40SFabiano Rosas  * License as published by the Free Software Foundation; either
9f0984d40SFabiano Rosas  * version 2.1 of the License, or (at your option) any later version.
10f0984d40SFabiano Rosas  *
11f0984d40SFabiano Rosas  * This library is distributed in the hope that it will be useful,
12f0984d40SFabiano Rosas  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13f0984d40SFabiano Rosas  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14f0984d40SFabiano Rosas  * Lesser General Public License for more details.
15f0984d40SFabiano Rosas  *
16f0984d40SFabiano Rosas  * You should have received a copy of the GNU Lesser General Public
17f0984d40SFabiano Rosas  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18f0984d40SFabiano Rosas  */
19f0984d40SFabiano Rosas 
20f0984d40SFabiano Rosas #include "qemu/osdep.h"
21f0984d40SFabiano Rosas #include "translate.h"
22f0984d40SFabiano Rosas #include "translate-a64.h"
23f0984d40SFabiano Rosas 
24f0984d40SFabiano Rosas /*
25f0984d40SFabiano Rosas  * Include the generated decoder.
26f0984d40SFabiano Rosas  */
27f0984d40SFabiano Rosas 
28f0984d40SFabiano Rosas #include "decode-sme.c.inc"
29f0984d40SFabiano Rosas 
30f0984d40SFabiano Rosas 
31f0984d40SFabiano Rosas /*
32f0984d40SFabiano Rosas  * Resolve tile.size[index] to a host pointer, where tile and index
33f0984d40SFabiano Rosas  * are always decoded together, dependent on the element size.
34f0984d40SFabiano Rosas  */
get_tile_rowcol(DisasContext * s,int esz,int rs,int tile_index,bool vertical)35f0984d40SFabiano Rosas static TCGv_ptr get_tile_rowcol(DisasContext *s, int esz, int rs,
36f0984d40SFabiano Rosas                                 int tile_index, bool vertical)
37f0984d40SFabiano Rosas {
38f0984d40SFabiano Rosas     int tile = tile_index >> (4 - esz);
39f0984d40SFabiano Rosas     int index = esz == MO_128 ? 0 : extract32(tile_index, 0, 4 - esz);
40f0984d40SFabiano Rosas     int pos, len, offset;
41f0984d40SFabiano Rosas     TCGv_i32 tmp;
42f0984d40SFabiano Rosas     TCGv_ptr addr;
43f0984d40SFabiano Rosas 
44f0984d40SFabiano Rosas     /* Compute the final index, which is Rs+imm. */
45f0984d40SFabiano Rosas     tmp = tcg_temp_new_i32();
46f0984d40SFabiano Rosas     tcg_gen_trunc_tl_i32(tmp, cpu_reg(s, rs));
47f0984d40SFabiano Rosas     tcg_gen_addi_i32(tmp, tmp, index);
48f0984d40SFabiano Rosas 
49f0984d40SFabiano Rosas     /* Prepare a power-of-two modulo via extraction of @len bits. */
50f0984d40SFabiano Rosas     len = ctz32(streaming_vec_reg_size(s)) - esz;
51f0984d40SFabiano Rosas 
5256f1c0dbSPeter Maydell     if (!len) {
5356f1c0dbSPeter Maydell         /*
5456f1c0dbSPeter Maydell          * SVL is 128 and the element size is 128. There is exactly
5556f1c0dbSPeter Maydell          * one 128x128 tile in the ZA storage, and so we calculate
5656f1c0dbSPeter Maydell          * (Rs + imm) MOD 1, which is always 0. We need to special case
5756f1c0dbSPeter Maydell          * this because TCG doesn't allow deposit ops with len 0.
5856f1c0dbSPeter Maydell          */
5956f1c0dbSPeter Maydell         tcg_gen_movi_i32(tmp, 0);
6056f1c0dbSPeter Maydell     } else if (vertical) {
61f0984d40SFabiano Rosas         /*
62f0984d40SFabiano Rosas          * Compute the byte offset of the index within the tile:
63f0984d40SFabiano Rosas          *     (index % (svl / size)) * size
64f0984d40SFabiano Rosas          *   = (index % (svl >> esz)) << esz
65f0984d40SFabiano Rosas          * Perform the power-of-two modulo via extraction of the low @len bits.
66f0984d40SFabiano Rosas          * Perform the multiply by shifting left by @pos bits.
67f0984d40SFabiano Rosas          * Perform these operations simultaneously via deposit into zero.
68f0984d40SFabiano Rosas          */
69f0984d40SFabiano Rosas         pos = esz;
70f0984d40SFabiano Rosas         tcg_gen_deposit_z_i32(tmp, tmp, pos, len);
71f0984d40SFabiano Rosas 
72f0984d40SFabiano Rosas         /*
73f0984d40SFabiano Rosas          * For big-endian, adjust the indexed column byte offset within
74f0984d40SFabiano Rosas          * the uint64_t host words that make up env->zarray[].
75f0984d40SFabiano Rosas          */
76f0984d40SFabiano Rosas         if (HOST_BIG_ENDIAN && esz < MO_64) {
77f0984d40SFabiano Rosas             tcg_gen_xori_i32(tmp, tmp, 8 - (1 << esz));
78f0984d40SFabiano Rosas         }
79f0984d40SFabiano Rosas     } else {
80f0984d40SFabiano Rosas         /*
81f0984d40SFabiano Rosas          * Compute the byte offset of the index within the tile:
82f0984d40SFabiano Rosas          *     (index % (svl / size)) * (size * sizeof(row))
83f0984d40SFabiano Rosas          *   = (index % (svl >> esz)) << (esz + log2(sizeof(row)))
84f0984d40SFabiano Rosas          */
85f0984d40SFabiano Rosas         pos = esz + ctz32(sizeof(ARMVectorReg));
86f0984d40SFabiano Rosas         tcg_gen_deposit_z_i32(tmp, tmp, pos, len);
87f0984d40SFabiano Rosas 
88f0984d40SFabiano Rosas         /* Row slices are always aligned and need no endian adjustment. */
89f0984d40SFabiano Rosas     }
90f0984d40SFabiano Rosas 
91f0984d40SFabiano Rosas     /* The tile byte offset within env->zarray is the row. */
92f0984d40SFabiano Rosas     offset = tile * sizeof(ARMVectorReg);
93f0984d40SFabiano Rosas 
94f0984d40SFabiano Rosas     /* Include the byte offset of zarray to make this relative to env. */
95f0984d40SFabiano Rosas     offset += offsetof(CPUARMState, zarray);
96f0984d40SFabiano Rosas     tcg_gen_addi_i32(tmp, tmp, offset);
97f0984d40SFabiano Rosas 
98f0984d40SFabiano Rosas     /* Add the byte offset to env to produce the final pointer. */
99f0984d40SFabiano Rosas     addr = tcg_temp_new_ptr();
100f0984d40SFabiano Rosas     tcg_gen_ext_i32_ptr(addr, tmp);
101ad75a51eSRichard Henderson     tcg_gen_add_ptr(addr, addr, tcg_env);
102f0984d40SFabiano Rosas 
103f0984d40SFabiano Rosas     return addr;
104f0984d40SFabiano Rosas }
105f0984d40SFabiano Rosas 
1061f51573fSRichard Henderson /*
1071f51573fSRichard Henderson  * Resolve tile.size[0] to a host pointer.
1081f51573fSRichard Henderson  * Used by e.g. outer product insns where we require the entire tile.
1091f51573fSRichard Henderson  */
get_tile(DisasContext * s,int esz,int tile)1101f51573fSRichard Henderson static TCGv_ptr get_tile(DisasContext *s, int esz, int tile)
1111f51573fSRichard Henderson {
1121f51573fSRichard Henderson     TCGv_ptr addr = tcg_temp_new_ptr();
1131f51573fSRichard Henderson     int offset;
1141f51573fSRichard Henderson 
1151f51573fSRichard Henderson     offset = tile * sizeof(ARMVectorReg) + offsetof(CPUARMState, zarray);
1161f51573fSRichard Henderson 
117ad75a51eSRichard Henderson     tcg_gen_addi_ptr(addr, tcg_env, offset);
1181f51573fSRichard Henderson     return addr;
1191f51573fSRichard Henderson }
1201f51573fSRichard Henderson 
trans_ZERO(DisasContext * s,arg_ZERO * a)121f0984d40SFabiano Rosas static bool trans_ZERO(DisasContext *s, arg_ZERO *a)
122f0984d40SFabiano Rosas {
123f0984d40SFabiano Rosas     if (!dc_isar_feature(aa64_sme, s)) {
124f0984d40SFabiano Rosas         return false;
125f0984d40SFabiano Rosas     }
126f0984d40SFabiano Rosas     if (sme_za_enabled_check(s)) {
127ad75a51eSRichard Henderson         gen_helper_sme_zero(tcg_env, tcg_constant_i32(a->imm),
128f0984d40SFabiano Rosas                             tcg_constant_i32(streaming_vec_reg_size(s)));
129f0984d40SFabiano Rosas     }
130f0984d40SFabiano Rosas     return true;
131f0984d40SFabiano Rosas }
132f0984d40SFabiano Rosas 
trans_MOVA(DisasContext * s,arg_MOVA * a)133f0984d40SFabiano Rosas static bool trans_MOVA(DisasContext *s, arg_MOVA *a)
134f0984d40SFabiano Rosas {
135f0984d40SFabiano Rosas     static gen_helper_gvec_4 * const h_fns[5] = {
136f0984d40SFabiano Rosas         gen_helper_sve_sel_zpzz_b, gen_helper_sve_sel_zpzz_h,
137f0984d40SFabiano Rosas         gen_helper_sve_sel_zpzz_s, gen_helper_sve_sel_zpzz_d,
138f0984d40SFabiano Rosas         gen_helper_sve_sel_zpzz_q
139f0984d40SFabiano Rosas     };
140f0984d40SFabiano Rosas     static gen_helper_gvec_3 * const cz_fns[5] = {
141f0984d40SFabiano Rosas         gen_helper_sme_mova_cz_b, gen_helper_sme_mova_cz_h,
142f0984d40SFabiano Rosas         gen_helper_sme_mova_cz_s, gen_helper_sme_mova_cz_d,
143f0984d40SFabiano Rosas         gen_helper_sme_mova_cz_q,
144f0984d40SFabiano Rosas     };
145f0984d40SFabiano Rosas     static gen_helper_gvec_3 * const zc_fns[5] = {
146f0984d40SFabiano Rosas         gen_helper_sme_mova_zc_b, gen_helper_sme_mova_zc_h,
147f0984d40SFabiano Rosas         gen_helper_sme_mova_zc_s, gen_helper_sme_mova_zc_d,
148f0984d40SFabiano Rosas         gen_helper_sme_mova_zc_q,
149f0984d40SFabiano Rosas     };
150f0984d40SFabiano Rosas 
151f0984d40SFabiano Rosas     TCGv_ptr t_za, t_zr, t_pg;
152f0984d40SFabiano Rosas     TCGv_i32 t_desc;
153f0984d40SFabiano Rosas     int svl;
154f0984d40SFabiano Rosas 
155f0984d40SFabiano Rosas     if (!dc_isar_feature(aa64_sme, s)) {
156f0984d40SFabiano Rosas         return false;
157f0984d40SFabiano Rosas     }
158f0984d40SFabiano Rosas     if (!sme_smza_enabled_check(s)) {
159f0984d40SFabiano Rosas         return true;
160f0984d40SFabiano Rosas     }
161f0984d40SFabiano Rosas 
162f0984d40SFabiano Rosas     t_za = get_tile_rowcol(s, a->esz, a->rs, a->za_imm, a->v);
163f0984d40SFabiano Rosas     t_zr = vec_full_reg_ptr(s, a->zr);
164f0984d40SFabiano Rosas     t_pg = pred_full_reg_ptr(s, a->pg);
165f0984d40SFabiano Rosas 
166f0984d40SFabiano Rosas     svl = streaming_vec_reg_size(s);
167f0984d40SFabiano Rosas     t_desc = tcg_constant_i32(simd_desc(svl, svl, 0));
168f0984d40SFabiano Rosas 
169f0984d40SFabiano Rosas     if (a->v) {
170f0984d40SFabiano Rosas         /* Vertical slice -- use sme mova helpers. */
171f0984d40SFabiano Rosas         if (a->to_vec) {
172f0984d40SFabiano Rosas             zc_fns[a->esz](t_zr, t_za, t_pg, t_desc);
173f0984d40SFabiano Rosas         } else {
174f0984d40SFabiano Rosas             cz_fns[a->esz](t_za, t_zr, t_pg, t_desc);
175f0984d40SFabiano Rosas         }
176f0984d40SFabiano Rosas     } else {
177f0984d40SFabiano Rosas         /* Horizontal slice -- reuse sve sel helpers. */
178f0984d40SFabiano Rosas         if (a->to_vec) {
179f0984d40SFabiano Rosas             h_fns[a->esz](t_zr, t_za, t_zr, t_pg, t_desc);
180f0984d40SFabiano Rosas         } else {
181f0984d40SFabiano Rosas             h_fns[a->esz](t_za, t_zr, t_za, t_pg, t_desc);
182f0984d40SFabiano Rosas         }
183f0984d40SFabiano Rosas     }
184f0984d40SFabiano Rosas     return true;
185f0984d40SFabiano Rosas }
186f0984d40SFabiano Rosas 
trans_LDST1(DisasContext * s,arg_LDST1 * a)187f0984d40SFabiano Rosas static bool trans_LDST1(DisasContext *s, arg_LDST1 *a)
188f0984d40SFabiano Rosas {
189f0984d40SFabiano Rosas     typedef void GenLdSt1(TCGv_env, TCGv_ptr, TCGv_ptr, TCGv, TCGv_i32);
190f0984d40SFabiano Rosas 
191f0984d40SFabiano Rosas     /*
192f0984d40SFabiano Rosas      * Indexed by [esz][be][v][mte][st], which is (except for load/store)
193f0984d40SFabiano Rosas      * also the order in which the elements appear in the function names,
194f0984d40SFabiano Rosas      * and so how we must concatenate the pieces.
195f0984d40SFabiano Rosas      */
196f0984d40SFabiano Rosas 
197f0984d40SFabiano Rosas #define FN_LS(F)     { gen_helper_sme_ld1##F, gen_helper_sme_st1##F }
198f0984d40SFabiano Rosas #define FN_MTE(F)    { FN_LS(F), FN_LS(F##_mte) }
199f0984d40SFabiano Rosas #define FN_HV(F)     { FN_MTE(F##_h), FN_MTE(F##_v) }
200f0984d40SFabiano Rosas #define FN_END(L, B) { FN_HV(L), FN_HV(B) }
201f0984d40SFabiano Rosas 
202f0984d40SFabiano Rosas     static GenLdSt1 * const fns[5][2][2][2][2] = {
203f0984d40SFabiano Rosas         FN_END(b, b),
204f0984d40SFabiano Rosas         FN_END(h_le, h_be),
205f0984d40SFabiano Rosas         FN_END(s_le, s_be),
206f0984d40SFabiano Rosas         FN_END(d_le, d_be),
207f0984d40SFabiano Rosas         FN_END(q_le, q_be),
208f0984d40SFabiano Rosas     };
209f0984d40SFabiano Rosas 
210f0984d40SFabiano Rosas #undef FN_LS
211f0984d40SFabiano Rosas #undef FN_MTE
212f0984d40SFabiano Rosas #undef FN_HV
213f0984d40SFabiano Rosas #undef FN_END
214f0984d40SFabiano Rosas 
215f0984d40SFabiano Rosas     TCGv_ptr t_za, t_pg;
216f0984d40SFabiano Rosas     TCGv_i64 addr;
21796fcc998SRichard Henderson     uint32_t desc;
218f0984d40SFabiano Rosas     bool be = s->be_data == MO_BE;
219f0984d40SFabiano Rosas     bool mte = s->mte_active[0];
220f0984d40SFabiano Rosas 
221f0984d40SFabiano Rosas     if (!dc_isar_feature(aa64_sme, s)) {
222f0984d40SFabiano Rosas         return false;
223f0984d40SFabiano Rosas     }
224f0984d40SFabiano Rosas     if (!sme_smza_enabled_check(s)) {
225f0984d40SFabiano Rosas         return true;
226f0984d40SFabiano Rosas     }
227f0984d40SFabiano Rosas 
228f0984d40SFabiano Rosas     t_za = get_tile_rowcol(s, a->esz, a->rs, a->za_imm, a->v);
229f0984d40SFabiano Rosas     t_pg = pred_full_reg_ptr(s, a->pg);
230f0984d40SFabiano Rosas     addr = tcg_temp_new_i64();
231f0984d40SFabiano Rosas 
232f0984d40SFabiano Rosas     tcg_gen_shli_i64(addr, cpu_reg(s, a->rm), a->esz);
233f0984d40SFabiano Rosas     tcg_gen_add_i64(addr, addr, cpu_reg_sp(s, a->rn));
234f0984d40SFabiano Rosas 
23596fcc998SRichard Henderson     if (!mte) {
236f0984d40SFabiano Rosas         addr = clean_data_tbi(s, addr);
237f0984d40SFabiano Rosas     }
23896fcc998SRichard Henderson 
23996fcc998SRichard Henderson     desc = make_svemte_desc(s, streaming_vec_reg_size(s), 1, a->esz, a->st, 0);
240f0984d40SFabiano Rosas 
241ad75a51eSRichard Henderson     fns[a->esz][be][a->v][mte][a->st](tcg_env, t_za, t_pg, addr,
242f0984d40SFabiano Rosas                                       tcg_constant_i32(desc));
243f0984d40SFabiano Rosas     return true;
244f0984d40SFabiano Rosas }
245f0984d40SFabiano Rosas 
246f0984d40SFabiano Rosas typedef void GenLdStR(DisasContext *, TCGv_ptr, int, int, int, int);
247f0984d40SFabiano Rosas 
do_ldst_r(DisasContext * s,arg_ldstr * a,GenLdStR * fn)248f0984d40SFabiano Rosas static bool do_ldst_r(DisasContext *s, arg_ldstr *a, GenLdStR *fn)
249f0984d40SFabiano Rosas {
250f0984d40SFabiano Rosas     int svl = streaming_vec_reg_size(s);
251f0984d40SFabiano Rosas     int imm = a->imm;
252f0984d40SFabiano Rosas     TCGv_ptr base;
253f0984d40SFabiano Rosas 
254f0984d40SFabiano Rosas     if (!sme_za_enabled_check(s)) {
255f0984d40SFabiano Rosas         return true;
256f0984d40SFabiano Rosas     }
257f0984d40SFabiano Rosas 
258f0984d40SFabiano Rosas     /* ZA[n] equates to ZA0H.B[n]. */
259f0984d40SFabiano Rosas     base = get_tile_rowcol(s, MO_8, a->rv, imm, false);
260f0984d40SFabiano Rosas 
261f0984d40SFabiano Rosas     fn(s, base, 0, svl, a->rn, imm * svl);
262f0984d40SFabiano Rosas     return true;
263f0984d40SFabiano Rosas }
264f0984d40SFabiano Rosas 
TRANS_FEAT(LDR,aa64_sme,do_ldst_r,a,gen_sve_ldr)265f0984d40SFabiano Rosas TRANS_FEAT(LDR, aa64_sme, do_ldst_r, a, gen_sve_ldr)
266f0984d40SFabiano Rosas TRANS_FEAT(STR, aa64_sme, do_ldst_r, a, gen_sve_str)
267f0984d40SFabiano Rosas 
268f0984d40SFabiano Rosas static bool do_adda(DisasContext *s, arg_adda *a, MemOp esz,
269f0984d40SFabiano Rosas                     gen_helper_gvec_4 *fn)
270f0984d40SFabiano Rosas {
271f0984d40SFabiano Rosas     int svl = streaming_vec_reg_size(s);
272f0984d40SFabiano Rosas     uint32_t desc = simd_desc(svl, svl, 0);
273f0984d40SFabiano Rosas     TCGv_ptr za, zn, pn, pm;
274f0984d40SFabiano Rosas 
275f0984d40SFabiano Rosas     if (!sme_smza_enabled_check(s)) {
276f0984d40SFabiano Rosas         return true;
277f0984d40SFabiano Rosas     }
278f0984d40SFabiano Rosas 
2791f51573fSRichard Henderson     za = get_tile(s, esz, a->zad);
280f0984d40SFabiano Rosas     zn = vec_full_reg_ptr(s, a->zn);
281f0984d40SFabiano Rosas     pn = pred_full_reg_ptr(s, a->pn);
282f0984d40SFabiano Rosas     pm = pred_full_reg_ptr(s, a->pm);
283f0984d40SFabiano Rosas 
284f0984d40SFabiano Rosas     fn(za, zn, pn, pm, tcg_constant_i32(desc));
285f0984d40SFabiano Rosas     return true;
286f0984d40SFabiano Rosas }
287f0984d40SFabiano Rosas 
TRANS_FEAT(ADDHA_s,aa64_sme,do_adda,a,MO_32,gen_helper_sme_addha_s)288f0984d40SFabiano Rosas TRANS_FEAT(ADDHA_s, aa64_sme, do_adda, a, MO_32, gen_helper_sme_addha_s)
289f0984d40SFabiano Rosas TRANS_FEAT(ADDVA_s, aa64_sme, do_adda, a, MO_32, gen_helper_sme_addva_s)
290f0984d40SFabiano Rosas TRANS_FEAT(ADDHA_d, aa64_sme_i16i64, do_adda, a, MO_64, gen_helper_sme_addha_d)
291f0984d40SFabiano Rosas TRANS_FEAT(ADDVA_d, aa64_sme_i16i64, do_adda, a, MO_64, gen_helper_sme_addva_d)
292f0984d40SFabiano Rosas 
293f0984d40SFabiano Rosas static bool do_outprod(DisasContext *s, arg_op *a, MemOp esz,
294f0984d40SFabiano Rosas                        gen_helper_gvec_5 *fn)
295f0984d40SFabiano Rosas {
296f0984d40SFabiano Rosas     int svl = streaming_vec_reg_size(s);
297f0984d40SFabiano Rosas     uint32_t desc = simd_desc(svl, svl, a->sub);
298f0984d40SFabiano Rosas     TCGv_ptr za, zn, zm, pn, pm;
299f0984d40SFabiano Rosas 
300f0984d40SFabiano Rosas     if (!sme_smza_enabled_check(s)) {
301f0984d40SFabiano Rosas         return true;
302f0984d40SFabiano Rosas     }
303f0984d40SFabiano Rosas 
3041f51573fSRichard Henderson     za = get_tile(s, esz, a->zad);
305f0984d40SFabiano Rosas     zn = vec_full_reg_ptr(s, a->zn);
306f0984d40SFabiano Rosas     zm = vec_full_reg_ptr(s, a->zm);
307f0984d40SFabiano Rosas     pn = pred_full_reg_ptr(s, a->pn);
308f0984d40SFabiano Rosas     pm = pred_full_reg_ptr(s, a->pm);
309f0984d40SFabiano Rosas 
310f0984d40SFabiano Rosas     fn(za, zn, zm, pn, pm, tcg_constant_i32(desc));
311f0984d40SFabiano Rosas     return true;
312f0984d40SFabiano Rosas }
313f0984d40SFabiano Rosas 
do_outprod_fpst(DisasContext * s,arg_op * a,MemOp esz,ARMFPStatusFlavour e_fpst,gen_helper_gvec_5_ptr * fn)314f0984d40SFabiano Rosas static bool do_outprod_fpst(DisasContext *s, arg_op *a, MemOp esz,
315207d30b5SRichard Henderson                             ARMFPStatusFlavour e_fpst,
316f0984d40SFabiano Rosas                             gen_helper_gvec_5_ptr *fn)
317f0984d40SFabiano Rosas {
318f0984d40SFabiano Rosas     int svl = streaming_vec_reg_size(s);
319f0984d40SFabiano Rosas     uint32_t desc = simd_desc(svl, svl, a->sub);
320f0984d40SFabiano Rosas     TCGv_ptr za, zn, zm, pn, pm, fpst;
321f0984d40SFabiano Rosas 
322f0984d40SFabiano Rosas     if (!sme_smza_enabled_check(s)) {
323f0984d40SFabiano Rosas         return true;
324f0984d40SFabiano Rosas     }
325f0984d40SFabiano Rosas 
3261f51573fSRichard Henderson     za = get_tile(s, esz, a->zad);
327f0984d40SFabiano Rosas     zn = vec_full_reg_ptr(s, a->zn);
328f0984d40SFabiano Rosas     zm = vec_full_reg_ptr(s, a->zm);
329f0984d40SFabiano Rosas     pn = pred_full_reg_ptr(s, a->pn);
330f0984d40SFabiano Rosas     pm = pred_full_reg_ptr(s, a->pm);
331207d30b5SRichard Henderson     fpst = fpstatus_ptr(e_fpst);
332f0984d40SFabiano Rosas 
333f0984d40SFabiano Rosas     fn(za, zn, zm, pn, pm, fpst, tcg_constant_i32(desc));
334f0984d40SFabiano Rosas     return true;
335f0984d40SFabiano Rosas }
336f0984d40SFabiano Rosas 
do_outprod_env(DisasContext * s,arg_op * a,MemOp esz,gen_helper_gvec_5_ptr * fn)33755f9f4eeSPeter Maydell static bool do_outprod_env(DisasContext *s, arg_op *a, MemOp esz,
33855f9f4eeSPeter Maydell                            gen_helper_gvec_5_ptr *fn)
33955f9f4eeSPeter Maydell {
34055f9f4eeSPeter Maydell     int svl = streaming_vec_reg_size(s);
34155f9f4eeSPeter Maydell     uint32_t desc = simd_desc(svl, svl, a->sub);
34255f9f4eeSPeter Maydell     TCGv_ptr za, zn, zm, pn, pm;
34355f9f4eeSPeter Maydell 
34455f9f4eeSPeter Maydell     if (!sme_smza_enabled_check(s)) {
34555f9f4eeSPeter Maydell         return true;
34655f9f4eeSPeter Maydell     }
34755f9f4eeSPeter Maydell 
34855f9f4eeSPeter Maydell     za = get_tile(s, esz, a->zad);
34955f9f4eeSPeter Maydell     zn = vec_full_reg_ptr(s, a->zn);
35055f9f4eeSPeter Maydell     zm = vec_full_reg_ptr(s, a->zm);
35155f9f4eeSPeter Maydell     pn = pred_full_reg_ptr(s, a->pn);
35255f9f4eeSPeter Maydell     pm = pred_full_reg_ptr(s, a->pm);
35355f9f4eeSPeter Maydell 
35455f9f4eeSPeter Maydell     fn(za, zn, zm, pn, pm, tcg_env, tcg_constant_i32(desc));
35555f9f4eeSPeter Maydell     return true;
35655f9f4eeSPeter Maydell }
35755f9f4eeSPeter Maydell 
35855f9f4eeSPeter Maydell TRANS_FEAT(FMOPA_h, aa64_sme, do_outprod_env, a,
35955f9f4eeSPeter Maydell            MO_32, gen_helper_sme_fmopa_h)
360207d30b5SRichard Henderson TRANS_FEAT(FMOPA_s, aa64_sme, do_outprod_fpst, a,
361207d30b5SRichard Henderson            MO_32, FPST_FPCR, gen_helper_sme_fmopa_s)
362207d30b5SRichard Henderson TRANS_FEAT(FMOPA_d, aa64_sme_f64f64, do_outprod_fpst, a,
363207d30b5SRichard Henderson            MO_64, FPST_FPCR, gen_helper_sme_fmopa_d)
364f0984d40SFabiano Rosas 
365*ecabcfa4SPeter Maydell TRANS_FEAT(BFMOPA, aa64_sme, do_outprod_env, a, MO_32, gen_helper_sme_bfmopa)
366f0984d40SFabiano Rosas 
367f0984d40SFabiano Rosas TRANS_FEAT(SMOPA_s, aa64_sme, do_outprod, a, MO_32, gen_helper_sme_smopa_s)
368f0984d40SFabiano Rosas TRANS_FEAT(UMOPA_s, aa64_sme, do_outprod, a, MO_32, gen_helper_sme_umopa_s)
369f0984d40SFabiano Rosas TRANS_FEAT(SUMOPA_s, aa64_sme, do_outprod, a, MO_32, gen_helper_sme_sumopa_s)
370f0984d40SFabiano Rosas TRANS_FEAT(USMOPA_s, aa64_sme, do_outprod, a, MO_32, gen_helper_sme_usmopa_s)
371f0984d40SFabiano Rosas 
372f0984d40SFabiano Rosas TRANS_FEAT(SMOPA_d, aa64_sme_i16i64, do_outprod, a, MO_64, gen_helper_sme_smopa_d)
373f0984d40SFabiano Rosas TRANS_FEAT(UMOPA_d, aa64_sme_i16i64, do_outprod, a, MO_64, gen_helper_sme_umopa_d)
374f0984d40SFabiano Rosas TRANS_FEAT(SUMOPA_d, aa64_sme_i16i64, do_outprod, a, MO_64, gen_helper_sme_sumopa_d)
375f0984d40SFabiano Rosas TRANS_FEAT(USMOPA_d, aa64_sme_i16i64, do_outprod, a, MO_64, gen_helper_sme_usmopa_d)
376