xref: /qemu/target/mips/tcg/msa_translate.c (revision ce121fe23443fbf885b3c0a583a91efd2efa6e10)
180e64a38SPhilippe Mathieu-Daudé /*
280e64a38SPhilippe Mathieu-Daudé  *  MIPS SIMD Architecture (MSA) translation routines
380e64a38SPhilippe Mathieu-Daudé  *
480e64a38SPhilippe Mathieu-Daudé  *  Copyright (c) 2004-2005 Jocelyn Mayer
580e64a38SPhilippe Mathieu-Daudé  *  Copyright (c) 2006 Marius Groeger (FPU operations)
680e64a38SPhilippe Mathieu-Daudé  *  Copyright (c) 2006 Thiemo Seufer (MIPS32R2 support)
780e64a38SPhilippe Mathieu-Daudé  *  Copyright (c) 2009 CodeSourcery (MIPS16 and microMIPS support)
880e64a38SPhilippe Mathieu-Daudé  *  Copyright (c) 2012 Jia Liu & Dongxue Zhang (MIPS ASE DSP support)
9c7a9ef75SPhilippe Mathieu-Daudé  *  Copyright (c) 2020 Philippe Mathieu-Daudé
1080e64a38SPhilippe Mathieu-Daudé  *
1180e64a38SPhilippe Mathieu-Daudé  * SPDX-License-Identifier: LGPL-2.1-or-later
1280e64a38SPhilippe Mathieu-Daudé  */
1380e64a38SPhilippe Mathieu-Daudé #include "qemu/osdep.h"
1480e64a38SPhilippe Mathieu-Daudé #include "tcg/tcg-op.h"
1580e64a38SPhilippe Mathieu-Daudé #include "exec/helper-gen.h"
1680e64a38SPhilippe Mathieu-Daudé #include "translate.h"
1780e64a38SPhilippe Mathieu-Daudé #include "fpu_helper.h"
1880e64a38SPhilippe Mathieu-Daudé #include "internal.h"
1980e64a38SPhilippe Mathieu-Daudé 
204701d23aSPhilippe Mathieu-Daudé static int bit_m(DisasContext *ctx, int x);
214701d23aSPhilippe Mathieu-Daudé static int bit_df(DisasContext *ctx, int x);
224701d23aSPhilippe Mathieu-Daudé 
23c7a9ef75SPhilippe Mathieu-Daudé /* Include the auto-generated decoder.  */
24f5c6ee0cSPhilippe Mathieu-Daudé #include "decode-msa.c.inc"
25c7a9ef75SPhilippe Mathieu-Daudé 
2680e64a38SPhilippe Mathieu-Daudé #define OPC_MSA (0x1E << 26)
2780e64a38SPhilippe Mathieu-Daudé 
2880e64a38SPhilippe Mathieu-Daudé #define MASK_MSA_MINOR(op)          (MASK_OP_MAJOR(op) | (op & 0x3F))
2980e64a38SPhilippe Mathieu-Daudé enum {
3080e64a38SPhilippe Mathieu-Daudé     OPC_MSA_3R_0D   = 0x0D | OPC_MSA,
3180e64a38SPhilippe Mathieu-Daudé     OPC_MSA_3R_0E   = 0x0E | OPC_MSA,
3280e64a38SPhilippe Mathieu-Daudé     OPC_MSA_3R_0F   = 0x0F | OPC_MSA,
3380e64a38SPhilippe Mathieu-Daudé     OPC_MSA_3R_10   = 0x10 | OPC_MSA,
3480e64a38SPhilippe Mathieu-Daudé     OPC_MSA_3R_11   = 0x11 | OPC_MSA,
3580e64a38SPhilippe Mathieu-Daudé     OPC_MSA_3R_12   = 0x12 | OPC_MSA,
3680e64a38SPhilippe Mathieu-Daudé     OPC_MSA_3R_13   = 0x13 | OPC_MSA,
3780e64a38SPhilippe Mathieu-Daudé     OPC_MSA_3R_14   = 0x14 | OPC_MSA,
3880e64a38SPhilippe Mathieu-Daudé     OPC_MSA_3R_15   = 0x15 | OPC_MSA,
3980e64a38SPhilippe Mathieu-Daudé     OPC_MSA_ELM     = 0x19 | OPC_MSA,
4080e64a38SPhilippe Mathieu-Daudé     OPC_MSA_3RF_1A  = 0x1A | OPC_MSA,
4180e64a38SPhilippe Mathieu-Daudé     OPC_MSA_3RF_1B  = 0x1B | OPC_MSA,
4280e64a38SPhilippe Mathieu-Daudé     OPC_MSA_3RF_1C  = 0x1C | OPC_MSA,
4380e64a38SPhilippe Mathieu-Daudé     OPC_MSA_VEC     = 0x1E | OPC_MSA,
4480e64a38SPhilippe Mathieu-Daudé };
4580e64a38SPhilippe Mathieu-Daudé 
4680e64a38SPhilippe Mathieu-Daudé enum {
4780e64a38SPhilippe Mathieu-Daudé     /* VEC/2R/2RF instruction */
4880e64a38SPhilippe Mathieu-Daudé     OPC_AND_V       = (0x00 << 21) | OPC_MSA_VEC,
4980e64a38SPhilippe Mathieu-Daudé     OPC_OR_V        = (0x01 << 21) | OPC_MSA_VEC,
5080e64a38SPhilippe Mathieu-Daudé     OPC_NOR_V       = (0x02 << 21) | OPC_MSA_VEC,
5180e64a38SPhilippe Mathieu-Daudé     OPC_XOR_V       = (0x03 << 21) | OPC_MSA_VEC,
5280e64a38SPhilippe Mathieu-Daudé     OPC_BMNZ_V      = (0x04 << 21) | OPC_MSA_VEC,
5380e64a38SPhilippe Mathieu-Daudé     OPC_BMZ_V       = (0x05 << 21) | OPC_MSA_VEC,
5480e64a38SPhilippe Mathieu-Daudé     OPC_BSEL_V      = (0x06 << 21) | OPC_MSA_VEC,
5580e64a38SPhilippe Mathieu-Daudé 
5680e64a38SPhilippe Mathieu-Daudé     OPC_MSA_2R      = (0x18 << 21) | OPC_MSA_VEC,
5780e64a38SPhilippe Mathieu-Daudé     OPC_MSA_2RF     = (0x19 << 21) | OPC_MSA_VEC,
5880e64a38SPhilippe Mathieu-Daudé 
5980e64a38SPhilippe Mathieu-Daudé     /* 2R instruction df(bits 17..16) = _b, _h, _w, _d */
6080e64a38SPhilippe Mathieu-Daudé     OPC_FILL_df     = (0x00 << 18) | OPC_MSA_2R,
6180e64a38SPhilippe Mathieu-Daudé     OPC_PCNT_df     = (0x01 << 18) | OPC_MSA_2R,
6280e64a38SPhilippe Mathieu-Daudé     OPC_NLOC_df     = (0x02 << 18) | OPC_MSA_2R,
6380e64a38SPhilippe Mathieu-Daudé     OPC_NLZC_df     = (0x03 << 18) | OPC_MSA_2R,
6480e64a38SPhilippe Mathieu-Daudé 
6580e64a38SPhilippe Mathieu-Daudé     /* 2RF instruction df(bit 16) = _w, _d */
6680e64a38SPhilippe Mathieu-Daudé     OPC_FCLASS_df   = (0x00 << 17) | OPC_MSA_2RF,
6780e64a38SPhilippe Mathieu-Daudé     OPC_FTRUNC_S_df = (0x01 << 17) | OPC_MSA_2RF,
6880e64a38SPhilippe Mathieu-Daudé     OPC_FTRUNC_U_df = (0x02 << 17) | OPC_MSA_2RF,
6980e64a38SPhilippe Mathieu-Daudé     OPC_FSQRT_df    = (0x03 << 17) | OPC_MSA_2RF,
7080e64a38SPhilippe Mathieu-Daudé     OPC_FRSQRT_df   = (0x04 << 17) | OPC_MSA_2RF,
7180e64a38SPhilippe Mathieu-Daudé     OPC_FRCP_df     = (0x05 << 17) | OPC_MSA_2RF,
7280e64a38SPhilippe Mathieu-Daudé     OPC_FRINT_df    = (0x06 << 17) | OPC_MSA_2RF,
7380e64a38SPhilippe Mathieu-Daudé     OPC_FLOG2_df    = (0x07 << 17) | OPC_MSA_2RF,
7480e64a38SPhilippe Mathieu-Daudé     OPC_FEXUPL_df   = (0x08 << 17) | OPC_MSA_2RF,
7580e64a38SPhilippe Mathieu-Daudé     OPC_FEXUPR_df   = (0x09 << 17) | OPC_MSA_2RF,
7680e64a38SPhilippe Mathieu-Daudé     OPC_FFQL_df     = (0x0A << 17) | OPC_MSA_2RF,
7780e64a38SPhilippe Mathieu-Daudé     OPC_FFQR_df     = (0x0B << 17) | OPC_MSA_2RF,
7880e64a38SPhilippe Mathieu-Daudé     OPC_FTINT_S_df  = (0x0C << 17) | OPC_MSA_2RF,
7980e64a38SPhilippe Mathieu-Daudé     OPC_FTINT_U_df  = (0x0D << 17) | OPC_MSA_2RF,
8080e64a38SPhilippe Mathieu-Daudé     OPC_FFINT_S_df  = (0x0E << 17) | OPC_MSA_2RF,
8180e64a38SPhilippe Mathieu-Daudé     OPC_FFINT_U_df  = (0x0F << 17) | OPC_MSA_2RF,
8280e64a38SPhilippe Mathieu-Daudé 
8380e64a38SPhilippe Mathieu-Daudé     /* 3R instruction df(bits 22..21) = _b, _h, _w, d */
8480e64a38SPhilippe Mathieu-Daudé     OPC_SLL_df      = (0x0 << 23) | OPC_MSA_3R_0D,
8580e64a38SPhilippe Mathieu-Daudé     OPC_ADDV_df     = (0x0 << 23) | OPC_MSA_3R_0E,
8680e64a38SPhilippe Mathieu-Daudé     OPC_CEQ_df      = (0x0 << 23) | OPC_MSA_3R_0F,
8780e64a38SPhilippe Mathieu-Daudé     OPC_ADD_A_df    = (0x0 << 23) | OPC_MSA_3R_10,
8880e64a38SPhilippe Mathieu-Daudé     OPC_SUBS_S_df   = (0x0 << 23) | OPC_MSA_3R_11,
8980e64a38SPhilippe Mathieu-Daudé     OPC_MULV_df     = (0x0 << 23) | OPC_MSA_3R_12,
9080e64a38SPhilippe Mathieu-Daudé     OPC_DOTP_S_df   = (0x0 << 23) | OPC_MSA_3R_13,
9180e64a38SPhilippe Mathieu-Daudé     OPC_SLD_df      = (0x0 << 23) | OPC_MSA_3R_14,
9280e64a38SPhilippe Mathieu-Daudé     OPC_VSHF_df     = (0x0 << 23) | OPC_MSA_3R_15,
9380e64a38SPhilippe Mathieu-Daudé     OPC_SRA_df      = (0x1 << 23) | OPC_MSA_3R_0D,
9480e64a38SPhilippe Mathieu-Daudé     OPC_SUBV_df     = (0x1 << 23) | OPC_MSA_3R_0E,
9580e64a38SPhilippe Mathieu-Daudé     OPC_ADDS_A_df   = (0x1 << 23) | OPC_MSA_3R_10,
9680e64a38SPhilippe Mathieu-Daudé     OPC_SUBS_U_df   = (0x1 << 23) | OPC_MSA_3R_11,
9780e64a38SPhilippe Mathieu-Daudé     OPC_MADDV_df    = (0x1 << 23) | OPC_MSA_3R_12,
9880e64a38SPhilippe Mathieu-Daudé     OPC_DOTP_U_df   = (0x1 << 23) | OPC_MSA_3R_13,
9980e64a38SPhilippe Mathieu-Daudé     OPC_SPLAT_df    = (0x1 << 23) | OPC_MSA_3R_14,
10080e64a38SPhilippe Mathieu-Daudé     OPC_SRAR_df     = (0x1 << 23) | OPC_MSA_3R_15,
10180e64a38SPhilippe Mathieu-Daudé     OPC_SRL_df      = (0x2 << 23) | OPC_MSA_3R_0D,
10280e64a38SPhilippe Mathieu-Daudé     OPC_MAX_S_df    = (0x2 << 23) | OPC_MSA_3R_0E,
10380e64a38SPhilippe Mathieu-Daudé     OPC_CLT_S_df    = (0x2 << 23) | OPC_MSA_3R_0F,
10480e64a38SPhilippe Mathieu-Daudé     OPC_ADDS_S_df   = (0x2 << 23) | OPC_MSA_3R_10,
10580e64a38SPhilippe Mathieu-Daudé     OPC_SUBSUS_U_df = (0x2 << 23) | OPC_MSA_3R_11,
10680e64a38SPhilippe Mathieu-Daudé     OPC_MSUBV_df    = (0x2 << 23) | OPC_MSA_3R_12,
10780e64a38SPhilippe Mathieu-Daudé     OPC_DPADD_S_df  = (0x2 << 23) | OPC_MSA_3R_13,
10880e64a38SPhilippe Mathieu-Daudé     OPC_PCKEV_df    = (0x2 << 23) | OPC_MSA_3R_14,
10980e64a38SPhilippe Mathieu-Daudé     OPC_SRLR_df     = (0x2 << 23) | OPC_MSA_3R_15,
11080e64a38SPhilippe Mathieu-Daudé     OPC_BCLR_df     = (0x3 << 23) | OPC_MSA_3R_0D,
11180e64a38SPhilippe Mathieu-Daudé     OPC_MAX_U_df    = (0x3 << 23) | OPC_MSA_3R_0E,
11280e64a38SPhilippe Mathieu-Daudé     OPC_CLT_U_df    = (0x3 << 23) | OPC_MSA_3R_0F,
11380e64a38SPhilippe Mathieu-Daudé     OPC_ADDS_U_df   = (0x3 << 23) | OPC_MSA_3R_10,
11480e64a38SPhilippe Mathieu-Daudé     OPC_SUBSUU_S_df = (0x3 << 23) | OPC_MSA_3R_11,
11580e64a38SPhilippe Mathieu-Daudé     OPC_DPADD_U_df  = (0x3 << 23) | OPC_MSA_3R_13,
11680e64a38SPhilippe Mathieu-Daudé     OPC_PCKOD_df    = (0x3 << 23) | OPC_MSA_3R_14,
11780e64a38SPhilippe Mathieu-Daudé     OPC_BSET_df     = (0x4 << 23) | OPC_MSA_3R_0D,
11880e64a38SPhilippe Mathieu-Daudé     OPC_MIN_S_df    = (0x4 << 23) | OPC_MSA_3R_0E,
11980e64a38SPhilippe Mathieu-Daudé     OPC_CLE_S_df    = (0x4 << 23) | OPC_MSA_3R_0F,
12080e64a38SPhilippe Mathieu-Daudé     OPC_AVE_S_df    = (0x4 << 23) | OPC_MSA_3R_10,
12180e64a38SPhilippe Mathieu-Daudé     OPC_ASUB_S_df   = (0x4 << 23) | OPC_MSA_3R_11,
12280e64a38SPhilippe Mathieu-Daudé     OPC_DIV_S_df    = (0x4 << 23) | OPC_MSA_3R_12,
12380e64a38SPhilippe Mathieu-Daudé     OPC_DPSUB_S_df  = (0x4 << 23) | OPC_MSA_3R_13,
12480e64a38SPhilippe Mathieu-Daudé     OPC_ILVL_df     = (0x4 << 23) | OPC_MSA_3R_14,
12580e64a38SPhilippe Mathieu-Daudé     OPC_HADD_S_df   = (0x4 << 23) | OPC_MSA_3R_15,
12680e64a38SPhilippe Mathieu-Daudé     OPC_BNEG_df     = (0x5 << 23) | OPC_MSA_3R_0D,
12780e64a38SPhilippe Mathieu-Daudé     OPC_MIN_U_df    = (0x5 << 23) | OPC_MSA_3R_0E,
12880e64a38SPhilippe Mathieu-Daudé     OPC_CLE_U_df    = (0x5 << 23) | OPC_MSA_3R_0F,
12980e64a38SPhilippe Mathieu-Daudé     OPC_AVE_U_df    = (0x5 << 23) | OPC_MSA_3R_10,
13080e64a38SPhilippe Mathieu-Daudé     OPC_ASUB_U_df   = (0x5 << 23) | OPC_MSA_3R_11,
13180e64a38SPhilippe Mathieu-Daudé     OPC_DIV_U_df    = (0x5 << 23) | OPC_MSA_3R_12,
13280e64a38SPhilippe Mathieu-Daudé     OPC_DPSUB_U_df  = (0x5 << 23) | OPC_MSA_3R_13,
13380e64a38SPhilippe Mathieu-Daudé     OPC_ILVR_df     = (0x5 << 23) | OPC_MSA_3R_14,
13480e64a38SPhilippe Mathieu-Daudé     OPC_HADD_U_df   = (0x5 << 23) | OPC_MSA_3R_15,
13580e64a38SPhilippe Mathieu-Daudé     OPC_BINSL_df    = (0x6 << 23) | OPC_MSA_3R_0D,
13680e64a38SPhilippe Mathieu-Daudé     OPC_MAX_A_df    = (0x6 << 23) | OPC_MSA_3R_0E,
13780e64a38SPhilippe Mathieu-Daudé     OPC_AVER_S_df   = (0x6 << 23) | OPC_MSA_3R_10,
13880e64a38SPhilippe Mathieu-Daudé     OPC_MOD_S_df    = (0x6 << 23) | OPC_MSA_3R_12,
13980e64a38SPhilippe Mathieu-Daudé     OPC_ILVEV_df    = (0x6 << 23) | OPC_MSA_3R_14,
14080e64a38SPhilippe Mathieu-Daudé     OPC_HSUB_S_df   = (0x6 << 23) | OPC_MSA_3R_15,
14180e64a38SPhilippe Mathieu-Daudé     OPC_BINSR_df    = (0x7 << 23) | OPC_MSA_3R_0D,
14280e64a38SPhilippe Mathieu-Daudé     OPC_MIN_A_df    = (0x7 << 23) | OPC_MSA_3R_0E,
14380e64a38SPhilippe Mathieu-Daudé     OPC_AVER_U_df   = (0x7 << 23) | OPC_MSA_3R_10,
14480e64a38SPhilippe Mathieu-Daudé     OPC_MOD_U_df    = (0x7 << 23) | OPC_MSA_3R_12,
14580e64a38SPhilippe Mathieu-Daudé     OPC_ILVOD_df    = (0x7 << 23) | OPC_MSA_3R_14,
14680e64a38SPhilippe Mathieu-Daudé     OPC_HSUB_U_df   = (0x7 << 23) | OPC_MSA_3R_15,
14780e64a38SPhilippe Mathieu-Daudé 
14880e64a38SPhilippe Mathieu-Daudé     /* ELM instructions df(bits 21..16) = _b, _h, _w, _d */
14980e64a38SPhilippe Mathieu-Daudé     OPC_SLDI_df     = (0x0 << 22) | (0x00 << 16) | OPC_MSA_ELM,
15080e64a38SPhilippe Mathieu-Daudé     OPC_CTCMSA      = (0x0 << 22) | (0x3E << 16) | OPC_MSA_ELM,
15180e64a38SPhilippe Mathieu-Daudé     OPC_SPLATI_df   = (0x1 << 22) | (0x00 << 16) | OPC_MSA_ELM,
15280e64a38SPhilippe Mathieu-Daudé     OPC_CFCMSA      = (0x1 << 22) | (0x3E << 16) | OPC_MSA_ELM,
15380e64a38SPhilippe Mathieu-Daudé     OPC_COPY_S_df   = (0x2 << 22) | (0x00 << 16) | OPC_MSA_ELM,
15480e64a38SPhilippe Mathieu-Daudé     OPC_MOVE_V      = (0x2 << 22) | (0x3E << 16) | OPC_MSA_ELM,
15580e64a38SPhilippe Mathieu-Daudé     OPC_COPY_U_df   = (0x3 << 22) | (0x00 << 16) | OPC_MSA_ELM,
15680e64a38SPhilippe Mathieu-Daudé     OPC_INSERT_df   = (0x4 << 22) | (0x00 << 16) | OPC_MSA_ELM,
15780e64a38SPhilippe Mathieu-Daudé     OPC_INSVE_df    = (0x5 << 22) | (0x00 << 16) | OPC_MSA_ELM,
15880e64a38SPhilippe Mathieu-Daudé 
15980e64a38SPhilippe Mathieu-Daudé     /* 3RF instruction _df(bit 21) = _w, _d */
16080e64a38SPhilippe Mathieu-Daudé     OPC_FCAF_df     = (0x0 << 22) | OPC_MSA_3RF_1A,
16180e64a38SPhilippe Mathieu-Daudé     OPC_FADD_df     = (0x0 << 22) | OPC_MSA_3RF_1B,
16280e64a38SPhilippe Mathieu-Daudé     OPC_FCUN_df     = (0x1 << 22) | OPC_MSA_3RF_1A,
16380e64a38SPhilippe Mathieu-Daudé     OPC_FSUB_df     = (0x1 << 22) | OPC_MSA_3RF_1B,
16480e64a38SPhilippe Mathieu-Daudé     OPC_FCOR_df     = (0x1 << 22) | OPC_MSA_3RF_1C,
16580e64a38SPhilippe Mathieu-Daudé     OPC_FCEQ_df     = (0x2 << 22) | OPC_MSA_3RF_1A,
16680e64a38SPhilippe Mathieu-Daudé     OPC_FMUL_df     = (0x2 << 22) | OPC_MSA_3RF_1B,
16780e64a38SPhilippe Mathieu-Daudé     OPC_FCUNE_df    = (0x2 << 22) | OPC_MSA_3RF_1C,
16880e64a38SPhilippe Mathieu-Daudé     OPC_FCUEQ_df    = (0x3 << 22) | OPC_MSA_3RF_1A,
16980e64a38SPhilippe Mathieu-Daudé     OPC_FDIV_df     = (0x3 << 22) | OPC_MSA_3RF_1B,
17080e64a38SPhilippe Mathieu-Daudé     OPC_FCNE_df     = (0x3 << 22) | OPC_MSA_3RF_1C,
17180e64a38SPhilippe Mathieu-Daudé     OPC_FCLT_df     = (0x4 << 22) | OPC_MSA_3RF_1A,
17280e64a38SPhilippe Mathieu-Daudé     OPC_FMADD_df    = (0x4 << 22) | OPC_MSA_3RF_1B,
17380e64a38SPhilippe Mathieu-Daudé     OPC_MUL_Q_df    = (0x4 << 22) | OPC_MSA_3RF_1C,
17480e64a38SPhilippe Mathieu-Daudé     OPC_FCULT_df    = (0x5 << 22) | OPC_MSA_3RF_1A,
17580e64a38SPhilippe Mathieu-Daudé     OPC_FMSUB_df    = (0x5 << 22) | OPC_MSA_3RF_1B,
17680e64a38SPhilippe Mathieu-Daudé     OPC_MADD_Q_df   = (0x5 << 22) | OPC_MSA_3RF_1C,
17780e64a38SPhilippe Mathieu-Daudé     OPC_FCLE_df     = (0x6 << 22) | OPC_MSA_3RF_1A,
17880e64a38SPhilippe Mathieu-Daudé     OPC_MSUB_Q_df   = (0x6 << 22) | OPC_MSA_3RF_1C,
17980e64a38SPhilippe Mathieu-Daudé     OPC_FCULE_df    = (0x7 << 22) | OPC_MSA_3RF_1A,
18080e64a38SPhilippe Mathieu-Daudé     OPC_FEXP2_df    = (0x7 << 22) | OPC_MSA_3RF_1B,
18180e64a38SPhilippe Mathieu-Daudé     OPC_FSAF_df     = (0x8 << 22) | OPC_MSA_3RF_1A,
18280e64a38SPhilippe Mathieu-Daudé     OPC_FEXDO_df    = (0x8 << 22) | OPC_MSA_3RF_1B,
18380e64a38SPhilippe Mathieu-Daudé     OPC_FSUN_df     = (0x9 << 22) | OPC_MSA_3RF_1A,
18480e64a38SPhilippe Mathieu-Daudé     OPC_FSOR_df     = (0x9 << 22) | OPC_MSA_3RF_1C,
18580e64a38SPhilippe Mathieu-Daudé     OPC_FSEQ_df     = (0xA << 22) | OPC_MSA_3RF_1A,
18680e64a38SPhilippe Mathieu-Daudé     OPC_FTQ_df      = (0xA << 22) | OPC_MSA_3RF_1B,
18780e64a38SPhilippe Mathieu-Daudé     OPC_FSUNE_df    = (0xA << 22) | OPC_MSA_3RF_1C,
18880e64a38SPhilippe Mathieu-Daudé     OPC_FSUEQ_df    = (0xB << 22) | OPC_MSA_3RF_1A,
18980e64a38SPhilippe Mathieu-Daudé     OPC_FSNE_df     = (0xB << 22) | OPC_MSA_3RF_1C,
19080e64a38SPhilippe Mathieu-Daudé     OPC_FSLT_df     = (0xC << 22) | OPC_MSA_3RF_1A,
19180e64a38SPhilippe Mathieu-Daudé     OPC_FMIN_df     = (0xC << 22) | OPC_MSA_3RF_1B,
19280e64a38SPhilippe Mathieu-Daudé     OPC_MULR_Q_df   = (0xC << 22) | OPC_MSA_3RF_1C,
19380e64a38SPhilippe Mathieu-Daudé     OPC_FSULT_df    = (0xD << 22) | OPC_MSA_3RF_1A,
19480e64a38SPhilippe Mathieu-Daudé     OPC_FMIN_A_df   = (0xD << 22) | OPC_MSA_3RF_1B,
19580e64a38SPhilippe Mathieu-Daudé     OPC_MADDR_Q_df  = (0xD << 22) | OPC_MSA_3RF_1C,
19680e64a38SPhilippe Mathieu-Daudé     OPC_FSLE_df     = (0xE << 22) | OPC_MSA_3RF_1A,
19780e64a38SPhilippe Mathieu-Daudé     OPC_FMAX_df     = (0xE << 22) | OPC_MSA_3RF_1B,
19880e64a38SPhilippe Mathieu-Daudé     OPC_MSUBR_Q_df  = (0xE << 22) | OPC_MSA_3RF_1C,
19980e64a38SPhilippe Mathieu-Daudé     OPC_FSULE_df    = (0xF << 22) | OPC_MSA_3RF_1A,
20080e64a38SPhilippe Mathieu-Daudé     OPC_FMAX_A_df   = (0xF << 22) | OPC_MSA_3RF_1B,
20180e64a38SPhilippe Mathieu-Daudé };
20280e64a38SPhilippe Mathieu-Daudé 
20306106772SPhilippe Mathieu-Daudé static const char msaregnames[][6] = {
20480e64a38SPhilippe Mathieu-Daudé     "w0.d0",  "w0.d1",  "w1.d0",  "w1.d1",
20580e64a38SPhilippe Mathieu-Daudé     "w2.d0",  "w2.d1",  "w3.d0",  "w3.d1",
20680e64a38SPhilippe Mathieu-Daudé     "w4.d0",  "w4.d1",  "w5.d0",  "w5.d1",
20780e64a38SPhilippe Mathieu-Daudé     "w6.d0",  "w6.d1",  "w7.d0",  "w7.d1",
20880e64a38SPhilippe Mathieu-Daudé     "w8.d0",  "w8.d1",  "w9.d0",  "w9.d1",
20980e64a38SPhilippe Mathieu-Daudé     "w10.d0", "w10.d1", "w11.d0", "w11.d1",
21080e64a38SPhilippe Mathieu-Daudé     "w12.d0", "w12.d1", "w13.d0", "w13.d1",
21180e64a38SPhilippe Mathieu-Daudé     "w14.d0", "w14.d1", "w15.d0", "w15.d1",
21280e64a38SPhilippe Mathieu-Daudé     "w16.d0", "w16.d1", "w17.d0", "w17.d1",
21380e64a38SPhilippe Mathieu-Daudé     "w18.d0", "w18.d1", "w19.d0", "w19.d1",
21480e64a38SPhilippe Mathieu-Daudé     "w20.d0", "w20.d1", "w21.d0", "w21.d1",
21580e64a38SPhilippe Mathieu-Daudé     "w22.d0", "w22.d1", "w23.d0", "w23.d1",
21680e64a38SPhilippe Mathieu-Daudé     "w24.d0", "w24.d1", "w25.d0", "w25.d1",
21780e64a38SPhilippe Mathieu-Daudé     "w26.d0", "w26.d1", "w27.d0", "w27.d1",
21880e64a38SPhilippe Mathieu-Daudé     "w28.d0", "w28.d1", "w29.d0", "w29.d1",
21980e64a38SPhilippe Mathieu-Daudé     "w30.d0", "w30.d1", "w31.d0", "w31.d1",
22080e64a38SPhilippe Mathieu-Daudé };
22180e64a38SPhilippe Mathieu-Daudé 
2224701d23aSPhilippe Mathieu-Daudé /* Encoding of Operation Field (must be indexed by CPUMIPSMSADataFormat) */
2234701d23aSPhilippe Mathieu-Daudé struct dfe {
2244701d23aSPhilippe Mathieu-Daudé     int start;
2254701d23aSPhilippe Mathieu-Daudé     int length;
2264701d23aSPhilippe Mathieu-Daudé     uint32_t mask;
2274701d23aSPhilippe Mathieu-Daudé };
2284701d23aSPhilippe Mathieu-Daudé 
2294701d23aSPhilippe Mathieu-Daudé /*
2304701d23aSPhilippe Mathieu-Daudé  * Extract immediate from df/{m,n} format (used by ELM & BIT instructions).
2314701d23aSPhilippe Mathieu-Daudé  * Returns the immediate value, or -1 if the format does not match.
2324701d23aSPhilippe Mathieu-Daudé  */
2334701d23aSPhilippe Mathieu-Daudé static int df_extract_val(DisasContext *ctx, int x, const struct dfe *s)
2344701d23aSPhilippe Mathieu-Daudé {
2354701d23aSPhilippe Mathieu-Daudé     for (unsigned i = 0; i < 4; i++) {
2364701d23aSPhilippe Mathieu-Daudé         if (extract32(x, s->start, s->length) == s->mask) {
2374701d23aSPhilippe Mathieu-Daudé             return extract32(x, 0, s->start);
2384701d23aSPhilippe Mathieu-Daudé         }
2394701d23aSPhilippe Mathieu-Daudé     }
2404701d23aSPhilippe Mathieu-Daudé     return -1;
2414701d23aSPhilippe Mathieu-Daudé }
2424701d23aSPhilippe Mathieu-Daudé 
2434701d23aSPhilippe Mathieu-Daudé /*
2444701d23aSPhilippe Mathieu-Daudé  * Extract DataField from df/{m,n} format (used by ELM & BIT instructions).
2454701d23aSPhilippe Mathieu-Daudé  * Returns the DataField, or -1 if the format does not match.
2464701d23aSPhilippe Mathieu-Daudé  */
2474701d23aSPhilippe Mathieu-Daudé static int df_extract_df(DisasContext *ctx, int x, const struct dfe *s)
2484701d23aSPhilippe Mathieu-Daudé {
2494701d23aSPhilippe Mathieu-Daudé     for (unsigned i = 0; i < 4; i++) {
2504701d23aSPhilippe Mathieu-Daudé         if (extract32(x, s->start, s->length) == s->mask) {
2514701d23aSPhilippe Mathieu-Daudé             return i;
2524701d23aSPhilippe Mathieu-Daudé         }
2534701d23aSPhilippe Mathieu-Daudé     }
2544701d23aSPhilippe Mathieu-Daudé     return -1;
2554701d23aSPhilippe Mathieu-Daudé }
2564701d23aSPhilippe Mathieu-Daudé 
2574701d23aSPhilippe Mathieu-Daudé static const struct dfe df_bit[] = {
2584701d23aSPhilippe Mathieu-Daudé     /* Table 3.28 BIT Instruction Format */
2594701d23aSPhilippe Mathieu-Daudé     [DF_BYTE]   = {3, 4, 0b1110},
2604701d23aSPhilippe Mathieu-Daudé     [DF_HALF]   = {4, 3, 0b110},
2614701d23aSPhilippe Mathieu-Daudé     [DF_WORD]   = {5, 2, 0b10},
2624701d23aSPhilippe Mathieu-Daudé     [DF_DOUBLE] = {6, 1, 0b0}
2634701d23aSPhilippe Mathieu-Daudé };
2644701d23aSPhilippe Mathieu-Daudé 
2654701d23aSPhilippe Mathieu-Daudé static int bit_m(DisasContext *ctx, int x)
2664701d23aSPhilippe Mathieu-Daudé {
2674701d23aSPhilippe Mathieu-Daudé     return df_extract_val(ctx, x, df_bit);
2684701d23aSPhilippe Mathieu-Daudé }
2694701d23aSPhilippe Mathieu-Daudé 
2704701d23aSPhilippe Mathieu-Daudé static int bit_df(DisasContext *ctx, int x)
2714701d23aSPhilippe Mathieu-Daudé {
2724701d23aSPhilippe Mathieu-Daudé     return df_extract_df(ctx, x, df_bit);
2734701d23aSPhilippe Mathieu-Daudé }
2744701d23aSPhilippe Mathieu-Daudé 
27580e64a38SPhilippe Mathieu-Daudé static TCGv_i64 msa_wr_d[64];
27680e64a38SPhilippe Mathieu-Daudé 
27780e64a38SPhilippe Mathieu-Daudé void msa_translate_init(void)
27880e64a38SPhilippe Mathieu-Daudé {
27980e64a38SPhilippe Mathieu-Daudé     int i;
28080e64a38SPhilippe Mathieu-Daudé 
28180e64a38SPhilippe Mathieu-Daudé     for (i = 0; i < 32; i++) {
282bbc213b3SPhilippe Mathieu-Daudé         int off;
28380e64a38SPhilippe Mathieu-Daudé 
28480e64a38SPhilippe Mathieu-Daudé         /*
28580e64a38SPhilippe Mathieu-Daudé          * The MSA vector registers are mapped on the
28680e64a38SPhilippe Mathieu-Daudé          * scalar floating-point unit (FPU) registers.
28780e64a38SPhilippe Mathieu-Daudé          */
288bbc213b3SPhilippe Mathieu-Daudé         off = offsetof(CPUMIPSState, active_fpu.fpr[i].wr.d[0]);
28980e64a38SPhilippe Mathieu-Daudé         msa_wr_d[i * 2] = fpu_f64[i];
290bbc213b3SPhilippe Mathieu-Daudé 
29180e64a38SPhilippe Mathieu-Daudé         off = offsetof(CPUMIPSState, active_fpu.fpr[i].wr.d[1]);
29280e64a38SPhilippe Mathieu-Daudé         msa_wr_d[i * 2 + 1] =
29380e64a38SPhilippe Mathieu-Daudé                 tcg_global_mem_new_i64(cpu_env, off, msaregnames[i * 2 + 1]);
29480e64a38SPhilippe Mathieu-Daudé     }
29580e64a38SPhilippe Mathieu-Daudé }
29680e64a38SPhilippe Mathieu-Daudé 
297340ee8b3SPhilippe Mathieu-Daudé /*
298340ee8b3SPhilippe Mathieu-Daudé  * Check if MSA is enabled.
299340ee8b3SPhilippe Mathieu-Daudé  * This function is always called with MSA available.
300340ee8b3SPhilippe Mathieu-Daudé  * If MSA is disabled, raise an exception.
301340ee8b3SPhilippe Mathieu-Daudé  */
302340ee8b3SPhilippe Mathieu-Daudé static inline bool check_msa_enabled(DisasContext *ctx)
30380e64a38SPhilippe Mathieu-Daudé {
30480e64a38SPhilippe Mathieu-Daudé     if (unlikely((ctx->hflags & MIPS_HFLAG_FPU) &&
30580e64a38SPhilippe Mathieu-Daudé                  !(ctx->hflags & MIPS_HFLAG_F64))) {
30680e64a38SPhilippe Mathieu-Daudé         gen_reserved_instruction(ctx);
307340ee8b3SPhilippe Mathieu-Daudé         return false;
30880e64a38SPhilippe Mathieu-Daudé     }
30980e64a38SPhilippe Mathieu-Daudé 
31080e64a38SPhilippe Mathieu-Daudé     if (unlikely(!(ctx->hflags & MIPS_HFLAG_MSA))) {
31180e64a38SPhilippe Mathieu-Daudé         generate_exception_end(ctx, EXCP_MSADIS);
312340ee8b3SPhilippe Mathieu-Daudé         return false;
31380e64a38SPhilippe Mathieu-Daudé     }
314340ee8b3SPhilippe Mathieu-Daudé     return true;
31580e64a38SPhilippe Mathieu-Daudé }
31680e64a38SPhilippe Mathieu-Daudé 
317*ce121fe2SPhilippe Mathieu-Daudé typedef void gen_helper_piv(TCGv_ptr, TCGv_i32, TCGv);
3187cc351ffSPhilippe Mathieu-Daudé typedef void gen_helper_piii(TCGv_ptr, TCGv_i32, TCGv_i32, TCGv_i32);
319b8e74816SPhilippe Mathieu-Daudé typedef void gen_helper_piiii(TCGv_ptr, TCGv_i32, TCGv_i32, TCGv_i32, TCGv_i32);
320b8e74816SPhilippe Mathieu-Daudé 
321*ce121fe2SPhilippe Mathieu-Daudé #define TRANS_DF_x(TYPE, NAME, trans_func, gen_func) \
322*ce121fe2SPhilippe Mathieu-Daudé     static gen_helper_p##TYPE * const NAME##_tab[4] = { \
323*ce121fe2SPhilippe Mathieu-Daudé         gen_func##_b, gen_func##_h, gen_func##_w, gen_func##_d \
324*ce121fe2SPhilippe Mathieu-Daudé     }; \
325*ce121fe2SPhilippe Mathieu-Daudé     TRANS(NAME, trans_func, NAME##_tab[a->df])
326*ce121fe2SPhilippe Mathieu-Daudé 
327*ce121fe2SPhilippe Mathieu-Daudé #define TRANS_DF_iv(NAME, trans_func, gen_func) \
328*ce121fe2SPhilippe Mathieu-Daudé     TRANS_DF_x(iv, NAME, trans_func, gen_func)
329*ce121fe2SPhilippe Mathieu-Daudé 
330878b87b5SPhilippe Mathieu-Daudé static void gen_check_zero_element(TCGv tresult, uint8_t df, uint8_t wt,
331878b87b5SPhilippe Mathieu-Daudé                                    TCGCond cond)
33280e64a38SPhilippe Mathieu-Daudé {
33380e64a38SPhilippe Mathieu-Daudé     /* generates tcg ops to check if any element is 0 */
33480e64a38SPhilippe Mathieu-Daudé     /* Note this function only works with MSA_WRLEN = 128 */
33540f75c02SPhilippe Mathieu-Daudé     uint64_t eval_zero_or_big = dup_const(df, 1);
33640f75c02SPhilippe Mathieu-Daudé     uint64_t eval_big = eval_zero_or_big << ((8 << df) - 1);
33780e64a38SPhilippe Mathieu-Daudé     TCGv_i64 t0 = tcg_temp_new_i64();
33880e64a38SPhilippe Mathieu-Daudé     TCGv_i64 t1 = tcg_temp_new_i64();
33940f75c02SPhilippe Mathieu-Daudé 
34080e64a38SPhilippe Mathieu-Daudé     tcg_gen_subi_i64(t0, msa_wr_d[wt << 1], eval_zero_or_big);
34180e64a38SPhilippe Mathieu-Daudé     tcg_gen_andc_i64(t0, t0, msa_wr_d[wt << 1]);
34280e64a38SPhilippe Mathieu-Daudé     tcg_gen_andi_i64(t0, t0, eval_big);
34380e64a38SPhilippe Mathieu-Daudé     tcg_gen_subi_i64(t1, msa_wr_d[(wt << 1) + 1], eval_zero_or_big);
34480e64a38SPhilippe Mathieu-Daudé     tcg_gen_andc_i64(t1, t1, msa_wr_d[(wt << 1) + 1]);
34580e64a38SPhilippe Mathieu-Daudé     tcg_gen_andi_i64(t1, t1, eval_big);
34680e64a38SPhilippe Mathieu-Daudé     tcg_gen_or_i64(t0, t0, t1);
34780e64a38SPhilippe Mathieu-Daudé     /* if all bits are zero then all elements are not zero */
34880e64a38SPhilippe Mathieu-Daudé     /* if some bit is non-zero then some element is zero */
349878b87b5SPhilippe Mathieu-Daudé     tcg_gen_setcondi_i64(cond, t0, t0, 0);
35080e64a38SPhilippe Mathieu-Daudé     tcg_gen_trunc_i64_tl(tresult, t0);
35180e64a38SPhilippe Mathieu-Daudé     tcg_temp_free_i64(t0);
35280e64a38SPhilippe Mathieu-Daudé     tcg_temp_free_i64(t1);
35380e64a38SPhilippe Mathieu-Daudé }
35480e64a38SPhilippe Mathieu-Daudé 
355d61566cfSPhilippe Mathieu-Daudé static bool gen_msa_BxZ_V(DisasContext *ctx, int wt, int sa, TCGCond cond)
35680e64a38SPhilippe Mathieu-Daudé {
35780e64a38SPhilippe Mathieu-Daudé     TCGv_i64 t0;
35880e64a38SPhilippe Mathieu-Daudé 
359340ee8b3SPhilippe Mathieu-Daudé     if (!check_msa_enabled(ctx)) {
360340ee8b3SPhilippe Mathieu-Daudé         return true;
361340ee8b3SPhilippe Mathieu-Daudé     }
36280e64a38SPhilippe Mathieu-Daudé 
36380e64a38SPhilippe Mathieu-Daudé     if (ctx->hflags & MIPS_HFLAG_BMASK) {
36480e64a38SPhilippe Mathieu-Daudé         gen_reserved_instruction(ctx);
36580e64a38SPhilippe Mathieu-Daudé         return true;
36680e64a38SPhilippe Mathieu-Daudé     }
36780e64a38SPhilippe Mathieu-Daudé     t0 = tcg_temp_new_i64();
36880e64a38SPhilippe Mathieu-Daudé     tcg_gen_or_i64(t0, msa_wr_d[wt << 1], msa_wr_d[(wt << 1) + 1]);
36980e64a38SPhilippe Mathieu-Daudé     tcg_gen_setcondi_i64(cond, t0, t0, 0);
37080e64a38SPhilippe Mathieu-Daudé     tcg_gen_trunc_i64_tl(bcond, t0);
37180e64a38SPhilippe Mathieu-Daudé     tcg_temp_free_i64(t0);
37280e64a38SPhilippe Mathieu-Daudé 
373d61566cfSPhilippe Mathieu-Daudé     ctx->btarget = ctx->base.pc_next + (sa << 2) + 4;
37480e64a38SPhilippe Mathieu-Daudé 
37580e64a38SPhilippe Mathieu-Daudé     ctx->hflags |= MIPS_HFLAG_BC;
37680e64a38SPhilippe Mathieu-Daudé     ctx->hflags |= MIPS_HFLAG_BDS32;
37780e64a38SPhilippe Mathieu-Daudé 
37880e64a38SPhilippe Mathieu-Daudé     return true;
37980e64a38SPhilippe Mathieu-Daudé }
38080e64a38SPhilippe Mathieu-Daudé 
381c7a9ef75SPhilippe Mathieu-Daudé static bool trans_BZ_V(DisasContext *ctx, arg_msa_bz *a)
382c7a9ef75SPhilippe Mathieu-Daudé {
383d61566cfSPhilippe Mathieu-Daudé     return gen_msa_BxZ_V(ctx, a->wt, a->sa, TCG_COND_EQ);
384c7a9ef75SPhilippe Mathieu-Daudé }
385c7a9ef75SPhilippe Mathieu-Daudé 
386c7a9ef75SPhilippe Mathieu-Daudé static bool trans_BNZ_V(DisasContext *ctx, arg_msa_bz *a)
387c7a9ef75SPhilippe Mathieu-Daudé {
388d61566cfSPhilippe Mathieu-Daudé     return gen_msa_BxZ_V(ctx, a->wt, a->sa, TCG_COND_NE);
389c7a9ef75SPhilippe Mathieu-Daudé }
390c7a9ef75SPhilippe Mathieu-Daudé 
391d61566cfSPhilippe Mathieu-Daudé static bool gen_msa_BxZ(DisasContext *ctx, int df, int wt, int sa, bool if_not)
39280e64a38SPhilippe Mathieu-Daudé {
393340ee8b3SPhilippe Mathieu-Daudé     if (!check_msa_enabled(ctx)) {
394340ee8b3SPhilippe Mathieu-Daudé         return true;
395340ee8b3SPhilippe Mathieu-Daudé     }
39680e64a38SPhilippe Mathieu-Daudé 
39780e64a38SPhilippe Mathieu-Daudé     if (ctx->hflags & MIPS_HFLAG_BMASK) {
39880e64a38SPhilippe Mathieu-Daudé         gen_reserved_instruction(ctx);
39980e64a38SPhilippe Mathieu-Daudé         return true;
40080e64a38SPhilippe Mathieu-Daudé     }
40180e64a38SPhilippe Mathieu-Daudé 
402878b87b5SPhilippe Mathieu-Daudé     gen_check_zero_element(bcond, df, wt, if_not ? TCG_COND_EQ : TCG_COND_NE);
40380e64a38SPhilippe Mathieu-Daudé 
404d61566cfSPhilippe Mathieu-Daudé     ctx->btarget = ctx->base.pc_next + (sa << 2) + 4;
40580e64a38SPhilippe Mathieu-Daudé     ctx->hflags |= MIPS_HFLAG_BC;
40680e64a38SPhilippe Mathieu-Daudé     ctx->hflags |= MIPS_HFLAG_BDS32;
40780e64a38SPhilippe Mathieu-Daudé 
40880e64a38SPhilippe Mathieu-Daudé     return true;
40980e64a38SPhilippe Mathieu-Daudé }
41080e64a38SPhilippe Mathieu-Daudé 
411d61566cfSPhilippe Mathieu-Daudé static bool trans_BZ(DisasContext *ctx, arg_msa_bz *a)
412c7a9ef75SPhilippe Mathieu-Daudé {
413d61566cfSPhilippe Mathieu-Daudé     return gen_msa_BxZ(ctx, a->df, a->wt, a->sa, false);
414c7a9ef75SPhilippe Mathieu-Daudé }
415c7a9ef75SPhilippe Mathieu-Daudé 
416d61566cfSPhilippe Mathieu-Daudé static bool trans_BNZ(DisasContext *ctx, arg_msa_bz *a)
417c7a9ef75SPhilippe Mathieu-Daudé {
418d61566cfSPhilippe Mathieu-Daudé     return gen_msa_BxZ(ctx, a->df, a->wt, a->sa, true);
419c7a9ef75SPhilippe Mathieu-Daudé }
420c7a9ef75SPhilippe Mathieu-Daudé 
4217cc351ffSPhilippe Mathieu-Daudé static bool trans_msa_i8(DisasContext *ctx, arg_msa_i *a,
4227cc351ffSPhilippe Mathieu-Daudé                          gen_helper_piii *gen_msa_i8)
42380e64a38SPhilippe Mathieu-Daudé {
4247cc351ffSPhilippe Mathieu-Daudé     if (!check_msa_enabled(ctx)) {
4257cc351ffSPhilippe Mathieu-Daudé         return true;
42680e64a38SPhilippe Mathieu-Daudé     }
42780e64a38SPhilippe Mathieu-Daudé 
4287cc351ffSPhilippe Mathieu-Daudé     gen_msa_i8(cpu_env,
4297cc351ffSPhilippe Mathieu-Daudé                tcg_constant_i32(a->wd),
4307cc351ffSPhilippe Mathieu-Daudé                tcg_constant_i32(a->ws),
4317cc351ffSPhilippe Mathieu-Daudé                tcg_constant_i32(a->sa));
4327cc351ffSPhilippe Mathieu-Daudé 
4337cc351ffSPhilippe Mathieu-Daudé     return true;
43480e64a38SPhilippe Mathieu-Daudé }
43580e64a38SPhilippe Mathieu-Daudé 
4367cc351ffSPhilippe Mathieu-Daudé TRANS(ANDI,     trans_msa_i8, gen_helper_msa_andi_b);
4377cc351ffSPhilippe Mathieu-Daudé TRANS(ORI,      trans_msa_i8, gen_helper_msa_ori_b);
4387cc351ffSPhilippe Mathieu-Daudé TRANS(NORI,     trans_msa_i8, gen_helper_msa_nori_b);
4397cc351ffSPhilippe Mathieu-Daudé TRANS(XORI,     trans_msa_i8, gen_helper_msa_xori_b);
4407cc351ffSPhilippe Mathieu-Daudé TRANS(BMNZI,    trans_msa_i8, gen_helper_msa_bmnzi_b);
4417cc351ffSPhilippe Mathieu-Daudé TRANS(BMZI,     trans_msa_i8, gen_helper_msa_bmzi_b);
4427cc351ffSPhilippe Mathieu-Daudé TRANS(BSELI,    trans_msa_i8, gen_helper_msa_bseli_b);
4437cc351ffSPhilippe Mathieu-Daudé 
444a9e17958SPhilippe Mathieu-Daudé static bool trans_SHF(DisasContext *ctx, arg_msa_i *a)
445a9e17958SPhilippe Mathieu-Daudé {
446a9e17958SPhilippe Mathieu-Daudé     if (a->df == DF_DOUBLE) {
447a9e17958SPhilippe Mathieu-Daudé         return false;
448a9e17958SPhilippe Mathieu-Daudé     }
449a9e17958SPhilippe Mathieu-Daudé 
450a9e17958SPhilippe Mathieu-Daudé     if (!check_msa_enabled(ctx)) {
451a9e17958SPhilippe Mathieu-Daudé         return true;
452a9e17958SPhilippe Mathieu-Daudé     }
453a9e17958SPhilippe Mathieu-Daudé 
454a9e17958SPhilippe Mathieu-Daudé     gen_helper_msa_shf_df(cpu_env,
455a9e17958SPhilippe Mathieu-Daudé                           tcg_constant_i32(a->df),
456a9e17958SPhilippe Mathieu-Daudé                           tcg_constant_i32(a->wd),
457a9e17958SPhilippe Mathieu-Daudé                           tcg_constant_i32(a->ws),
458a9e17958SPhilippe Mathieu-Daudé                           tcg_constant_i32(a->sa));
459a9e17958SPhilippe Mathieu-Daudé 
460a9e17958SPhilippe Mathieu-Daudé     return true;
461a9e17958SPhilippe Mathieu-Daudé }
462a9e17958SPhilippe Mathieu-Daudé 
463b8e74816SPhilippe Mathieu-Daudé static bool trans_msa_i5(DisasContext *ctx, arg_msa_i *a,
464b8e74816SPhilippe Mathieu-Daudé                          gen_helper_piiii *gen_msa_i5)
46580e64a38SPhilippe Mathieu-Daudé {
466b8e74816SPhilippe Mathieu-Daudé     if (!check_msa_enabled(ctx)) {
467b8e74816SPhilippe Mathieu-Daudé         return true;
46880e64a38SPhilippe Mathieu-Daudé     }
46980e64a38SPhilippe Mathieu-Daudé 
470b8e74816SPhilippe Mathieu-Daudé     gen_msa_i5(cpu_env,
471b8e74816SPhilippe Mathieu-Daudé                tcg_constant_i32(a->df),
472b8e74816SPhilippe Mathieu-Daudé                tcg_constant_i32(a->wd),
473b8e74816SPhilippe Mathieu-Daudé                tcg_constant_i32(a->ws),
474b8e74816SPhilippe Mathieu-Daudé                tcg_constant_i32(a->sa));
475b8e74816SPhilippe Mathieu-Daudé 
476b8e74816SPhilippe Mathieu-Daudé     return true;
47780e64a38SPhilippe Mathieu-Daudé }
47880e64a38SPhilippe Mathieu-Daudé 
479b8e74816SPhilippe Mathieu-Daudé TRANS(ADDVI,    trans_msa_i5, gen_helper_msa_addvi_df);
480b8e74816SPhilippe Mathieu-Daudé TRANS(SUBVI,    trans_msa_i5, gen_helper_msa_subvi_df);
481b8e74816SPhilippe Mathieu-Daudé TRANS(MAXI_S,   trans_msa_i5, gen_helper_msa_maxi_s_df);
482b8e74816SPhilippe Mathieu-Daudé TRANS(MAXI_U,   trans_msa_i5, gen_helper_msa_maxi_u_df);
483b8e74816SPhilippe Mathieu-Daudé TRANS(MINI_S,   trans_msa_i5, gen_helper_msa_mini_s_df);
484b8e74816SPhilippe Mathieu-Daudé TRANS(MINI_U,   trans_msa_i5, gen_helper_msa_mini_u_df);
485b8e74816SPhilippe Mathieu-Daudé TRANS(CLTI_S,   trans_msa_i5, gen_helper_msa_clti_s_df);
486b8e74816SPhilippe Mathieu-Daudé TRANS(CLTI_U,   trans_msa_i5, gen_helper_msa_clti_u_df);
487b8e74816SPhilippe Mathieu-Daudé TRANS(CLEI_S,   trans_msa_i5, gen_helper_msa_clei_s_df);
488b8e74816SPhilippe Mathieu-Daudé TRANS(CLEI_U,   trans_msa_i5, gen_helper_msa_clei_u_df);
489b8e74816SPhilippe Mathieu-Daudé TRANS(CEQI,     trans_msa_i5, gen_helper_msa_ceqi_df);
490b8e74816SPhilippe Mathieu-Daudé 
49175094c33SPhilippe Mathieu-Daudé static bool trans_LDI(DisasContext *ctx, arg_msa_ldi *a)
49275094c33SPhilippe Mathieu-Daudé {
49375094c33SPhilippe Mathieu-Daudé     if (!check_msa_enabled(ctx)) {
49475094c33SPhilippe Mathieu-Daudé         return true;
49575094c33SPhilippe Mathieu-Daudé     }
49675094c33SPhilippe Mathieu-Daudé 
49775094c33SPhilippe Mathieu-Daudé     gen_helper_msa_ldi_df(cpu_env,
49875094c33SPhilippe Mathieu-Daudé                           tcg_constant_i32(a->df),
49975094c33SPhilippe Mathieu-Daudé                           tcg_constant_i32(a->wd),
50075094c33SPhilippe Mathieu-Daudé                           tcg_constant_i32(a->sa));
50175094c33SPhilippe Mathieu-Daudé 
50275094c33SPhilippe Mathieu-Daudé     return true;
50375094c33SPhilippe Mathieu-Daudé }
50475094c33SPhilippe Mathieu-Daudé 
5054701d23aSPhilippe Mathieu-Daudé static bool trans_msa_bit(DisasContext *ctx, arg_msa_bit *a,
5064701d23aSPhilippe Mathieu-Daudé                           gen_helper_piiii *gen_msa_bit)
50780e64a38SPhilippe Mathieu-Daudé {
5084701d23aSPhilippe Mathieu-Daudé     if (a->df < 0) {
5094701d23aSPhilippe Mathieu-Daudé         return false;
51080e64a38SPhilippe Mathieu-Daudé     }
51180e64a38SPhilippe Mathieu-Daudé 
5124701d23aSPhilippe Mathieu-Daudé     if (!check_msa_enabled(ctx)) {
5134701d23aSPhilippe Mathieu-Daudé         return true;
51480e64a38SPhilippe Mathieu-Daudé     }
51580e64a38SPhilippe Mathieu-Daudé 
5164701d23aSPhilippe Mathieu-Daudé     gen_msa_bit(cpu_env,
5174701d23aSPhilippe Mathieu-Daudé                 tcg_constant_i32(a->df),
5184701d23aSPhilippe Mathieu-Daudé                 tcg_constant_i32(a->wd),
5194701d23aSPhilippe Mathieu-Daudé                 tcg_constant_i32(a->ws),
5204701d23aSPhilippe Mathieu-Daudé                 tcg_constant_i32(a->m));
5214701d23aSPhilippe Mathieu-Daudé 
5224701d23aSPhilippe Mathieu-Daudé     return true;
52380e64a38SPhilippe Mathieu-Daudé }
52480e64a38SPhilippe Mathieu-Daudé 
5254701d23aSPhilippe Mathieu-Daudé TRANS(SLLI,     trans_msa_bit, gen_helper_msa_slli_df);
5264701d23aSPhilippe Mathieu-Daudé TRANS(SRAI,     trans_msa_bit, gen_helper_msa_srai_df);
5274701d23aSPhilippe Mathieu-Daudé TRANS(SRLI,     trans_msa_bit, gen_helper_msa_srli_df);
5284701d23aSPhilippe Mathieu-Daudé TRANS(BCLRI,    trans_msa_bit, gen_helper_msa_bclri_df);
5294701d23aSPhilippe Mathieu-Daudé TRANS(BSETI,    trans_msa_bit, gen_helper_msa_bseti_df);
5304701d23aSPhilippe Mathieu-Daudé TRANS(BNEGI,    trans_msa_bit, gen_helper_msa_bnegi_df);
5314701d23aSPhilippe Mathieu-Daudé TRANS(BINSLI,   trans_msa_bit, gen_helper_msa_binsli_df);
5324701d23aSPhilippe Mathieu-Daudé TRANS(BINSRI,   trans_msa_bit, gen_helper_msa_binsri_df);
5334701d23aSPhilippe Mathieu-Daudé TRANS(SAT_S,    trans_msa_bit, gen_helper_msa_sat_u_df);
5344701d23aSPhilippe Mathieu-Daudé TRANS(SAT_U,    trans_msa_bit, gen_helper_msa_sat_u_df);
5354701d23aSPhilippe Mathieu-Daudé TRANS(SRARI,    trans_msa_bit, gen_helper_msa_srari_df);
5364701d23aSPhilippe Mathieu-Daudé TRANS(SRLRI,    trans_msa_bit, gen_helper_msa_srlri_df);
5374701d23aSPhilippe Mathieu-Daudé 
53880e64a38SPhilippe Mathieu-Daudé static void gen_msa_3r(DisasContext *ctx)
53980e64a38SPhilippe Mathieu-Daudé {
54080e64a38SPhilippe Mathieu-Daudé #define MASK_MSA_3R(op)    (MASK_MSA_MINOR(op) | (op & (0x7 << 23)))
54180e64a38SPhilippe Mathieu-Daudé     uint8_t df = (ctx->opcode >> 21) & 0x3;
54280e64a38SPhilippe Mathieu-Daudé     uint8_t wt = (ctx->opcode >> 16) & 0x1f;
54380e64a38SPhilippe Mathieu-Daudé     uint8_t ws = (ctx->opcode >> 11) & 0x1f;
54480e64a38SPhilippe Mathieu-Daudé     uint8_t wd = (ctx->opcode >> 6) & 0x1f;
54580e64a38SPhilippe Mathieu-Daudé 
54680e64a38SPhilippe Mathieu-Daudé     TCGv_i32 tdf = tcg_const_i32(df);
54780e64a38SPhilippe Mathieu-Daudé     TCGv_i32 twd = tcg_const_i32(wd);
54880e64a38SPhilippe Mathieu-Daudé     TCGv_i32 tws = tcg_const_i32(ws);
54980e64a38SPhilippe Mathieu-Daudé     TCGv_i32 twt = tcg_const_i32(wt);
55080e64a38SPhilippe Mathieu-Daudé 
55180e64a38SPhilippe Mathieu-Daudé     switch (MASK_MSA_3R(ctx->opcode)) {
55280e64a38SPhilippe Mathieu-Daudé     case OPC_BINSL_df:
55380e64a38SPhilippe Mathieu-Daudé         switch (df) {
55480e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
55580e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_binsl_b(cpu_env, twd, tws, twt);
55680e64a38SPhilippe Mathieu-Daudé             break;
55780e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
55880e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_binsl_h(cpu_env, twd, tws, twt);
55980e64a38SPhilippe Mathieu-Daudé             break;
56080e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
56180e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_binsl_w(cpu_env, twd, tws, twt);
56280e64a38SPhilippe Mathieu-Daudé             break;
56380e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
56480e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_binsl_d(cpu_env, twd, tws, twt);
56580e64a38SPhilippe Mathieu-Daudé             break;
56680e64a38SPhilippe Mathieu-Daudé         }
56780e64a38SPhilippe Mathieu-Daudé         break;
56880e64a38SPhilippe Mathieu-Daudé     case OPC_BINSR_df:
56980e64a38SPhilippe Mathieu-Daudé         switch (df) {
57080e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
57180e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_binsr_b(cpu_env, twd, tws, twt);
57280e64a38SPhilippe Mathieu-Daudé             break;
57380e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
57480e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_binsr_h(cpu_env, twd, tws, twt);
57580e64a38SPhilippe Mathieu-Daudé             break;
57680e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
57780e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_binsr_w(cpu_env, twd, tws, twt);
57880e64a38SPhilippe Mathieu-Daudé             break;
57980e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
58080e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_binsr_d(cpu_env, twd, tws, twt);
58180e64a38SPhilippe Mathieu-Daudé             break;
58280e64a38SPhilippe Mathieu-Daudé         }
58380e64a38SPhilippe Mathieu-Daudé         break;
58480e64a38SPhilippe Mathieu-Daudé     case OPC_BCLR_df:
58580e64a38SPhilippe Mathieu-Daudé         switch (df) {
58680e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
58780e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_bclr_b(cpu_env, twd, tws, twt);
58880e64a38SPhilippe Mathieu-Daudé             break;
58980e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
59080e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_bclr_h(cpu_env, twd, tws, twt);
59180e64a38SPhilippe Mathieu-Daudé             break;
59280e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
59380e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_bclr_w(cpu_env, twd, tws, twt);
59480e64a38SPhilippe Mathieu-Daudé             break;
59580e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
59680e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_bclr_d(cpu_env, twd, tws, twt);
59780e64a38SPhilippe Mathieu-Daudé             break;
59880e64a38SPhilippe Mathieu-Daudé         }
59980e64a38SPhilippe Mathieu-Daudé         break;
60080e64a38SPhilippe Mathieu-Daudé     case OPC_BNEG_df:
60180e64a38SPhilippe Mathieu-Daudé         switch (df) {
60280e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
60380e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_bneg_b(cpu_env, twd, tws, twt);
60480e64a38SPhilippe Mathieu-Daudé             break;
60580e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
60680e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_bneg_h(cpu_env, twd, tws, twt);
60780e64a38SPhilippe Mathieu-Daudé             break;
60880e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
60980e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_bneg_w(cpu_env, twd, tws, twt);
61080e64a38SPhilippe Mathieu-Daudé             break;
61180e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
61280e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_bneg_d(cpu_env, twd, tws, twt);
61380e64a38SPhilippe Mathieu-Daudé             break;
61480e64a38SPhilippe Mathieu-Daudé         }
61580e64a38SPhilippe Mathieu-Daudé         break;
61680e64a38SPhilippe Mathieu-Daudé     case OPC_BSET_df:
61780e64a38SPhilippe Mathieu-Daudé         switch (df) {
61880e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
61980e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_bset_b(cpu_env, twd, tws, twt);
62080e64a38SPhilippe Mathieu-Daudé             break;
62180e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
62280e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_bset_h(cpu_env, twd, tws, twt);
62380e64a38SPhilippe Mathieu-Daudé             break;
62480e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
62580e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_bset_w(cpu_env, twd, tws, twt);
62680e64a38SPhilippe Mathieu-Daudé             break;
62780e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
62880e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_bset_d(cpu_env, twd, tws, twt);
62980e64a38SPhilippe Mathieu-Daudé             break;
63080e64a38SPhilippe Mathieu-Daudé         }
63180e64a38SPhilippe Mathieu-Daudé         break;
63280e64a38SPhilippe Mathieu-Daudé     case OPC_ADD_A_df:
63380e64a38SPhilippe Mathieu-Daudé         switch (df) {
63480e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
63580e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_add_a_b(cpu_env, twd, tws, twt);
63680e64a38SPhilippe Mathieu-Daudé             break;
63780e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
63880e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_add_a_h(cpu_env, twd, tws, twt);
63980e64a38SPhilippe Mathieu-Daudé             break;
64080e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
64180e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_add_a_w(cpu_env, twd, tws, twt);
64280e64a38SPhilippe Mathieu-Daudé             break;
64380e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
64480e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_add_a_d(cpu_env, twd, tws, twt);
64580e64a38SPhilippe Mathieu-Daudé             break;
64680e64a38SPhilippe Mathieu-Daudé         }
64780e64a38SPhilippe Mathieu-Daudé         break;
64880e64a38SPhilippe Mathieu-Daudé     case OPC_ADDS_A_df:
64980e64a38SPhilippe Mathieu-Daudé         switch (df) {
65080e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
65180e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_adds_a_b(cpu_env, twd, tws, twt);
65280e64a38SPhilippe Mathieu-Daudé             break;
65380e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
65480e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_adds_a_h(cpu_env, twd, tws, twt);
65580e64a38SPhilippe Mathieu-Daudé             break;
65680e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
65780e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_adds_a_w(cpu_env, twd, tws, twt);
65880e64a38SPhilippe Mathieu-Daudé             break;
65980e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
66080e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_adds_a_d(cpu_env, twd, tws, twt);
66180e64a38SPhilippe Mathieu-Daudé             break;
66280e64a38SPhilippe Mathieu-Daudé         }
66380e64a38SPhilippe Mathieu-Daudé         break;
66480e64a38SPhilippe Mathieu-Daudé     case OPC_ADDS_S_df:
66580e64a38SPhilippe Mathieu-Daudé         switch (df) {
66680e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
66780e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_adds_s_b(cpu_env, twd, tws, twt);
66880e64a38SPhilippe Mathieu-Daudé             break;
66980e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
67080e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_adds_s_h(cpu_env, twd, tws, twt);
67180e64a38SPhilippe Mathieu-Daudé             break;
67280e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
67380e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_adds_s_w(cpu_env, twd, tws, twt);
67480e64a38SPhilippe Mathieu-Daudé             break;
67580e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
67680e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_adds_s_d(cpu_env, twd, tws, twt);
67780e64a38SPhilippe Mathieu-Daudé             break;
67880e64a38SPhilippe Mathieu-Daudé         }
67980e64a38SPhilippe Mathieu-Daudé         break;
68080e64a38SPhilippe Mathieu-Daudé     case OPC_ADDS_U_df:
68180e64a38SPhilippe Mathieu-Daudé         switch (df) {
68280e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
68380e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_adds_u_b(cpu_env, twd, tws, twt);
68480e64a38SPhilippe Mathieu-Daudé             break;
68580e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
68680e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_adds_u_h(cpu_env, twd, tws, twt);
68780e64a38SPhilippe Mathieu-Daudé             break;
68880e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
68980e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_adds_u_w(cpu_env, twd, tws, twt);
69080e64a38SPhilippe Mathieu-Daudé             break;
69180e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
69280e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_adds_u_d(cpu_env, twd, tws, twt);
69380e64a38SPhilippe Mathieu-Daudé             break;
69480e64a38SPhilippe Mathieu-Daudé         }
69580e64a38SPhilippe Mathieu-Daudé         break;
69680e64a38SPhilippe Mathieu-Daudé     case OPC_ADDV_df:
69780e64a38SPhilippe Mathieu-Daudé         switch (df) {
69880e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
69980e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_addv_b(cpu_env, twd, tws, twt);
70080e64a38SPhilippe Mathieu-Daudé             break;
70180e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
70280e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_addv_h(cpu_env, twd, tws, twt);
70380e64a38SPhilippe Mathieu-Daudé             break;
70480e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
70580e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_addv_w(cpu_env, twd, tws, twt);
70680e64a38SPhilippe Mathieu-Daudé             break;
70780e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
70880e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_addv_d(cpu_env, twd, tws, twt);
70980e64a38SPhilippe Mathieu-Daudé             break;
71080e64a38SPhilippe Mathieu-Daudé         }
71180e64a38SPhilippe Mathieu-Daudé         break;
71280e64a38SPhilippe Mathieu-Daudé     case OPC_AVE_S_df:
71380e64a38SPhilippe Mathieu-Daudé         switch (df) {
71480e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
71580e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ave_s_b(cpu_env, twd, tws, twt);
71680e64a38SPhilippe Mathieu-Daudé             break;
71780e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
71880e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ave_s_h(cpu_env, twd, tws, twt);
71980e64a38SPhilippe Mathieu-Daudé             break;
72080e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
72180e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ave_s_w(cpu_env, twd, tws, twt);
72280e64a38SPhilippe Mathieu-Daudé             break;
72380e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
72480e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ave_s_d(cpu_env, twd, tws, twt);
72580e64a38SPhilippe Mathieu-Daudé             break;
72680e64a38SPhilippe Mathieu-Daudé         }
72780e64a38SPhilippe Mathieu-Daudé         break;
72880e64a38SPhilippe Mathieu-Daudé     case OPC_AVE_U_df:
72980e64a38SPhilippe Mathieu-Daudé         switch (df) {
73080e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
73180e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ave_u_b(cpu_env, twd, tws, twt);
73280e64a38SPhilippe Mathieu-Daudé             break;
73380e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
73480e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ave_u_h(cpu_env, twd, tws, twt);
73580e64a38SPhilippe Mathieu-Daudé             break;
73680e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
73780e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ave_u_w(cpu_env, twd, tws, twt);
73880e64a38SPhilippe Mathieu-Daudé             break;
73980e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
74080e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ave_u_d(cpu_env, twd, tws, twt);
74180e64a38SPhilippe Mathieu-Daudé             break;
74280e64a38SPhilippe Mathieu-Daudé         }
74380e64a38SPhilippe Mathieu-Daudé         break;
74480e64a38SPhilippe Mathieu-Daudé     case OPC_AVER_S_df:
74580e64a38SPhilippe Mathieu-Daudé         switch (df) {
74680e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
74780e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_aver_s_b(cpu_env, twd, tws, twt);
74880e64a38SPhilippe Mathieu-Daudé             break;
74980e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
75080e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_aver_s_h(cpu_env, twd, tws, twt);
75180e64a38SPhilippe Mathieu-Daudé             break;
75280e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
75380e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_aver_s_w(cpu_env, twd, tws, twt);
75480e64a38SPhilippe Mathieu-Daudé             break;
75580e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
75680e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_aver_s_d(cpu_env, twd, tws, twt);
75780e64a38SPhilippe Mathieu-Daudé             break;
75880e64a38SPhilippe Mathieu-Daudé         }
75980e64a38SPhilippe Mathieu-Daudé         break;
76080e64a38SPhilippe Mathieu-Daudé     case OPC_AVER_U_df:
76180e64a38SPhilippe Mathieu-Daudé         switch (df) {
76280e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
76380e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_aver_u_b(cpu_env, twd, tws, twt);
76480e64a38SPhilippe Mathieu-Daudé             break;
76580e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
76680e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_aver_u_h(cpu_env, twd, tws, twt);
76780e64a38SPhilippe Mathieu-Daudé             break;
76880e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
76980e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_aver_u_w(cpu_env, twd, tws, twt);
77080e64a38SPhilippe Mathieu-Daudé             break;
77180e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
77280e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_aver_u_d(cpu_env, twd, tws, twt);
77380e64a38SPhilippe Mathieu-Daudé             break;
77480e64a38SPhilippe Mathieu-Daudé         }
77580e64a38SPhilippe Mathieu-Daudé         break;
77680e64a38SPhilippe Mathieu-Daudé     case OPC_CEQ_df:
77780e64a38SPhilippe Mathieu-Daudé         switch (df) {
77880e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
77980e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ceq_b(cpu_env, twd, tws, twt);
78080e64a38SPhilippe Mathieu-Daudé             break;
78180e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
78280e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ceq_h(cpu_env, twd, tws, twt);
78380e64a38SPhilippe Mathieu-Daudé             break;
78480e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
78580e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ceq_w(cpu_env, twd, tws, twt);
78680e64a38SPhilippe Mathieu-Daudé             break;
78780e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
78880e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ceq_d(cpu_env, twd, tws, twt);
78980e64a38SPhilippe Mathieu-Daudé             break;
79080e64a38SPhilippe Mathieu-Daudé         }
79180e64a38SPhilippe Mathieu-Daudé         break;
79280e64a38SPhilippe Mathieu-Daudé     case OPC_CLE_S_df:
79380e64a38SPhilippe Mathieu-Daudé         switch (df) {
79480e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
79580e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_cle_s_b(cpu_env, twd, tws, twt);
79680e64a38SPhilippe Mathieu-Daudé             break;
79780e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
79880e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_cle_s_h(cpu_env, twd, tws, twt);
79980e64a38SPhilippe Mathieu-Daudé             break;
80080e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
80180e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_cle_s_w(cpu_env, twd, tws, twt);
80280e64a38SPhilippe Mathieu-Daudé             break;
80380e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
80480e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_cle_s_d(cpu_env, twd, tws, twt);
80580e64a38SPhilippe Mathieu-Daudé             break;
80680e64a38SPhilippe Mathieu-Daudé         }
80780e64a38SPhilippe Mathieu-Daudé         break;
80880e64a38SPhilippe Mathieu-Daudé     case OPC_CLE_U_df:
80980e64a38SPhilippe Mathieu-Daudé         switch (df) {
81080e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
81180e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_cle_u_b(cpu_env, twd, tws, twt);
81280e64a38SPhilippe Mathieu-Daudé             break;
81380e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
81480e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_cle_u_h(cpu_env, twd, tws, twt);
81580e64a38SPhilippe Mathieu-Daudé             break;
81680e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
81780e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_cle_u_w(cpu_env, twd, tws, twt);
81880e64a38SPhilippe Mathieu-Daudé             break;
81980e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
82080e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_cle_u_d(cpu_env, twd, tws, twt);
82180e64a38SPhilippe Mathieu-Daudé             break;
82280e64a38SPhilippe Mathieu-Daudé         }
82380e64a38SPhilippe Mathieu-Daudé         break;
82480e64a38SPhilippe Mathieu-Daudé     case OPC_CLT_S_df:
82580e64a38SPhilippe Mathieu-Daudé         switch (df) {
82680e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
82780e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_clt_s_b(cpu_env, twd, tws, twt);
82880e64a38SPhilippe Mathieu-Daudé             break;
82980e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
83080e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_clt_s_h(cpu_env, twd, tws, twt);
83180e64a38SPhilippe Mathieu-Daudé             break;
83280e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
83380e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_clt_s_w(cpu_env, twd, tws, twt);
83480e64a38SPhilippe Mathieu-Daudé             break;
83580e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
83680e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_clt_s_d(cpu_env, twd, tws, twt);
83780e64a38SPhilippe Mathieu-Daudé             break;
83880e64a38SPhilippe Mathieu-Daudé         }
83980e64a38SPhilippe Mathieu-Daudé         break;
84080e64a38SPhilippe Mathieu-Daudé     case OPC_CLT_U_df:
84180e64a38SPhilippe Mathieu-Daudé         switch (df) {
84280e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
84380e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_clt_u_b(cpu_env, twd, tws, twt);
84480e64a38SPhilippe Mathieu-Daudé             break;
84580e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
84680e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_clt_u_h(cpu_env, twd, tws, twt);
84780e64a38SPhilippe Mathieu-Daudé             break;
84880e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
84980e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_clt_u_w(cpu_env, twd, tws, twt);
85080e64a38SPhilippe Mathieu-Daudé             break;
85180e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
85280e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_clt_u_d(cpu_env, twd, tws, twt);
85380e64a38SPhilippe Mathieu-Daudé             break;
85480e64a38SPhilippe Mathieu-Daudé         }
85580e64a38SPhilippe Mathieu-Daudé         break;
85680e64a38SPhilippe Mathieu-Daudé     case OPC_DIV_S_df:
85780e64a38SPhilippe Mathieu-Daudé         switch (df) {
85880e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
85980e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_div_s_b(cpu_env, twd, tws, twt);
86080e64a38SPhilippe Mathieu-Daudé             break;
86180e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
86280e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_div_s_h(cpu_env, twd, tws, twt);
86380e64a38SPhilippe Mathieu-Daudé             break;
86480e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
86580e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_div_s_w(cpu_env, twd, tws, twt);
86680e64a38SPhilippe Mathieu-Daudé             break;
86780e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
86880e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_div_s_d(cpu_env, twd, tws, twt);
86980e64a38SPhilippe Mathieu-Daudé             break;
87080e64a38SPhilippe Mathieu-Daudé         }
87180e64a38SPhilippe Mathieu-Daudé         break;
87280e64a38SPhilippe Mathieu-Daudé     case OPC_DIV_U_df:
87380e64a38SPhilippe Mathieu-Daudé         switch (df) {
87480e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
87580e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_div_u_b(cpu_env, twd, tws, twt);
87680e64a38SPhilippe Mathieu-Daudé             break;
87780e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
87880e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_div_u_h(cpu_env, twd, tws, twt);
87980e64a38SPhilippe Mathieu-Daudé             break;
88080e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
88180e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_div_u_w(cpu_env, twd, tws, twt);
88280e64a38SPhilippe Mathieu-Daudé             break;
88380e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
88480e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_div_u_d(cpu_env, twd, tws, twt);
88580e64a38SPhilippe Mathieu-Daudé             break;
88680e64a38SPhilippe Mathieu-Daudé         }
88780e64a38SPhilippe Mathieu-Daudé         break;
88880e64a38SPhilippe Mathieu-Daudé     case OPC_MAX_A_df:
88980e64a38SPhilippe Mathieu-Daudé         switch (df) {
89080e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
89180e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_max_a_b(cpu_env, twd, tws, twt);
89280e64a38SPhilippe Mathieu-Daudé             break;
89380e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
89480e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_max_a_h(cpu_env, twd, tws, twt);
89580e64a38SPhilippe Mathieu-Daudé             break;
89680e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
89780e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_max_a_w(cpu_env, twd, tws, twt);
89880e64a38SPhilippe Mathieu-Daudé             break;
89980e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
90080e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_max_a_d(cpu_env, twd, tws, twt);
90180e64a38SPhilippe Mathieu-Daudé             break;
90280e64a38SPhilippe Mathieu-Daudé         }
90380e64a38SPhilippe Mathieu-Daudé         break;
90480e64a38SPhilippe Mathieu-Daudé     case OPC_MAX_S_df:
90580e64a38SPhilippe Mathieu-Daudé         switch (df) {
90680e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
90780e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_max_s_b(cpu_env, twd, tws, twt);
90880e64a38SPhilippe Mathieu-Daudé             break;
90980e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
91080e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_max_s_h(cpu_env, twd, tws, twt);
91180e64a38SPhilippe Mathieu-Daudé             break;
91280e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
91380e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_max_s_w(cpu_env, twd, tws, twt);
91480e64a38SPhilippe Mathieu-Daudé             break;
91580e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
91680e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_max_s_d(cpu_env, twd, tws, twt);
91780e64a38SPhilippe Mathieu-Daudé             break;
91880e64a38SPhilippe Mathieu-Daudé         }
91980e64a38SPhilippe Mathieu-Daudé         break;
92080e64a38SPhilippe Mathieu-Daudé     case OPC_MAX_U_df:
92180e64a38SPhilippe Mathieu-Daudé         switch (df) {
92280e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
92380e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_max_u_b(cpu_env, twd, tws, twt);
92480e64a38SPhilippe Mathieu-Daudé             break;
92580e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
92680e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_max_u_h(cpu_env, twd, tws, twt);
92780e64a38SPhilippe Mathieu-Daudé             break;
92880e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
92980e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_max_u_w(cpu_env, twd, tws, twt);
93080e64a38SPhilippe Mathieu-Daudé             break;
93180e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
93280e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_max_u_d(cpu_env, twd, tws, twt);
93380e64a38SPhilippe Mathieu-Daudé             break;
93480e64a38SPhilippe Mathieu-Daudé         }
93580e64a38SPhilippe Mathieu-Daudé         break;
93680e64a38SPhilippe Mathieu-Daudé     case OPC_MIN_A_df:
93780e64a38SPhilippe Mathieu-Daudé         switch (df) {
93880e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
93980e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_min_a_b(cpu_env, twd, tws, twt);
94080e64a38SPhilippe Mathieu-Daudé             break;
94180e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
94280e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_min_a_h(cpu_env, twd, tws, twt);
94380e64a38SPhilippe Mathieu-Daudé             break;
94480e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
94580e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_min_a_w(cpu_env, twd, tws, twt);
94680e64a38SPhilippe Mathieu-Daudé             break;
94780e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
94880e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_min_a_d(cpu_env, twd, tws, twt);
94980e64a38SPhilippe Mathieu-Daudé             break;
95080e64a38SPhilippe Mathieu-Daudé         }
95180e64a38SPhilippe Mathieu-Daudé         break;
95280e64a38SPhilippe Mathieu-Daudé     case OPC_MIN_S_df:
95380e64a38SPhilippe Mathieu-Daudé         switch (df) {
95480e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
95580e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_min_s_b(cpu_env, twd, tws, twt);
95680e64a38SPhilippe Mathieu-Daudé             break;
95780e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
95880e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_min_s_h(cpu_env, twd, tws, twt);
95980e64a38SPhilippe Mathieu-Daudé             break;
96080e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
96180e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_min_s_w(cpu_env, twd, tws, twt);
96280e64a38SPhilippe Mathieu-Daudé             break;
96380e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
96480e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_min_s_d(cpu_env, twd, tws, twt);
96580e64a38SPhilippe Mathieu-Daudé             break;
96680e64a38SPhilippe Mathieu-Daudé         }
96780e64a38SPhilippe Mathieu-Daudé         break;
96880e64a38SPhilippe Mathieu-Daudé     case OPC_MIN_U_df:
96980e64a38SPhilippe Mathieu-Daudé         switch (df) {
97080e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
97180e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_min_u_b(cpu_env, twd, tws, twt);
97280e64a38SPhilippe Mathieu-Daudé             break;
97380e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
97480e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_min_u_h(cpu_env, twd, tws, twt);
97580e64a38SPhilippe Mathieu-Daudé             break;
97680e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
97780e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_min_u_w(cpu_env, twd, tws, twt);
97880e64a38SPhilippe Mathieu-Daudé             break;
97980e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
98080e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_min_u_d(cpu_env, twd, tws, twt);
98180e64a38SPhilippe Mathieu-Daudé             break;
98280e64a38SPhilippe Mathieu-Daudé         }
98380e64a38SPhilippe Mathieu-Daudé         break;
98480e64a38SPhilippe Mathieu-Daudé     case OPC_MOD_S_df:
98580e64a38SPhilippe Mathieu-Daudé         switch (df) {
98680e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
98780e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_mod_s_b(cpu_env, twd, tws, twt);
98880e64a38SPhilippe Mathieu-Daudé             break;
98980e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
99080e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_mod_s_h(cpu_env, twd, tws, twt);
99180e64a38SPhilippe Mathieu-Daudé             break;
99280e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
99380e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_mod_s_w(cpu_env, twd, tws, twt);
99480e64a38SPhilippe Mathieu-Daudé             break;
99580e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
99680e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_mod_s_d(cpu_env, twd, tws, twt);
99780e64a38SPhilippe Mathieu-Daudé             break;
99880e64a38SPhilippe Mathieu-Daudé         }
99980e64a38SPhilippe Mathieu-Daudé         break;
100080e64a38SPhilippe Mathieu-Daudé     case OPC_MOD_U_df:
100180e64a38SPhilippe Mathieu-Daudé         switch (df) {
100280e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
100380e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_mod_u_b(cpu_env, twd, tws, twt);
100480e64a38SPhilippe Mathieu-Daudé             break;
100580e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
100680e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_mod_u_h(cpu_env, twd, tws, twt);
100780e64a38SPhilippe Mathieu-Daudé             break;
100880e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
100980e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_mod_u_w(cpu_env, twd, tws, twt);
101080e64a38SPhilippe Mathieu-Daudé             break;
101180e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
101280e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_mod_u_d(cpu_env, twd, tws, twt);
101380e64a38SPhilippe Mathieu-Daudé             break;
101480e64a38SPhilippe Mathieu-Daudé         }
101580e64a38SPhilippe Mathieu-Daudé         break;
101680e64a38SPhilippe Mathieu-Daudé     case OPC_MADDV_df:
101780e64a38SPhilippe Mathieu-Daudé         switch (df) {
101880e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
101980e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_maddv_b(cpu_env, twd, tws, twt);
102080e64a38SPhilippe Mathieu-Daudé             break;
102180e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
102280e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_maddv_h(cpu_env, twd, tws, twt);
102380e64a38SPhilippe Mathieu-Daudé             break;
102480e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
102580e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_maddv_w(cpu_env, twd, tws, twt);
102680e64a38SPhilippe Mathieu-Daudé             break;
102780e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
102880e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_maddv_d(cpu_env, twd, tws, twt);
102980e64a38SPhilippe Mathieu-Daudé             break;
103080e64a38SPhilippe Mathieu-Daudé         }
103180e64a38SPhilippe Mathieu-Daudé         break;
103280e64a38SPhilippe Mathieu-Daudé     case OPC_MSUBV_df:
103380e64a38SPhilippe Mathieu-Daudé         switch (df) {
103480e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
103580e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_msubv_b(cpu_env, twd, tws, twt);
103680e64a38SPhilippe Mathieu-Daudé             break;
103780e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
103880e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_msubv_h(cpu_env, twd, tws, twt);
103980e64a38SPhilippe Mathieu-Daudé             break;
104080e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
104180e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_msubv_w(cpu_env, twd, tws, twt);
104280e64a38SPhilippe Mathieu-Daudé             break;
104380e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
104480e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_msubv_d(cpu_env, twd, tws, twt);
104580e64a38SPhilippe Mathieu-Daudé             break;
104680e64a38SPhilippe Mathieu-Daudé         }
104780e64a38SPhilippe Mathieu-Daudé         break;
104880e64a38SPhilippe Mathieu-Daudé     case OPC_ASUB_S_df:
104980e64a38SPhilippe Mathieu-Daudé         switch (df) {
105080e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
105180e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_asub_s_b(cpu_env, twd, tws, twt);
105280e64a38SPhilippe Mathieu-Daudé             break;
105380e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
105480e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_asub_s_h(cpu_env, twd, tws, twt);
105580e64a38SPhilippe Mathieu-Daudé             break;
105680e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
105780e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_asub_s_w(cpu_env, twd, tws, twt);
105880e64a38SPhilippe Mathieu-Daudé             break;
105980e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
106080e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_asub_s_d(cpu_env, twd, tws, twt);
106180e64a38SPhilippe Mathieu-Daudé             break;
106280e64a38SPhilippe Mathieu-Daudé         }
106380e64a38SPhilippe Mathieu-Daudé         break;
106480e64a38SPhilippe Mathieu-Daudé     case OPC_ASUB_U_df:
106580e64a38SPhilippe Mathieu-Daudé         switch (df) {
106680e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
106780e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_asub_u_b(cpu_env, twd, tws, twt);
106880e64a38SPhilippe Mathieu-Daudé             break;
106980e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
107080e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_asub_u_h(cpu_env, twd, tws, twt);
107180e64a38SPhilippe Mathieu-Daudé             break;
107280e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
107380e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_asub_u_w(cpu_env, twd, tws, twt);
107480e64a38SPhilippe Mathieu-Daudé             break;
107580e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
107680e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_asub_u_d(cpu_env, twd, tws, twt);
107780e64a38SPhilippe Mathieu-Daudé             break;
107880e64a38SPhilippe Mathieu-Daudé         }
107980e64a38SPhilippe Mathieu-Daudé         break;
108080e64a38SPhilippe Mathieu-Daudé     case OPC_ILVEV_df:
108180e64a38SPhilippe Mathieu-Daudé         switch (df) {
108280e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
108380e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ilvev_b(cpu_env, twd, tws, twt);
108480e64a38SPhilippe Mathieu-Daudé             break;
108580e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
108680e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ilvev_h(cpu_env, twd, tws, twt);
108780e64a38SPhilippe Mathieu-Daudé             break;
108880e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
108980e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ilvev_w(cpu_env, twd, tws, twt);
109080e64a38SPhilippe Mathieu-Daudé             break;
109180e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
109280e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ilvev_d(cpu_env, twd, tws, twt);
109380e64a38SPhilippe Mathieu-Daudé             break;
109480e64a38SPhilippe Mathieu-Daudé         }
109580e64a38SPhilippe Mathieu-Daudé         break;
109680e64a38SPhilippe Mathieu-Daudé     case OPC_ILVOD_df:
109780e64a38SPhilippe Mathieu-Daudé         switch (df) {
109880e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
109980e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ilvod_b(cpu_env, twd, tws, twt);
110080e64a38SPhilippe Mathieu-Daudé             break;
110180e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
110280e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ilvod_h(cpu_env, twd, tws, twt);
110380e64a38SPhilippe Mathieu-Daudé             break;
110480e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
110580e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ilvod_w(cpu_env, twd, tws, twt);
110680e64a38SPhilippe Mathieu-Daudé             break;
110780e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
110880e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ilvod_d(cpu_env, twd, tws, twt);
110980e64a38SPhilippe Mathieu-Daudé             break;
111080e64a38SPhilippe Mathieu-Daudé         }
111180e64a38SPhilippe Mathieu-Daudé         break;
111280e64a38SPhilippe Mathieu-Daudé     case OPC_ILVL_df:
111380e64a38SPhilippe Mathieu-Daudé         switch (df) {
111480e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
111580e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ilvl_b(cpu_env, twd, tws, twt);
111680e64a38SPhilippe Mathieu-Daudé             break;
111780e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
111880e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ilvl_h(cpu_env, twd, tws, twt);
111980e64a38SPhilippe Mathieu-Daudé             break;
112080e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
112180e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ilvl_w(cpu_env, twd, tws, twt);
112280e64a38SPhilippe Mathieu-Daudé             break;
112380e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
112480e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ilvl_d(cpu_env, twd, tws, twt);
112580e64a38SPhilippe Mathieu-Daudé             break;
112680e64a38SPhilippe Mathieu-Daudé         }
112780e64a38SPhilippe Mathieu-Daudé         break;
112880e64a38SPhilippe Mathieu-Daudé     case OPC_ILVR_df:
112980e64a38SPhilippe Mathieu-Daudé         switch (df) {
113080e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
113180e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ilvr_b(cpu_env, twd, tws, twt);
113280e64a38SPhilippe Mathieu-Daudé             break;
113380e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
113480e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ilvr_h(cpu_env, twd, tws, twt);
113580e64a38SPhilippe Mathieu-Daudé             break;
113680e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
113780e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ilvr_w(cpu_env, twd, tws, twt);
113880e64a38SPhilippe Mathieu-Daudé             break;
113980e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
114080e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_ilvr_d(cpu_env, twd, tws, twt);
114180e64a38SPhilippe Mathieu-Daudé             break;
114280e64a38SPhilippe Mathieu-Daudé         }
114380e64a38SPhilippe Mathieu-Daudé         break;
114480e64a38SPhilippe Mathieu-Daudé     case OPC_PCKEV_df:
114580e64a38SPhilippe Mathieu-Daudé         switch (df) {
114680e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
114780e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_pckev_b(cpu_env, twd, tws, twt);
114880e64a38SPhilippe Mathieu-Daudé             break;
114980e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
115080e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_pckev_h(cpu_env, twd, tws, twt);
115180e64a38SPhilippe Mathieu-Daudé             break;
115280e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
115380e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_pckev_w(cpu_env, twd, tws, twt);
115480e64a38SPhilippe Mathieu-Daudé             break;
115580e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
115680e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_pckev_d(cpu_env, twd, tws, twt);
115780e64a38SPhilippe Mathieu-Daudé             break;
115880e64a38SPhilippe Mathieu-Daudé         }
115980e64a38SPhilippe Mathieu-Daudé         break;
116080e64a38SPhilippe Mathieu-Daudé     case OPC_PCKOD_df:
116180e64a38SPhilippe Mathieu-Daudé         switch (df) {
116280e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
116380e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_pckod_b(cpu_env, twd, tws, twt);
116480e64a38SPhilippe Mathieu-Daudé             break;
116580e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
116680e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_pckod_h(cpu_env, twd, tws, twt);
116780e64a38SPhilippe Mathieu-Daudé             break;
116880e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
116980e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_pckod_w(cpu_env, twd, tws, twt);
117080e64a38SPhilippe Mathieu-Daudé             break;
117180e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
117280e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_pckod_d(cpu_env, twd, tws, twt);
117380e64a38SPhilippe Mathieu-Daudé             break;
117480e64a38SPhilippe Mathieu-Daudé         }
117580e64a38SPhilippe Mathieu-Daudé         break;
117680e64a38SPhilippe Mathieu-Daudé     case OPC_SLL_df:
117780e64a38SPhilippe Mathieu-Daudé         switch (df) {
117880e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
117980e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_sll_b(cpu_env, twd, tws, twt);
118080e64a38SPhilippe Mathieu-Daudé             break;
118180e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
118280e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_sll_h(cpu_env, twd, tws, twt);
118380e64a38SPhilippe Mathieu-Daudé             break;
118480e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
118580e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_sll_w(cpu_env, twd, tws, twt);
118680e64a38SPhilippe Mathieu-Daudé             break;
118780e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
118880e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_sll_d(cpu_env, twd, tws, twt);
118980e64a38SPhilippe Mathieu-Daudé             break;
119080e64a38SPhilippe Mathieu-Daudé         }
119180e64a38SPhilippe Mathieu-Daudé         break;
119280e64a38SPhilippe Mathieu-Daudé     case OPC_SRA_df:
119380e64a38SPhilippe Mathieu-Daudé         switch (df) {
119480e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
119580e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_sra_b(cpu_env, twd, tws, twt);
119680e64a38SPhilippe Mathieu-Daudé             break;
119780e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
119880e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_sra_h(cpu_env, twd, tws, twt);
119980e64a38SPhilippe Mathieu-Daudé             break;
120080e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
120180e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_sra_w(cpu_env, twd, tws, twt);
120280e64a38SPhilippe Mathieu-Daudé             break;
120380e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
120480e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_sra_d(cpu_env, twd, tws, twt);
120580e64a38SPhilippe Mathieu-Daudé             break;
120680e64a38SPhilippe Mathieu-Daudé         }
120780e64a38SPhilippe Mathieu-Daudé         break;
120880e64a38SPhilippe Mathieu-Daudé     case OPC_SRAR_df:
120980e64a38SPhilippe Mathieu-Daudé         switch (df) {
121080e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
121180e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_srar_b(cpu_env, twd, tws, twt);
121280e64a38SPhilippe Mathieu-Daudé             break;
121380e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
121480e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_srar_h(cpu_env, twd, tws, twt);
121580e64a38SPhilippe Mathieu-Daudé             break;
121680e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
121780e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_srar_w(cpu_env, twd, tws, twt);
121880e64a38SPhilippe Mathieu-Daudé             break;
121980e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
122080e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_srar_d(cpu_env, twd, tws, twt);
122180e64a38SPhilippe Mathieu-Daudé             break;
122280e64a38SPhilippe Mathieu-Daudé         }
122380e64a38SPhilippe Mathieu-Daudé         break;
122480e64a38SPhilippe Mathieu-Daudé     case OPC_SRL_df:
122580e64a38SPhilippe Mathieu-Daudé         switch (df) {
122680e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
122780e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_srl_b(cpu_env, twd, tws, twt);
122880e64a38SPhilippe Mathieu-Daudé             break;
122980e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
123080e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_srl_h(cpu_env, twd, tws, twt);
123180e64a38SPhilippe Mathieu-Daudé             break;
123280e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
123380e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_srl_w(cpu_env, twd, tws, twt);
123480e64a38SPhilippe Mathieu-Daudé             break;
123580e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
123680e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_srl_d(cpu_env, twd, tws, twt);
123780e64a38SPhilippe Mathieu-Daudé             break;
123880e64a38SPhilippe Mathieu-Daudé         }
123980e64a38SPhilippe Mathieu-Daudé         break;
124080e64a38SPhilippe Mathieu-Daudé     case OPC_SRLR_df:
124180e64a38SPhilippe Mathieu-Daudé         switch (df) {
124280e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
124380e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_srlr_b(cpu_env, twd, tws, twt);
124480e64a38SPhilippe Mathieu-Daudé             break;
124580e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
124680e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_srlr_h(cpu_env, twd, tws, twt);
124780e64a38SPhilippe Mathieu-Daudé             break;
124880e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
124980e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_srlr_w(cpu_env, twd, tws, twt);
125080e64a38SPhilippe Mathieu-Daudé             break;
125180e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
125280e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_srlr_d(cpu_env, twd, tws, twt);
125380e64a38SPhilippe Mathieu-Daudé             break;
125480e64a38SPhilippe Mathieu-Daudé         }
125580e64a38SPhilippe Mathieu-Daudé         break;
125680e64a38SPhilippe Mathieu-Daudé     case OPC_SUBS_S_df:
125780e64a38SPhilippe Mathieu-Daudé         switch (df) {
125880e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
125980e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_subs_s_b(cpu_env, twd, tws, twt);
126080e64a38SPhilippe Mathieu-Daudé             break;
126180e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
126280e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_subs_s_h(cpu_env, twd, tws, twt);
126380e64a38SPhilippe Mathieu-Daudé             break;
126480e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
126580e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_subs_s_w(cpu_env, twd, tws, twt);
126680e64a38SPhilippe Mathieu-Daudé             break;
126780e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
126880e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_subs_s_d(cpu_env, twd, tws, twt);
126980e64a38SPhilippe Mathieu-Daudé             break;
127080e64a38SPhilippe Mathieu-Daudé         }
127180e64a38SPhilippe Mathieu-Daudé         break;
127280e64a38SPhilippe Mathieu-Daudé     case OPC_MULV_df:
127380e64a38SPhilippe Mathieu-Daudé         switch (df) {
127480e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
127580e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_mulv_b(cpu_env, twd, tws, twt);
127680e64a38SPhilippe Mathieu-Daudé             break;
127780e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
127880e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_mulv_h(cpu_env, twd, tws, twt);
127980e64a38SPhilippe Mathieu-Daudé             break;
128080e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
128180e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_mulv_w(cpu_env, twd, tws, twt);
128280e64a38SPhilippe Mathieu-Daudé             break;
128380e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
128480e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_mulv_d(cpu_env, twd, tws, twt);
128580e64a38SPhilippe Mathieu-Daudé             break;
128680e64a38SPhilippe Mathieu-Daudé         }
128780e64a38SPhilippe Mathieu-Daudé         break;
128880e64a38SPhilippe Mathieu-Daudé     case OPC_SLD_df:
128980e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_sld_df(cpu_env, tdf, twd, tws, twt);
129080e64a38SPhilippe Mathieu-Daudé         break;
129180e64a38SPhilippe Mathieu-Daudé     case OPC_VSHF_df:
129280e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_vshf_df(cpu_env, tdf, twd, tws, twt);
129380e64a38SPhilippe Mathieu-Daudé         break;
129480e64a38SPhilippe Mathieu-Daudé     case OPC_SUBV_df:
129580e64a38SPhilippe Mathieu-Daudé         switch (df) {
129680e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
129780e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_subv_b(cpu_env, twd, tws, twt);
129880e64a38SPhilippe Mathieu-Daudé             break;
129980e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
130080e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_subv_h(cpu_env, twd, tws, twt);
130180e64a38SPhilippe Mathieu-Daudé             break;
130280e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
130380e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_subv_w(cpu_env, twd, tws, twt);
130480e64a38SPhilippe Mathieu-Daudé             break;
130580e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
130680e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_subv_d(cpu_env, twd, tws, twt);
130780e64a38SPhilippe Mathieu-Daudé             break;
130880e64a38SPhilippe Mathieu-Daudé         }
130980e64a38SPhilippe Mathieu-Daudé         break;
131080e64a38SPhilippe Mathieu-Daudé     case OPC_SUBS_U_df:
131180e64a38SPhilippe Mathieu-Daudé         switch (df) {
131280e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
131380e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_subs_u_b(cpu_env, twd, tws, twt);
131480e64a38SPhilippe Mathieu-Daudé             break;
131580e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
131680e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_subs_u_h(cpu_env, twd, tws, twt);
131780e64a38SPhilippe Mathieu-Daudé             break;
131880e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
131980e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_subs_u_w(cpu_env, twd, tws, twt);
132080e64a38SPhilippe Mathieu-Daudé             break;
132180e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
132280e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_subs_u_d(cpu_env, twd, tws, twt);
132380e64a38SPhilippe Mathieu-Daudé             break;
132480e64a38SPhilippe Mathieu-Daudé         }
132580e64a38SPhilippe Mathieu-Daudé         break;
132680e64a38SPhilippe Mathieu-Daudé     case OPC_SPLAT_df:
132780e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_splat_df(cpu_env, tdf, twd, tws, twt);
132880e64a38SPhilippe Mathieu-Daudé         break;
132980e64a38SPhilippe Mathieu-Daudé     case OPC_SUBSUS_U_df:
133080e64a38SPhilippe Mathieu-Daudé         switch (df) {
133180e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
133280e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_subsus_u_b(cpu_env, twd, tws, twt);
133380e64a38SPhilippe Mathieu-Daudé             break;
133480e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
133580e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_subsus_u_h(cpu_env, twd, tws, twt);
133680e64a38SPhilippe Mathieu-Daudé             break;
133780e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
133880e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_subsus_u_w(cpu_env, twd, tws, twt);
133980e64a38SPhilippe Mathieu-Daudé             break;
134080e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
134180e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_subsus_u_d(cpu_env, twd, tws, twt);
134280e64a38SPhilippe Mathieu-Daudé             break;
134380e64a38SPhilippe Mathieu-Daudé         }
134480e64a38SPhilippe Mathieu-Daudé         break;
134580e64a38SPhilippe Mathieu-Daudé     case OPC_SUBSUU_S_df:
134680e64a38SPhilippe Mathieu-Daudé         switch (df) {
134780e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
134880e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_subsuu_s_b(cpu_env, twd, tws, twt);
134980e64a38SPhilippe Mathieu-Daudé             break;
135080e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
135180e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_subsuu_s_h(cpu_env, twd, tws, twt);
135280e64a38SPhilippe Mathieu-Daudé             break;
135380e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
135480e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_subsuu_s_w(cpu_env, twd, tws, twt);
135580e64a38SPhilippe Mathieu-Daudé             break;
135680e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
135780e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_subsuu_s_d(cpu_env, twd, tws, twt);
135880e64a38SPhilippe Mathieu-Daudé             break;
135980e64a38SPhilippe Mathieu-Daudé         }
136080e64a38SPhilippe Mathieu-Daudé         break;
136180e64a38SPhilippe Mathieu-Daudé 
136280e64a38SPhilippe Mathieu-Daudé     case OPC_DOTP_S_df:
136380e64a38SPhilippe Mathieu-Daudé     case OPC_DOTP_U_df:
136480e64a38SPhilippe Mathieu-Daudé     case OPC_DPADD_S_df:
136580e64a38SPhilippe Mathieu-Daudé     case OPC_DPADD_U_df:
136680e64a38SPhilippe Mathieu-Daudé     case OPC_DPSUB_S_df:
136780e64a38SPhilippe Mathieu-Daudé     case OPC_HADD_S_df:
136880e64a38SPhilippe Mathieu-Daudé     case OPC_DPSUB_U_df:
136980e64a38SPhilippe Mathieu-Daudé     case OPC_HADD_U_df:
137080e64a38SPhilippe Mathieu-Daudé     case OPC_HSUB_S_df:
137180e64a38SPhilippe Mathieu-Daudé     case OPC_HSUB_U_df:
137280e64a38SPhilippe Mathieu-Daudé         if (df == DF_BYTE) {
137380e64a38SPhilippe Mathieu-Daudé             gen_reserved_instruction(ctx);
137480e64a38SPhilippe Mathieu-Daudé             break;
137580e64a38SPhilippe Mathieu-Daudé         }
137680e64a38SPhilippe Mathieu-Daudé         switch (MASK_MSA_3R(ctx->opcode)) {
137780e64a38SPhilippe Mathieu-Daudé         case OPC_HADD_S_df:
137880e64a38SPhilippe Mathieu-Daudé             switch (df) {
137980e64a38SPhilippe Mathieu-Daudé             case DF_HALF:
138080e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_hadd_s_h(cpu_env, twd, tws, twt);
138180e64a38SPhilippe Mathieu-Daudé                 break;
138280e64a38SPhilippe Mathieu-Daudé             case DF_WORD:
138380e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_hadd_s_w(cpu_env, twd, tws, twt);
138480e64a38SPhilippe Mathieu-Daudé                 break;
138580e64a38SPhilippe Mathieu-Daudé             case DF_DOUBLE:
138680e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_hadd_s_d(cpu_env, twd, tws, twt);
138780e64a38SPhilippe Mathieu-Daudé                 break;
138880e64a38SPhilippe Mathieu-Daudé             }
138980e64a38SPhilippe Mathieu-Daudé             break;
139080e64a38SPhilippe Mathieu-Daudé         case OPC_HADD_U_df:
139180e64a38SPhilippe Mathieu-Daudé             switch (df) {
139280e64a38SPhilippe Mathieu-Daudé             case DF_HALF:
139380e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_hadd_u_h(cpu_env, twd, tws, twt);
139480e64a38SPhilippe Mathieu-Daudé                 break;
139580e64a38SPhilippe Mathieu-Daudé             case DF_WORD:
139680e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_hadd_u_w(cpu_env, twd, tws, twt);
139780e64a38SPhilippe Mathieu-Daudé                 break;
139880e64a38SPhilippe Mathieu-Daudé             case DF_DOUBLE:
139980e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_hadd_u_d(cpu_env, twd, tws, twt);
140080e64a38SPhilippe Mathieu-Daudé                 break;
140180e64a38SPhilippe Mathieu-Daudé             }
140280e64a38SPhilippe Mathieu-Daudé             break;
140380e64a38SPhilippe Mathieu-Daudé         case OPC_HSUB_S_df:
140480e64a38SPhilippe Mathieu-Daudé             switch (df) {
140580e64a38SPhilippe Mathieu-Daudé             case DF_HALF:
140680e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_hsub_s_h(cpu_env, twd, tws, twt);
140780e64a38SPhilippe Mathieu-Daudé                 break;
140880e64a38SPhilippe Mathieu-Daudé             case DF_WORD:
140980e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_hsub_s_w(cpu_env, twd, tws, twt);
141080e64a38SPhilippe Mathieu-Daudé                 break;
141180e64a38SPhilippe Mathieu-Daudé             case DF_DOUBLE:
141280e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_hsub_s_d(cpu_env, twd, tws, twt);
141380e64a38SPhilippe Mathieu-Daudé                 break;
141480e64a38SPhilippe Mathieu-Daudé             }
141580e64a38SPhilippe Mathieu-Daudé             break;
141680e64a38SPhilippe Mathieu-Daudé         case OPC_HSUB_U_df:
141780e64a38SPhilippe Mathieu-Daudé             switch (df) {
141880e64a38SPhilippe Mathieu-Daudé             case DF_HALF:
141980e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_hsub_u_h(cpu_env, twd, tws, twt);
142080e64a38SPhilippe Mathieu-Daudé                 break;
142180e64a38SPhilippe Mathieu-Daudé             case DF_WORD:
142280e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_hsub_u_w(cpu_env, twd, tws, twt);
142380e64a38SPhilippe Mathieu-Daudé                 break;
142480e64a38SPhilippe Mathieu-Daudé             case DF_DOUBLE:
142580e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_hsub_u_d(cpu_env, twd, tws, twt);
142680e64a38SPhilippe Mathieu-Daudé                 break;
142780e64a38SPhilippe Mathieu-Daudé             }
142880e64a38SPhilippe Mathieu-Daudé             break;
142980e64a38SPhilippe Mathieu-Daudé         case OPC_DOTP_S_df:
143080e64a38SPhilippe Mathieu-Daudé             switch (df) {
143180e64a38SPhilippe Mathieu-Daudé             case DF_HALF:
143280e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_dotp_s_h(cpu_env, twd, tws, twt);
143380e64a38SPhilippe Mathieu-Daudé                 break;
143480e64a38SPhilippe Mathieu-Daudé             case DF_WORD:
143580e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_dotp_s_w(cpu_env, twd, tws, twt);
143680e64a38SPhilippe Mathieu-Daudé                 break;
143780e64a38SPhilippe Mathieu-Daudé             case DF_DOUBLE:
143880e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_dotp_s_d(cpu_env, twd, tws, twt);
143980e64a38SPhilippe Mathieu-Daudé                 break;
144080e64a38SPhilippe Mathieu-Daudé             }
144180e64a38SPhilippe Mathieu-Daudé             break;
144280e64a38SPhilippe Mathieu-Daudé         case OPC_DOTP_U_df:
144380e64a38SPhilippe Mathieu-Daudé             switch (df) {
144480e64a38SPhilippe Mathieu-Daudé             case DF_HALF:
144580e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_dotp_u_h(cpu_env, twd, tws, twt);
144680e64a38SPhilippe Mathieu-Daudé                 break;
144780e64a38SPhilippe Mathieu-Daudé             case DF_WORD:
144880e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_dotp_u_w(cpu_env, twd, tws, twt);
144980e64a38SPhilippe Mathieu-Daudé                 break;
145080e64a38SPhilippe Mathieu-Daudé             case DF_DOUBLE:
145180e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_dotp_u_d(cpu_env, twd, tws, twt);
145280e64a38SPhilippe Mathieu-Daudé                 break;
145380e64a38SPhilippe Mathieu-Daudé             }
145480e64a38SPhilippe Mathieu-Daudé             break;
145580e64a38SPhilippe Mathieu-Daudé         case OPC_DPADD_S_df:
145680e64a38SPhilippe Mathieu-Daudé             switch (df) {
145780e64a38SPhilippe Mathieu-Daudé             case DF_HALF:
145880e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_dpadd_s_h(cpu_env, twd, tws, twt);
145980e64a38SPhilippe Mathieu-Daudé                 break;
146080e64a38SPhilippe Mathieu-Daudé             case DF_WORD:
146180e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_dpadd_s_w(cpu_env, twd, tws, twt);
146280e64a38SPhilippe Mathieu-Daudé                 break;
146380e64a38SPhilippe Mathieu-Daudé             case DF_DOUBLE:
146480e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_dpadd_s_d(cpu_env, twd, tws, twt);
146580e64a38SPhilippe Mathieu-Daudé                 break;
146680e64a38SPhilippe Mathieu-Daudé             }
146780e64a38SPhilippe Mathieu-Daudé             break;
146880e64a38SPhilippe Mathieu-Daudé         case OPC_DPADD_U_df:
146980e64a38SPhilippe Mathieu-Daudé             switch (df) {
147080e64a38SPhilippe Mathieu-Daudé             case DF_HALF:
147180e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_dpadd_u_h(cpu_env, twd, tws, twt);
147280e64a38SPhilippe Mathieu-Daudé                 break;
147380e64a38SPhilippe Mathieu-Daudé             case DF_WORD:
147480e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_dpadd_u_w(cpu_env, twd, tws, twt);
147580e64a38SPhilippe Mathieu-Daudé                 break;
147680e64a38SPhilippe Mathieu-Daudé             case DF_DOUBLE:
147780e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_dpadd_u_d(cpu_env, twd, tws, twt);
147880e64a38SPhilippe Mathieu-Daudé                 break;
147980e64a38SPhilippe Mathieu-Daudé             }
148080e64a38SPhilippe Mathieu-Daudé             break;
148180e64a38SPhilippe Mathieu-Daudé         case OPC_DPSUB_S_df:
148280e64a38SPhilippe Mathieu-Daudé             switch (df) {
148380e64a38SPhilippe Mathieu-Daudé             case DF_HALF:
148480e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_dpsub_s_h(cpu_env, twd, tws, twt);
148580e64a38SPhilippe Mathieu-Daudé                 break;
148680e64a38SPhilippe Mathieu-Daudé             case DF_WORD:
148780e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_dpsub_s_w(cpu_env, twd, tws, twt);
148880e64a38SPhilippe Mathieu-Daudé                 break;
148980e64a38SPhilippe Mathieu-Daudé             case DF_DOUBLE:
149080e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_dpsub_s_d(cpu_env, twd, tws, twt);
149180e64a38SPhilippe Mathieu-Daudé                 break;
149280e64a38SPhilippe Mathieu-Daudé             }
149380e64a38SPhilippe Mathieu-Daudé             break;
149480e64a38SPhilippe Mathieu-Daudé         case OPC_DPSUB_U_df:
149580e64a38SPhilippe Mathieu-Daudé             switch (df) {
149680e64a38SPhilippe Mathieu-Daudé             case DF_HALF:
149780e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_dpsub_u_h(cpu_env, twd, tws, twt);
149880e64a38SPhilippe Mathieu-Daudé                 break;
149980e64a38SPhilippe Mathieu-Daudé             case DF_WORD:
150080e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_dpsub_u_w(cpu_env, twd, tws, twt);
150180e64a38SPhilippe Mathieu-Daudé                 break;
150280e64a38SPhilippe Mathieu-Daudé             case DF_DOUBLE:
150380e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_dpsub_u_d(cpu_env, twd, tws, twt);
150480e64a38SPhilippe Mathieu-Daudé                 break;
150580e64a38SPhilippe Mathieu-Daudé             }
150680e64a38SPhilippe Mathieu-Daudé             break;
150780e64a38SPhilippe Mathieu-Daudé         }
150880e64a38SPhilippe Mathieu-Daudé         break;
150980e64a38SPhilippe Mathieu-Daudé     default:
151080e64a38SPhilippe Mathieu-Daudé         MIPS_INVAL("MSA instruction");
151180e64a38SPhilippe Mathieu-Daudé         gen_reserved_instruction(ctx);
151280e64a38SPhilippe Mathieu-Daudé         break;
151380e64a38SPhilippe Mathieu-Daudé     }
151480e64a38SPhilippe Mathieu-Daudé     tcg_temp_free_i32(twd);
151580e64a38SPhilippe Mathieu-Daudé     tcg_temp_free_i32(tws);
151680e64a38SPhilippe Mathieu-Daudé     tcg_temp_free_i32(twt);
151780e64a38SPhilippe Mathieu-Daudé     tcg_temp_free_i32(tdf);
151880e64a38SPhilippe Mathieu-Daudé }
151980e64a38SPhilippe Mathieu-Daudé 
152080e64a38SPhilippe Mathieu-Daudé static void gen_msa_elm_3e(DisasContext *ctx)
152180e64a38SPhilippe Mathieu-Daudé {
152280e64a38SPhilippe Mathieu-Daudé #define MASK_MSA_ELM_DF3E(op)   (MASK_MSA_MINOR(op) | (op & (0x3FF << 16)))
152380e64a38SPhilippe Mathieu-Daudé     uint8_t source = (ctx->opcode >> 11) & 0x1f;
152480e64a38SPhilippe Mathieu-Daudé     uint8_t dest = (ctx->opcode >> 6) & 0x1f;
152580e64a38SPhilippe Mathieu-Daudé     TCGv telm = tcg_temp_new();
152680e64a38SPhilippe Mathieu-Daudé     TCGv_i32 tsr = tcg_const_i32(source);
152780e64a38SPhilippe Mathieu-Daudé     TCGv_i32 tdt = tcg_const_i32(dest);
152880e64a38SPhilippe Mathieu-Daudé 
152980e64a38SPhilippe Mathieu-Daudé     switch (MASK_MSA_ELM_DF3E(ctx->opcode)) {
153080e64a38SPhilippe Mathieu-Daudé     case OPC_CTCMSA:
153180e64a38SPhilippe Mathieu-Daudé         gen_load_gpr(telm, source);
153280e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_ctcmsa(cpu_env, telm, tdt);
153380e64a38SPhilippe Mathieu-Daudé         break;
153480e64a38SPhilippe Mathieu-Daudé     case OPC_CFCMSA:
153580e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_cfcmsa(telm, cpu_env, tsr);
153680e64a38SPhilippe Mathieu-Daudé         gen_store_gpr(telm, dest);
153780e64a38SPhilippe Mathieu-Daudé         break;
153880e64a38SPhilippe Mathieu-Daudé     case OPC_MOVE_V:
153980e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_move_v(cpu_env, tdt, tsr);
154080e64a38SPhilippe Mathieu-Daudé         break;
154180e64a38SPhilippe Mathieu-Daudé     default:
154280e64a38SPhilippe Mathieu-Daudé         MIPS_INVAL("MSA instruction");
154380e64a38SPhilippe Mathieu-Daudé         gen_reserved_instruction(ctx);
154480e64a38SPhilippe Mathieu-Daudé         break;
154580e64a38SPhilippe Mathieu-Daudé     }
154680e64a38SPhilippe Mathieu-Daudé 
154780e64a38SPhilippe Mathieu-Daudé     tcg_temp_free(telm);
154880e64a38SPhilippe Mathieu-Daudé     tcg_temp_free_i32(tdt);
154980e64a38SPhilippe Mathieu-Daudé     tcg_temp_free_i32(tsr);
155080e64a38SPhilippe Mathieu-Daudé }
155180e64a38SPhilippe Mathieu-Daudé 
155280e64a38SPhilippe Mathieu-Daudé static void gen_msa_elm_df(DisasContext *ctx, uint32_t df, uint32_t n)
155380e64a38SPhilippe Mathieu-Daudé {
155480e64a38SPhilippe Mathieu-Daudé #define MASK_MSA_ELM(op)    (MASK_MSA_MINOR(op) | (op & (0xf << 22)))
155580e64a38SPhilippe Mathieu-Daudé     uint8_t ws = (ctx->opcode >> 11) & 0x1f;
155680e64a38SPhilippe Mathieu-Daudé     uint8_t wd = (ctx->opcode >> 6) & 0x1f;
155780e64a38SPhilippe Mathieu-Daudé 
155880e64a38SPhilippe Mathieu-Daudé     TCGv_i32 tws = tcg_const_i32(ws);
155980e64a38SPhilippe Mathieu-Daudé     TCGv_i32 twd = tcg_const_i32(wd);
156080e64a38SPhilippe Mathieu-Daudé     TCGv_i32 tn  = tcg_const_i32(n);
15612b537a3dSPhilippe Mathieu-Daudé     TCGv_i32 tdf = tcg_constant_i32(df);
156280e64a38SPhilippe Mathieu-Daudé 
156380e64a38SPhilippe Mathieu-Daudé     switch (MASK_MSA_ELM(ctx->opcode)) {
156480e64a38SPhilippe Mathieu-Daudé     case OPC_SLDI_df:
156580e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_sldi_df(cpu_env, tdf, twd, tws, tn);
156680e64a38SPhilippe Mathieu-Daudé         break;
156780e64a38SPhilippe Mathieu-Daudé     case OPC_SPLATI_df:
156880e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_splati_df(cpu_env, tdf, twd, tws, tn);
156980e64a38SPhilippe Mathieu-Daudé         break;
157080e64a38SPhilippe Mathieu-Daudé     case OPC_INSVE_df:
157180e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_insve_df(cpu_env, tdf, twd, tws, tn);
157280e64a38SPhilippe Mathieu-Daudé         break;
157380e64a38SPhilippe Mathieu-Daudé     case OPC_COPY_S_df:
157480e64a38SPhilippe Mathieu-Daudé     case OPC_COPY_U_df:
157580e64a38SPhilippe Mathieu-Daudé     case OPC_INSERT_df:
157680e64a38SPhilippe Mathieu-Daudé #if !defined(TARGET_MIPS64)
157780e64a38SPhilippe Mathieu-Daudé         /* Double format valid only for MIPS64 */
157880e64a38SPhilippe Mathieu-Daudé         if (df == DF_DOUBLE) {
157980e64a38SPhilippe Mathieu-Daudé             gen_reserved_instruction(ctx);
158080e64a38SPhilippe Mathieu-Daudé             break;
158180e64a38SPhilippe Mathieu-Daudé         }
158280e64a38SPhilippe Mathieu-Daudé         if ((MASK_MSA_ELM(ctx->opcode) == OPC_COPY_U_df) &&
158380e64a38SPhilippe Mathieu-Daudé               (df == DF_WORD)) {
158480e64a38SPhilippe Mathieu-Daudé             gen_reserved_instruction(ctx);
158580e64a38SPhilippe Mathieu-Daudé             break;
158680e64a38SPhilippe Mathieu-Daudé         }
158780e64a38SPhilippe Mathieu-Daudé #endif
158880e64a38SPhilippe Mathieu-Daudé         switch (MASK_MSA_ELM(ctx->opcode)) {
158980e64a38SPhilippe Mathieu-Daudé         case OPC_COPY_S_df:
159080e64a38SPhilippe Mathieu-Daudé             if (likely(wd != 0)) {
159180e64a38SPhilippe Mathieu-Daudé                 switch (df) {
159280e64a38SPhilippe Mathieu-Daudé                 case DF_BYTE:
159380e64a38SPhilippe Mathieu-Daudé                     gen_helper_msa_copy_s_b(cpu_env, twd, tws, tn);
159480e64a38SPhilippe Mathieu-Daudé                     break;
159580e64a38SPhilippe Mathieu-Daudé                 case DF_HALF:
159680e64a38SPhilippe Mathieu-Daudé                     gen_helper_msa_copy_s_h(cpu_env, twd, tws, tn);
159780e64a38SPhilippe Mathieu-Daudé                     break;
159880e64a38SPhilippe Mathieu-Daudé                 case DF_WORD:
159980e64a38SPhilippe Mathieu-Daudé                     gen_helper_msa_copy_s_w(cpu_env, twd, tws, tn);
160080e64a38SPhilippe Mathieu-Daudé                     break;
160180e64a38SPhilippe Mathieu-Daudé #if defined(TARGET_MIPS64)
160280e64a38SPhilippe Mathieu-Daudé                 case DF_DOUBLE:
160380e64a38SPhilippe Mathieu-Daudé                     gen_helper_msa_copy_s_d(cpu_env, twd, tws, tn);
160480e64a38SPhilippe Mathieu-Daudé                     break;
160580e64a38SPhilippe Mathieu-Daudé #endif
160680e64a38SPhilippe Mathieu-Daudé                 default:
160780e64a38SPhilippe Mathieu-Daudé                     assert(0);
160880e64a38SPhilippe Mathieu-Daudé                 }
160980e64a38SPhilippe Mathieu-Daudé             }
161080e64a38SPhilippe Mathieu-Daudé             break;
161180e64a38SPhilippe Mathieu-Daudé         case OPC_COPY_U_df:
161280e64a38SPhilippe Mathieu-Daudé             if (likely(wd != 0)) {
161380e64a38SPhilippe Mathieu-Daudé                 switch (df) {
161480e64a38SPhilippe Mathieu-Daudé                 case DF_BYTE:
161580e64a38SPhilippe Mathieu-Daudé                     gen_helper_msa_copy_u_b(cpu_env, twd, tws, tn);
161680e64a38SPhilippe Mathieu-Daudé                     break;
161780e64a38SPhilippe Mathieu-Daudé                 case DF_HALF:
161880e64a38SPhilippe Mathieu-Daudé                     gen_helper_msa_copy_u_h(cpu_env, twd, tws, tn);
161980e64a38SPhilippe Mathieu-Daudé                     break;
162080e64a38SPhilippe Mathieu-Daudé #if defined(TARGET_MIPS64)
162180e64a38SPhilippe Mathieu-Daudé                 case DF_WORD:
162280e64a38SPhilippe Mathieu-Daudé                     gen_helper_msa_copy_u_w(cpu_env, twd, tws, tn);
162380e64a38SPhilippe Mathieu-Daudé                     break;
162480e64a38SPhilippe Mathieu-Daudé #endif
162580e64a38SPhilippe Mathieu-Daudé                 default:
162680e64a38SPhilippe Mathieu-Daudé                     assert(0);
162780e64a38SPhilippe Mathieu-Daudé                 }
162880e64a38SPhilippe Mathieu-Daudé             }
162980e64a38SPhilippe Mathieu-Daudé             break;
163080e64a38SPhilippe Mathieu-Daudé         case OPC_INSERT_df:
163180e64a38SPhilippe Mathieu-Daudé             switch (df) {
163280e64a38SPhilippe Mathieu-Daudé             case DF_BYTE:
163380e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_insert_b(cpu_env, twd, tws, tn);
163480e64a38SPhilippe Mathieu-Daudé                 break;
163580e64a38SPhilippe Mathieu-Daudé             case DF_HALF:
163680e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_insert_h(cpu_env, twd, tws, tn);
163780e64a38SPhilippe Mathieu-Daudé                 break;
163880e64a38SPhilippe Mathieu-Daudé             case DF_WORD:
163980e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_insert_w(cpu_env, twd, tws, tn);
164080e64a38SPhilippe Mathieu-Daudé                 break;
164180e64a38SPhilippe Mathieu-Daudé #if defined(TARGET_MIPS64)
164280e64a38SPhilippe Mathieu-Daudé             case DF_DOUBLE:
164380e64a38SPhilippe Mathieu-Daudé                 gen_helper_msa_insert_d(cpu_env, twd, tws, tn);
164480e64a38SPhilippe Mathieu-Daudé                 break;
164580e64a38SPhilippe Mathieu-Daudé #endif
164680e64a38SPhilippe Mathieu-Daudé             default:
164780e64a38SPhilippe Mathieu-Daudé                 assert(0);
164880e64a38SPhilippe Mathieu-Daudé             }
164980e64a38SPhilippe Mathieu-Daudé             break;
165080e64a38SPhilippe Mathieu-Daudé         }
165180e64a38SPhilippe Mathieu-Daudé         break;
165280e64a38SPhilippe Mathieu-Daudé     default:
165380e64a38SPhilippe Mathieu-Daudé         MIPS_INVAL("MSA instruction");
165480e64a38SPhilippe Mathieu-Daudé         gen_reserved_instruction(ctx);
165580e64a38SPhilippe Mathieu-Daudé     }
165680e64a38SPhilippe Mathieu-Daudé     tcg_temp_free_i32(twd);
165780e64a38SPhilippe Mathieu-Daudé     tcg_temp_free_i32(tws);
165880e64a38SPhilippe Mathieu-Daudé     tcg_temp_free_i32(tn);
165980e64a38SPhilippe Mathieu-Daudé }
166080e64a38SPhilippe Mathieu-Daudé 
166180e64a38SPhilippe Mathieu-Daudé static void gen_msa_elm(DisasContext *ctx)
166280e64a38SPhilippe Mathieu-Daudé {
166380e64a38SPhilippe Mathieu-Daudé     uint8_t dfn = (ctx->opcode >> 16) & 0x3f;
166480e64a38SPhilippe Mathieu-Daudé     uint32_t df = 0, n = 0;
166580e64a38SPhilippe Mathieu-Daudé 
166680e64a38SPhilippe Mathieu-Daudé     if ((dfn & 0x30) == 0x00) {
166780e64a38SPhilippe Mathieu-Daudé         n = dfn & 0x0f;
166880e64a38SPhilippe Mathieu-Daudé         df = DF_BYTE;
166980e64a38SPhilippe Mathieu-Daudé     } else if ((dfn & 0x38) == 0x20) {
167080e64a38SPhilippe Mathieu-Daudé         n = dfn & 0x07;
167180e64a38SPhilippe Mathieu-Daudé         df = DF_HALF;
167280e64a38SPhilippe Mathieu-Daudé     } else if ((dfn & 0x3c) == 0x30) {
167380e64a38SPhilippe Mathieu-Daudé         n = dfn & 0x03;
167480e64a38SPhilippe Mathieu-Daudé         df = DF_WORD;
167580e64a38SPhilippe Mathieu-Daudé     } else if ((dfn & 0x3e) == 0x38) {
167680e64a38SPhilippe Mathieu-Daudé         n = dfn & 0x01;
167780e64a38SPhilippe Mathieu-Daudé         df = DF_DOUBLE;
167880e64a38SPhilippe Mathieu-Daudé     } else if (dfn == 0x3E) {
167980e64a38SPhilippe Mathieu-Daudé         /* CTCMSA, CFCMSA, MOVE.V */
168080e64a38SPhilippe Mathieu-Daudé         gen_msa_elm_3e(ctx);
168180e64a38SPhilippe Mathieu-Daudé         return;
168280e64a38SPhilippe Mathieu-Daudé     } else {
168380e64a38SPhilippe Mathieu-Daudé         gen_reserved_instruction(ctx);
168480e64a38SPhilippe Mathieu-Daudé         return;
168580e64a38SPhilippe Mathieu-Daudé     }
168680e64a38SPhilippe Mathieu-Daudé 
168780e64a38SPhilippe Mathieu-Daudé     gen_msa_elm_df(ctx, df, n);
168880e64a38SPhilippe Mathieu-Daudé }
168980e64a38SPhilippe Mathieu-Daudé 
169080e64a38SPhilippe Mathieu-Daudé static void gen_msa_3rf(DisasContext *ctx)
169180e64a38SPhilippe Mathieu-Daudé {
169280e64a38SPhilippe Mathieu-Daudé #define MASK_MSA_3RF(op)    (MASK_MSA_MINOR(op) | (op & (0xf << 22)))
169380e64a38SPhilippe Mathieu-Daudé     uint8_t df = (ctx->opcode >> 21) & 0x1;
169480e64a38SPhilippe Mathieu-Daudé     uint8_t wt = (ctx->opcode >> 16) & 0x1f;
169580e64a38SPhilippe Mathieu-Daudé     uint8_t ws = (ctx->opcode >> 11) & 0x1f;
169680e64a38SPhilippe Mathieu-Daudé     uint8_t wd = (ctx->opcode >> 6) & 0x1f;
169780e64a38SPhilippe Mathieu-Daudé 
169880e64a38SPhilippe Mathieu-Daudé     TCGv_i32 twd = tcg_const_i32(wd);
169980e64a38SPhilippe Mathieu-Daudé     TCGv_i32 tws = tcg_const_i32(ws);
170080e64a38SPhilippe Mathieu-Daudé     TCGv_i32 twt = tcg_const_i32(wt);
17011b5c0a11SPhilippe Mathieu-Daudé     TCGv_i32 tdf;
170280e64a38SPhilippe Mathieu-Daudé 
170380e64a38SPhilippe Mathieu-Daudé     /* adjust df value for floating-point instruction */
17041b5c0a11SPhilippe Mathieu-Daudé     switch (MASK_MSA_3RF(ctx->opcode)) {
17051b5c0a11SPhilippe Mathieu-Daudé     case OPC_MUL_Q_df:
17061b5c0a11SPhilippe Mathieu-Daudé     case OPC_MADD_Q_df:
17071b5c0a11SPhilippe Mathieu-Daudé     case OPC_MSUB_Q_df:
17081b5c0a11SPhilippe Mathieu-Daudé     case OPC_MULR_Q_df:
17091b5c0a11SPhilippe Mathieu-Daudé     case OPC_MADDR_Q_df:
17101b5c0a11SPhilippe Mathieu-Daudé     case OPC_MSUBR_Q_df:
17117e9db46dSPhilippe Mathieu-Daudé         tdf = tcg_constant_i32(DF_HALF + df);
17121b5c0a11SPhilippe Mathieu-Daudé         break;
17131b5c0a11SPhilippe Mathieu-Daudé     default:
17147e9db46dSPhilippe Mathieu-Daudé         tdf = tcg_constant_i32(DF_WORD + df);
17151b5c0a11SPhilippe Mathieu-Daudé         break;
17161b5c0a11SPhilippe Mathieu-Daudé     }
171780e64a38SPhilippe Mathieu-Daudé 
171880e64a38SPhilippe Mathieu-Daudé     switch (MASK_MSA_3RF(ctx->opcode)) {
171980e64a38SPhilippe Mathieu-Daudé     case OPC_FCAF_df:
172080e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fcaf_df(cpu_env, tdf, twd, tws, twt);
172180e64a38SPhilippe Mathieu-Daudé         break;
172280e64a38SPhilippe Mathieu-Daudé     case OPC_FADD_df:
172380e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fadd_df(cpu_env, tdf, twd, tws, twt);
172480e64a38SPhilippe Mathieu-Daudé         break;
172580e64a38SPhilippe Mathieu-Daudé     case OPC_FCUN_df:
172680e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fcun_df(cpu_env, tdf, twd, tws, twt);
172780e64a38SPhilippe Mathieu-Daudé         break;
172880e64a38SPhilippe Mathieu-Daudé     case OPC_FSUB_df:
172980e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fsub_df(cpu_env, tdf, twd, tws, twt);
173080e64a38SPhilippe Mathieu-Daudé         break;
173180e64a38SPhilippe Mathieu-Daudé     case OPC_FCOR_df:
173280e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fcor_df(cpu_env, tdf, twd, tws, twt);
173380e64a38SPhilippe Mathieu-Daudé         break;
173480e64a38SPhilippe Mathieu-Daudé     case OPC_FCEQ_df:
173580e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fceq_df(cpu_env, tdf, twd, tws, twt);
173680e64a38SPhilippe Mathieu-Daudé         break;
173780e64a38SPhilippe Mathieu-Daudé     case OPC_FMUL_df:
173880e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fmul_df(cpu_env, tdf, twd, tws, twt);
173980e64a38SPhilippe Mathieu-Daudé         break;
174080e64a38SPhilippe Mathieu-Daudé     case OPC_FCUNE_df:
174180e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fcune_df(cpu_env, tdf, twd, tws, twt);
174280e64a38SPhilippe Mathieu-Daudé         break;
174380e64a38SPhilippe Mathieu-Daudé     case OPC_FCUEQ_df:
174480e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fcueq_df(cpu_env, tdf, twd, tws, twt);
174580e64a38SPhilippe Mathieu-Daudé         break;
174680e64a38SPhilippe Mathieu-Daudé     case OPC_FDIV_df:
174780e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fdiv_df(cpu_env, tdf, twd, tws, twt);
174880e64a38SPhilippe Mathieu-Daudé         break;
174980e64a38SPhilippe Mathieu-Daudé     case OPC_FCNE_df:
175080e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fcne_df(cpu_env, tdf, twd, tws, twt);
175180e64a38SPhilippe Mathieu-Daudé         break;
175280e64a38SPhilippe Mathieu-Daudé     case OPC_FCLT_df:
175380e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fclt_df(cpu_env, tdf, twd, tws, twt);
175480e64a38SPhilippe Mathieu-Daudé         break;
175580e64a38SPhilippe Mathieu-Daudé     case OPC_FMADD_df:
175680e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fmadd_df(cpu_env, tdf, twd, tws, twt);
175780e64a38SPhilippe Mathieu-Daudé         break;
175880e64a38SPhilippe Mathieu-Daudé     case OPC_MUL_Q_df:
175980e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_mul_q_df(cpu_env, tdf, twd, tws, twt);
176080e64a38SPhilippe Mathieu-Daudé         break;
176180e64a38SPhilippe Mathieu-Daudé     case OPC_FCULT_df:
176280e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fcult_df(cpu_env, tdf, twd, tws, twt);
176380e64a38SPhilippe Mathieu-Daudé         break;
176480e64a38SPhilippe Mathieu-Daudé     case OPC_FMSUB_df:
176580e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fmsub_df(cpu_env, tdf, twd, tws, twt);
176680e64a38SPhilippe Mathieu-Daudé         break;
176780e64a38SPhilippe Mathieu-Daudé     case OPC_MADD_Q_df:
176880e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_madd_q_df(cpu_env, tdf, twd, tws, twt);
176980e64a38SPhilippe Mathieu-Daudé         break;
177080e64a38SPhilippe Mathieu-Daudé     case OPC_FCLE_df:
177180e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fcle_df(cpu_env, tdf, twd, tws, twt);
177280e64a38SPhilippe Mathieu-Daudé         break;
177380e64a38SPhilippe Mathieu-Daudé     case OPC_MSUB_Q_df:
177480e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_msub_q_df(cpu_env, tdf, twd, tws, twt);
177580e64a38SPhilippe Mathieu-Daudé         break;
177680e64a38SPhilippe Mathieu-Daudé     case OPC_FCULE_df:
177780e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fcule_df(cpu_env, tdf, twd, tws, twt);
177880e64a38SPhilippe Mathieu-Daudé         break;
177980e64a38SPhilippe Mathieu-Daudé     case OPC_FEXP2_df:
178080e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fexp2_df(cpu_env, tdf, twd, tws, twt);
178180e64a38SPhilippe Mathieu-Daudé         break;
178280e64a38SPhilippe Mathieu-Daudé     case OPC_FSAF_df:
178380e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fsaf_df(cpu_env, tdf, twd, tws, twt);
178480e64a38SPhilippe Mathieu-Daudé         break;
178580e64a38SPhilippe Mathieu-Daudé     case OPC_FEXDO_df:
178680e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fexdo_df(cpu_env, tdf, twd, tws, twt);
178780e64a38SPhilippe Mathieu-Daudé         break;
178880e64a38SPhilippe Mathieu-Daudé     case OPC_FSUN_df:
178980e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fsun_df(cpu_env, tdf, twd, tws, twt);
179080e64a38SPhilippe Mathieu-Daudé         break;
179180e64a38SPhilippe Mathieu-Daudé     case OPC_FSOR_df:
179280e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fsor_df(cpu_env, tdf, twd, tws, twt);
179380e64a38SPhilippe Mathieu-Daudé         break;
179480e64a38SPhilippe Mathieu-Daudé     case OPC_FSEQ_df:
179580e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fseq_df(cpu_env, tdf, twd, tws, twt);
179680e64a38SPhilippe Mathieu-Daudé         break;
179780e64a38SPhilippe Mathieu-Daudé     case OPC_FTQ_df:
179880e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_ftq_df(cpu_env, tdf, twd, tws, twt);
179980e64a38SPhilippe Mathieu-Daudé         break;
180080e64a38SPhilippe Mathieu-Daudé     case OPC_FSUNE_df:
180180e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fsune_df(cpu_env, tdf, twd, tws, twt);
180280e64a38SPhilippe Mathieu-Daudé         break;
180380e64a38SPhilippe Mathieu-Daudé     case OPC_FSUEQ_df:
180480e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fsueq_df(cpu_env, tdf, twd, tws, twt);
180580e64a38SPhilippe Mathieu-Daudé         break;
180680e64a38SPhilippe Mathieu-Daudé     case OPC_FSNE_df:
180780e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fsne_df(cpu_env, tdf, twd, tws, twt);
180880e64a38SPhilippe Mathieu-Daudé         break;
180980e64a38SPhilippe Mathieu-Daudé     case OPC_FSLT_df:
181080e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fslt_df(cpu_env, tdf, twd, tws, twt);
181180e64a38SPhilippe Mathieu-Daudé         break;
181280e64a38SPhilippe Mathieu-Daudé     case OPC_FMIN_df:
181380e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fmin_df(cpu_env, tdf, twd, tws, twt);
181480e64a38SPhilippe Mathieu-Daudé         break;
181580e64a38SPhilippe Mathieu-Daudé     case OPC_MULR_Q_df:
181680e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_mulr_q_df(cpu_env, tdf, twd, tws, twt);
181780e64a38SPhilippe Mathieu-Daudé         break;
181880e64a38SPhilippe Mathieu-Daudé     case OPC_FSULT_df:
181980e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fsult_df(cpu_env, tdf, twd, tws, twt);
182080e64a38SPhilippe Mathieu-Daudé         break;
182180e64a38SPhilippe Mathieu-Daudé     case OPC_FMIN_A_df:
182280e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fmin_a_df(cpu_env, tdf, twd, tws, twt);
182380e64a38SPhilippe Mathieu-Daudé         break;
182480e64a38SPhilippe Mathieu-Daudé     case OPC_MADDR_Q_df:
182580e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_maddr_q_df(cpu_env, tdf, twd, tws, twt);
182680e64a38SPhilippe Mathieu-Daudé         break;
182780e64a38SPhilippe Mathieu-Daudé     case OPC_FSLE_df:
182880e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fsle_df(cpu_env, tdf, twd, tws, twt);
182980e64a38SPhilippe Mathieu-Daudé         break;
183080e64a38SPhilippe Mathieu-Daudé     case OPC_FMAX_df:
183180e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fmax_df(cpu_env, tdf, twd, tws, twt);
183280e64a38SPhilippe Mathieu-Daudé         break;
183380e64a38SPhilippe Mathieu-Daudé     case OPC_MSUBR_Q_df:
183480e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_msubr_q_df(cpu_env, tdf, twd, tws, twt);
183580e64a38SPhilippe Mathieu-Daudé         break;
183680e64a38SPhilippe Mathieu-Daudé     case OPC_FSULE_df:
183780e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fsule_df(cpu_env, tdf, twd, tws, twt);
183880e64a38SPhilippe Mathieu-Daudé         break;
183980e64a38SPhilippe Mathieu-Daudé     case OPC_FMAX_A_df:
184080e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fmax_a_df(cpu_env, tdf, twd, tws, twt);
184180e64a38SPhilippe Mathieu-Daudé         break;
184280e64a38SPhilippe Mathieu-Daudé     default:
184380e64a38SPhilippe Mathieu-Daudé         MIPS_INVAL("MSA instruction");
184480e64a38SPhilippe Mathieu-Daudé         gen_reserved_instruction(ctx);
184580e64a38SPhilippe Mathieu-Daudé         break;
184680e64a38SPhilippe Mathieu-Daudé     }
184780e64a38SPhilippe Mathieu-Daudé 
184880e64a38SPhilippe Mathieu-Daudé     tcg_temp_free_i32(twd);
184980e64a38SPhilippe Mathieu-Daudé     tcg_temp_free_i32(tws);
185080e64a38SPhilippe Mathieu-Daudé     tcg_temp_free_i32(twt);
185180e64a38SPhilippe Mathieu-Daudé }
185280e64a38SPhilippe Mathieu-Daudé 
185380e64a38SPhilippe Mathieu-Daudé static void gen_msa_2r(DisasContext *ctx)
185480e64a38SPhilippe Mathieu-Daudé {
185580e64a38SPhilippe Mathieu-Daudé #define MASK_MSA_2R(op)     (MASK_MSA_MINOR(op) | (op & (0x1f << 21)) | \
185680e64a38SPhilippe Mathieu-Daudé                             (op & (0x7 << 18)))
185780e64a38SPhilippe Mathieu-Daudé     uint8_t ws = (ctx->opcode >> 11) & 0x1f;
185880e64a38SPhilippe Mathieu-Daudé     uint8_t wd = (ctx->opcode >> 6) & 0x1f;
185980e64a38SPhilippe Mathieu-Daudé     uint8_t df = (ctx->opcode >> 16) & 0x3;
186080e64a38SPhilippe Mathieu-Daudé     TCGv_i32 twd = tcg_const_i32(wd);
186180e64a38SPhilippe Mathieu-Daudé     TCGv_i32 tws = tcg_const_i32(ws);
186280e64a38SPhilippe Mathieu-Daudé 
186380e64a38SPhilippe Mathieu-Daudé     switch (MASK_MSA_2R(ctx->opcode)) {
186480e64a38SPhilippe Mathieu-Daudé     case OPC_FILL_df:
186580e64a38SPhilippe Mathieu-Daudé #if !defined(TARGET_MIPS64)
186680e64a38SPhilippe Mathieu-Daudé         /* Double format valid only for MIPS64 */
186780e64a38SPhilippe Mathieu-Daudé         if (df == DF_DOUBLE) {
186880e64a38SPhilippe Mathieu-Daudé             gen_reserved_instruction(ctx);
186980e64a38SPhilippe Mathieu-Daudé             break;
187080e64a38SPhilippe Mathieu-Daudé         }
187180e64a38SPhilippe Mathieu-Daudé #endif
187274341af7SPhilippe Mathieu-Daudé         gen_helper_msa_fill_df(cpu_env, tcg_constant_i32(df),
187374341af7SPhilippe Mathieu-Daudé                                twd, tws); /* trs */
187480e64a38SPhilippe Mathieu-Daudé         break;
187580e64a38SPhilippe Mathieu-Daudé     case OPC_NLOC_df:
187680e64a38SPhilippe Mathieu-Daudé         switch (df) {
187780e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
187880e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_nloc_b(cpu_env, twd, tws);
187980e64a38SPhilippe Mathieu-Daudé             break;
188080e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
188180e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_nloc_h(cpu_env, twd, tws);
188280e64a38SPhilippe Mathieu-Daudé             break;
188380e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
188480e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_nloc_w(cpu_env, twd, tws);
188580e64a38SPhilippe Mathieu-Daudé             break;
188680e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
188780e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_nloc_d(cpu_env, twd, tws);
188880e64a38SPhilippe Mathieu-Daudé             break;
188980e64a38SPhilippe Mathieu-Daudé         }
189080e64a38SPhilippe Mathieu-Daudé         break;
189180e64a38SPhilippe Mathieu-Daudé     case OPC_NLZC_df:
189280e64a38SPhilippe Mathieu-Daudé         switch (df) {
189380e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
189480e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_nlzc_b(cpu_env, twd, tws);
189580e64a38SPhilippe Mathieu-Daudé             break;
189680e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
189780e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_nlzc_h(cpu_env, twd, tws);
189880e64a38SPhilippe Mathieu-Daudé             break;
189980e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
190080e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_nlzc_w(cpu_env, twd, tws);
190180e64a38SPhilippe Mathieu-Daudé             break;
190280e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
190380e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_nlzc_d(cpu_env, twd, tws);
190480e64a38SPhilippe Mathieu-Daudé             break;
190580e64a38SPhilippe Mathieu-Daudé         }
190680e64a38SPhilippe Mathieu-Daudé         break;
190780e64a38SPhilippe Mathieu-Daudé     case OPC_PCNT_df:
190880e64a38SPhilippe Mathieu-Daudé         switch (df) {
190980e64a38SPhilippe Mathieu-Daudé         case DF_BYTE:
191080e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_pcnt_b(cpu_env, twd, tws);
191180e64a38SPhilippe Mathieu-Daudé             break;
191280e64a38SPhilippe Mathieu-Daudé         case DF_HALF:
191380e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_pcnt_h(cpu_env, twd, tws);
191480e64a38SPhilippe Mathieu-Daudé             break;
191580e64a38SPhilippe Mathieu-Daudé         case DF_WORD:
191680e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_pcnt_w(cpu_env, twd, tws);
191780e64a38SPhilippe Mathieu-Daudé             break;
191880e64a38SPhilippe Mathieu-Daudé         case DF_DOUBLE:
191980e64a38SPhilippe Mathieu-Daudé             gen_helper_msa_pcnt_d(cpu_env, twd, tws);
192080e64a38SPhilippe Mathieu-Daudé             break;
192180e64a38SPhilippe Mathieu-Daudé         }
192280e64a38SPhilippe Mathieu-Daudé         break;
192380e64a38SPhilippe Mathieu-Daudé     default:
192480e64a38SPhilippe Mathieu-Daudé         MIPS_INVAL("MSA instruction");
192580e64a38SPhilippe Mathieu-Daudé         gen_reserved_instruction(ctx);
192680e64a38SPhilippe Mathieu-Daudé         break;
192780e64a38SPhilippe Mathieu-Daudé     }
192880e64a38SPhilippe Mathieu-Daudé 
192980e64a38SPhilippe Mathieu-Daudé     tcg_temp_free_i32(twd);
193080e64a38SPhilippe Mathieu-Daudé     tcg_temp_free_i32(tws);
193180e64a38SPhilippe Mathieu-Daudé }
193280e64a38SPhilippe Mathieu-Daudé 
193380e64a38SPhilippe Mathieu-Daudé static void gen_msa_2rf(DisasContext *ctx)
193480e64a38SPhilippe Mathieu-Daudé {
193580e64a38SPhilippe Mathieu-Daudé #define MASK_MSA_2RF(op)    (MASK_MSA_MINOR(op) | (op & (0x1f << 21)) | \
193680e64a38SPhilippe Mathieu-Daudé                             (op & (0xf << 17)))
193780e64a38SPhilippe Mathieu-Daudé     uint8_t ws = (ctx->opcode >> 11) & 0x1f;
193880e64a38SPhilippe Mathieu-Daudé     uint8_t wd = (ctx->opcode >> 6) & 0x1f;
193980e64a38SPhilippe Mathieu-Daudé     uint8_t df = (ctx->opcode >> 16) & 0x1;
194080e64a38SPhilippe Mathieu-Daudé     TCGv_i32 twd = tcg_const_i32(wd);
194180e64a38SPhilippe Mathieu-Daudé     TCGv_i32 tws = tcg_const_i32(ws);
194280e64a38SPhilippe Mathieu-Daudé     /* adjust df value for floating-point instruction */
19437e9db46dSPhilippe Mathieu-Daudé     TCGv_i32 tdf = tcg_constant_i32(DF_WORD + df);
194480e64a38SPhilippe Mathieu-Daudé 
194580e64a38SPhilippe Mathieu-Daudé     switch (MASK_MSA_2RF(ctx->opcode)) {
194680e64a38SPhilippe Mathieu-Daudé     case OPC_FCLASS_df:
194780e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fclass_df(cpu_env, tdf, twd, tws);
194880e64a38SPhilippe Mathieu-Daudé         break;
194980e64a38SPhilippe Mathieu-Daudé     case OPC_FTRUNC_S_df:
195080e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_ftrunc_s_df(cpu_env, tdf, twd, tws);
195180e64a38SPhilippe Mathieu-Daudé         break;
195280e64a38SPhilippe Mathieu-Daudé     case OPC_FTRUNC_U_df:
195380e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_ftrunc_u_df(cpu_env, tdf, twd, tws);
195480e64a38SPhilippe Mathieu-Daudé         break;
195580e64a38SPhilippe Mathieu-Daudé     case OPC_FSQRT_df:
195680e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fsqrt_df(cpu_env, tdf, twd, tws);
195780e64a38SPhilippe Mathieu-Daudé         break;
195880e64a38SPhilippe Mathieu-Daudé     case OPC_FRSQRT_df:
195980e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_frsqrt_df(cpu_env, tdf, twd, tws);
196080e64a38SPhilippe Mathieu-Daudé         break;
196180e64a38SPhilippe Mathieu-Daudé     case OPC_FRCP_df:
196280e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_frcp_df(cpu_env, tdf, twd, tws);
196380e64a38SPhilippe Mathieu-Daudé         break;
196480e64a38SPhilippe Mathieu-Daudé     case OPC_FRINT_df:
196580e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_frint_df(cpu_env, tdf, twd, tws);
196680e64a38SPhilippe Mathieu-Daudé         break;
196780e64a38SPhilippe Mathieu-Daudé     case OPC_FLOG2_df:
196880e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_flog2_df(cpu_env, tdf, twd, tws);
196980e64a38SPhilippe Mathieu-Daudé         break;
197080e64a38SPhilippe Mathieu-Daudé     case OPC_FEXUPL_df:
197180e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fexupl_df(cpu_env, tdf, twd, tws);
197280e64a38SPhilippe Mathieu-Daudé         break;
197380e64a38SPhilippe Mathieu-Daudé     case OPC_FEXUPR_df:
197480e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_fexupr_df(cpu_env, tdf, twd, tws);
197580e64a38SPhilippe Mathieu-Daudé         break;
197680e64a38SPhilippe Mathieu-Daudé     case OPC_FFQL_df:
197780e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_ffql_df(cpu_env, tdf, twd, tws);
197880e64a38SPhilippe Mathieu-Daudé         break;
197980e64a38SPhilippe Mathieu-Daudé     case OPC_FFQR_df:
198080e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_ffqr_df(cpu_env, tdf, twd, tws);
198180e64a38SPhilippe Mathieu-Daudé         break;
198280e64a38SPhilippe Mathieu-Daudé     case OPC_FTINT_S_df:
198380e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_ftint_s_df(cpu_env, tdf, twd, tws);
198480e64a38SPhilippe Mathieu-Daudé         break;
198580e64a38SPhilippe Mathieu-Daudé     case OPC_FTINT_U_df:
198680e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_ftint_u_df(cpu_env, tdf, twd, tws);
198780e64a38SPhilippe Mathieu-Daudé         break;
198880e64a38SPhilippe Mathieu-Daudé     case OPC_FFINT_S_df:
198980e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_ffint_s_df(cpu_env, tdf, twd, tws);
199080e64a38SPhilippe Mathieu-Daudé         break;
199180e64a38SPhilippe Mathieu-Daudé     case OPC_FFINT_U_df:
199280e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_ffint_u_df(cpu_env, tdf, twd, tws);
199380e64a38SPhilippe Mathieu-Daudé         break;
199480e64a38SPhilippe Mathieu-Daudé     }
199580e64a38SPhilippe Mathieu-Daudé 
199680e64a38SPhilippe Mathieu-Daudé     tcg_temp_free_i32(twd);
199780e64a38SPhilippe Mathieu-Daudé     tcg_temp_free_i32(tws);
199880e64a38SPhilippe Mathieu-Daudé }
199980e64a38SPhilippe Mathieu-Daudé 
200080e64a38SPhilippe Mathieu-Daudé static void gen_msa_vec_v(DisasContext *ctx)
200180e64a38SPhilippe Mathieu-Daudé {
200280e64a38SPhilippe Mathieu-Daudé #define MASK_MSA_VEC(op)    (MASK_MSA_MINOR(op) | (op & (0x1f << 21)))
200380e64a38SPhilippe Mathieu-Daudé     uint8_t wt = (ctx->opcode >> 16) & 0x1f;
200480e64a38SPhilippe Mathieu-Daudé     uint8_t ws = (ctx->opcode >> 11) & 0x1f;
200580e64a38SPhilippe Mathieu-Daudé     uint8_t wd = (ctx->opcode >> 6) & 0x1f;
200680e64a38SPhilippe Mathieu-Daudé     TCGv_i32 twd = tcg_const_i32(wd);
200780e64a38SPhilippe Mathieu-Daudé     TCGv_i32 tws = tcg_const_i32(ws);
200880e64a38SPhilippe Mathieu-Daudé     TCGv_i32 twt = tcg_const_i32(wt);
200980e64a38SPhilippe Mathieu-Daudé 
201080e64a38SPhilippe Mathieu-Daudé     switch (MASK_MSA_VEC(ctx->opcode)) {
201180e64a38SPhilippe Mathieu-Daudé     case OPC_AND_V:
201280e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_and_v(cpu_env, twd, tws, twt);
201380e64a38SPhilippe Mathieu-Daudé         break;
201480e64a38SPhilippe Mathieu-Daudé     case OPC_OR_V:
201580e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_or_v(cpu_env, twd, tws, twt);
201680e64a38SPhilippe Mathieu-Daudé         break;
201780e64a38SPhilippe Mathieu-Daudé     case OPC_NOR_V:
201880e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_nor_v(cpu_env, twd, tws, twt);
201980e64a38SPhilippe Mathieu-Daudé         break;
202080e64a38SPhilippe Mathieu-Daudé     case OPC_XOR_V:
202180e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_xor_v(cpu_env, twd, tws, twt);
202280e64a38SPhilippe Mathieu-Daudé         break;
202380e64a38SPhilippe Mathieu-Daudé     case OPC_BMNZ_V:
202480e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_bmnz_v(cpu_env, twd, tws, twt);
202580e64a38SPhilippe Mathieu-Daudé         break;
202680e64a38SPhilippe Mathieu-Daudé     case OPC_BMZ_V:
202780e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_bmz_v(cpu_env, twd, tws, twt);
202880e64a38SPhilippe Mathieu-Daudé         break;
202980e64a38SPhilippe Mathieu-Daudé     case OPC_BSEL_V:
203080e64a38SPhilippe Mathieu-Daudé         gen_helper_msa_bsel_v(cpu_env, twd, tws, twt);
203180e64a38SPhilippe Mathieu-Daudé         break;
203280e64a38SPhilippe Mathieu-Daudé     default:
203380e64a38SPhilippe Mathieu-Daudé         MIPS_INVAL("MSA instruction");
203480e64a38SPhilippe Mathieu-Daudé         gen_reserved_instruction(ctx);
203580e64a38SPhilippe Mathieu-Daudé         break;
203680e64a38SPhilippe Mathieu-Daudé     }
203780e64a38SPhilippe Mathieu-Daudé 
203880e64a38SPhilippe Mathieu-Daudé     tcg_temp_free_i32(twd);
203980e64a38SPhilippe Mathieu-Daudé     tcg_temp_free_i32(tws);
204080e64a38SPhilippe Mathieu-Daudé     tcg_temp_free_i32(twt);
204180e64a38SPhilippe Mathieu-Daudé }
204280e64a38SPhilippe Mathieu-Daudé 
204380e64a38SPhilippe Mathieu-Daudé static void gen_msa_vec(DisasContext *ctx)
204480e64a38SPhilippe Mathieu-Daudé {
204580e64a38SPhilippe Mathieu-Daudé     switch (MASK_MSA_VEC(ctx->opcode)) {
204680e64a38SPhilippe Mathieu-Daudé     case OPC_AND_V:
204780e64a38SPhilippe Mathieu-Daudé     case OPC_OR_V:
204880e64a38SPhilippe Mathieu-Daudé     case OPC_NOR_V:
204980e64a38SPhilippe Mathieu-Daudé     case OPC_XOR_V:
205080e64a38SPhilippe Mathieu-Daudé     case OPC_BMNZ_V:
205180e64a38SPhilippe Mathieu-Daudé     case OPC_BMZ_V:
205280e64a38SPhilippe Mathieu-Daudé     case OPC_BSEL_V:
205380e64a38SPhilippe Mathieu-Daudé         gen_msa_vec_v(ctx);
205480e64a38SPhilippe Mathieu-Daudé         break;
205580e64a38SPhilippe Mathieu-Daudé     case OPC_MSA_2R:
205680e64a38SPhilippe Mathieu-Daudé         gen_msa_2r(ctx);
205780e64a38SPhilippe Mathieu-Daudé         break;
205880e64a38SPhilippe Mathieu-Daudé     case OPC_MSA_2RF:
205980e64a38SPhilippe Mathieu-Daudé         gen_msa_2rf(ctx);
206080e64a38SPhilippe Mathieu-Daudé         break;
206180e64a38SPhilippe Mathieu-Daudé     default:
206280e64a38SPhilippe Mathieu-Daudé         MIPS_INVAL("MSA instruction");
206380e64a38SPhilippe Mathieu-Daudé         gen_reserved_instruction(ctx);
206480e64a38SPhilippe Mathieu-Daudé         break;
206580e64a38SPhilippe Mathieu-Daudé     }
206680e64a38SPhilippe Mathieu-Daudé }
206780e64a38SPhilippe Mathieu-Daudé 
2068525ea877SPhilippe Mathieu-Daudé static bool trans_MSA(DisasContext *ctx, arg_MSA *a)
206980e64a38SPhilippe Mathieu-Daudé {
207080e64a38SPhilippe Mathieu-Daudé     uint32_t opcode = ctx->opcode;
207180e64a38SPhilippe Mathieu-Daudé 
2072340ee8b3SPhilippe Mathieu-Daudé     if (!check_msa_enabled(ctx)) {
2073340ee8b3SPhilippe Mathieu-Daudé         return true;
2074340ee8b3SPhilippe Mathieu-Daudé     }
207580e64a38SPhilippe Mathieu-Daudé 
207680e64a38SPhilippe Mathieu-Daudé     switch (MASK_MSA_MINOR(opcode)) {
207780e64a38SPhilippe Mathieu-Daudé     case OPC_MSA_3R_0D:
207880e64a38SPhilippe Mathieu-Daudé     case OPC_MSA_3R_0E:
207980e64a38SPhilippe Mathieu-Daudé     case OPC_MSA_3R_0F:
208080e64a38SPhilippe Mathieu-Daudé     case OPC_MSA_3R_10:
208180e64a38SPhilippe Mathieu-Daudé     case OPC_MSA_3R_11:
208280e64a38SPhilippe Mathieu-Daudé     case OPC_MSA_3R_12:
208380e64a38SPhilippe Mathieu-Daudé     case OPC_MSA_3R_13:
208480e64a38SPhilippe Mathieu-Daudé     case OPC_MSA_3R_14:
208580e64a38SPhilippe Mathieu-Daudé     case OPC_MSA_3R_15:
208680e64a38SPhilippe Mathieu-Daudé         gen_msa_3r(ctx);
208780e64a38SPhilippe Mathieu-Daudé         break;
208880e64a38SPhilippe Mathieu-Daudé     case OPC_MSA_ELM:
208980e64a38SPhilippe Mathieu-Daudé         gen_msa_elm(ctx);
209080e64a38SPhilippe Mathieu-Daudé         break;
209180e64a38SPhilippe Mathieu-Daudé     case OPC_MSA_3RF_1A:
209280e64a38SPhilippe Mathieu-Daudé     case OPC_MSA_3RF_1B:
209380e64a38SPhilippe Mathieu-Daudé     case OPC_MSA_3RF_1C:
209480e64a38SPhilippe Mathieu-Daudé         gen_msa_3rf(ctx);
209580e64a38SPhilippe Mathieu-Daudé         break;
209680e64a38SPhilippe Mathieu-Daudé     case OPC_MSA_VEC:
209780e64a38SPhilippe Mathieu-Daudé         gen_msa_vec(ctx);
209880e64a38SPhilippe Mathieu-Daudé         break;
209980e64a38SPhilippe Mathieu-Daudé     default:
210080e64a38SPhilippe Mathieu-Daudé         MIPS_INVAL("MSA instruction");
210180e64a38SPhilippe Mathieu-Daudé         gen_reserved_instruction(ctx);
210280e64a38SPhilippe Mathieu-Daudé         break;
210380e64a38SPhilippe Mathieu-Daudé     }
2104c7a9ef75SPhilippe Mathieu-Daudé 
2105c7a9ef75SPhilippe Mathieu-Daudé     return true;
2106c7a9ef75SPhilippe Mathieu-Daudé }
2107c7a9ef75SPhilippe Mathieu-Daudé 
2108*ce121fe2SPhilippe Mathieu-Daudé static bool trans_msa_ldst(DisasContext *ctx, arg_msa_i *a,
2109*ce121fe2SPhilippe Mathieu-Daudé                            gen_helper_piv *gen_msa_ldst)
2110*ce121fe2SPhilippe Mathieu-Daudé {
2111*ce121fe2SPhilippe Mathieu-Daudé     TCGv taddr;
2112*ce121fe2SPhilippe Mathieu-Daudé 
2113*ce121fe2SPhilippe Mathieu-Daudé     if (!check_msa_enabled(ctx)) {
2114*ce121fe2SPhilippe Mathieu-Daudé         return true;
2115*ce121fe2SPhilippe Mathieu-Daudé     }
2116*ce121fe2SPhilippe Mathieu-Daudé 
2117*ce121fe2SPhilippe Mathieu-Daudé     taddr = tcg_temp_new();
2118*ce121fe2SPhilippe Mathieu-Daudé 
2119*ce121fe2SPhilippe Mathieu-Daudé     gen_base_offset_addr(ctx, taddr, a->ws, a->sa << a->df);
2120*ce121fe2SPhilippe Mathieu-Daudé     gen_msa_ldst(cpu_env, tcg_constant_i32(a->wd), taddr);
2121*ce121fe2SPhilippe Mathieu-Daudé 
2122*ce121fe2SPhilippe Mathieu-Daudé     tcg_temp_free(taddr);
2123*ce121fe2SPhilippe Mathieu-Daudé 
2124*ce121fe2SPhilippe Mathieu-Daudé     return true;
2125*ce121fe2SPhilippe Mathieu-Daudé }
2126*ce121fe2SPhilippe Mathieu-Daudé 
2127*ce121fe2SPhilippe Mathieu-Daudé TRANS_DF_iv(LD, trans_msa_ldst, gen_helper_msa_ld);
2128*ce121fe2SPhilippe Mathieu-Daudé TRANS_DF_iv(ST, trans_msa_ldst, gen_helper_msa_st);
2129*ce121fe2SPhilippe Mathieu-Daudé 
213034fe9fa3SPhilippe Mathieu-Daudé static bool trans_LSA(DisasContext *ctx, arg_r *a)
21315f21f30dSPhilippe Mathieu-Daudé {
21325f21f30dSPhilippe Mathieu-Daudé     return gen_lsa(ctx, a->rd, a->rt, a->rs, a->sa);
21335f21f30dSPhilippe Mathieu-Daudé }
21345f21f30dSPhilippe Mathieu-Daudé 
213534fe9fa3SPhilippe Mathieu-Daudé static bool trans_DLSA(DisasContext *ctx, arg_r *a)
21365f21f30dSPhilippe Mathieu-Daudé {
2137f5c6ee0cSPhilippe Mathieu-Daudé     if (TARGET_LONG_BITS != 64) {
2138f5c6ee0cSPhilippe Mathieu-Daudé         return false;
2139f5c6ee0cSPhilippe Mathieu-Daudé     }
21405f21f30dSPhilippe Mathieu-Daudé     return gen_dlsa(ctx, a->rd, a->rt, a->rs, a->sa);
21415f21f30dSPhilippe Mathieu-Daudé }
2142