1a2b0a27dSPhilippe Mathieu-Daudé /* 2a2b0a27dSPhilippe Mathieu-Daudé * MIPS SIMD Architecture (MSA) translation routines 3a2b0a27dSPhilippe Mathieu-Daudé * 4a2b0a27dSPhilippe Mathieu-Daudé * Copyright (c) 2004-2005 Jocelyn Mayer 5a2b0a27dSPhilippe Mathieu-Daudé * Copyright (c) 2006 Marius Groeger (FPU operations) 6a2b0a27dSPhilippe Mathieu-Daudé * Copyright (c) 2006 Thiemo Seufer (MIPS32R2 support) 7a2b0a27dSPhilippe Mathieu-Daudé * Copyright (c) 2009 CodeSourcery (MIPS16 and microMIPS support) 8a2b0a27dSPhilippe Mathieu-Daudé * Copyright (c) 2012 Jia Liu & Dongxue Zhang (MIPS ASE DSP support) 9a2b0a27dSPhilippe Mathieu-Daudé * Copyright (c) 2020 Philippe Mathieu-Daudé 10a2b0a27dSPhilippe Mathieu-Daudé * 11a2b0a27dSPhilippe Mathieu-Daudé * SPDX-License-Identifier: LGPL-2.1-or-later 12a2b0a27dSPhilippe Mathieu-Daudé */ 13a2b0a27dSPhilippe Mathieu-Daudé #include "qemu/osdep.h" 14a2b0a27dSPhilippe Mathieu-Daudé #include "tcg/tcg-op.h" 15a2b0a27dSPhilippe Mathieu-Daudé #include "exec/helper-gen.h" 16a2b0a27dSPhilippe Mathieu-Daudé #include "translate.h" 17a2b0a27dSPhilippe Mathieu-Daudé #include "fpu_helper.h" 18a2b0a27dSPhilippe Mathieu-Daudé #include "internal.h" 19a2b0a27dSPhilippe 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é 23*ff29e5d3SPhilippe Mathieu-Daudé static inline int plus_1(DisasContext *s, int x) 24*ff29e5d3SPhilippe Mathieu-Daudé { 25*ff29e5d3SPhilippe Mathieu-Daudé return x + 1; 26*ff29e5d3SPhilippe Mathieu-Daudé } 27*ff29e5d3SPhilippe Mathieu-Daudé 285c5b6400SPhilippe Mathieu-Daudé static inline int plus_2(DisasContext *s, int x) 295c5b6400SPhilippe Mathieu-Daudé { 305c5b6400SPhilippe Mathieu-Daudé return x + 2; 315c5b6400SPhilippe Mathieu-Daudé } 325c5b6400SPhilippe Mathieu-Daudé 33a2b0a27dSPhilippe Mathieu-Daudé /* Include the auto-generated decoder. */ 34f5c6ee0cSPhilippe Mathieu-Daudé #include "decode-msa.c.inc" 35a2b0a27dSPhilippe Mathieu-Daudé 36a2b0a27dSPhilippe Mathieu-Daudé #define OPC_MSA (0x1E << 26) 37a2b0a27dSPhilippe Mathieu-Daudé 38a2b0a27dSPhilippe Mathieu-Daudé #define MASK_MSA_MINOR(op) (MASK_OP_MAJOR(op) | (op & 0x3F)) 39a2b0a27dSPhilippe Mathieu-Daudé enum { 40a2b0a27dSPhilippe Mathieu-Daudé OPC_MSA_3R_0D = 0x0D | OPC_MSA, 41a2b0a27dSPhilippe Mathieu-Daudé OPC_MSA_3R_0E = 0x0E | OPC_MSA, 42a2b0a27dSPhilippe Mathieu-Daudé OPC_MSA_3R_0F = 0x0F | OPC_MSA, 43a2b0a27dSPhilippe Mathieu-Daudé OPC_MSA_3R_10 = 0x10 | OPC_MSA, 44a2b0a27dSPhilippe Mathieu-Daudé OPC_MSA_3R_11 = 0x11 | OPC_MSA, 45a2b0a27dSPhilippe Mathieu-Daudé OPC_MSA_3R_12 = 0x12 | OPC_MSA, 46a2b0a27dSPhilippe Mathieu-Daudé OPC_MSA_3R_13 = 0x13 | OPC_MSA, 47a2b0a27dSPhilippe Mathieu-Daudé OPC_MSA_3R_14 = 0x14 | OPC_MSA, 48a2b0a27dSPhilippe Mathieu-Daudé OPC_MSA_3R_15 = 0x15 | OPC_MSA, 49a2b0a27dSPhilippe Mathieu-Daudé OPC_MSA_ELM = 0x19 | OPC_MSA, 50a2b0a27dSPhilippe Mathieu-Daudé OPC_MSA_3RF_1A = 0x1A | OPC_MSA, 51a2b0a27dSPhilippe Mathieu-Daudé OPC_MSA_3RF_1B = 0x1B | OPC_MSA, 52a2b0a27dSPhilippe Mathieu-Daudé OPC_MSA_3RF_1C = 0x1C | OPC_MSA, 53a2b0a27dSPhilippe Mathieu-Daudé }; 54a2b0a27dSPhilippe Mathieu-Daudé 55a2b0a27dSPhilippe Mathieu-Daudé enum { 56a2b0a27dSPhilippe Mathieu-Daudé /* 3R instruction df(bits 22..21) = _b, _h, _w, d */ 57a2b0a27dSPhilippe Mathieu-Daudé OPC_SLL_df = (0x0 << 23) | OPC_MSA_3R_0D, 58a2b0a27dSPhilippe Mathieu-Daudé OPC_ADDV_df = (0x0 << 23) | OPC_MSA_3R_0E, 59a2b0a27dSPhilippe Mathieu-Daudé OPC_CEQ_df = (0x0 << 23) | OPC_MSA_3R_0F, 60a2b0a27dSPhilippe Mathieu-Daudé OPC_ADD_A_df = (0x0 << 23) | OPC_MSA_3R_10, 61a2b0a27dSPhilippe Mathieu-Daudé OPC_SUBS_S_df = (0x0 << 23) | OPC_MSA_3R_11, 62a2b0a27dSPhilippe Mathieu-Daudé OPC_MULV_df = (0x0 << 23) | OPC_MSA_3R_12, 63a2b0a27dSPhilippe Mathieu-Daudé OPC_DOTP_S_df = (0x0 << 23) | OPC_MSA_3R_13, 64a2b0a27dSPhilippe Mathieu-Daudé OPC_SLD_df = (0x0 << 23) | OPC_MSA_3R_14, 65a2b0a27dSPhilippe Mathieu-Daudé OPC_VSHF_df = (0x0 << 23) | OPC_MSA_3R_15, 66a2b0a27dSPhilippe Mathieu-Daudé OPC_SRA_df = (0x1 << 23) | OPC_MSA_3R_0D, 67a2b0a27dSPhilippe Mathieu-Daudé OPC_SUBV_df = (0x1 << 23) | OPC_MSA_3R_0E, 68a2b0a27dSPhilippe Mathieu-Daudé OPC_ADDS_A_df = (0x1 << 23) | OPC_MSA_3R_10, 69a2b0a27dSPhilippe Mathieu-Daudé OPC_SUBS_U_df = (0x1 << 23) | OPC_MSA_3R_11, 70a2b0a27dSPhilippe Mathieu-Daudé OPC_MADDV_df = (0x1 << 23) | OPC_MSA_3R_12, 71a2b0a27dSPhilippe Mathieu-Daudé OPC_DOTP_U_df = (0x1 << 23) | OPC_MSA_3R_13, 72a2b0a27dSPhilippe Mathieu-Daudé OPC_SPLAT_df = (0x1 << 23) | OPC_MSA_3R_14, 73a2b0a27dSPhilippe Mathieu-Daudé OPC_SRAR_df = (0x1 << 23) | OPC_MSA_3R_15, 74a2b0a27dSPhilippe Mathieu-Daudé OPC_SRL_df = (0x2 << 23) | OPC_MSA_3R_0D, 75a2b0a27dSPhilippe Mathieu-Daudé OPC_MAX_S_df = (0x2 << 23) | OPC_MSA_3R_0E, 76a2b0a27dSPhilippe Mathieu-Daudé OPC_CLT_S_df = (0x2 << 23) | OPC_MSA_3R_0F, 77a2b0a27dSPhilippe Mathieu-Daudé OPC_ADDS_S_df = (0x2 << 23) | OPC_MSA_3R_10, 78a2b0a27dSPhilippe Mathieu-Daudé OPC_SUBSUS_U_df = (0x2 << 23) | OPC_MSA_3R_11, 79a2b0a27dSPhilippe Mathieu-Daudé OPC_MSUBV_df = (0x2 << 23) | OPC_MSA_3R_12, 80a2b0a27dSPhilippe Mathieu-Daudé OPC_DPADD_S_df = (0x2 << 23) | OPC_MSA_3R_13, 81a2b0a27dSPhilippe Mathieu-Daudé OPC_PCKEV_df = (0x2 << 23) | OPC_MSA_3R_14, 82a2b0a27dSPhilippe Mathieu-Daudé OPC_SRLR_df = (0x2 << 23) | OPC_MSA_3R_15, 83a2b0a27dSPhilippe Mathieu-Daudé OPC_BCLR_df = (0x3 << 23) | OPC_MSA_3R_0D, 84a2b0a27dSPhilippe Mathieu-Daudé OPC_MAX_U_df = (0x3 << 23) | OPC_MSA_3R_0E, 85a2b0a27dSPhilippe Mathieu-Daudé OPC_CLT_U_df = (0x3 << 23) | OPC_MSA_3R_0F, 86a2b0a27dSPhilippe Mathieu-Daudé OPC_ADDS_U_df = (0x3 << 23) | OPC_MSA_3R_10, 87a2b0a27dSPhilippe Mathieu-Daudé OPC_SUBSUU_S_df = (0x3 << 23) | OPC_MSA_3R_11, 88a2b0a27dSPhilippe Mathieu-Daudé OPC_DPADD_U_df = (0x3 << 23) | OPC_MSA_3R_13, 89a2b0a27dSPhilippe Mathieu-Daudé OPC_PCKOD_df = (0x3 << 23) | OPC_MSA_3R_14, 90a2b0a27dSPhilippe Mathieu-Daudé OPC_BSET_df = (0x4 << 23) | OPC_MSA_3R_0D, 91a2b0a27dSPhilippe Mathieu-Daudé OPC_MIN_S_df = (0x4 << 23) | OPC_MSA_3R_0E, 92a2b0a27dSPhilippe Mathieu-Daudé OPC_CLE_S_df = (0x4 << 23) | OPC_MSA_3R_0F, 93a2b0a27dSPhilippe Mathieu-Daudé OPC_AVE_S_df = (0x4 << 23) | OPC_MSA_3R_10, 94a2b0a27dSPhilippe Mathieu-Daudé OPC_ASUB_S_df = (0x4 << 23) | OPC_MSA_3R_11, 95a2b0a27dSPhilippe Mathieu-Daudé OPC_DIV_S_df = (0x4 << 23) | OPC_MSA_3R_12, 96a2b0a27dSPhilippe Mathieu-Daudé OPC_DPSUB_S_df = (0x4 << 23) | OPC_MSA_3R_13, 97a2b0a27dSPhilippe Mathieu-Daudé OPC_ILVL_df = (0x4 << 23) | OPC_MSA_3R_14, 98a2b0a27dSPhilippe Mathieu-Daudé OPC_HADD_S_df = (0x4 << 23) | OPC_MSA_3R_15, 99a2b0a27dSPhilippe Mathieu-Daudé OPC_BNEG_df = (0x5 << 23) | OPC_MSA_3R_0D, 100a2b0a27dSPhilippe Mathieu-Daudé OPC_MIN_U_df = (0x5 << 23) | OPC_MSA_3R_0E, 101a2b0a27dSPhilippe Mathieu-Daudé OPC_CLE_U_df = (0x5 << 23) | OPC_MSA_3R_0F, 102a2b0a27dSPhilippe Mathieu-Daudé OPC_AVE_U_df = (0x5 << 23) | OPC_MSA_3R_10, 103a2b0a27dSPhilippe Mathieu-Daudé OPC_ASUB_U_df = (0x5 << 23) | OPC_MSA_3R_11, 104a2b0a27dSPhilippe Mathieu-Daudé OPC_DIV_U_df = (0x5 << 23) | OPC_MSA_3R_12, 105a2b0a27dSPhilippe Mathieu-Daudé OPC_DPSUB_U_df = (0x5 << 23) | OPC_MSA_3R_13, 106a2b0a27dSPhilippe Mathieu-Daudé OPC_ILVR_df = (0x5 << 23) | OPC_MSA_3R_14, 107a2b0a27dSPhilippe Mathieu-Daudé OPC_HADD_U_df = (0x5 << 23) | OPC_MSA_3R_15, 108a2b0a27dSPhilippe Mathieu-Daudé OPC_BINSL_df = (0x6 << 23) | OPC_MSA_3R_0D, 109a2b0a27dSPhilippe Mathieu-Daudé OPC_MAX_A_df = (0x6 << 23) | OPC_MSA_3R_0E, 110a2b0a27dSPhilippe Mathieu-Daudé OPC_AVER_S_df = (0x6 << 23) | OPC_MSA_3R_10, 111a2b0a27dSPhilippe Mathieu-Daudé OPC_MOD_S_df = (0x6 << 23) | OPC_MSA_3R_12, 112a2b0a27dSPhilippe Mathieu-Daudé OPC_ILVEV_df = (0x6 << 23) | OPC_MSA_3R_14, 113a2b0a27dSPhilippe Mathieu-Daudé OPC_HSUB_S_df = (0x6 << 23) | OPC_MSA_3R_15, 114a2b0a27dSPhilippe Mathieu-Daudé OPC_BINSR_df = (0x7 << 23) | OPC_MSA_3R_0D, 115a2b0a27dSPhilippe Mathieu-Daudé OPC_MIN_A_df = (0x7 << 23) | OPC_MSA_3R_0E, 116a2b0a27dSPhilippe Mathieu-Daudé OPC_AVER_U_df = (0x7 << 23) | OPC_MSA_3R_10, 117a2b0a27dSPhilippe Mathieu-Daudé OPC_MOD_U_df = (0x7 << 23) | OPC_MSA_3R_12, 118a2b0a27dSPhilippe Mathieu-Daudé OPC_ILVOD_df = (0x7 << 23) | OPC_MSA_3R_14, 119a2b0a27dSPhilippe Mathieu-Daudé OPC_HSUB_U_df = (0x7 << 23) | OPC_MSA_3R_15, 120a2b0a27dSPhilippe Mathieu-Daudé 121a2b0a27dSPhilippe Mathieu-Daudé /* ELM instructions df(bits 21..16) = _b, _h, _w, _d */ 122a2b0a27dSPhilippe Mathieu-Daudé OPC_SLDI_df = (0x0 << 22) | (0x00 << 16) | OPC_MSA_ELM, 123a2b0a27dSPhilippe Mathieu-Daudé OPC_CTCMSA = (0x0 << 22) | (0x3E << 16) | OPC_MSA_ELM, 124a2b0a27dSPhilippe Mathieu-Daudé OPC_SPLATI_df = (0x1 << 22) | (0x00 << 16) | OPC_MSA_ELM, 125a2b0a27dSPhilippe Mathieu-Daudé OPC_CFCMSA = (0x1 << 22) | (0x3E << 16) | OPC_MSA_ELM, 126a2b0a27dSPhilippe Mathieu-Daudé OPC_COPY_S_df = (0x2 << 22) | (0x00 << 16) | OPC_MSA_ELM, 127a2b0a27dSPhilippe Mathieu-Daudé OPC_MOVE_V = (0x2 << 22) | (0x3E << 16) | OPC_MSA_ELM, 128a2b0a27dSPhilippe Mathieu-Daudé OPC_COPY_U_df = (0x3 << 22) | (0x00 << 16) | OPC_MSA_ELM, 129a2b0a27dSPhilippe Mathieu-Daudé OPC_INSERT_df = (0x4 << 22) | (0x00 << 16) | OPC_MSA_ELM, 130a2b0a27dSPhilippe Mathieu-Daudé OPC_INSVE_df = (0x5 << 22) | (0x00 << 16) | OPC_MSA_ELM, 131a2b0a27dSPhilippe Mathieu-Daudé 132a2b0a27dSPhilippe Mathieu-Daudé /* 3RF instruction _df(bit 21) = _w, _d */ 133a2b0a27dSPhilippe Mathieu-Daudé OPC_FCAF_df = (0x0 << 22) | OPC_MSA_3RF_1A, 134a2b0a27dSPhilippe Mathieu-Daudé OPC_FADD_df = (0x0 << 22) | OPC_MSA_3RF_1B, 135a2b0a27dSPhilippe Mathieu-Daudé OPC_FCUN_df = (0x1 << 22) | OPC_MSA_3RF_1A, 136a2b0a27dSPhilippe Mathieu-Daudé OPC_FSUB_df = (0x1 << 22) | OPC_MSA_3RF_1B, 137a2b0a27dSPhilippe Mathieu-Daudé OPC_FCOR_df = (0x1 << 22) | OPC_MSA_3RF_1C, 138a2b0a27dSPhilippe Mathieu-Daudé OPC_FCEQ_df = (0x2 << 22) | OPC_MSA_3RF_1A, 139a2b0a27dSPhilippe Mathieu-Daudé OPC_FMUL_df = (0x2 << 22) | OPC_MSA_3RF_1B, 140a2b0a27dSPhilippe Mathieu-Daudé OPC_FCUNE_df = (0x2 << 22) | OPC_MSA_3RF_1C, 141a2b0a27dSPhilippe Mathieu-Daudé OPC_FCUEQ_df = (0x3 << 22) | OPC_MSA_3RF_1A, 142a2b0a27dSPhilippe Mathieu-Daudé OPC_FDIV_df = (0x3 << 22) | OPC_MSA_3RF_1B, 143a2b0a27dSPhilippe Mathieu-Daudé OPC_FCNE_df = (0x3 << 22) | OPC_MSA_3RF_1C, 144a2b0a27dSPhilippe Mathieu-Daudé OPC_FCLT_df = (0x4 << 22) | OPC_MSA_3RF_1A, 145a2b0a27dSPhilippe Mathieu-Daudé OPC_FMADD_df = (0x4 << 22) | OPC_MSA_3RF_1B, 146a2b0a27dSPhilippe Mathieu-Daudé OPC_FCULT_df = (0x5 << 22) | OPC_MSA_3RF_1A, 147a2b0a27dSPhilippe Mathieu-Daudé OPC_FMSUB_df = (0x5 << 22) | OPC_MSA_3RF_1B, 148a2b0a27dSPhilippe Mathieu-Daudé OPC_FCLE_df = (0x6 << 22) | OPC_MSA_3RF_1A, 149a2b0a27dSPhilippe Mathieu-Daudé OPC_FCULE_df = (0x7 << 22) | OPC_MSA_3RF_1A, 150a2b0a27dSPhilippe Mathieu-Daudé OPC_FEXP2_df = (0x7 << 22) | OPC_MSA_3RF_1B, 151a2b0a27dSPhilippe Mathieu-Daudé OPC_FSAF_df = (0x8 << 22) | OPC_MSA_3RF_1A, 152a2b0a27dSPhilippe Mathieu-Daudé OPC_FEXDO_df = (0x8 << 22) | OPC_MSA_3RF_1B, 153a2b0a27dSPhilippe Mathieu-Daudé OPC_FSUN_df = (0x9 << 22) | OPC_MSA_3RF_1A, 154a2b0a27dSPhilippe Mathieu-Daudé OPC_FSOR_df = (0x9 << 22) | OPC_MSA_3RF_1C, 155a2b0a27dSPhilippe Mathieu-Daudé OPC_FSEQ_df = (0xA << 22) | OPC_MSA_3RF_1A, 156a2b0a27dSPhilippe Mathieu-Daudé OPC_FTQ_df = (0xA << 22) | OPC_MSA_3RF_1B, 157a2b0a27dSPhilippe Mathieu-Daudé OPC_FSUNE_df = (0xA << 22) | OPC_MSA_3RF_1C, 158a2b0a27dSPhilippe Mathieu-Daudé OPC_FSUEQ_df = (0xB << 22) | OPC_MSA_3RF_1A, 159a2b0a27dSPhilippe Mathieu-Daudé OPC_FSNE_df = (0xB << 22) | OPC_MSA_3RF_1C, 160a2b0a27dSPhilippe Mathieu-Daudé OPC_FSLT_df = (0xC << 22) | OPC_MSA_3RF_1A, 161a2b0a27dSPhilippe Mathieu-Daudé OPC_FMIN_df = (0xC << 22) | OPC_MSA_3RF_1B, 162a2b0a27dSPhilippe Mathieu-Daudé OPC_FSULT_df = (0xD << 22) | OPC_MSA_3RF_1A, 163a2b0a27dSPhilippe Mathieu-Daudé OPC_FMIN_A_df = (0xD << 22) | OPC_MSA_3RF_1B, 164a2b0a27dSPhilippe Mathieu-Daudé OPC_FSLE_df = (0xE << 22) | OPC_MSA_3RF_1A, 165a2b0a27dSPhilippe Mathieu-Daudé OPC_FMAX_df = (0xE << 22) | OPC_MSA_3RF_1B, 166a2b0a27dSPhilippe Mathieu-Daudé OPC_FSULE_df = (0xF << 22) | OPC_MSA_3RF_1A, 167a2b0a27dSPhilippe Mathieu-Daudé OPC_FMAX_A_df = (0xF << 22) | OPC_MSA_3RF_1B, 168a2b0a27dSPhilippe Mathieu-Daudé }; 169a2b0a27dSPhilippe Mathieu-Daudé 17006106772SPhilippe Mathieu-Daudé static const char msaregnames[][6] = { 171a2b0a27dSPhilippe Mathieu-Daudé "w0.d0", "w0.d1", "w1.d0", "w1.d1", 172a2b0a27dSPhilippe Mathieu-Daudé "w2.d0", "w2.d1", "w3.d0", "w3.d1", 173a2b0a27dSPhilippe Mathieu-Daudé "w4.d0", "w4.d1", "w5.d0", "w5.d1", 174a2b0a27dSPhilippe Mathieu-Daudé "w6.d0", "w6.d1", "w7.d0", "w7.d1", 175a2b0a27dSPhilippe Mathieu-Daudé "w8.d0", "w8.d1", "w9.d0", "w9.d1", 176a2b0a27dSPhilippe Mathieu-Daudé "w10.d0", "w10.d1", "w11.d0", "w11.d1", 177a2b0a27dSPhilippe Mathieu-Daudé "w12.d0", "w12.d1", "w13.d0", "w13.d1", 178a2b0a27dSPhilippe Mathieu-Daudé "w14.d0", "w14.d1", "w15.d0", "w15.d1", 179a2b0a27dSPhilippe Mathieu-Daudé "w16.d0", "w16.d1", "w17.d0", "w17.d1", 180a2b0a27dSPhilippe Mathieu-Daudé "w18.d0", "w18.d1", "w19.d0", "w19.d1", 181a2b0a27dSPhilippe Mathieu-Daudé "w20.d0", "w20.d1", "w21.d0", "w21.d1", 182a2b0a27dSPhilippe Mathieu-Daudé "w22.d0", "w22.d1", "w23.d0", "w23.d1", 183a2b0a27dSPhilippe Mathieu-Daudé "w24.d0", "w24.d1", "w25.d0", "w25.d1", 184a2b0a27dSPhilippe Mathieu-Daudé "w26.d0", "w26.d1", "w27.d0", "w27.d1", 185a2b0a27dSPhilippe Mathieu-Daudé "w28.d0", "w28.d1", "w29.d0", "w29.d1", 186a2b0a27dSPhilippe Mathieu-Daudé "w30.d0", "w30.d1", "w31.d0", "w31.d1", 187a2b0a27dSPhilippe Mathieu-Daudé }; 188a2b0a27dSPhilippe Mathieu-Daudé 1894701d23aSPhilippe Mathieu-Daudé /* Encoding of Operation Field (must be indexed by CPUMIPSMSADataFormat) */ 1904701d23aSPhilippe Mathieu-Daudé struct dfe { 1914701d23aSPhilippe Mathieu-Daudé int start; 1924701d23aSPhilippe Mathieu-Daudé int length; 1934701d23aSPhilippe Mathieu-Daudé uint32_t mask; 1944701d23aSPhilippe Mathieu-Daudé }; 1954701d23aSPhilippe Mathieu-Daudé 1964701d23aSPhilippe Mathieu-Daudé /* 1974701d23aSPhilippe Mathieu-Daudé * Extract immediate from df/{m,n} format (used by ELM & BIT instructions). 1984701d23aSPhilippe Mathieu-Daudé * Returns the immediate value, or -1 if the format does not match. 1994701d23aSPhilippe Mathieu-Daudé */ 2004701d23aSPhilippe Mathieu-Daudé static int df_extract_val(DisasContext *ctx, int x, const struct dfe *s) 2014701d23aSPhilippe Mathieu-Daudé { 2024701d23aSPhilippe Mathieu-Daudé for (unsigned i = 0; i < 4; i++) { 2034701d23aSPhilippe Mathieu-Daudé if (extract32(x, s->start, s->length) == s->mask) { 2044701d23aSPhilippe Mathieu-Daudé return extract32(x, 0, s->start); 2054701d23aSPhilippe Mathieu-Daudé } 2064701d23aSPhilippe Mathieu-Daudé } 2074701d23aSPhilippe Mathieu-Daudé return -1; 2084701d23aSPhilippe Mathieu-Daudé } 2094701d23aSPhilippe Mathieu-Daudé 2104701d23aSPhilippe Mathieu-Daudé /* 2114701d23aSPhilippe Mathieu-Daudé * Extract DataField from df/{m,n} format (used by ELM & BIT instructions). 2124701d23aSPhilippe Mathieu-Daudé * Returns the DataField, or -1 if the format does not match. 2134701d23aSPhilippe Mathieu-Daudé */ 2144701d23aSPhilippe Mathieu-Daudé static int df_extract_df(DisasContext *ctx, int x, const struct dfe *s) 2154701d23aSPhilippe Mathieu-Daudé { 2164701d23aSPhilippe Mathieu-Daudé for (unsigned i = 0; i < 4; i++) { 2174701d23aSPhilippe Mathieu-Daudé if (extract32(x, s->start, s->length) == s->mask) { 2184701d23aSPhilippe Mathieu-Daudé return i; 2194701d23aSPhilippe Mathieu-Daudé } 2204701d23aSPhilippe Mathieu-Daudé } 2214701d23aSPhilippe Mathieu-Daudé return -1; 2224701d23aSPhilippe Mathieu-Daudé } 2234701d23aSPhilippe Mathieu-Daudé 2244701d23aSPhilippe Mathieu-Daudé static const struct dfe df_bit[] = { 2254701d23aSPhilippe Mathieu-Daudé /* Table 3.28 BIT Instruction Format */ 2264701d23aSPhilippe Mathieu-Daudé [DF_BYTE] = {3, 4, 0b1110}, 2274701d23aSPhilippe Mathieu-Daudé [DF_HALF] = {4, 3, 0b110}, 2284701d23aSPhilippe Mathieu-Daudé [DF_WORD] = {5, 2, 0b10}, 2294701d23aSPhilippe Mathieu-Daudé [DF_DOUBLE] = {6, 1, 0b0} 2304701d23aSPhilippe Mathieu-Daudé }; 2314701d23aSPhilippe Mathieu-Daudé 2324701d23aSPhilippe Mathieu-Daudé static int bit_m(DisasContext *ctx, int x) 2334701d23aSPhilippe Mathieu-Daudé { 2344701d23aSPhilippe Mathieu-Daudé return df_extract_val(ctx, x, df_bit); 2354701d23aSPhilippe Mathieu-Daudé } 2364701d23aSPhilippe Mathieu-Daudé 2374701d23aSPhilippe Mathieu-Daudé static int bit_df(DisasContext *ctx, int x) 2384701d23aSPhilippe Mathieu-Daudé { 2394701d23aSPhilippe Mathieu-Daudé return df_extract_df(ctx, x, df_bit); 2404701d23aSPhilippe Mathieu-Daudé } 2414701d23aSPhilippe Mathieu-Daudé 242a2b0a27dSPhilippe Mathieu-Daudé static TCGv_i64 msa_wr_d[64]; 243a2b0a27dSPhilippe Mathieu-Daudé 244a2b0a27dSPhilippe Mathieu-Daudé void msa_translate_init(void) 245a2b0a27dSPhilippe Mathieu-Daudé { 246a2b0a27dSPhilippe Mathieu-Daudé int i; 247a2b0a27dSPhilippe Mathieu-Daudé 248a2b0a27dSPhilippe Mathieu-Daudé for (i = 0; i < 32; i++) { 249bbc213b3SPhilippe Mathieu-Daudé int off; 250a2b0a27dSPhilippe Mathieu-Daudé 251a2b0a27dSPhilippe Mathieu-Daudé /* 252a2b0a27dSPhilippe Mathieu-Daudé * The MSA vector registers are mapped on the 253a2b0a27dSPhilippe Mathieu-Daudé * scalar floating-point unit (FPU) registers. 254a2b0a27dSPhilippe Mathieu-Daudé */ 255bbc213b3SPhilippe Mathieu-Daudé off = offsetof(CPUMIPSState, active_fpu.fpr[i].wr.d[0]); 256a2b0a27dSPhilippe Mathieu-Daudé msa_wr_d[i * 2] = fpu_f64[i]; 257bbc213b3SPhilippe Mathieu-Daudé 258a2b0a27dSPhilippe Mathieu-Daudé off = offsetof(CPUMIPSState, active_fpu.fpr[i].wr.d[1]); 259a2b0a27dSPhilippe Mathieu-Daudé msa_wr_d[i * 2 + 1] = 260a2b0a27dSPhilippe Mathieu-Daudé tcg_global_mem_new_i64(cpu_env, off, msaregnames[i * 2 + 1]); 261a2b0a27dSPhilippe Mathieu-Daudé } 262a2b0a27dSPhilippe Mathieu-Daudé } 263a2b0a27dSPhilippe Mathieu-Daudé 264340ee8b3SPhilippe Mathieu-Daudé /* 265340ee8b3SPhilippe Mathieu-Daudé * Check if MSA is enabled. 266340ee8b3SPhilippe Mathieu-Daudé * This function is always called with MSA available. 267340ee8b3SPhilippe Mathieu-Daudé * If MSA is disabled, raise an exception. 268340ee8b3SPhilippe Mathieu-Daudé */ 269340ee8b3SPhilippe Mathieu-Daudé static inline bool check_msa_enabled(DisasContext *ctx) 270a2b0a27dSPhilippe Mathieu-Daudé { 271a2b0a27dSPhilippe Mathieu-Daudé if (unlikely((ctx->hflags & MIPS_HFLAG_FPU) && 272a2b0a27dSPhilippe Mathieu-Daudé !(ctx->hflags & MIPS_HFLAG_F64))) { 273a2b0a27dSPhilippe Mathieu-Daudé gen_reserved_instruction(ctx); 274340ee8b3SPhilippe Mathieu-Daudé return false; 275a2b0a27dSPhilippe Mathieu-Daudé } 276a2b0a27dSPhilippe Mathieu-Daudé 277a2b0a27dSPhilippe Mathieu-Daudé if (unlikely(!(ctx->hflags & MIPS_HFLAG_MSA))) { 278a2b0a27dSPhilippe Mathieu-Daudé generate_exception_end(ctx, EXCP_MSADIS); 279340ee8b3SPhilippe Mathieu-Daudé return false; 280a2b0a27dSPhilippe Mathieu-Daudé } 281340ee8b3SPhilippe Mathieu-Daudé return true; 282a2b0a27dSPhilippe Mathieu-Daudé } 283a2b0a27dSPhilippe Mathieu-Daudé 284ce121fe2SPhilippe Mathieu-Daudé typedef void gen_helper_piv(TCGv_ptr, TCGv_i32, TCGv); 285adcff99aSPhilippe Mathieu-Daudé typedef void gen_helper_pii(TCGv_ptr, TCGv_i32, TCGv_i32); 2867cc351ffSPhilippe Mathieu-Daudé typedef void gen_helper_piii(TCGv_ptr, TCGv_i32, TCGv_i32, TCGv_i32); 287b8e74816SPhilippe Mathieu-Daudé typedef void gen_helper_piiii(TCGv_ptr, TCGv_i32, TCGv_i32, TCGv_i32, TCGv_i32); 288b8e74816SPhilippe Mathieu-Daudé 289ce121fe2SPhilippe Mathieu-Daudé #define TRANS_DF_x(TYPE, NAME, trans_func, gen_func) \ 290ce121fe2SPhilippe Mathieu-Daudé static gen_helper_p##TYPE * const NAME##_tab[4] = { \ 291ce121fe2SPhilippe Mathieu-Daudé gen_func##_b, gen_func##_h, gen_func##_w, gen_func##_d \ 292ce121fe2SPhilippe Mathieu-Daudé }; \ 293ce121fe2SPhilippe Mathieu-Daudé TRANS(NAME, trans_func, NAME##_tab[a->df]) 294ce121fe2SPhilippe Mathieu-Daudé 295ce121fe2SPhilippe Mathieu-Daudé #define TRANS_DF_iv(NAME, trans_func, gen_func) \ 296ce121fe2SPhilippe Mathieu-Daudé TRANS_DF_x(iv, NAME, trans_func, gen_func) 297ce121fe2SPhilippe Mathieu-Daudé 298adcff99aSPhilippe Mathieu-Daudé #define TRANS_DF_ii(NAME, trans_func, gen_func) \ 299adcff99aSPhilippe Mathieu-Daudé TRANS_DF_x(ii, NAME, trans_func, gen_func) 300adcff99aSPhilippe Mathieu-Daudé 301a2b0a27dSPhilippe Mathieu-Daudé static void gen_check_zero_element(TCGv tresult, uint8_t df, uint8_t wt, 302a2b0a27dSPhilippe Mathieu-Daudé TCGCond cond) 303a2b0a27dSPhilippe Mathieu-Daudé { 304a2b0a27dSPhilippe Mathieu-Daudé /* generates tcg ops to check if any element is 0 */ 305a2b0a27dSPhilippe Mathieu-Daudé /* Note this function only works with MSA_WRLEN = 128 */ 30640f75c02SPhilippe Mathieu-Daudé uint64_t eval_zero_or_big = dup_const(df, 1); 30740f75c02SPhilippe Mathieu-Daudé uint64_t eval_big = eval_zero_or_big << ((8 << df) - 1); 308a2b0a27dSPhilippe Mathieu-Daudé TCGv_i64 t0 = tcg_temp_new_i64(); 309a2b0a27dSPhilippe Mathieu-Daudé TCGv_i64 t1 = tcg_temp_new_i64(); 31040f75c02SPhilippe Mathieu-Daudé 311a2b0a27dSPhilippe Mathieu-Daudé tcg_gen_subi_i64(t0, msa_wr_d[wt << 1], eval_zero_or_big); 312a2b0a27dSPhilippe Mathieu-Daudé tcg_gen_andc_i64(t0, t0, msa_wr_d[wt << 1]); 313a2b0a27dSPhilippe Mathieu-Daudé tcg_gen_andi_i64(t0, t0, eval_big); 314a2b0a27dSPhilippe Mathieu-Daudé tcg_gen_subi_i64(t1, msa_wr_d[(wt << 1) + 1], eval_zero_or_big); 315a2b0a27dSPhilippe Mathieu-Daudé tcg_gen_andc_i64(t1, t1, msa_wr_d[(wt << 1) + 1]); 316a2b0a27dSPhilippe Mathieu-Daudé tcg_gen_andi_i64(t1, t1, eval_big); 317a2b0a27dSPhilippe Mathieu-Daudé tcg_gen_or_i64(t0, t0, t1); 318a2b0a27dSPhilippe Mathieu-Daudé /* if all bits are zero then all elements are not zero */ 319a2b0a27dSPhilippe Mathieu-Daudé /* if some bit is non-zero then some element is zero */ 320a2b0a27dSPhilippe Mathieu-Daudé tcg_gen_setcondi_i64(cond, t0, t0, 0); 321a2b0a27dSPhilippe Mathieu-Daudé tcg_gen_trunc_i64_tl(tresult, t0); 322a2b0a27dSPhilippe Mathieu-Daudé tcg_temp_free_i64(t0); 323a2b0a27dSPhilippe Mathieu-Daudé tcg_temp_free_i64(t1); 324a2b0a27dSPhilippe Mathieu-Daudé } 325a2b0a27dSPhilippe Mathieu-Daudé 326d61566cfSPhilippe Mathieu-Daudé static bool gen_msa_BxZ_V(DisasContext *ctx, int wt, int sa, TCGCond cond) 327a2b0a27dSPhilippe Mathieu-Daudé { 328a2b0a27dSPhilippe Mathieu-Daudé TCGv_i64 t0; 329a2b0a27dSPhilippe Mathieu-Daudé 330340ee8b3SPhilippe Mathieu-Daudé if (!check_msa_enabled(ctx)) { 331340ee8b3SPhilippe Mathieu-Daudé return true; 332340ee8b3SPhilippe Mathieu-Daudé } 333a2b0a27dSPhilippe Mathieu-Daudé 334a2b0a27dSPhilippe Mathieu-Daudé if (ctx->hflags & MIPS_HFLAG_BMASK) { 335a2b0a27dSPhilippe Mathieu-Daudé gen_reserved_instruction(ctx); 336a2b0a27dSPhilippe Mathieu-Daudé return true; 337a2b0a27dSPhilippe Mathieu-Daudé } 338a2b0a27dSPhilippe Mathieu-Daudé t0 = tcg_temp_new_i64(); 339a2b0a27dSPhilippe Mathieu-Daudé tcg_gen_or_i64(t0, msa_wr_d[wt << 1], msa_wr_d[(wt << 1) + 1]); 340a2b0a27dSPhilippe Mathieu-Daudé tcg_gen_setcondi_i64(cond, t0, t0, 0); 341a2b0a27dSPhilippe Mathieu-Daudé tcg_gen_trunc_i64_tl(bcond, t0); 342a2b0a27dSPhilippe Mathieu-Daudé tcg_temp_free_i64(t0); 343a2b0a27dSPhilippe Mathieu-Daudé 344d61566cfSPhilippe Mathieu-Daudé ctx->btarget = ctx->base.pc_next + (sa << 2) + 4; 345a2b0a27dSPhilippe Mathieu-Daudé 346a2b0a27dSPhilippe Mathieu-Daudé ctx->hflags |= MIPS_HFLAG_BC; 347a2b0a27dSPhilippe Mathieu-Daudé ctx->hflags |= MIPS_HFLAG_BDS32; 348a2b0a27dSPhilippe Mathieu-Daudé 349a2b0a27dSPhilippe Mathieu-Daudé return true; 350a2b0a27dSPhilippe Mathieu-Daudé } 351a2b0a27dSPhilippe Mathieu-Daudé 352a2b0a27dSPhilippe Mathieu-Daudé static bool trans_BZ_V(DisasContext *ctx, arg_msa_bz *a) 353a2b0a27dSPhilippe Mathieu-Daudé { 354d61566cfSPhilippe Mathieu-Daudé return gen_msa_BxZ_V(ctx, a->wt, a->sa, TCG_COND_EQ); 355a2b0a27dSPhilippe Mathieu-Daudé } 356a2b0a27dSPhilippe Mathieu-Daudé 357a2b0a27dSPhilippe Mathieu-Daudé static bool trans_BNZ_V(DisasContext *ctx, arg_msa_bz *a) 358a2b0a27dSPhilippe Mathieu-Daudé { 359d61566cfSPhilippe Mathieu-Daudé return gen_msa_BxZ_V(ctx, a->wt, a->sa, TCG_COND_NE); 360a2b0a27dSPhilippe Mathieu-Daudé } 361a2b0a27dSPhilippe Mathieu-Daudé 362d61566cfSPhilippe Mathieu-Daudé static bool gen_msa_BxZ(DisasContext *ctx, int df, int wt, int sa, bool if_not) 363a2b0a27dSPhilippe Mathieu-Daudé { 364340ee8b3SPhilippe Mathieu-Daudé if (!check_msa_enabled(ctx)) { 365340ee8b3SPhilippe Mathieu-Daudé return true; 366340ee8b3SPhilippe Mathieu-Daudé } 367a2b0a27dSPhilippe Mathieu-Daudé 368a2b0a27dSPhilippe Mathieu-Daudé if (ctx->hflags & MIPS_HFLAG_BMASK) { 369a2b0a27dSPhilippe Mathieu-Daudé gen_reserved_instruction(ctx); 370a2b0a27dSPhilippe Mathieu-Daudé return true; 371a2b0a27dSPhilippe Mathieu-Daudé } 372a2b0a27dSPhilippe Mathieu-Daudé 373a2b0a27dSPhilippe Mathieu-Daudé gen_check_zero_element(bcond, df, wt, if_not ? TCG_COND_EQ : TCG_COND_NE); 374a2b0a27dSPhilippe Mathieu-Daudé 375d61566cfSPhilippe Mathieu-Daudé ctx->btarget = ctx->base.pc_next + (sa << 2) + 4; 376a2b0a27dSPhilippe Mathieu-Daudé ctx->hflags |= MIPS_HFLAG_BC; 377a2b0a27dSPhilippe Mathieu-Daudé ctx->hflags |= MIPS_HFLAG_BDS32; 378a2b0a27dSPhilippe Mathieu-Daudé 379a2b0a27dSPhilippe Mathieu-Daudé return true; 380a2b0a27dSPhilippe Mathieu-Daudé } 381a2b0a27dSPhilippe Mathieu-Daudé 382d61566cfSPhilippe Mathieu-Daudé static bool trans_BZ(DisasContext *ctx, arg_msa_bz *a) 383a2b0a27dSPhilippe Mathieu-Daudé { 384d61566cfSPhilippe Mathieu-Daudé return gen_msa_BxZ(ctx, a->df, a->wt, a->sa, false); 385a2b0a27dSPhilippe Mathieu-Daudé } 386a2b0a27dSPhilippe Mathieu-Daudé 387d61566cfSPhilippe Mathieu-Daudé static bool trans_BNZ(DisasContext *ctx, arg_msa_bz *a) 388a2b0a27dSPhilippe Mathieu-Daudé { 389d61566cfSPhilippe Mathieu-Daudé return gen_msa_BxZ(ctx, a->df, a->wt, a->sa, true); 390a2b0a27dSPhilippe Mathieu-Daudé } 391a2b0a27dSPhilippe Mathieu-Daudé 3927cc351ffSPhilippe Mathieu-Daudé static bool trans_msa_i8(DisasContext *ctx, arg_msa_i *a, 3937cc351ffSPhilippe Mathieu-Daudé gen_helper_piii *gen_msa_i8) 394a2b0a27dSPhilippe Mathieu-Daudé { 3957cc351ffSPhilippe Mathieu-Daudé if (!check_msa_enabled(ctx)) { 3967cc351ffSPhilippe Mathieu-Daudé return true; 397a2b0a27dSPhilippe Mathieu-Daudé } 398a2b0a27dSPhilippe Mathieu-Daudé 3997cc351ffSPhilippe Mathieu-Daudé gen_msa_i8(cpu_env, 4007cc351ffSPhilippe Mathieu-Daudé tcg_constant_i32(a->wd), 4017cc351ffSPhilippe Mathieu-Daudé tcg_constant_i32(a->ws), 4027cc351ffSPhilippe Mathieu-Daudé tcg_constant_i32(a->sa)); 4037cc351ffSPhilippe Mathieu-Daudé 4047cc351ffSPhilippe Mathieu-Daudé return true; 405a2b0a27dSPhilippe Mathieu-Daudé } 406a2b0a27dSPhilippe Mathieu-Daudé 4077cc351ffSPhilippe Mathieu-Daudé TRANS(ANDI, trans_msa_i8, gen_helper_msa_andi_b); 4087cc351ffSPhilippe Mathieu-Daudé TRANS(ORI, trans_msa_i8, gen_helper_msa_ori_b); 4097cc351ffSPhilippe Mathieu-Daudé TRANS(NORI, trans_msa_i8, gen_helper_msa_nori_b); 4107cc351ffSPhilippe Mathieu-Daudé TRANS(XORI, trans_msa_i8, gen_helper_msa_xori_b); 4117cc351ffSPhilippe Mathieu-Daudé TRANS(BMNZI, trans_msa_i8, gen_helper_msa_bmnzi_b); 4127cc351ffSPhilippe Mathieu-Daudé TRANS(BMZI, trans_msa_i8, gen_helper_msa_bmzi_b); 4137cc351ffSPhilippe Mathieu-Daudé TRANS(BSELI, trans_msa_i8, gen_helper_msa_bseli_b); 4147cc351ffSPhilippe Mathieu-Daudé 415a9e17958SPhilippe Mathieu-Daudé static bool trans_SHF(DisasContext *ctx, arg_msa_i *a) 416a9e17958SPhilippe Mathieu-Daudé { 417a9e17958SPhilippe Mathieu-Daudé if (a->df == DF_DOUBLE) { 418a9e17958SPhilippe Mathieu-Daudé return false; 419a9e17958SPhilippe Mathieu-Daudé } 420a9e17958SPhilippe Mathieu-Daudé 421a9e17958SPhilippe Mathieu-Daudé if (!check_msa_enabled(ctx)) { 422a9e17958SPhilippe Mathieu-Daudé return true; 423a9e17958SPhilippe Mathieu-Daudé } 424a9e17958SPhilippe Mathieu-Daudé 425a9e17958SPhilippe Mathieu-Daudé gen_helper_msa_shf_df(cpu_env, 426a9e17958SPhilippe Mathieu-Daudé tcg_constant_i32(a->df), 427a9e17958SPhilippe Mathieu-Daudé tcg_constant_i32(a->wd), 428a9e17958SPhilippe Mathieu-Daudé tcg_constant_i32(a->ws), 429a9e17958SPhilippe Mathieu-Daudé tcg_constant_i32(a->sa)); 430a9e17958SPhilippe Mathieu-Daudé 431a9e17958SPhilippe Mathieu-Daudé return true; 432a9e17958SPhilippe Mathieu-Daudé } 433a9e17958SPhilippe Mathieu-Daudé 434b8e74816SPhilippe Mathieu-Daudé static bool trans_msa_i5(DisasContext *ctx, arg_msa_i *a, 435b8e74816SPhilippe Mathieu-Daudé gen_helper_piiii *gen_msa_i5) 436a2b0a27dSPhilippe Mathieu-Daudé { 437b8e74816SPhilippe Mathieu-Daudé if (!check_msa_enabled(ctx)) { 438b8e74816SPhilippe Mathieu-Daudé return true; 439a2b0a27dSPhilippe Mathieu-Daudé } 440a2b0a27dSPhilippe Mathieu-Daudé 441b8e74816SPhilippe Mathieu-Daudé gen_msa_i5(cpu_env, 442b8e74816SPhilippe Mathieu-Daudé tcg_constant_i32(a->df), 443b8e74816SPhilippe Mathieu-Daudé tcg_constant_i32(a->wd), 444b8e74816SPhilippe Mathieu-Daudé tcg_constant_i32(a->ws), 445b8e74816SPhilippe Mathieu-Daudé tcg_constant_i32(a->sa)); 446b8e74816SPhilippe Mathieu-Daudé 447b8e74816SPhilippe Mathieu-Daudé return true; 448a2b0a27dSPhilippe Mathieu-Daudé } 449a2b0a27dSPhilippe Mathieu-Daudé 450b8e74816SPhilippe Mathieu-Daudé TRANS(ADDVI, trans_msa_i5, gen_helper_msa_addvi_df); 451b8e74816SPhilippe Mathieu-Daudé TRANS(SUBVI, trans_msa_i5, gen_helper_msa_subvi_df); 452b8e74816SPhilippe Mathieu-Daudé TRANS(MAXI_S, trans_msa_i5, gen_helper_msa_maxi_s_df); 453b8e74816SPhilippe Mathieu-Daudé TRANS(MAXI_U, trans_msa_i5, gen_helper_msa_maxi_u_df); 454b8e74816SPhilippe Mathieu-Daudé TRANS(MINI_S, trans_msa_i5, gen_helper_msa_mini_s_df); 455b8e74816SPhilippe Mathieu-Daudé TRANS(MINI_U, trans_msa_i5, gen_helper_msa_mini_u_df); 456b8e74816SPhilippe Mathieu-Daudé TRANS(CLTI_S, trans_msa_i5, gen_helper_msa_clti_s_df); 457b8e74816SPhilippe Mathieu-Daudé TRANS(CLTI_U, trans_msa_i5, gen_helper_msa_clti_u_df); 458b8e74816SPhilippe Mathieu-Daudé TRANS(CLEI_S, trans_msa_i5, gen_helper_msa_clei_s_df); 459b8e74816SPhilippe Mathieu-Daudé TRANS(CLEI_U, trans_msa_i5, gen_helper_msa_clei_u_df); 460b8e74816SPhilippe Mathieu-Daudé TRANS(CEQI, trans_msa_i5, gen_helper_msa_ceqi_df); 461b8e74816SPhilippe Mathieu-Daudé 46275094c33SPhilippe Mathieu-Daudé static bool trans_LDI(DisasContext *ctx, arg_msa_ldi *a) 46375094c33SPhilippe Mathieu-Daudé { 46475094c33SPhilippe Mathieu-Daudé if (!check_msa_enabled(ctx)) { 46575094c33SPhilippe Mathieu-Daudé return true; 46675094c33SPhilippe Mathieu-Daudé } 46775094c33SPhilippe Mathieu-Daudé 46875094c33SPhilippe Mathieu-Daudé gen_helper_msa_ldi_df(cpu_env, 46975094c33SPhilippe Mathieu-Daudé tcg_constant_i32(a->df), 47075094c33SPhilippe Mathieu-Daudé tcg_constant_i32(a->wd), 47175094c33SPhilippe Mathieu-Daudé tcg_constant_i32(a->sa)); 47275094c33SPhilippe Mathieu-Daudé 47375094c33SPhilippe Mathieu-Daudé return true; 47475094c33SPhilippe Mathieu-Daudé } 47575094c33SPhilippe Mathieu-Daudé 4764701d23aSPhilippe Mathieu-Daudé static bool trans_msa_bit(DisasContext *ctx, arg_msa_bit *a, 4774701d23aSPhilippe Mathieu-Daudé gen_helper_piiii *gen_msa_bit) 478a2b0a27dSPhilippe Mathieu-Daudé { 4794701d23aSPhilippe Mathieu-Daudé if (a->df < 0) { 4804701d23aSPhilippe Mathieu-Daudé return false; 481a2b0a27dSPhilippe Mathieu-Daudé } 482a2b0a27dSPhilippe Mathieu-Daudé 4834701d23aSPhilippe Mathieu-Daudé if (!check_msa_enabled(ctx)) { 4844701d23aSPhilippe Mathieu-Daudé return true; 485a2b0a27dSPhilippe Mathieu-Daudé } 486a2b0a27dSPhilippe Mathieu-Daudé 4874701d23aSPhilippe Mathieu-Daudé gen_msa_bit(cpu_env, 4884701d23aSPhilippe Mathieu-Daudé tcg_constant_i32(a->df), 4894701d23aSPhilippe Mathieu-Daudé tcg_constant_i32(a->wd), 4904701d23aSPhilippe Mathieu-Daudé tcg_constant_i32(a->ws), 4914701d23aSPhilippe Mathieu-Daudé tcg_constant_i32(a->m)); 4924701d23aSPhilippe Mathieu-Daudé 4934701d23aSPhilippe Mathieu-Daudé return true; 494a2b0a27dSPhilippe Mathieu-Daudé } 495a2b0a27dSPhilippe Mathieu-Daudé 4964701d23aSPhilippe Mathieu-Daudé TRANS(SLLI, trans_msa_bit, gen_helper_msa_slli_df); 4974701d23aSPhilippe Mathieu-Daudé TRANS(SRAI, trans_msa_bit, gen_helper_msa_srai_df); 4984701d23aSPhilippe Mathieu-Daudé TRANS(SRLI, trans_msa_bit, gen_helper_msa_srli_df); 4994701d23aSPhilippe Mathieu-Daudé TRANS(BCLRI, trans_msa_bit, gen_helper_msa_bclri_df); 5004701d23aSPhilippe Mathieu-Daudé TRANS(BSETI, trans_msa_bit, gen_helper_msa_bseti_df); 5014701d23aSPhilippe Mathieu-Daudé TRANS(BNEGI, trans_msa_bit, gen_helper_msa_bnegi_df); 5024701d23aSPhilippe Mathieu-Daudé TRANS(BINSLI, trans_msa_bit, gen_helper_msa_binsli_df); 5034701d23aSPhilippe Mathieu-Daudé TRANS(BINSRI, trans_msa_bit, gen_helper_msa_binsri_df); 5044701d23aSPhilippe Mathieu-Daudé TRANS(SAT_S, trans_msa_bit, gen_helper_msa_sat_u_df); 5054701d23aSPhilippe Mathieu-Daudé TRANS(SAT_U, trans_msa_bit, gen_helper_msa_sat_u_df); 5064701d23aSPhilippe Mathieu-Daudé TRANS(SRARI, trans_msa_bit, gen_helper_msa_srari_df); 5074701d23aSPhilippe Mathieu-Daudé TRANS(SRLRI, trans_msa_bit, gen_helper_msa_srlri_df); 5084701d23aSPhilippe Mathieu-Daudé 509*ff29e5d3SPhilippe Mathieu-Daudé static bool trans_msa_3rf(DisasContext *ctx, arg_msa_r *a, 510*ff29e5d3SPhilippe Mathieu-Daudé gen_helper_piiii *gen_msa_3rf) 511*ff29e5d3SPhilippe Mathieu-Daudé { 512*ff29e5d3SPhilippe Mathieu-Daudé if (!check_msa_enabled(ctx)) { 513*ff29e5d3SPhilippe Mathieu-Daudé return true; 514*ff29e5d3SPhilippe Mathieu-Daudé } 515*ff29e5d3SPhilippe Mathieu-Daudé 516*ff29e5d3SPhilippe Mathieu-Daudé gen_msa_3rf(cpu_env, 517*ff29e5d3SPhilippe Mathieu-Daudé tcg_constant_i32(a->df), 518*ff29e5d3SPhilippe Mathieu-Daudé tcg_constant_i32(a->wd), 519*ff29e5d3SPhilippe Mathieu-Daudé tcg_constant_i32(a->ws), 520*ff29e5d3SPhilippe Mathieu-Daudé tcg_constant_i32(a->wt)); 521*ff29e5d3SPhilippe Mathieu-Daudé 522*ff29e5d3SPhilippe Mathieu-Daudé return true; 523*ff29e5d3SPhilippe Mathieu-Daudé } 524*ff29e5d3SPhilippe Mathieu-Daudé 5257acb5c78SPhilippe Mathieu-Daudé static bool trans_msa_3r(DisasContext *ctx, arg_msa_r *a, 5267acb5c78SPhilippe Mathieu-Daudé gen_helper_piii *gen_msa_3r) 5277acb5c78SPhilippe Mathieu-Daudé { 5287acb5c78SPhilippe Mathieu-Daudé if (!check_msa_enabled(ctx)) { 5297acb5c78SPhilippe Mathieu-Daudé return true; 5307acb5c78SPhilippe Mathieu-Daudé } 5317acb5c78SPhilippe Mathieu-Daudé 5327acb5c78SPhilippe Mathieu-Daudé gen_msa_3r(cpu_env, 5337acb5c78SPhilippe Mathieu-Daudé tcg_constant_i32(a->wd), 5347acb5c78SPhilippe Mathieu-Daudé tcg_constant_i32(a->ws), 5357acb5c78SPhilippe Mathieu-Daudé tcg_constant_i32(a->wt)); 5367acb5c78SPhilippe Mathieu-Daudé 5377acb5c78SPhilippe Mathieu-Daudé return true; 5387acb5c78SPhilippe Mathieu-Daudé } 5397acb5c78SPhilippe Mathieu-Daudé 5407acb5c78SPhilippe Mathieu-Daudé TRANS(AND_V, trans_msa_3r, gen_helper_msa_and_v); 5417acb5c78SPhilippe Mathieu-Daudé TRANS(OR_V, trans_msa_3r, gen_helper_msa_or_v); 5427acb5c78SPhilippe Mathieu-Daudé TRANS(NOR_V, trans_msa_3r, gen_helper_msa_nor_v); 5437acb5c78SPhilippe Mathieu-Daudé TRANS(XOR_V, trans_msa_3r, gen_helper_msa_xor_v); 5447acb5c78SPhilippe Mathieu-Daudé TRANS(BMNZ_V, trans_msa_3r, gen_helper_msa_bmnz_v); 5457acb5c78SPhilippe Mathieu-Daudé TRANS(BMZ_V, trans_msa_3r, gen_helper_msa_bmz_v); 5467acb5c78SPhilippe Mathieu-Daudé TRANS(BSEL_V, trans_msa_3r, gen_helper_msa_bsel_v); 5477acb5c78SPhilippe Mathieu-Daudé 548a2b0a27dSPhilippe Mathieu-Daudé static void gen_msa_3r(DisasContext *ctx) 549a2b0a27dSPhilippe Mathieu-Daudé { 550a2b0a27dSPhilippe Mathieu-Daudé #define MASK_MSA_3R(op) (MASK_MSA_MINOR(op) | (op & (0x7 << 23))) 551a2b0a27dSPhilippe Mathieu-Daudé uint8_t df = (ctx->opcode >> 21) & 0x3; 552a2b0a27dSPhilippe Mathieu-Daudé uint8_t wt = (ctx->opcode >> 16) & 0x1f; 553a2b0a27dSPhilippe Mathieu-Daudé uint8_t ws = (ctx->opcode >> 11) & 0x1f; 554a2b0a27dSPhilippe Mathieu-Daudé uint8_t wd = (ctx->opcode >> 6) & 0x1f; 555a2b0a27dSPhilippe Mathieu-Daudé 556a2b0a27dSPhilippe Mathieu-Daudé TCGv_i32 tdf = tcg_const_i32(df); 557a2b0a27dSPhilippe Mathieu-Daudé TCGv_i32 twd = tcg_const_i32(wd); 558a2b0a27dSPhilippe Mathieu-Daudé TCGv_i32 tws = tcg_const_i32(ws); 559a2b0a27dSPhilippe Mathieu-Daudé TCGv_i32 twt = tcg_const_i32(wt); 560a2b0a27dSPhilippe Mathieu-Daudé 561a2b0a27dSPhilippe Mathieu-Daudé switch (MASK_MSA_3R(ctx->opcode)) { 562a2b0a27dSPhilippe Mathieu-Daudé case OPC_BINSL_df: 563a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 564a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 565a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_binsl_b(cpu_env, twd, tws, twt); 566a2b0a27dSPhilippe Mathieu-Daudé break; 567a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 568a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_binsl_h(cpu_env, twd, tws, twt); 569a2b0a27dSPhilippe Mathieu-Daudé break; 570a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 571a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_binsl_w(cpu_env, twd, tws, twt); 572a2b0a27dSPhilippe Mathieu-Daudé break; 573a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 574a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_binsl_d(cpu_env, twd, tws, twt); 575a2b0a27dSPhilippe Mathieu-Daudé break; 576a2b0a27dSPhilippe Mathieu-Daudé } 577a2b0a27dSPhilippe Mathieu-Daudé break; 578a2b0a27dSPhilippe Mathieu-Daudé case OPC_BINSR_df: 579a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 580a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 581a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_binsr_b(cpu_env, twd, tws, twt); 582a2b0a27dSPhilippe Mathieu-Daudé break; 583a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 584a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_binsr_h(cpu_env, twd, tws, twt); 585a2b0a27dSPhilippe Mathieu-Daudé break; 586a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 587a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_binsr_w(cpu_env, twd, tws, twt); 588a2b0a27dSPhilippe Mathieu-Daudé break; 589a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 590a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_binsr_d(cpu_env, twd, tws, twt); 591a2b0a27dSPhilippe Mathieu-Daudé break; 592a2b0a27dSPhilippe Mathieu-Daudé } 593a2b0a27dSPhilippe Mathieu-Daudé break; 594a2b0a27dSPhilippe Mathieu-Daudé case OPC_BCLR_df: 595a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 596a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 597a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_bclr_b(cpu_env, twd, tws, twt); 598a2b0a27dSPhilippe Mathieu-Daudé break; 599a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 600a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_bclr_h(cpu_env, twd, tws, twt); 601a2b0a27dSPhilippe Mathieu-Daudé break; 602a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 603a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_bclr_w(cpu_env, twd, tws, twt); 604a2b0a27dSPhilippe Mathieu-Daudé break; 605a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 606a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_bclr_d(cpu_env, twd, tws, twt); 607a2b0a27dSPhilippe Mathieu-Daudé break; 608a2b0a27dSPhilippe Mathieu-Daudé } 609a2b0a27dSPhilippe Mathieu-Daudé break; 610a2b0a27dSPhilippe Mathieu-Daudé case OPC_BNEG_df: 611a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 612a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 613a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_bneg_b(cpu_env, twd, tws, twt); 614a2b0a27dSPhilippe Mathieu-Daudé break; 615a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 616a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_bneg_h(cpu_env, twd, tws, twt); 617a2b0a27dSPhilippe Mathieu-Daudé break; 618a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 619a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_bneg_w(cpu_env, twd, tws, twt); 620a2b0a27dSPhilippe Mathieu-Daudé break; 621a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 622a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_bneg_d(cpu_env, twd, tws, twt); 623a2b0a27dSPhilippe Mathieu-Daudé break; 624a2b0a27dSPhilippe Mathieu-Daudé } 625a2b0a27dSPhilippe Mathieu-Daudé break; 626a2b0a27dSPhilippe Mathieu-Daudé case OPC_BSET_df: 627a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 628a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 629a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_bset_b(cpu_env, twd, tws, twt); 630a2b0a27dSPhilippe Mathieu-Daudé break; 631a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 632a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_bset_h(cpu_env, twd, tws, twt); 633a2b0a27dSPhilippe Mathieu-Daudé break; 634a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 635a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_bset_w(cpu_env, twd, tws, twt); 636a2b0a27dSPhilippe Mathieu-Daudé break; 637a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 638a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_bset_d(cpu_env, twd, tws, twt); 639a2b0a27dSPhilippe Mathieu-Daudé break; 640a2b0a27dSPhilippe Mathieu-Daudé } 641a2b0a27dSPhilippe Mathieu-Daudé break; 642a2b0a27dSPhilippe Mathieu-Daudé case OPC_ADD_A_df: 643a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 644a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 645a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_add_a_b(cpu_env, twd, tws, twt); 646a2b0a27dSPhilippe Mathieu-Daudé break; 647a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 648a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_add_a_h(cpu_env, twd, tws, twt); 649a2b0a27dSPhilippe Mathieu-Daudé break; 650a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 651a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_add_a_w(cpu_env, twd, tws, twt); 652a2b0a27dSPhilippe Mathieu-Daudé break; 653a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 654a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_add_a_d(cpu_env, twd, tws, twt); 655a2b0a27dSPhilippe Mathieu-Daudé break; 656a2b0a27dSPhilippe Mathieu-Daudé } 657a2b0a27dSPhilippe Mathieu-Daudé break; 658a2b0a27dSPhilippe Mathieu-Daudé case OPC_ADDS_A_df: 659a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 660a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 661a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_adds_a_b(cpu_env, twd, tws, twt); 662a2b0a27dSPhilippe Mathieu-Daudé break; 663a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 664a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_adds_a_h(cpu_env, twd, tws, twt); 665a2b0a27dSPhilippe Mathieu-Daudé break; 666a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 667a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_adds_a_w(cpu_env, twd, tws, twt); 668a2b0a27dSPhilippe Mathieu-Daudé break; 669a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 670a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_adds_a_d(cpu_env, twd, tws, twt); 671a2b0a27dSPhilippe Mathieu-Daudé break; 672a2b0a27dSPhilippe Mathieu-Daudé } 673a2b0a27dSPhilippe Mathieu-Daudé break; 674a2b0a27dSPhilippe Mathieu-Daudé case OPC_ADDS_S_df: 675a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 676a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 677a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_adds_s_b(cpu_env, twd, tws, twt); 678a2b0a27dSPhilippe Mathieu-Daudé break; 679a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 680a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_adds_s_h(cpu_env, twd, tws, twt); 681a2b0a27dSPhilippe Mathieu-Daudé break; 682a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 683a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_adds_s_w(cpu_env, twd, tws, twt); 684a2b0a27dSPhilippe Mathieu-Daudé break; 685a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 686a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_adds_s_d(cpu_env, twd, tws, twt); 687a2b0a27dSPhilippe Mathieu-Daudé break; 688a2b0a27dSPhilippe Mathieu-Daudé } 689a2b0a27dSPhilippe Mathieu-Daudé break; 690a2b0a27dSPhilippe Mathieu-Daudé case OPC_ADDS_U_df: 691a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 692a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 693a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_adds_u_b(cpu_env, twd, tws, twt); 694a2b0a27dSPhilippe Mathieu-Daudé break; 695a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 696a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_adds_u_h(cpu_env, twd, tws, twt); 697a2b0a27dSPhilippe Mathieu-Daudé break; 698a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 699a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_adds_u_w(cpu_env, twd, tws, twt); 700a2b0a27dSPhilippe Mathieu-Daudé break; 701a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 702a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_adds_u_d(cpu_env, twd, tws, twt); 703a2b0a27dSPhilippe Mathieu-Daudé break; 704a2b0a27dSPhilippe Mathieu-Daudé } 705a2b0a27dSPhilippe Mathieu-Daudé break; 706a2b0a27dSPhilippe Mathieu-Daudé case OPC_ADDV_df: 707a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 708a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 709a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_addv_b(cpu_env, twd, tws, twt); 710a2b0a27dSPhilippe Mathieu-Daudé break; 711a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 712a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_addv_h(cpu_env, twd, tws, twt); 713a2b0a27dSPhilippe Mathieu-Daudé break; 714a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 715a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_addv_w(cpu_env, twd, tws, twt); 716a2b0a27dSPhilippe Mathieu-Daudé break; 717a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 718a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_addv_d(cpu_env, twd, tws, twt); 719a2b0a27dSPhilippe Mathieu-Daudé break; 720a2b0a27dSPhilippe Mathieu-Daudé } 721a2b0a27dSPhilippe Mathieu-Daudé break; 722a2b0a27dSPhilippe Mathieu-Daudé case OPC_AVE_S_df: 723a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 724a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 725a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ave_s_b(cpu_env, twd, tws, twt); 726a2b0a27dSPhilippe Mathieu-Daudé break; 727a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 728a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ave_s_h(cpu_env, twd, tws, twt); 729a2b0a27dSPhilippe Mathieu-Daudé break; 730a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 731a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ave_s_w(cpu_env, twd, tws, twt); 732a2b0a27dSPhilippe Mathieu-Daudé break; 733a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 734a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ave_s_d(cpu_env, twd, tws, twt); 735a2b0a27dSPhilippe Mathieu-Daudé break; 736a2b0a27dSPhilippe Mathieu-Daudé } 737a2b0a27dSPhilippe Mathieu-Daudé break; 738a2b0a27dSPhilippe Mathieu-Daudé case OPC_AVE_U_df: 739a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 740a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 741a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ave_u_b(cpu_env, twd, tws, twt); 742a2b0a27dSPhilippe Mathieu-Daudé break; 743a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 744a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ave_u_h(cpu_env, twd, tws, twt); 745a2b0a27dSPhilippe Mathieu-Daudé break; 746a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 747a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ave_u_w(cpu_env, twd, tws, twt); 748a2b0a27dSPhilippe Mathieu-Daudé break; 749a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 750a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ave_u_d(cpu_env, twd, tws, twt); 751a2b0a27dSPhilippe Mathieu-Daudé break; 752a2b0a27dSPhilippe Mathieu-Daudé } 753a2b0a27dSPhilippe Mathieu-Daudé break; 754a2b0a27dSPhilippe Mathieu-Daudé case OPC_AVER_S_df: 755a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 756a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 757a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_aver_s_b(cpu_env, twd, tws, twt); 758a2b0a27dSPhilippe Mathieu-Daudé break; 759a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 760a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_aver_s_h(cpu_env, twd, tws, twt); 761a2b0a27dSPhilippe Mathieu-Daudé break; 762a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 763a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_aver_s_w(cpu_env, twd, tws, twt); 764a2b0a27dSPhilippe Mathieu-Daudé break; 765a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 766a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_aver_s_d(cpu_env, twd, tws, twt); 767a2b0a27dSPhilippe Mathieu-Daudé break; 768a2b0a27dSPhilippe Mathieu-Daudé } 769a2b0a27dSPhilippe Mathieu-Daudé break; 770a2b0a27dSPhilippe Mathieu-Daudé case OPC_AVER_U_df: 771a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 772a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 773a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_aver_u_b(cpu_env, twd, tws, twt); 774a2b0a27dSPhilippe Mathieu-Daudé break; 775a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 776a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_aver_u_h(cpu_env, twd, tws, twt); 777a2b0a27dSPhilippe Mathieu-Daudé break; 778a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 779a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_aver_u_w(cpu_env, twd, tws, twt); 780a2b0a27dSPhilippe Mathieu-Daudé break; 781a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 782a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_aver_u_d(cpu_env, twd, tws, twt); 783a2b0a27dSPhilippe Mathieu-Daudé break; 784a2b0a27dSPhilippe Mathieu-Daudé } 785a2b0a27dSPhilippe Mathieu-Daudé break; 786a2b0a27dSPhilippe Mathieu-Daudé case OPC_CEQ_df: 787a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 788a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 789a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ceq_b(cpu_env, twd, tws, twt); 790a2b0a27dSPhilippe Mathieu-Daudé break; 791a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 792a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ceq_h(cpu_env, twd, tws, twt); 793a2b0a27dSPhilippe Mathieu-Daudé break; 794a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 795a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ceq_w(cpu_env, twd, tws, twt); 796a2b0a27dSPhilippe Mathieu-Daudé break; 797a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 798a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ceq_d(cpu_env, twd, tws, twt); 799a2b0a27dSPhilippe Mathieu-Daudé break; 800a2b0a27dSPhilippe Mathieu-Daudé } 801a2b0a27dSPhilippe Mathieu-Daudé break; 802a2b0a27dSPhilippe Mathieu-Daudé case OPC_CLE_S_df: 803a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 804a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 805a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_cle_s_b(cpu_env, twd, tws, twt); 806a2b0a27dSPhilippe Mathieu-Daudé break; 807a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 808a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_cle_s_h(cpu_env, twd, tws, twt); 809a2b0a27dSPhilippe Mathieu-Daudé break; 810a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 811a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_cle_s_w(cpu_env, twd, tws, twt); 812a2b0a27dSPhilippe Mathieu-Daudé break; 813a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 814a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_cle_s_d(cpu_env, twd, tws, twt); 815a2b0a27dSPhilippe Mathieu-Daudé break; 816a2b0a27dSPhilippe Mathieu-Daudé } 817a2b0a27dSPhilippe Mathieu-Daudé break; 818a2b0a27dSPhilippe Mathieu-Daudé case OPC_CLE_U_df: 819a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 820a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 821a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_cle_u_b(cpu_env, twd, tws, twt); 822a2b0a27dSPhilippe Mathieu-Daudé break; 823a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 824a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_cle_u_h(cpu_env, twd, tws, twt); 825a2b0a27dSPhilippe Mathieu-Daudé break; 826a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 827a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_cle_u_w(cpu_env, twd, tws, twt); 828a2b0a27dSPhilippe Mathieu-Daudé break; 829a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 830a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_cle_u_d(cpu_env, twd, tws, twt); 831a2b0a27dSPhilippe Mathieu-Daudé break; 832a2b0a27dSPhilippe Mathieu-Daudé } 833a2b0a27dSPhilippe Mathieu-Daudé break; 834a2b0a27dSPhilippe Mathieu-Daudé case OPC_CLT_S_df: 835a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 836a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 837a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_clt_s_b(cpu_env, twd, tws, twt); 838a2b0a27dSPhilippe Mathieu-Daudé break; 839a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 840a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_clt_s_h(cpu_env, twd, tws, twt); 841a2b0a27dSPhilippe Mathieu-Daudé break; 842a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 843a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_clt_s_w(cpu_env, twd, tws, twt); 844a2b0a27dSPhilippe Mathieu-Daudé break; 845a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 846a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_clt_s_d(cpu_env, twd, tws, twt); 847a2b0a27dSPhilippe Mathieu-Daudé break; 848a2b0a27dSPhilippe Mathieu-Daudé } 849a2b0a27dSPhilippe Mathieu-Daudé break; 850a2b0a27dSPhilippe Mathieu-Daudé case OPC_CLT_U_df: 851a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 852a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 853a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_clt_u_b(cpu_env, twd, tws, twt); 854a2b0a27dSPhilippe Mathieu-Daudé break; 855a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 856a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_clt_u_h(cpu_env, twd, tws, twt); 857a2b0a27dSPhilippe Mathieu-Daudé break; 858a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 859a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_clt_u_w(cpu_env, twd, tws, twt); 860a2b0a27dSPhilippe Mathieu-Daudé break; 861a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 862a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_clt_u_d(cpu_env, twd, tws, twt); 863a2b0a27dSPhilippe Mathieu-Daudé break; 864a2b0a27dSPhilippe Mathieu-Daudé } 865a2b0a27dSPhilippe Mathieu-Daudé break; 866a2b0a27dSPhilippe Mathieu-Daudé case OPC_DIV_S_df: 867a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 868a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 869a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_div_s_b(cpu_env, twd, tws, twt); 870a2b0a27dSPhilippe Mathieu-Daudé break; 871a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 872a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_div_s_h(cpu_env, twd, tws, twt); 873a2b0a27dSPhilippe Mathieu-Daudé break; 874a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 875a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_div_s_w(cpu_env, twd, tws, twt); 876a2b0a27dSPhilippe Mathieu-Daudé break; 877a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 878a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_div_s_d(cpu_env, twd, tws, twt); 879a2b0a27dSPhilippe Mathieu-Daudé break; 880a2b0a27dSPhilippe Mathieu-Daudé } 881a2b0a27dSPhilippe Mathieu-Daudé break; 882a2b0a27dSPhilippe Mathieu-Daudé case OPC_DIV_U_df: 883a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 884a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 885a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_div_u_b(cpu_env, twd, tws, twt); 886a2b0a27dSPhilippe Mathieu-Daudé break; 887a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 888a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_div_u_h(cpu_env, twd, tws, twt); 889a2b0a27dSPhilippe Mathieu-Daudé break; 890a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 891a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_div_u_w(cpu_env, twd, tws, twt); 892a2b0a27dSPhilippe Mathieu-Daudé break; 893a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 894a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_div_u_d(cpu_env, twd, tws, twt); 895a2b0a27dSPhilippe Mathieu-Daudé break; 896a2b0a27dSPhilippe Mathieu-Daudé } 897a2b0a27dSPhilippe Mathieu-Daudé break; 898a2b0a27dSPhilippe Mathieu-Daudé case OPC_MAX_A_df: 899a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 900a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 901a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_max_a_b(cpu_env, twd, tws, twt); 902a2b0a27dSPhilippe Mathieu-Daudé break; 903a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 904a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_max_a_h(cpu_env, twd, tws, twt); 905a2b0a27dSPhilippe Mathieu-Daudé break; 906a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 907a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_max_a_w(cpu_env, twd, tws, twt); 908a2b0a27dSPhilippe Mathieu-Daudé break; 909a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 910a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_max_a_d(cpu_env, twd, tws, twt); 911a2b0a27dSPhilippe Mathieu-Daudé break; 912a2b0a27dSPhilippe Mathieu-Daudé } 913a2b0a27dSPhilippe Mathieu-Daudé break; 914a2b0a27dSPhilippe Mathieu-Daudé case OPC_MAX_S_df: 915a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 916a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 917a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_max_s_b(cpu_env, twd, tws, twt); 918a2b0a27dSPhilippe Mathieu-Daudé break; 919a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 920a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_max_s_h(cpu_env, twd, tws, twt); 921a2b0a27dSPhilippe Mathieu-Daudé break; 922a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 923a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_max_s_w(cpu_env, twd, tws, twt); 924a2b0a27dSPhilippe Mathieu-Daudé break; 925a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 926a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_max_s_d(cpu_env, twd, tws, twt); 927a2b0a27dSPhilippe Mathieu-Daudé break; 928a2b0a27dSPhilippe Mathieu-Daudé } 929a2b0a27dSPhilippe Mathieu-Daudé break; 930a2b0a27dSPhilippe Mathieu-Daudé case OPC_MAX_U_df: 931a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 932a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 933a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_max_u_b(cpu_env, twd, tws, twt); 934a2b0a27dSPhilippe Mathieu-Daudé break; 935a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 936a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_max_u_h(cpu_env, twd, tws, twt); 937a2b0a27dSPhilippe Mathieu-Daudé break; 938a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 939a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_max_u_w(cpu_env, twd, tws, twt); 940a2b0a27dSPhilippe Mathieu-Daudé break; 941a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 942a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_max_u_d(cpu_env, twd, tws, twt); 943a2b0a27dSPhilippe Mathieu-Daudé break; 944a2b0a27dSPhilippe Mathieu-Daudé } 945a2b0a27dSPhilippe Mathieu-Daudé break; 946a2b0a27dSPhilippe Mathieu-Daudé case OPC_MIN_A_df: 947a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 948a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 949a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_min_a_b(cpu_env, twd, tws, twt); 950a2b0a27dSPhilippe Mathieu-Daudé break; 951a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 952a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_min_a_h(cpu_env, twd, tws, twt); 953a2b0a27dSPhilippe Mathieu-Daudé break; 954a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 955a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_min_a_w(cpu_env, twd, tws, twt); 956a2b0a27dSPhilippe Mathieu-Daudé break; 957a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 958a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_min_a_d(cpu_env, twd, tws, twt); 959a2b0a27dSPhilippe Mathieu-Daudé break; 960a2b0a27dSPhilippe Mathieu-Daudé } 961a2b0a27dSPhilippe Mathieu-Daudé break; 962a2b0a27dSPhilippe Mathieu-Daudé case OPC_MIN_S_df: 963a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 964a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 965a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_min_s_b(cpu_env, twd, tws, twt); 966a2b0a27dSPhilippe Mathieu-Daudé break; 967a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 968a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_min_s_h(cpu_env, twd, tws, twt); 969a2b0a27dSPhilippe Mathieu-Daudé break; 970a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 971a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_min_s_w(cpu_env, twd, tws, twt); 972a2b0a27dSPhilippe Mathieu-Daudé break; 973a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 974a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_min_s_d(cpu_env, twd, tws, twt); 975a2b0a27dSPhilippe Mathieu-Daudé break; 976a2b0a27dSPhilippe Mathieu-Daudé } 977a2b0a27dSPhilippe Mathieu-Daudé break; 978a2b0a27dSPhilippe Mathieu-Daudé case OPC_MIN_U_df: 979a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 980a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 981a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_min_u_b(cpu_env, twd, tws, twt); 982a2b0a27dSPhilippe Mathieu-Daudé break; 983a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 984a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_min_u_h(cpu_env, twd, tws, twt); 985a2b0a27dSPhilippe Mathieu-Daudé break; 986a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 987a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_min_u_w(cpu_env, twd, tws, twt); 988a2b0a27dSPhilippe Mathieu-Daudé break; 989a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 990a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_min_u_d(cpu_env, twd, tws, twt); 991a2b0a27dSPhilippe Mathieu-Daudé break; 992a2b0a27dSPhilippe Mathieu-Daudé } 993a2b0a27dSPhilippe Mathieu-Daudé break; 994a2b0a27dSPhilippe Mathieu-Daudé case OPC_MOD_S_df: 995a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 996a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 997a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_mod_s_b(cpu_env, twd, tws, twt); 998a2b0a27dSPhilippe Mathieu-Daudé break; 999a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1000a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_mod_s_h(cpu_env, twd, tws, twt); 1001a2b0a27dSPhilippe Mathieu-Daudé break; 1002a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1003a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_mod_s_w(cpu_env, twd, tws, twt); 1004a2b0a27dSPhilippe Mathieu-Daudé break; 1005a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1006a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_mod_s_d(cpu_env, twd, tws, twt); 1007a2b0a27dSPhilippe Mathieu-Daudé break; 1008a2b0a27dSPhilippe Mathieu-Daudé } 1009a2b0a27dSPhilippe Mathieu-Daudé break; 1010a2b0a27dSPhilippe Mathieu-Daudé case OPC_MOD_U_df: 1011a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1012a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 1013a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_mod_u_b(cpu_env, twd, tws, twt); 1014a2b0a27dSPhilippe Mathieu-Daudé break; 1015a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1016a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_mod_u_h(cpu_env, twd, tws, twt); 1017a2b0a27dSPhilippe Mathieu-Daudé break; 1018a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1019a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_mod_u_w(cpu_env, twd, tws, twt); 1020a2b0a27dSPhilippe Mathieu-Daudé break; 1021a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1022a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_mod_u_d(cpu_env, twd, tws, twt); 1023a2b0a27dSPhilippe Mathieu-Daudé break; 1024a2b0a27dSPhilippe Mathieu-Daudé } 1025a2b0a27dSPhilippe Mathieu-Daudé break; 1026a2b0a27dSPhilippe Mathieu-Daudé case OPC_MADDV_df: 1027a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1028a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 1029a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_maddv_b(cpu_env, twd, tws, twt); 1030a2b0a27dSPhilippe Mathieu-Daudé break; 1031a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1032a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_maddv_h(cpu_env, twd, tws, twt); 1033a2b0a27dSPhilippe Mathieu-Daudé break; 1034a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1035a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_maddv_w(cpu_env, twd, tws, twt); 1036a2b0a27dSPhilippe Mathieu-Daudé break; 1037a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1038a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_maddv_d(cpu_env, twd, tws, twt); 1039a2b0a27dSPhilippe Mathieu-Daudé break; 1040a2b0a27dSPhilippe Mathieu-Daudé } 1041a2b0a27dSPhilippe Mathieu-Daudé break; 1042a2b0a27dSPhilippe Mathieu-Daudé case OPC_MSUBV_df: 1043a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1044a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 1045a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_msubv_b(cpu_env, twd, tws, twt); 1046a2b0a27dSPhilippe Mathieu-Daudé break; 1047a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1048a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_msubv_h(cpu_env, twd, tws, twt); 1049a2b0a27dSPhilippe Mathieu-Daudé break; 1050a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1051a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_msubv_w(cpu_env, twd, tws, twt); 1052a2b0a27dSPhilippe Mathieu-Daudé break; 1053a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1054a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_msubv_d(cpu_env, twd, tws, twt); 1055a2b0a27dSPhilippe Mathieu-Daudé break; 1056a2b0a27dSPhilippe Mathieu-Daudé } 1057a2b0a27dSPhilippe Mathieu-Daudé break; 1058a2b0a27dSPhilippe Mathieu-Daudé case OPC_ASUB_S_df: 1059a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1060a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 1061a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_asub_s_b(cpu_env, twd, tws, twt); 1062a2b0a27dSPhilippe Mathieu-Daudé break; 1063a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1064a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_asub_s_h(cpu_env, twd, tws, twt); 1065a2b0a27dSPhilippe Mathieu-Daudé break; 1066a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1067a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_asub_s_w(cpu_env, twd, tws, twt); 1068a2b0a27dSPhilippe Mathieu-Daudé break; 1069a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1070a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_asub_s_d(cpu_env, twd, tws, twt); 1071a2b0a27dSPhilippe Mathieu-Daudé break; 1072a2b0a27dSPhilippe Mathieu-Daudé } 1073a2b0a27dSPhilippe Mathieu-Daudé break; 1074a2b0a27dSPhilippe Mathieu-Daudé case OPC_ASUB_U_df: 1075a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1076a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 1077a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_asub_u_b(cpu_env, twd, tws, twt); 1078a2b0a27dSPhilippe Mathieu-Daudé break; 1079a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1080a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_asub_u_h(cpu_env, twd, tws, twt); 1081a2b0a27dSPhilippe Mathieu-Daudé break; 1082a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1083a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_asub_u_w(cpu_env, twd, tws, twt); 1084a2b0a27dSPhilippe Mathieu-Daudé break; 1085a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1086a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_asub_u_d(cpu_env, twd, tws, twt); 1087a2b0a27dSPhilippe Mathieu-Daudé break; 1088a2b0a27dSPhilippe Mathieu-Daudé } 1089a2b0a27dSPhilippe Mathieu-Daudé break; 1090a2b0a27dSPhilippe Mathieu-Daudé case OPC_ILVEV_df: 1091a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1092a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 1093a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ilvev_b(cpu_env, twd, tws, twt); 1094a2b0a27dSPhilippe Mathieu-Daudé break; 1095a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1096a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ilvev_h(cpu_env, twd, tws, twt); 1097a2b0a27dSPhilippe Mathieu-Daudé break; 1098a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1099a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ilvev_w(cpu_env, twd, tws, twt); 1100a2b0a27dSPhilippe Mathieu-Daudé break; 1101a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1102a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ilvev_d(cpu_env, twd, tws, twt); 1103a2b0a27dSPhilippe Mathieu-Daudé break; 1104a2b0a27dSPhilippe Mathieu-Daudé } 1105a2b0a27dSPhilippe Mathieu-Daudé break; 1106a2b0a27dSPhilippe Mathieu-Daudé case OPC_ILVOD_df: 1107a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1108a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 1109a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ilvod_b(cpu_env, twd, tws, twt); 1110a2b0a27dSPhilippe Mathieu-Daudé break; 1111a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1112a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ilvod_h(cpu_env, twd, tws, twt); 1113a2b0a27dSPhilippe Mathieu-Daudé break; 1114a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1115a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ilvod_w(cpu_env, twd, tws, twt); 1116a2b0a27dSPhilippe Mathieu-Daudé break; 1117a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1118a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ilvod_d(cpu_env, twd, tws, twt); 1119a2b0a27dSPhilippe Mathieu-Daudé break; 1120a2b0a27dSPhilippe Mathieu-Daudé } 1121a2b0a27dSPhilippe Mathieu-Daudé break; 1122a2b0a27dSPhilippe Mathieu-Daudé case OPC_ILVL_df: 1123a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1124a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 1125a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ilvl_b(cpu_env, twd, tws, twt); 1126a2b0a27dSPhilippe Mathieu-Daudé break; 1127a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1128a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ilvl_h(cpu_env, twd, tws, twt); 1129a2b0a27dSPhilippe Mathieu-Daudé break; 1130a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1131a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ilvl_w(cpu_env, twd, tws, twt); 1132a2b0a27dSPhilippe Mathieu-Daudé break; 1133a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1134a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ilvl_d(cpu_env, twd, tws, twt); 1135a2b0a27dSPhilippe Mathieu-Daudé break; 1136a2b0a27dSPhilippe Mathieu-Daudé } 1137a2b0a27dSPhilippe Mathieu-Daudé break; 1138a2b0a27dSPhilippe Mathieu-Daudé case OPC_ILVR_df: 1139a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1140a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 1141a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ilvr_b(cpu_env, twd, tws, twt); 1142a2b0a27dSPhilippe Mathieu-Daudé break; 1143a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1144a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ilvr_h(cpu_env, twd, tws, twt); 1145a2b0a27dSPhilippe Mathieu-Daudé break; 1146a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1147a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ilvr_w(cpu_env, twd, tws, twt); 1148a2b0a27dSPhilippe Mathieu-Daudé break; 1149a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1150a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ilvr_d(cpu_env, twd, tws, twt); 1151a2b0a27dSPhilippe Mathieu-Daudé break; 1152a2b0a27dSPhilippe Mathieu-Daudé } 1153a2b0a27dSPhilippe Mathieu-Daudé break; 1154a2b0a27dSPhilippe Mathieu-Daudé case OPC_PCKEV_df: 1155a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1156a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 1157a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_pckev_b(cpu_env, twd, tws, twt); 1158a2b0a27dSPhilippe Mathieu-Daudé break; 1159a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1160a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_pckev_h(cpu_env, twd, tws, twt); 1161a2b0a27dSPhilippe Mathieu-Daudé break; 1162a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1163a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_pckev_w(cpu_env, twd, tws, twt); 1164a2b0a27dSPhilippe Mathieu-Daudé break; 1165a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1166a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_pckev_d(cpu_env, twd, tws, twt); 1167a2b0a27dSPhilippe Mathieu-Daudé break; 1168a2b0a27dSPhilippe Mathieu-Daudé } 1169a2b0a27dSPhilippe Mathieu-Daudé break; 1170a2b0a27dSPhilippe Mathieu-Daudé case OPC_PCKOD_df: 1171a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1172a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 1173a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_pckod_b(cpu_env, twd, tws, twt); 1174a2b0a27dSPhilippe Mathieu-Daudé break; 1175a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1176a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_pckod_h(cpu_env, twd, tws, twt); 1177a2b0a27dSPhilippe Mathieu-Daudé break; 1178a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1179a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_pckod_w(cpu_env, twd, tws, twt); 1180a2b0a27dSPhilippe Mathieu-Daudé break; 1181a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1182a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_pckod_d(cpu_env, twd, tws, twt); 1183a2b0a27dSPhilippe Mathieu-Daudé break; 1184a2b0a27dSPhilippe Mathieu-Daudé } 1185a2b0a27dSPhilippe Mathieu-Daudé break; 1186a2b0a27dSPhilippe Mathieu-Daudé case OPC_SLL_df: 1187a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1188a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 1189a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_sll_b(cpu_env, twd, tws, twt); 1190a2b0a27dSPhilippe Mathieu-Daudé break; 1191a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1192a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_sll_h(cpu_env, twd, tws, twt); 1193a2b0a27dSPhilippe Mathieu-Daudé break; 1194a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1195a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_sll_w(cpu_env, twd, tws, twt); 1196a2b0a27dSPhilippe Mathieu-Daudé break; 1197a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1198a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_sll_d(cpu_env, twd, tws, twt); 1199a2b0a27dSPhilippe Mathieu-Daudé break; 1200a2b0a27dSPhilippe Mathieu-Daudé } 1201a2b0a27dSPhilippe Mathieu-Daudé break; 1202a2b0a27dSPhilippe Mathieu-Daudé case OPC_SRA_df: 1203a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1204a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 1205a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_sra_b(cpu_env, twd, tws, twt); 1206a2b0a27dSPhilippe Mathieu-Daudé break; 1207a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1208a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_sra_h(cpu_env, twd, tws, twt); 1209a2b0a27dSPhilippe Mathieu-Daudé break; 1210a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1211a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_sra_w(cpu_env, twd, tws, twt); 1212a2b0a27dSPhilippe Mathieu-Daudé break; 1213a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1214a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_sra_d(cpu_env, twd, tws, twt); 1215a2b0a27dSPhilippe Mathieu-Daudé break; 1216a2b0a27dSPhilippe Mathieu-Daudé } 1217a2b0a27dSPhilippe Mathieu-Daudé break; 1218a2b0a27dSPhilippe Mathieu-Daudé case OPC_SRAR_df: 1219a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1220a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 1221a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_srar_b(cpu_env, twd, tws, twt); 1222a2b0a27dSPhilippe Mathieu-Daudé break; 1223a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1224a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_srar_h(cpu_env, twd, tws, twt); 1225a2b0a27dSPhilippe Mathieu-Daudé break; 1226a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1227a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_srar_w(cpu_env, twd, tws, twt); 1228a2b0a27dSPhilippe Mathieu-Daudé break; 1229a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1230a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_srar_d(cpu_env, twd, tws, twt); 1231a2b0a27dSPhilippe Mathieu-Daudé break; 1232a2b0a27dSPhilippe Mathieu-Daudé } 1233a2b0a27dSPhilippe Mathieu-Daudé break; 1234a2b0a27dSPhilippe Mathieu-Daudé case OPC_SRL_df: 1235a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1236a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 1237a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_srl_b(cpu_env, twd, tws, twt); 1238a2b0a27dSPhilippe Mathieu-Daudé break; 1239a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1240a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_srl_h(cpu_env, twd, tws, twt); 1241a2b0a27dSPhilippe Mathieu-Daudé break; 1242a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1243a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_srl_w(cpu_env, twd, tws, twt); 1244a2b0a27dSPhilippe Mathieu-Daudé break; 1245a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1246a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_srl_d(cpu_env, twd, tws, twt); 1247a2b0a27dSPhilippe Mathieu-Daudé break; 1248a2b0a27dSPhilippe Mathieu-Daudé } 1249a2b0a27dSPhilippe Mathieu-Daudé break; 1250a2b0a27dSPhilippe Mathieu-Daudé case OPC_SRLR_df: 1251a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1252a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 1253a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_srlr_b(cpu_env, twd, tws, twt); 1254a2b0a27dSPhilippe Mathieu-Daudé break; 1255a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1256a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_srlr_h(cpu_env, twd, tws, twt); 1257a2b0a27dSPhilippe Mathieu-Daudé break; 1258a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1259a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_srlr_w(cpu_env, twd, tws, twt); 1260a2b0a27dSPhilippe Mathieu-Daudé break; 1261a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1262a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_srlr_d(cpu_env, twd, tws, twt); 1263a2b0a27dSPhilippe Mathieu-Daudé break; 1264a2b0a27dSPhilippe Mathieu-Daudé } 1265a2b0a27dSPhilippe Mathieu-Daudé break; 1266a2b0a27dSPhilippe Mathieu-Daudé case OPC_SUBS_S_df: 1267a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1268a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 1269a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_subs_s_b(cpu_env, twd, tws, twt); 1270a2b0a27dSPhilippe Mathieu-Daudé break; 1271a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1272a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_subs_s_h(cpu_env, twd, tws, twt); 1273a2b0a27dSPhilippe Mathieu-Daudé break; 1274a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1275a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_subs_s_w(cpu_env, twd, tws, twt); 1276a2b0a27dSPhilippe Mathieu-Daudé break; 1277a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1278a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_subs_s_d(cpu_env, twd, tws, twt); 1279a2b0a27dSPhilippe Mathieu-Daudé break; 1280a2b0a27dSPhilippe Mathieu-Daudé } 1281a2b0a27dSPhilippe Mathieu-Daudé break; 1282a2b0a27dSPhilippe Mathieu-Daudé case OPC_MULV_df: 1283a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1284a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 1285a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_mulv_b(cpu_env, twd, tws, twt); 1286a2b0a27dSPhilippe Mathieu-Daudé break; 1287a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1288a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_mulv_h(cpu_env, twd, tws, twt); 1289a2b0a27dSPhilippe Mathieu-Daudé break; 1290a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1291a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_mulv_w(cpu_env, twd, tws, twt); 1292a2b0a27dSPhilippe Mathieu-Daudé break; 1293a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1294a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_mulv_d(cpu_env, twd, tws, twt); 1295a2b0a27dSPhilippe Mathieu-Daudé break; 1296a2b0a27dSPhilippe Mathieu-Daudé } 1297a2b0a27dSPhilippe Mathieu-Daudé break; 1298a2b0a27dSPhilippe Mathieu-Daudé case OPC_SLD_df: 1299a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_sld_df(cpu_env, tdf, twd, tws, twt); 1300a2b0a27dSPhilippe Mathieu-Daudé break; 1301a2b0a27dSPhilippe Mathieu-Daudé case OPC_VSHF_df: 1302a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_vshf_df(cpu_env, tdf, twd, tws, twt); 1303a2b0a27dSPhilippe Mathieu-Daudé break; 1304a2b0a27dSPhilippe Mathieu-Daudé case OPC_SUBV_df: 1305a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1306a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 1307a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_subv_b(cpu_env, twd, tws, twt); 1308a2b0a27dSPhilippe Mathieu-Daudé break; 1309a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1310a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_subv_h(cpu_env, twd, tws, twt); 1311a2b0a27dSPhilippe Mathieu-Daudé break; 1312a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1313a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_subv_w(cpu_env, twd, tws, twt); 1314a2b0a27dSPhilippe Mathieu-Daudé break; 1315a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1316a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_subv_d(cpu_env, twd, tws, twt); 1317a2b0a27dSPhilippe Mathieu-Daudé break; 1318a2b0a27dSPhilippe Mathieu-Daudé } 1319a2b0a27dSPhilippe Mathieu-Daudé break; 1320a2b0a27dSPhilippe Mathieu-Daudé case OPC_SUBS_U_df: 1321a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1322a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 1323a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_subs_u_b(cpu_env, twd, tws, twt); 1324a2b0a27dSPhilippe Mathieu-Daudé break; 1325a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1326a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_subs_u_h(cpu_env, twd, tws, twt); 1327a2b0a27dSPhilippe Mathieu-Daudé break; 1328a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1329a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_subs_u_w(cpu_env, twd, tws, twt); 1330a2b0a27dSPhilippe Mathieu-Daudé break; 1331a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1332a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_subs_u_d(cpu_env, twd, tws, twt); 1333a2b0a27dSPhilippe Mathieu-Daudé break; 1334a2b0a27dSPhilippe Mathieu-Daudé } 1335a2b0a27dSPhilippe Mathieu-Daudé break; 1336a2b0a27dSPhilippe Mathieu-Daudé case OPC_SPLAT_df: 1337a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_splat_df(cpu_env, tdf, twd, tws, twt); 1338a2b0a27dSPhilippe Mathieu-Daudé break; 1339a2b0a27dSPhilippe Mathieu-Daudé case OPC_SUBSUS_U_df: 1340a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1341a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 1342a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_subsus_u_b(cpu_env, twd, tws, twt); 1343a2b0a27dSPhilippe Mathieu-Daudé break; 1344a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1345a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_subsus_u_h(cpu_env, twd, tws, twt); 1346a2b0a27dSPhilippe Mathieu-Daudé break; 1347a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1348a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_subsus_u_w(cpu_env, twd, tws, twt); 1349a2b0a27dSPhilippe Mathieu-Daudé break; 1350a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1351a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_subsus_u_d(cpu_env, twd, tws, twt); 1352a2b0a27dSPhilippe Mathieu-Daudé break; 1353a2b0a27dSPhilippe Mathieu-Daudé } 1354a2b0a27dSPhilippe Mathieu-Daudé break; 1355a2b0a27dSPhilippe Mathieu-Daudé case OPC_SUBSUU_S_df: 1356a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1357a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 1358a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_subsuu_s_b(cpu_env, twd, tws, twt); 1359a2b0a27dSPhilippe Mathieu-Daudé break; 1360a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1361a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_subsuu_s_h(cpu_env, twd, tws, twt); 1362a2b0a27dSPhilippe Mathieu-Daudé break; 1363a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1364a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_subsuu_s_w(cpu_env, twd, tws, twt); 1365a2b0a27dSPhilippe Mathieu-Daudé break; 1366a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1367a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_subsuu_s_d(cpu_env, twd, tws, twt); 1368a2b0a27dSPhilippe Mathieu-Daudé break; 1369a2b0a27dSPhilippe Mathieu-Daudé } 1370a2b0a27dSPhilippe Mathieu-Daudé break; 1371a2b0a27dSPhilippe Mathieu-Daudé 1372a2b0a27dSPhilippe Mathieu-Daudé case OPC_DOTP_S_df: 1373a2b0a27dSPhilippe Mathieu-Daudé case OPC_DOTP_U_df: 1374a2b0a27dSPhilippe Mathieu-Daudé case OPC_DPADD_S_df: 1375a2b0a27dSPhilippe Mathieu-Daudé case OPC_DPADD_U_df: 1376a2b0a27dSPhilippe Mathieu-Daudé case OPC_DPSUB_S_df: 1377a2b0a27dSPhilippe Mathieu-Daudé case OPC_HADD_S_df: 1378a2b0a27dSPhilippe Mathieu-Daudé case OPC_DPSUB_U_df: 1379a2b0a27dSPhilippe Mathieu-Daudé case OPC_HADD_U_df: 1380a2b0a27dSPhilippe Mathieu-Daudé case OPC_HSUB_S_df: 1381a2b0a27dSPhilippe Mathieu-Daudé case OPC_HSUB_U_df: 1382a2b0a27dSPhilippe Mathieu-Daudé if (df == DF_BYTE) { 1383a2b0a27dSPhilippe Mathieu-Daudé gen_reserved_instruction(ctx); 1384a2b0a27dSPhilippe Mathieu-Daudé break; 1385a2b0a27dSPhilippe Mathieu-Daudé } 1386a2b0a27dSPhilippe Mathieu-Daudé switch (MASK_MSA_3R(ctx->opcode)) { 1387a2b0a27dSPhilippe Mathieu-Daudé case OPC_HADD_S_df: 1388a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1389a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1390a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_hadd_s_h(cpu_env, twd, tws, twt); 1391a2b0a27dSPhilippe Mathieu-Daudé break; 1392a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1393a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_hadd_s_w(cpu_env, twd, tws, twt); 1394a2b0a27dSPhilippe Mathieu-Daudé break; 1395a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1396a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_hadd_s_d(cpu_env, twd, tws, twt); 1397a2b0a27dSPhilippe Mathieu-Daudé break; 1398a2b0a27dSPhilippe Mathieu-Daudé } 1399a2b0a27dSPhilippe Mathieu-Daudé break; 1400a2b0a27dSPhilippe Mathieu-Daudé case OPC_HADD_U_df: 1401a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1402a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1403a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_hadd_u_h(cpu_env, twd, tws, twt); 1404a2b0a27dSPhilippe Mathieu-Daudé break; 1405a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1406a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_hadd_u_w(cpu_env, twd, tws, twt); 1407a2b0a27dSPhilippe Mathieu-Daudé break; 1408a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1409a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_hadd_u_d(cpu_env, twd, tws, twt); 1410a2b0a27dSPhilippe Mathieu-Daudé break; 1411a2b0a27dSPhilippe Mathieu-Daudé } 1412a2b0a27dSPhilippe Mathieu-Daudé break; 1413a2b0a27dSPhilippe Mathieu-Daudé case OPC_HSUB_S_df: 1414a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1415a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1416a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_hsub_s_h(cpu_env, twd, tws, twt); 1417a2b0a27dSPhilippe Mathieu-Daudé break; 1418a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1419a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_hsub_s_w(cpu_env, twd, tws, twt); 1420a2b0a27dSPhilippe Mathieu-Daudé break; 1421a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1422a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_hsub_s_d(cpu_env, twd, tws, twt); 1423a2b0a27dSPhilippe Mathieu-Daudé break; 1424a2b0a27dSPhilippe Mathieu-Daudé } 1425a2b0a27dSPhilippe Mathieu-Daudé break; 1426a2b0a27dSPhilippe Mathieu-Daudé case OPC_HSUB_U_df: 1427a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1428a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1429a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_hsub_u_h(cpu_env, twd, tws, twt); 1430a2b0a27dSPhilippe Mathieu-Daudé break; 1431a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1432a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_hsub_u_w(cpu_env, twd, tws, twt); 1433a2b0a27dSPhilippe Mathieu-Daudé break; 1434a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1435a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_hsub_u_d(cpu_env, twd, tws, twt); 1436a2b0a27dSPhilippe Mathieu-Daudé break; 1437a2b0a27dSPhilippe Mathieu-Daudé } 1438a2b0a27dSPhilippe Mathieu-Daudé break; 1439a2b0a27dSPhilippe Mathieu-Daudé case OPC_DOTP_S_df: 1440a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1441a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1442a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_dotp_s_h(cpu_env, twd, tws, twt); 1443a2b0a27dSPhilippe Mathieu-Daudé break; 1444a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1445a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_dotp_s_w(cpu_env, twd, tws, twt); 1446a2b0a27dSPhilippe Mathieu-Daudé break; 1447a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1448a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_dotp_s_d(cpu_env, twd, tws, twt); 1449a2b0a27dSPhilippe Mathieu-Daudé break; 1450a2b0a27dSPhilippe Mathieu-Daudé } 1451a2b0a27dSPhilippe Mathieu-Daudé break; 1452a2b0a27dSPhilippe Mathieu-Daudé case OPC_DOTP_U_df: 1453a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1454a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1455a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_dotp_u_h(cpu_env, twd, tws, twt); 1456a2b0a27dSPhilippe Mathieu-Daudé break; 1457a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1458a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_dotp_u_w(cpu_env, twd, tws, twt); 1459a2b0a27dSPhilippe Mathieu-Daudé break; 1460a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1461a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_dotp_u_d(cpu_env, twd, tws, twt); 1462a2b0a27dSPhilippe Mathieu-Daudé break; 1463a2b0a27dSPhilippe Mathieu-Daudé } 1464a2b0a27dSPhilippe Mathieu-Daudé break; 1465a2b0a27dSPhilippe Mathieu-Daudé case OPC_DPADD_S_df: 1466a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1467a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1468a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_dpadd_s_h(cpu_env, twd, tws, twt); 1469a2b0a27dSPhilippe Mathieu-Daudé break; 1470a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1471a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_dpadd_s_w(cpu_env, twd, tws, twt); 1472a2b0a27dSPhilippe Mathieu-Daudé break; 1473a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1474a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_dpadd_s_d(cpu_env, twd, tws, twt); 1475a2b0a27dSPhilippe Mathieu-Daudé break; 1476a2b0a27dSPhilippe Mathieu-Daudé } 1477a2b0a27dSPhilippe Mathieu-Daudé break; 1478a2b0a27dSPhilippe Mathieu-Daudé case OPC_DPADD_U_df: 1479a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1480a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1481a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_dpadd_u_h(cpu_env, twd, tws, twt); 1482a2b0a27dSPhilippe Mathieu-Daudé break; 1483a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1484a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_dpadd_u_w(cpu_env, twd, tws, twt); 1485a2b0a27dSPhilippe Mathieu-Daudé break; 1486a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1487a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_dpadd_u_d(cpu_env, twd, tws, twt); 1488a2b0a27dSPhilippe Mathieu-Daudé break; 1489a2b0a27dSPhilippe Mathieu-Daudé } 1490a2b0a27dSPhilippe Mathieu-Daudé break; 1491a2b0a27dSPhilippe Mathieu-Daudé case OPC_DPSUB_S_df: 1492a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1493a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1494a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_dpsub_s_h(cpu_env, twd, tws, twt); 1495a2b0a27dSPhilippe Mathieu-Daudé break; 1496a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1497a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_dpsub_s_w(cpu_env, twd, tws, twt); 1498a2b0a27dSPhilippe Mathieu-Daudé break; 1499a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1500a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_dpsub_s_d(cpu_env, twd, tws, twt); 1501a2b0a27dSPhilippe Mathieu-Daudé break; 1502a2b0a27dSPhilippe Mathieu-Daudé } 1503a2b0a27dSPhilippe Mathieu-Daudé break; 1504a2b0a27dSPhilippe Mathieu-Daudé case OPC_DPSUB_U_df: 1505a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1506a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1507a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_dpsub_u_h(cpu_env, twd, tws, twt); 1508a2b0a27dSPhilippe Mathieu-Daudé break; 1509a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1510a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_dpsub_u_w(cpu_env, twd, tws, twt); 1511a2b0a27dSPhilippe Mathieu-Daudé break; 1512a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1513a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_dpsub_u_d(cpu_env, twd, tws, twt); 1514a2b0a27dSPhilippe Mathieu-Daudé break; 1515a2b0a27dSPhilippe Mathieu-Daudé } 1516a2b0a27dSPhilippe Mathieu-Daudé break; 1517a2b0a27dSPhilippe Mathieu-Daudé } 1518a2b0a27dSPhilippe Mathieu-Daudé break; 1519a2b0a27dSPhilippe Mathieu-Daudé default: 1520a2b0a27dSPhilippe Mathieu-Daudé MIPS_INVAL("MSA instruction"); 1521a2b0a27dSPhilippe Mathieu-Daudé gen_reserved_instruction(ctx); 1522a2b0a27dSPhilippe Mathieu-Daudé break; 1523a2b0a27dSPhilippe Mathieu-Daudé } 1524a2b0a27dSPhilippe Mathieu-Daudé tcg_temp_free_i32(twd); 1525a2b0a27dSPhilippe Mathieu-Daudé tcg_temp_free_i32(tws); 1526a2b0a27dSPhilippe Mathieu-Daudé tcg_temp_free_i32(twt); 1527a2b0a27dSPhilippe Mathieu-Daudé tcg_temp_free_i32(tdf); 1528a2b0a27dSPhilippe Mathieu-Daudé } 1529a2b0a27dSPhilippe Mathieu-Daudé 1530a2b0a27dSPhilippe Mathieu-Daudé static void gen_msa_elm_3e(DisasContext *ctx) 1531a2b0a27dSPhilippe Mathieu-Daudé { 1532a2b0a27dSPhilippe Mathieu-Daudé #define MASK_MSA_ELM_DF3E(op) (MASK_MSA_MINOR(op) | (op & (0x3FF << 16))) 1533a2b0a27dSPhilippe Mathieu-Daudé uint8_t source = (ctx->opcode >> 11) & 0x1f; 1534a2b0a27dSPhilippe Mathieu-Daudé uint8_t dest = (ctx->opcode >> 6) & 0x1f; 1535a2b0a27dSPhilippe Mathieu-Daudé TCGv telm = tcg_temp_new(); 1536a2b0a27dSPhilippe Mathieu-Daudé TCGv_i32 tsr = tcg_const_i32(source); 1537a2b0a27dSPhilippe Mathieu-Daudé TCGv_i32 tdt = tcg_const_i32(dest); 1538a2b0a27dSPhilippe Mathieu-Daudé 1539a2b0a27dSPhilippe Mathieu-Daudé switch (MASK_MSA_ELM_DF3E(ctx->opcode)) { 1540a2b0a27dSPhilippe Mathieu-Daudé case OPC_CTCMSA: 1541a2b0a27dSPhilippe Mathieu-Daudé gen_load_gpr(telm, source); 1542a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ctcmsa(cpu_env, telm, tdt); 1543a2b0a27dSPhilippe Mathieu-Daudé break; 1544a2b0a27dSPhilippe Mathieu-Daudé case OPC_CFCMSA: 1545a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_cfcmsa(telm, cpu_env, tsr); 1546a2b0a27dSPhilippe Mathieu-Daudé gen_store_gpr(telm, dest); 1547a2b0a27dSPhilippe Mathieu-Daudé break; 1548a2b0a27dSPhilippe Mathieu-Daudé case OPC_MOVE_V: 1549a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_move_v(cpu_env, tdt, tsr); 1550a2b0a27dSPhilippe Mathieu-Daudé break; 1551a2b0a27dSPhilippe Mathieu-Daudé default: 1552a2b0a27dSPhilippe Mathieu-Daudé MIPS_INVAL("MSA instruction"); 1553a2b0a27dSPhilippe Mathieu-Daudé gen_reserved_instruction(ctx); 1554a2b0a27dSPhilippe Mathieu-Daudé break; 1555a2b0a27dSPhilippe Mathieu-Daudé } 1556a2b0a27dSPhilippe Mathieu-Daudé 1557a2b0a27dSPhilippe Mathieu-Daudé tcg_temp_free(telm); 1558a2b0a27dSPhilippe Mathieu-Daudé tcg_temp_free_i32(tdt); 1559a2b0a27dSPhilippe Mathieu-Daudé tcg_temp_free_i32(tsr); 1560a2b0a27dSPhilippe Mathieu-Daudé } 1561a2b0a27dSPhilippe Mathieu-Daudé 1562a2b0a27dSPhilippe Mathieu-Daudé static void gen_msa_elm_df(DisasContext *ctx, uint32_t df, uint32_t n) 1563a2b0a27dSPhilippe Mathieu-Daudé { 1564a2b0a27dSPhilippe Mathieu-Daudé #define MASK_MSA_ELM(op) (MASK_MSA_MINOR(op) | (op & (0xf << 22))) 1565a2b0a27dSPhilippe Mathieu-Daudé uint8_t ws = (ctx->opcode >> 11) & 0x1f; 1566a2b0a27dSPhilippe Mathieu-Daudé uint8_t wd = (ctx->opcode >> 6) & 0x1f; 1567a2b0a27dSPhilippe Mathieu-Daudé 1568a2b0a27dSPhilippe Mathieu-Daudé TCGv_i32 tws = tcg_const_i32(ws); 1569a2b0a27dSPhilippe Mathieu-Daudé TCGv_i32 twd = tcg_const_i32(wd); 1570a2b0a27dSPhilippe Mathieu-Daudé TCGv_i32 tn = tcg_const_i32(n); 15712b537a3dSPhilippe Mathieu-Daudé TCGv_i32 tdf = tcg_constant_i32(df); 1572a2b0a27dSPhilippe Mathieu-Daudé 1573a2b0a27dSPhilippe Mathieu-Daudé switch (MASK_MSA_ELM(ctx->opcode)) { 1574a2b0a27dSPhilippe Mathieu-Daudé case OPC_SLDI_df: 1575a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_sldi_df(cpu_env, tdf, twd, tws, tn); 1576a2b0a27dSPhilippe Mathieu-Daudé break; 1577a2b0a27dSPhilippe Mathieu-Daudé case OPC_SPLATI_df: 1578a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_splati_df(cpu_env, tdf, twd, tws, tn); 1579a2b0a27dSPhilippe Mathieu-Daudé break; 1580a2b0a27dSPhilippe Mathieu-Daudé case OPC_INSVE_df: 1581a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_insve_df(cpu_env, tdf, twd, tws, tn); 1582a2b0a27dSPhilippe Mathieu-Daudé break; 1583a2b0a27dSPhilippe Mathieu-Daudé case OPC_COPY_S_df: 1584a2b0a27dSPhilippe Mathieu-Daudé case OPC_COPY_U_df: 1585a2b0a27dSPhilippe Mathieu-Daudé case OPC_INSERT_df: 1586a2b0a27dSPhilippe Mathieu-Daudé #if !defined(TARGET_MIPS64) 1587a2b0a27dSPhilippe Mathieu-Daudé /* Double format valid only for MIPS64 */ 1588a2b0a27dSPhilippe Mathieu-Daudé if (df == DF_DOUBLE) { 1589a2b0a27dSPhilippe Mathieu-Daudé gen_reserved_instruction(ctx); 1590a2b0a27dSPhilippe Mathieu-Daudé break; 1591a2b0a27dSPhilippe Mathieu-Daudé } 1592a2b0a27dSPhilippe Mathieu-Daudé if ((MASK_MSA_ELM(ctx->opcode) == OPC_COPY_U_df) && 1593a2b0a27dSPhilippe Mathieu-Daudé (df == DF_WORD)) { 1594a2b0a27dSPhilippe Mathieu-Daudé gen_reserved_instruction(ctx); 1595a2b0a27dSPhilippe Mathieu-Daudé break; 1596a2b0a27dSPhilippe Mathieu-Daudé } 1597a2b0a27dSPhilippe Mathieu-Daudé #endif 1598a2b0a27dSPhilippe Mathieu-Daudé switch (MASK_MSA_ELM(ctx->opcode)) { 1599a2b0a27dSPhilippe Mathieu-Daudé case OPC_COPY_S_df: 1600a2b0a27dSPhilippe Mathieu-Daudé if (likely(wd != 0)) { 1601a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1602a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 1603a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_copy_s_b(cpu_env, twd, tws, tn); 1604a2b0a27dSPhilippe Mathieu-Daudé break; 1605a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1606a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_copy_s_h(cpu_env, twd, tws, tn); 1607a2b0a27dSPhilippe Mathieu-Daudé break; 1608a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1609a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_copy_s_w(cpu_env, twd, tws, tn); 1610a2b0a27dSPhilippe Mathieu-Daudé break; 1611a2b0a27dSPhilippe Mathieu-Daudé #if defined(TARGET_MIPS64) 1612a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1613a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_copy_s_d(cpu_env, twd, tws, tn); 1614a2b0a27dSPhilippe Mathieu-Daudé break; 1615a2b0a27dSPhilippe Mathieu-Daudé #endif 1616a2b0a27dSPhilippe Mathieu-Daudé default: 1617a2b0a27dSPhilippe Mathieu-Daudé assert(0); 1618a2b0a27dSPhilippe Mathieu-Daudé } 1619a2b0a27dSPhilippe Mathieu-Daudé } 1620a2b0a27dSPhilippe Mathieu-Daudé break; 1621a2b0a27dSPhilippe Mathieu-Daudé case OPC_COPY_U_df: 1622a2b0a27dSPhilippe Mathieu-Daudé if (likely(wd != 0)) { 1623a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1624a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 1625a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_copy_u_b(cpu_env, twd, tws, tn); 1626a2b0a27dSPhilippe Mathieu-Daudé break; 1627a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1628a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_copy_u_h(cpu_env, twd, tws, tn); 1629a2b0a27dSPhilippe Mathieu-Daudé break; 1630a2b0a27dSPhilippe Mathieu-Daudé #if defined(TARGET_MIPS64) 1631a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1632a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_copy_u_w(cpu_env, twd, tws, tn); 1633a2b0a27dSPhilippe Mathieu-Daudé break; 1634a2b0a27dSPhilippe Mathieu-Daudé #endif 1635a2b0a27dSPhilippe Mathieu-Daudé default: 1636a2b0a27dSPhilippe Mathieu-Daudé assert(0); 1637a2b0a27dSPhilippe Mathieu-Daudé } 1638a2b0a27dSPhilippe Mathieu-Daudé } 1639a2b0a27dSPhilippe Mathieu-Daudé break; 1640a2b0a27dSPhilippe Mathieu-Daudé case OPC_INSERT_df: 1641a2b0a27dSPhilippe Mathieu-Daudé switch (df) { 1642a2b0a27dSPhilippe Mathieu-Daudé case DF_BYTE: 1643a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_insert_b(cpu_env, twd, tws, tn); 1644a2b0a27dSPhilippe Mathieu-Daudé break; 1645a2b0a27dSPhilippe Mathieu-Daudé case DF_HALF: 1646a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_insert_h(cpu_env, twd, tws, tn); 1647a2b0a27dSPhilippe Mathieu-Daudé break; 1648a2b0a27dSPhilippe Mathieu-Daudé case DF_WORD: 1649a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_insert_w(cpu_env, twd, tws, tn); 1650a2b0a27dSPhilippe Mathieu-Daudé break; 1651a2b0a27dSPhilippe Mathieu-Daudé #if defined(TARGET_MIPS64) 1652a2b0a27dSPhilippe Mathieu-Daudé case DF_DOUBLE: 1653a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_insert_d(cpu_env, twd, tws, tn); 1654a2b0a27dSPhilippe Mathieu-Daudé break; 1655a2b0a27dSPhilippe Mathieu-Daudé #endif 1656a2b0a27dSPhilippe Mathieu-Daudé default: 1657a2b0a27dSPhilippe Mathieu-Daudé assert(0); 1658a2b0a27dSPhilippe Mathieu-Daudé } 1659a2b0a27dSPhilippe Mathieu-Daudé break; 1660a2b0a27dSPhilippe Mathieu-Daudé } 1661a2b0a27dSPhilippe Mathieu-Daudé break; 1662a2b0a27dSPhilippe Mathieu-Daudé default: 1663a2b0a27dSPhilippe Mathieu-Daudé MIPS_INVAL("MSA instruction"); 1664a2b0a27dSPhilippe Mathieu-Daudé gen_reserved_instruction(ctx); 1665a2b0a27dSPhilippe Mathieu-Daudé } 1666a2b0a27dSPhilippe Mathieu-Daudé tcg_temp_free_i32(twd); 1667a2b0a27dSPhilippe Mathieu-Daudé tcg_temp_free_i32(tws); 1668a2b0a27dSPhilippe Mathieu-Daudé tcg_temp_free_i32(tn); 1669a2b0a27dSPhilippe Mathieu-Daudé } 1670a2b0a27dSPhilippe Mathieu-Daudé 1671a2b0a27dSPhilippe Mathieu-Daudé static void gen_msa_elm(DisasContext *ctx) 1672a2b0a27dSPhilippe Mathieu-Daudé { 1673a2b0a27dSPhilippe Mathieu-Daudé uint8_t dfn = (ctx->opcode >> 16) & 0x3f; 1674a2b0a27dSPhilippe Mathieu-Daudé uint32_t df = 0, n = 0; 1675a2b0a27dSPhilippe Mathieu-Daudé 1676a2b0a27dSPhilippe Mathieu-Daudé if ((dfn & 0x30) == 0x00) { 1677a2b0a27dSPhilippe Mathieu-Daudé n = dfn & 0x0f; 1678a2b0a27dSPhilippe Mathieu-Daudé df = DF_BYTE; 1679a2b0a27dSPhilippe Mathieu-Daudé } else if ((dfn & 0x38) == 0x20) { 1680a2b0a27dSPhilippe Mathieu-Daudé n = dfn & 0x07; 1681a2b0a27dSPhilippe Mathieu-Daudé df = DF_HALF; 1682a2b0a27dSPhilippe Mathieu-Daudé } else if ((dfn & 0x3c) == 0x30) { 1683a2b0a27dSPhilippe Mathieu-Daudé n = dfn & 0x03; 1684a2b0a27dSPhilippe Mathieu-Daudé df = DF_WORD; 1685a2b0a27dSPhilippe Mathieu-Daudé } else if ((dfn & 0x3e) == 0x38) { 1686a2b0a27dSPhilippe Mathieu-Daudé n = dfn & 0x01; 1687a2b0a27dSPhilippe Mathieu-Daudé df = DF_DOUBLE; 1688a2b0a27dSPhilippe Mathieu-Daudé } else if (dfn == 0x3E) { 1689a2b0a27dSPhilippe Mathieu-Daudé /* CTCMSA, CFCMSA, MOVE.V */ 1690a2b0a27dSPhilippe Mathieu-Daudé gen_msa_elm_3e(ctx); 1691a2b0a27dSPhilippe Mathieu-Daudé return; 1692a2b0a27dSPhilippe Mathieu-Daudé } else { 1693a2b0a27dSPhilippe Mathieu-Daudé gen_reserved_instruction(ctx); 1694a2b0a27dSPhilippe Mathieu-Daudé return; 1695a2b0a27dSPhilippe Mathieu-Daudé } 1696a2b0a27dSPhilippe Mathieu-Daudé 1697a2b0a27dSPhilippe Mathieu-Daudé gen_msa_elm_df(ctx, df, n); 1698a2b0a27dSPhilippe Mathieu-Daudé } 1699a2b0a27dSPhilippe Mathieu-Daudé 1700*ff29e5d3SPhilippe Mathieu-Daudé TRANS(MUL_Q, trans_msa_3rf, gen_helper_msa_mul_q_df); 1701*ff29e5d3SPhilippe Mathieu-Daudé TRANS(MADD_Q, trans_msa_3rf, gen_helper_msa_madd_q_df); 1702*ff29e5d3SPhilippe Mathieu-Daudé TRANS(MSUB_Q, trans_msa_3rf, gen_helper_msa_msub_q_df); 1703*ff29e5d3SPhilippe Mathieu-Daudé TRANS(MULR_Q, trans_msa_3rf, gen_helper_msa_mulr_q_df); 1704*ff29e5d3SPhilippe Mathieu-Daudé TRANS(MADDR_Q, trans_msa_3rf, gen_helper_msa_maddr_q_df); 1705*ff29e5d3SPhilippe Mathieu-Daudé TRANS(MSUBR_Q, trans_msa_3rf, gen_helper_msa_msubr_q_df); 1706*ff29e5d3SPhilippe Mathieu-Daudé 1707a2b0a27dSPhilippe Mathieu-Daudé static void gen_msa_3rf(DisasContext *ctx) 1708a2b0a27dSPhilippe Mathieu-Daudé { 1709a2b0a27dSPhilippe Mathieu-Daudé #define MASK_MSA_3RF(op) (MASK_MSA_MINOR(op) | (op & (0xf << 22))) 1710a2b0a27dSPhilippe Mathieu-Daudé uint8_t df = (ctx->opcode >> 21) & 0x1; 1711a2b0a27dSPhilippe Mathieu-Daudé uint8_t wt = (ctx->opcode >> 16) & 0x1f; 1712a2b0a27dSPhilippe Mathieu-Daudé uint8_t ws = (ctx->opcode >> 11) & 0x1f; 1713a2b0a27dSPhilippe Mathieu-Daudé uint8_t wd = (ctx->opcode >> 6) & 0x1f; 1714a2b0a27dSPhilippe Mathieu-Daudé 1715a2b0a27dSPhilippe Mathieu-Daudé TCGv_i32 twd = tcg_const_i32(wd); 1716a2b0a27dSPhilippe Mathieu-Daudé TCGv_i32 tws = tcg_const_i32(ws); 1717a2b0a27dSPhilippe Mathieu-Daudé TCGv_i32 twt = tcg_const_i32(wt); 1718a2b0a27dSPhilippe Mathieu-Daudé /* adjust df value for floating-point instruction */ 1719*ff29e5d3SPhilippe Mathieu-Daudé TCGv_i32 tdf = tcg_constant_i32(DF_WORD + df); 1720a2b0a27dSPhilippe Mathieu-Daudé 1721a2b0a27dSPhilippe Mathieu-Daudé switch (MASK_MSA_3RF(ctx->opcode)) { 1722a2b0a27dSPhilippe Mathieu-Daudé case OPC_FCAF_df: 1723a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fcaf_df(cpu_env, tdf, twd, tws, twt); 1724a2b0a27dSPhilippe Mathieu-Daudé break; 1725a2b0a27dSPhilippe Mathieu-Daudé case OPC_FADD_df: 1726a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fadd_df(cpu_env, tdf, twd, tws, twt); 1727a2b0a27dSPhilippe Mathieu-Daudé break; 1728a2b0a27dSPhilippe Mathieu-Daudé case OPC_FCUN_df: 1729a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fcun_df(cpu_env, tdf, twd, tws, twt); 1730a2b0a27dSPhilippe Mathieu-Daudé break; 1731a2b0a27dSPhilippe Mathieu-Daudé case OPC_FSUB_df: 1732a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fsub_df(cpu_env, tdf, twd, tws, twt); 1733a2b0a27dSPhilippe Mathieu-Daudé break; 1734a2b0a27dSPhilippe Mathieu-Daudé case OPC_FCOR_df: 1735a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fcor_df(cpu_env, tdf, twd, tws, twt); 1736a2b0a27dSPhilippe Mathieu-Daudé break; 1737a2b0a27dSPhilippe Mathieu-Daudé case OPC_FCEQ_df: 1738a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fceq_df(cpu_env, tdf, twd, tws, twt); 1739a2b0a27dSPhilippe Mathieu-Daudé break; 1740a2b0a27dSPhilippe Mathieu-Daudé case OPC_FMUL_df: 1741a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fmul_df(cpu_env, tdf, twd, tws, twt); 1742a2b0a27dSPhilippe Mathieu-Daudé break; 1743a2b0a27dSPhilippe Mathieu-Daudé case OPC_FCUNE_df: 1744a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fcune_df(cpu_env, tdf, twd, tws, twt); 1745a2b0a27dSPhilippe Mathieu-Daudé break; 1746a2b0a27dSPhilippe Mathieu-Daudé case OPC_FCUEQ_df: 1747a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fcueq_df(cpu_env, tdf, twd, tws, twt); 1748a2b0a27dSPhilippe Mathieu-Daudé break; 1749a2b0a27dSPhilippe Mathieu-Daudé case OPC_FDIV_df: 1750a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fdiv_df(cpu_env, tdf, twd, tws, twt); 1751a2b0a27dSPhilippe Mathieu-Daudé break; 1752a2b0a27dSPhilippe Mathieu-Daudé case OPC_FCNE_df: 1753a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fcne_df(cpu_env, tdf, twd, tws, twt); 1754a2b0a27dSPhilippe Mathieu-Daudé break; 1755a2b0a27dSPhilippe Mathieu-Daudé case OPC_FCLT_df: 1756a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fclt_df(cpu_env, tdf, twd, tws, twt); 1757a2b0a27dSPhilippe Mathieu-Daudé break; 1758a2b0a27dSPhilippe Mathieu-Daudé case OPC_FMADD_df: 1759a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fmadd_df(cpu_env, tdf, twd, tws, twt); 1760a2b0a27dSPhilippe Mathieu-Daudé break; 1761a2b0a27dSPhilippe Mathieu-Daudé case OPC_FCULT_df: 1762a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fcult_df(cpu_env, tdf, twd, tws, twt); 1763a2b0a27dSPhilippe Mathieu-Daudé break; 1764a2b0a27dSPhilippe Mathieu-Daudé case OPC_FMSUB_df: 1765a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fmsub_df(cpu_env, tdf, twd, tws, twt); 1766a2b0a27dSPhilippe Mathieu-Daudé break; 1767a2b0a27dSPhilippe Mathieu-Daudé case OPC_FCLE_df: 1768a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fcle_df(cpu_env, tdf, twd, tws, twt); 1769a2b0a27dSPhilippe Mathieu-Daudé break; 1770a2b0a27dSPhilippe Mathieu-Daudé case OPC_FCULE_df: 1771a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fcule_df(cpu_env, tdf, twd, tws, twt); 1772a2b0a27dSPhilippe Mathieu-Daudé break; 1773a2b0a27dSPhilippe Mathieu-Daudé case OPC_FEXP2_df: 1774a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fexp2_df(cpu_env, tdf, twd, tws, twt); 1775a2b0a27dSPhilippe Mathieu-Daudé break; 1776a2b0a27dSPhilippe Mathieu-Daudé case OPC_FSAF_df: 1777a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fsaf_df(cpu_env, tdf, twd, tws, twt); 1778a2b0a27dSPhilippe Mathieu-Daudé break; 1779a2b0a27dSPhilippe Mathieu-Daudé case OPC_FEXDO_df: 1780a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fexdo_df(cpu_env, tdf, twd, tws, twt); 1781a2b0a27dSPhilippe Mathieu-Daudé break; 1782a2b0a27dSPhilippe Mathieu-Daudé case OPC_FSUN_df: 1783a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fsun_df(cpu_env, tdf, twd, tws, twt); 1784a2b0a27dSPhilippe Mathieu-Daudé break; 1785a2b0a27dSPhilippe Mathieu-Daudé case OPC_FSOR_df: 1786a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fsor_df(cpu_env, tdf, twd, tws, twt); 1787a2b0a27dSPhilippe Mathieu-Daudé break; 1788a2b0a27dSPhilippe Mathieu-Daudé case OPC_FSEQ_df: 1789a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fseq_df(cpu_env, tdf, twd, tws, twt); 1790a2b0a27dSPhilippe Mathieu-Daudé break; 1791a2b0a27dSPhilippe Mathieu-Daudé case OPC_FTQ_df: 1792a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_ftq_df(cpu_env, tdf, twd, tws, twt); 1793a2b0a27dSPhilippe Mathieu-Daudé break; 1794a2b0a27dSPhilippe Mathieu-Daudé case OPC_FSUNE_df: 1795a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fsune_df(cpu_env, tdf, twd, tws, twt); 1796a2b0a27dSPhilippe Mathieu-Daudé break; 1797a2b0a27dSPhilippe Mathieu-Daudé case OPC_FSUEQ_df: 1798a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fsueq_df(cpu_env, tdf, twd, tws, twt); 1799a2b0a27dSPhilippe Mathieu-Daudé break; 1800a2b0a27dSPhilippe Mathieu-Daudé case OPC_FSNE_df: 1801a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fsne_df(cpu_env, tdf, twd, tws, twt); 1802a2b0a27dSPhilippe Mathieu-Daudé break; 1803a2b0a27dSPhilippe Mathieu-Daudé case OPC_FSLT_df: 1804a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fslt_df(cpu_env, tdf, twd, tws, twt); 1805a2b0a27dSPhilippe Mathieu-Daudé break; 1806a2b0a27dSPhilippe Mathieu-Daudé case OPC_FMIN_df: 1807a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fmin_df(cpu_env, tdf, twd, tws, twt); 1808a2b0a27dSPhilippe Mathieu-Daudé break; 1809a2b0a27dSPhilippe Mathieu-Daudé case OPC_FSULT_df: 1810a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fsult_df(cpu_env, tdf, twd, tws, twt); 1811a2b0a27dSPhilippe Mathieu-Daudé break; 1812a2b0a27dSPhilippe Mathieu-Daudé case OPC_FMIN_A_df: 1813a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fmin_a_df(cpu_env, tdf, twd, tws, twt); 1814a2b0a27dSPhilippe Mathieu-Daudé break; 1815a2b0a27dSPhilippe Mathieu-Daudé case OPC_FSLE_df: 1816a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fsle_df(cpu_env, tdf, twd, tws, twt); 1817a2b0a27dSPhilippe Mathieu-Daudé break; 1818a2b0a27dSPhilippe Mathieu-Daudé case OPC_FMAX_df: 1819a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fmax_df(cpu_env, tdf, twd, tws, twt); 1820a2b0a27dSPhilippe Mathieu-Daudé break; 1821a2b0a27dSPhilippe Mathieu-Daudé case OPC_FSULE_df: 1822a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fsule_df(cpu_env, tdf, twd, tws, twt); 1823a2b0a27dSPhilippe Mathieu-Daudé break; 1824a2b0a27dSPhilippe Mathieu-Daudé case OPC_FMAX_A_df: 1825a2b0a27dSPhilippe Mathieu-Daudé gen_helper_msa_fmax_a_df(cpu_env, tdf, twd, tws, twt); 1826a2b0a27dSPhilippe Mathieu-Daudé break; 1827a2b0a27dSPhilippe Mathieu-Daudé default: 1828a2b0a27dSPhilippe Mathieu-Daudé MIPS_INVAL("MSA instruction"); 1829a2b0a27dSPhilippe Mathieu-Daudé gen_reserved_instruction(ctx); 1830a2b0a27dSPhilippe Mathieu-Daudé break; 1831a2b0a27dSPhilippe Mathieu-Daudé } 1832a2b0a27dSPhilippe Mathieu-Daudé 1833a2b0a27dSPhilippe Mathieu-Daudé tcg_temp_free_i32(twd); 1834a2b0a27dSPhilippe Mathieu-Daudé tcg_temp_free_i32(tws); 1835a2b0a27dSPhilippe Mathieu-Daudé tcg_temp_free_i32(twt); 1836a2b0a27dSPhilippe Mathieu-Daudé } 1837a2b0a27dSPhilippe Mathieu-Daudé 1838adcff99aSPhilippe Mathieu-Daudé static bool trans_msa_2r(DisasContext *ctx, arg_msa_r *a, 1839adcff99aSPhilippe Mathieu-Daudé gen_helper_pii *gen_msa_2r) 1840a2b0a27dSPhilippe Mathieu-Daudé { 1841adcff99aSPhilippe Mathieu-Daudé if (!check_msa_enabled(ctx)) { 1842adcff99aSPhilippe Mathieu-Daudé return true; 1843a2b0a27dSPhilippe Mathieu-Daudé } 1844a2b0a27dSPhilippe Mathieu-Daudé 1845adcff99aSPhilippe Mathieu-Daudé gen_msa_2r(cpu_env, tcg_constant_i32(a->wd), tcg_constant_i32(a->ws)); 1846adcff99aSPhilippe Mathieu-Daudé 1847adcff99aSPhilippe Mathieu-Daudé return true; 1848a2b0a27dSPhilippe Mathieu-Daudé } 1849a2b0a27dSPhilippe Mathieu-Daudé 1850adcff99aSPhilippe Mathieu-Daudé TRANS_DF_ii(PCNT, trans_msa_2r, gen_helper_msa_pcnt); 1851adcff99aSPhilippe Mathieu-Daudé TRANS_DF_ii(NLOC, trans_msa_2r, gen_helper_msa_nloc); 1852adcff99aSPhilippe Mathieu-Daudé TRANS_DF_ii(NLZC, trans_msa_2r, gen_helper_msa_nlzc); 1853adcff99aSPhilippe Mathieu-Daudé 1854675bf34aSPhilippe Mathieu-Daudé static bool trans_FILL(DisasContext *ctx, arg_msa_r *a) 1855675bf34aSPhilippe Mathieu-Daudé { 1856675bf34aSPhilippe Mathieu-Daudé if (TARGET_LONG_BITS != 64 && a->df == DF_DOUBLE) { 1857675bf34aSPhilippe Mathieu-Daudé /* Double format valid only for MIPS64 */ 1858675bf34aSPhilippe Mathieu-Daudé return false; 1859675bf34aSPhilippe Mathieu-Daudé } 1860675bf34aSPhilippe Mathieu-Daudé 1861675bf34aSPhilippe Mathieu-Daudé if (!check_msa_enabled(ctx)) { 1862675bf34aSPhilippe Mathieu-Daudé return true; 1863675bf34aSPhilippe Mathieu-Daudé } 1864675bf34aSPhilippe Mathieu-Daudé 1865675bf34aSPhilippe Mathieu-Daudé gen_helper_msa_fill_df(cpu_env, 1866675bf34aSPhilippe Mathieu-Daudé tcg_constant_i32(a->df), 1867675bf34aSPhilippe Mathieu-Daudé tcg_constant_i32(a->wd), 1868675bf34aSPhilippe Mathieu-Daudé tcg_constant_i32(a->ws)); 1869675bf34aSPhilippe Mathieu-Daudé 1870675bf34aSPhilippe Mathieu-Daudé return true; 1871675bf34aSPhilippe Mathieu-Daudé } 1872675bf34aSPhilippe Mathieu-Daudé 18735c5b6400SPhilippe Mathieu-Daudé static bool trans_msa_2rf(DisasContext *ctx, arg_msa_r *a, 18745c5b6400SPhilippe Mathieu-Daudé gen_helper_piii *gen_msa_2rf) 1875a2b0a27dSPhilippe Mathieu-Daudé { 18765c5b6400SPhilippe Mathieu-Daudé if (!check_msa_enabled(ctx)) { 18775c5b6400SPhilippe Mathieu-Daudé return true; 1878a2b0a27dSPhilippe Mathieu-Daudé } 1879a2b0a27dSPhilippe Mathieu-Daudé 18805c5b6400SPhilippe Mathieu-Daudé gen_msa_2rf(cpu_env, 18815c5b6400SPhilippe Mathieu-Daudé tcg_constant_i32(a->df), 18825c5b6400SPhilippe Mathieu-Daudé tcg_constant_i32(a->wd), 18835c5b6400SPhilippe Mathieu-Daudé tcg_constant_i32(a->ws)); 18845c5b6400SPhilippe Mathieu-Daudé 18855c5b6400SPhilippe Mathieu-Daudé return true; 1886a2b0a27dSPhilippe Mathieu-Daudé } 1887a2b0a27dSPhilippe Mathieu-Daudé 18885c5b6400SPhilippe Mathieu-Daudé TRANS(FCLASS, trans_msa_2rf, gen_helper_msa_fclass_df); 18895c5b6400SPhilippe Mathieu-Daudé TRANS(FTRUNC_S, trans_msa_2rf, gen_helper_msa_fclass_df); 18905c5b6400SPhilippe Mathieu-Daudé TRANS(FTRUNC_U, trans_msa_2rf, gen_helper_msa_ftrunc_s_df); 18915c5b6400SPhilippe Mathieu-Daudé TRANS(FSQRT, trans_msa_2rf, gen_helper_msa_fsqrt_df); 18925c5b6400SPhilippe Mathieu-Daudé TRANS(FRSQRT, trans_msa_2rf, gen_helper_msa_frsqrt_df); 18935c5b6400SPhilippe Mathieu-Daudé TRANS(FRCP, trans_msa_2rf, gen_helper_msa_frcp_df); 18945c5b6400SPhilippe Mathieu-Daudé TRANS(FRINT, trans_msa_2rf, gen_helper_msa_frint_df); 18955c5b6400SPhilippe Mathieu-Daudé TRANS(FLOG2, trans_msa_2rf, gen_helper_msa_flog2_df); 18965c5b6400SPhilippe Mathieu-Daudé TRANS(FEXUPL, trans_msa_2rf, gen_helper_msa_fexupl_df); 18975c5b6400SPhilippe Mathieu-Daudé TRANS(FEXUPR, trans_msa_2rf, gen_helper_msa_fexupr_df); 18985c5b6400SPhilippe Mathieu-Daudé TRANS(FFQL, trans_msa_2rf, gen_helper_msa_ffql_df); 18995c5b6400SPhilippe Mathieu-Daudé TRANS(FFQR, trans_msa_2rf, gen_helper_msa_ffqr_df); 19005c5b6400SPhilippe Mathieu-Daudé TRANS(FTINT_S, trans_msa_2rf, gen_helper_msa_ftint_s_df); 19015c5b6400SPhilippe Mathieu-Daudé TRANS(FTINT_U, trans_msa_2rf, gen_helper_msa_ftint_u_df); 19025c5b6400SPhilippe Mathieu-Daudé TRANS(FFINT_S, trans_msa_2rf, gen_helper_msa_ffint_s_df); 19035c5b6400SPhilippe Mathieu-Daudé TRANS(FFINT_U, trans_msa_2rf, gen_helper_msa_ffint_u_df); 19045c5b6400SPhilippe Mathieu-Daudé 1905525ea877SPhilippe Mathieu-Daudé static bool trans_MSA(DisasContext *ctx, arg_MSA *a) 1906a2b0a27dSPhilippe Mathieu-Daudé { 1907a2b0a27dSPhilippe Mathieu-Daudé uint32_t opcode = ctx->opcode; 1908a2b0a27dSPhilippe Mathieu-Daudé 1909340ee8b3SPhilippe Mathieu-Daudé if (!check_msa_enabled(ctx)) { 1910340ee8b3SPhilippe Mathieu-Daudé return true; 1911340ee8b3SPhilippe Mathieu-Daudé } 1912a2b0a27dSPhilippe Mathieu-Daudé 1913a2b0a27dSPhilippe Mathieu-Daudé switch (MASK_MSA_MINOR(opcode)) { 1914a2b0a27dSPhilippe Mathieu-Daudé case OPC_MSA_3R_0D: 1915a2b0a27dSPhilippe Mathieu-Daudé case OPC_MSA_3R_0E: 1916a2b0a27dSPhilippe Mathieu-Daudé case OPC_MSA_3R_0F: 1917a2b0a27dSPhilippe Mathieu-Daudé case OPC_MSA_3R_10: 1918a2b0a27dSPhilippe Mathieu-Daudé case OPC_MSA_3R_11: 1919a2b0a27dSPhilippe Mathieu-Daudé case OPC_MSA_3R_12: 1920a2b0a27dSPhilippe Mathieu-Daudé case OPC_MSA_3R_13: 1921a2b0a27dSPhilippe Mathieu-Daudé case OPC_MSA_3R_14: 1922a2b0a27dSPhilippe Mathieu-Daudé case OPC_MSA_3R_15: 1923a2b0a27dSPhilippe Mathieu-Daudé gen_msa_3r(ctx); 1924a2b0a27dSPhilippe Mathieu-Daudé break; 1925a2b0a27dSPhilippe Mathieu-Daudé case OPC_MSA_ELM: 1926a2b0a27dSPhilippe Mathieu-Daudé gen_msa_elm(ctx); 1927a2b0a27dSPhilippe Mathieu-Daudé break; 1928a2b0a27dSPhilippe Mathieu-Daudé case OPC_MSA_3RF_1A: 1929a2b0a27dSPhilippe Mathieu-Daudé case OPC_MSA_3RF_1B: 1930a2b0a27dSPhilippe Mathieu-Daudé case OPC_MSA_3RF_1C: 1931a2b0a27dSPhilippe Mathieu-Daudé gen_msa_3rf(ctx); 1932a2b0a27dSPhilippe Mathieu-Daudé break; 1933a2b0a27dSPhilippe Mathieu-Daudé default: 1934a2b0a27dSPhilippe Mathieu-Daudé MIPS_INVAL("MSA instruction"); 1935a2b0a27dSPhilippe Mathieu-Daudé gen_reserved_instruction(ctx); 1936a2b0a27dSPhilippe Mathieu-Daudé break; 1937a2b0a27dSPhilippe Mathieu-Daudé } 1938a2b0a27dSPhilippe Mathieu-Daudé 1939a2b0a27dSPhilippe Mathieu-Daudé return true; 1940a2b0a27dSPhilippe Mathieu-Daudé } 1941a2b0a27dSPhilippe Mathieu-Daudé 1942ce121fe2SPhilippe Mathieu-Daudé static bool trans_msa_ldst(DisasContext *ctx, arg_msa_i *a, 1943ce121fe2SPhilippe Mathieu-Daudé gen_helper_piv *gen_msa_ldst) 1944ce121fe2SPhilippe Mathieu-Daudé { 1945ce121fe2SPhilippe Mathieu-Daudé TCGv taddr; 1946ce121fe2SPhilippe Mathieu-Daudé 1947ce121fe2SPhilippe Mathieu-Daudé if (!check_msa_enabled(ctx)) { 1948ce121fe2SPhilippe Mathieu-Daudé return true; 1949ce121fe2SPhilippe Mathieu-Daudé } 1950ce121fe2SPhilippe Mathieu-Daudé 1951ce121fe2SPhilippe Mathieu-Daudé taddr = tcg_temp_new(); 1952ce121fe2SPhilippe Mathieu-Daudé 1953ce121fe2SPhilippe Mathieu-Daudé gen_base_offset_addr(ctx, taddr, a->ws, a->sa << a->df); 1954ce121fe2SPhilippe Mathieu-Daudé gen_msa_ldst(cpu_env, tcg_constant_i32(a->wd), taddr); 1955ce121fe2SPhilippe Mathieu-Daudé 1956ce121fe2SPhilippe Mathieu-Daudé tcg_temp_free(taddr); 1957ce121fe2SPhilippe Mathieu-Daudé 1958ce121fe2SPhilippe Mathieu-Daudé return true; 1959ce121fe2SPhilippe Mathieu-Daudé } 1960ce121fe2SPhilippe Mathieu-Daudé 1961ce121fe2SPhilippe Mathieu-Daudé TRANS_DF_iv(LD, trans_msa_ldst, gen_helper_msa_ld); 1962ce121fe2SPhilippe Mathieu-Daudé TRANS_DF_iv(ST, trans_msa_ldst, gen_helper_msa_st); 1963ce121fe2SPhilippe Mathieu-Daudé 196434fe9fa3SPhilippe Mathieu-Daudé static bool trans_LSA(DisasContext *ctx, arg_r *a) 1965a2b0a27dSPhilippe Mathieu-Daudé { 1966a2b0a27dSPhilippe Mathieu-Daudé return gen_lsa(ctx, a->rd, a->rt, a->rs, a->sa); 1967a2b0a27dSPhilippe Mathieu-Daudé } 1968a2b0a27dSPhilippe Mathieu-Daudé 196934fe9fa3SPhilippe Mathieu-Daudé static bool trans_DLSA(DisasContext *ctx, arg_r *a) 1970a2b0a27dSPhilippe Mathieu-Daudé { 1971f5c6ee0cSPhilippe Mathieu-Daudé if (TARGET_LONG_BITS != 64) { 1972f5c6ee0cSPhilippe Mathieu-Daudé return false; 1973f5c6ee0cSPhilippe Mathieu-Daudé } 1974a2b0a27dSPhilippe Mathieu-Daudé return gen_dlsa(ctx, a->rd, a->rt, a->rs, a->sa); 1975a2b0a27dSPhilippe Mathieu-Daudé } 1976