xref: /freebsd/contrib/llvm-project/llvm/lib/Target/Mips/MipsMSAInstrInfo.td (revision cfd6422a5217410fbd66f7a7a8a64d9d85e61229)
1//===- MipsMSAInstrInfo.td - MSA ASE instructions -*- tablegen ------------*-=//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file describes Mips MSA ASE instructions.
10//
11//===----------------------------------------------------------------------===//
12
13def SDT_MipsVecCond : SDTypeProfile<1, 1, [SDTCisInt<0>, SDTCisVec<1>]>;
14def SDT_VSetCC : SDTypeProfile<1, 3, [SDTCisInt<0>,
15                                      SDTCisInt<1>,
16                                      SDTCisSameAs<1, 2>,
17                                      SDTCisVT<3, OtherVT>]>;
18def SDT_VFSetCC : SDTypeProfile<1, 3, [SDTCisInt<0>,
19                                       SDTCisFP<1>,
20                                       SDTCisSameAs<1, 2>,
21                                       SDTCisVT<3, OtherVT>]>;
22def SDT_VSHF : SDTypeProfile<1, 3, [SDTCisInt<0>, SDTCisVec<0>,
23                                    SDTCisInt<1>, SDTCisVec<1>,
24                                    SDTCisSameAs<0, 2>, SDTCisSameAs<2, 3>]>;
25def SDT_SHF : SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisVec<0>,
26                                   SDTCisVT<1, i32>, SDTCisSameAs<0, 2>]>;
27def SDT_ILV : SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisVec<0>,
28                                   SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>]>;
29def SDT_INSVE : SDTypeProfile<1, 4, [SDTCisVec<0>, SDTCisSameAs<0, 1>,
30                                     SDTCisVT<2, i32>, SDTCisSameAs<0, 3>,
31                                     SDTCisVT<4, i32>]>;
32
33def MipsVAllNonZero : SDNode<"MipsISD::VALL_NONZERO", SDT_MipsVecCond>;
34def MipsVAnyNonZero : SDNode<"MipsISD::VANY_NONZERO", SDT_MipsVecCond>;
35def MipsVAllZero : SDNode<"MipsISD::VALL_ZERO", SDT_MipsVecCond>;
36def MipsVAnyZero : SDNode<"MipsISD::VANY_ZERO", SDT_MipsVecCond>;
37def MipsVNOR : SDNode<"MipsISD::VNOR", SDTIntBinOp,
38                      [SDNPCommutative, SDNPAssociative]>;
39def MipsVSHF : SDNode<"MipsISD::VSHF", SDT_VSHF>;
40def MipsSHF : SDNode<"MipsISD::SHF", SDT_SHF>;
41def MipsILVEV : SDNode<"MipsISD::ILVEV", SDT_ILV>;
42def MipsILVOD : SDNode<"MipsISD::ILVOD", SDT_ILV>;
43def MipsILVL  : SDNode<"MipsISD::ILVL",  SDT_ILV>;
44def MipsILVR  : SDNode<"MipsISD::ILVR",  SDT_ILV>;
45def MipsPCKEV : SDNode<"MipsISD::PCKEV", SDT_ILV>;
46def MipsPCKOD : SDNode<"MipsISD::PCKOD", SDT_ILV>;
47def MipsINSVE : SDNode<"MipsISD::INSVE", SDT_INSVE>;
48def MipsFMS   : SDNode<"MipsISD::FMS", SDTFPTernaryOp>;
49
50def vsetcc : SDNode<"ISD::SETCC", SDT_VSetCC>;
51def vfsetcc : SDNode<"ISD::SETCC", SDT_VFSetCC>;
52
53def MipsVExtractSExt : SDNode<"MipsISD::VEXTRACT_SEXT_ELT",
54    SDTypeProfile<1, 3, [SDTCisPtrTy<2>]>, []>;
55def MipsVExtractZExt : SDNode<"MipsISD::VEXTRACT_ZEXT_ELT",
56    SDTypeProfile<1, 3, [SDTCisPtrTy<2>]>, []>;
57
58def immZExt1Ptr : ImmLeaf<iPTR, [{return isUInt<1>(Imm);}]>;
59def immZExt2Ptr : ImmLeaf<iPTR, [{return isUInt<2>(Imm);}]>;
60def immZExt3Ptr : ImmLeaf<iPTR, [{return isUInt<3>(Imm);}]>;
61def immZExt4Ptr : ImmLeaf<iPTR, [{return isUInt<4>(Imm);}]>;
62
63def timmZExt1Ptr : TImmLeaf<iPTR, [{return isUInt<1>(Imm);}]>;
64def timmZExt2Ptr : TImmLeaf<iPTR, [{return isUInt<2>(Imm);}]>;
65def timmZExt3Ptr : TImmLeaf<iPTR, [{return isUInt<3>(Imm);}]>;
66def timmZExt4Ptr : TImmLeaf<iPTR, [{return isUInt<4>(Imm);}]>;
67
68// Operands
69
70def immZExt2Lsa : ImmLeaf<i32, [{return isUInt<2>(Imm - 1);}]>;
71
72// Pattern fragments
73def vextract_sext_i8  : PatFrag<(ops node:$vec, node:$idx),
74                                (MipsVExtractSExt node:$vec, node:$idx, i8)>;
75def vextract_sext_i16 : PatFrag<(ops node:$vec, node:$idx),
76                                (MipsVExtractSExt node:$vec, node:$idx, i16)>;
77def vextract_sext_i32 : PatFrag<(ops node:$vec, node:$idx),
78                                (MipsVExtractSExt node:$vec, node:$idx, i32)>;
79def vextract_sext_i64 : PatFrag<(ops node:$vec, node:$idx),
80                                (MipsVExtractSExt node:$vec, node:$idx, i64)>;
81
82def vextract_zext_i8  : PatFrag<(ops node:$vec, node:$idx),
83                                (MipsVExtractZExt node:$vec, node:$idx, i8)>;
84def vextract_zext_i16 : PatFrag<(ops node:$vec, node:$idx),
85                                (MipsVExtractZExt node:$vec, node:$idx, i16)>;
86def vextract_zext_i32 : PatFrag<(ops node:$vec, node:$idx),
87                                (MipsVExtractZExt node:$vec, node:$idx, i32)>;
88def vextract_zext_i64 : PatFrag<(ops node:$vec, node:$idx),
89                                (MipsVExtractZExt node:$vec, node:$idx, i64)>;
90
91def vinsert_v16i8 : PatFrag<(ops node:$vec, node:$val, node:$idx),
92    (v16i8 (vector_insert node:$vec, node:$val, node:$idx))>;
93def vinsert_v8i16 : PatFrag<(ops node:$vec, node:$val, node:$idx),
94    (v8i16 (vector_insert node:$vec, node:$val, node:$idx))>;
95def vinsert_v4i32 : PatFrag<(ops node:$vec, node:$val, node:$idx),
96    (v4i32 (vector_insert node:$vec, node:$val, node:$idx))>;
97def vinsert_v2i64 : PatFrag<(ops node:$vec, node:$val, node:$idx),
98    (v2i64 (vector_insert node:$vec, node:$val, node:$idx))>;
99
100def insve_v16i8 : PatFrag<(ops node:$v1, node:$i1, node:$v2, node:$i2),
101    (v16i8 (MipsINSVE node:$v1, node:$i1, node:$v2, node:$i2))>;
102def insve_v8i16 : PatFrag<(ops node:$v1, node:$i1, node:$v2, node:$i2),
103    (v8i16 (MipsINSVE node:$v1, node:$i1, node:$v2, node:$i2))>;
104def insve_v4i32 : PatFrag<(ops node:$v1, node:$i1, node:$v2, node:$i2),
105    (v4i32 (MipsINSVE node:$v1, node:$i1, node:$v2, node:$i2))>;
106def insve_v2i64 : PatFrag<(ops node:$v1, node:$i1, node:$v2, node:$i2),
107    (v2i64 (MipsINSVE node:$v1, node:$i1, node:$v2, node:$i2))>;
108
109class vfsetcc_type<ValueType ResTy, ValueType OpTy, CondCode CC> :
110  PatFrag<(ops node:$lhs, node:$rhs),
111          (ResTy (vfsetcc (OpTy node:$lhs), (OpTy node:$rhs), CC))>;
112
113// ISD::SETFALSE cannot occur
114def vfseteq_v4f32 : vfsetcc_type<v4i32, v4f32, SETEQ>;
115def vfseteq_v2f64 : vfsetcc_type<v2i64, v2f64, SETEQ>;
116def vfsetge_v4f32 : vfsetcc_type<v4i32, v4f32, SETGE>;
117def vfsetge_v2f64 : vfsetcc_type<v2i64, v2f64, SETGE>;
118def vfsetgt_v4f32 : vfsetcc_type<v4i32, v4f32, SETGT>;
119def vfsetgt_v2f64 : vfsetcc_type<v2i64, v2f64, SETGT>;
120def vfsetle_v4f32 : vfsetcc_type<v4i32, v4f32, SETLE>;
121def vfsetle_v2f64 : vfsetcc_type<v2i64, v2f64, SETLE>;
122def vfsetlt_v4f32 : vfsetcc_type<v4i32, v4f32, SETLT>;
123def vfsetlt_v2f64 : vfsetcc_type<v2i64, v2f64, SETLT>;
124def vfsetne_v4f32 : vfsetcc_type<v4i32, v4f32, SETNE>;
125def vfsetne_v2f64 : vfsetcc_type<v2i64, v2f64, SETNE>;
126def vfsetoeq_v4f32 : vfsetcc_type<v4i32, v4f32, SETOEQ>;
127def vfsetoeq_v2f64 : vfsetcc_type<v2i64, v2f64, SETOEQ>;
128def vfsetoge_v4f32 : vfsetcc_type<v4i32, v4f32, SETOGE>;
129def vfsetoge_v2f64 : vfsetcc_type<v2i64, v2f64, SETOGE>;
130def vfsetogt_v4f32 : vfsetcc_type<v4i32, v4f32, SETOGT>;
131def vfsetogt_v2f64 : vfsetcc_type<v2i64, v2f64, SETOGT>;
132def vfsetole_v4f32 : vfsetcc_type<v4i32, v4f32, SETOLE>;
133def vfsetole_v2f64 : vfsetcc_type<v2i64, v2f64, SETOLE>;
134def vfsetolt_v4f32 : vfsetcc_type<v4i32, v4f32, SETOLT>;
135def vfsetolt_v2f64 : vfsetcc_type<v2i64, v2f64, SETOLT>;
136def vfsetone_v4f32 : vfsetcc_type<v4i32, v4f32, SETONE>;
137def vfsetone_v2f64 : vfsetcc_type<v2i64, v2f64, SETONE>;
138def vfsetord_v4f32 : vfsetcc_type<v4i32, v4f32, SETO>;
139def vfsetord_v2f64 : vfsetcc_type<v2i64, v2f64, SETO>;
140def vfsetun_v4f32  : vfsetcc_type<v4i32, v4f32, SETUO>;
141def vfsetun_v2f64  : vfsetcc_type<v2i64, v2f64, SETUO>;
142def vfsetueq_v4f32 : vfsetcc_type<v4i32, v4f32, SETUEQ>;
143def vfsetueq_v2f64 : vfsetcc_type<v2i64, v2f64, SETUEQ>;
144def vfsetuge_v4f32 : vfsetcc_type<v4i32, v4f32, SETUGE>;
145def vfsetuge_v2f64 : vfsetcc_type<v2i64, v2f64, SETUGE>;
146def vfsetugt_v4f32 : vfsetcc_type<v4i32, v4f32, SETUGT>;
147def vfsetugt_v2f64 : vfsetcc_type<v2i64, v2f64, SETUGT>;
148def vfsetule_v4f32 : vfsetcc_type<v4i32, v4f32, SETULE>;
149def vfsetule_v2f64 : vfsetcc_type<v2i64, v2f64, SETULE>;
150def vfsetult_v4f32 : vfsetcc_type<v4i32, v4f32, SETULT>;
151def vfsetult_v2f64 : vfsetcc_type<v2i64, v2f64, SETULT>;
152def vfsetune_v4f32 : vfsetcc_type<v4i32, v4f32, SETUNE>;
153def vfsetune_v2f64 : vfsetcc_type<v2i64, v2f64, SETUNE>;
154// ISD::SETTRUE cannot occur
155// ISD::SETFALSE2 cannot occur
156// ISD::SETTRUE2 cannot occur
157
158class vsetcc_type<ValueType ResTy, CondCode CC> :
159  PatFrag<(ops node:$lhs, node:$rhs),
160          (ResTy (vsetcc node:$lhs, node:$rhs, CC))>;
161
162def vseteq_v16i8  : vsetcc_type<v16i8, SETEQ>;
163def vseteq_v8i16  : vsetcc_type<v8i16, SETEQ>;
164def vseteq_v4i32  : vsetcc_type<v4i32, SETEQ>;
165def vseteq_v2i64  : vsetcc_type<v2i64, SETEQ>;
166def vsetle_v16i8  : vsetcc_type<v16i8, SETLE>;
167def vsetle_v8i16  : vsetcc_type<v8i16, SETLE>;
168def vsetle_v4i32  : vsetcc_type<v4i32, SETLE>;
169def vsetle_v2i64  : vsetcc_type<v2i64, SETLE>;
170def vsetlt_v16i8  : vsetcc_type<v16i8, SETLT>;
171def vsetlt_v8i16  : vsetcc_type<v8i16, SETLT>;
172def vsetlt_v4i32  : vsetcc_type<v4i32, SETLT>;
173def vsetlt_v2i64  : vsetcc_type<v2i64, SETLT>;
174def vsetule_v16i8 : vsetcc_type<v16i8, SETULE>;
175def vsetule_v8i16 : vsetcc_type<v8i16, SETULE>;
176def vsetule_v4i32 : vsetcc_type<v4i32, SETULE>;
177def vsetule_v2i64 : vsetcc_type<v2i64, SETULE>;
178def vsetult_v16i8 : vsetcc_type<v16i8, SETULT>;
179def vsetult_v8i16 : vsetcc_type<v8i16, SETULT>;
180def vsetult_v4i32 : vsetcc_type<v4i32, SETULT>;
181def vsetult_v2i64 : vsetcc_type<v2i64, SETULT>;
182
183def vsplati8  : PatFrag<(ops node:$e0),
184                        (v16i8 (build_vector node:$e0, node:$e0,
185                                             node:$e0, node:$e0,
186                                             node:$e0, node:$e0,
187                                             node:$e0, node:$e0,
188                                             node:$e0, node:$e0,
189                                             node:$e0, node:$e0,
190                                             node:$e0, node:$e0,
191                                             node:$e0, node:$e0))>;
192def vsplati16 : PatFrag<(ops node:$e0),
193                        (v8i16 (build_vector node:$e0, node:$e0,
194                                             node:$e0, node:$e0,
195                                             node:$e0, node:$e0,
196                                             node:$e0, node:$e0))>;
197def vsplati32 : PatFrag<(ops node:$e0),
198                        (v4i32 (build_vector node:$e0, node:$e0,
199                                             node:$e0, node:$e0))>;
200
201def vsplati64_imm_eq_1 : PatLeaf<(bitconvert (v4i32 (build_vector))), [{
202  APInt Imm;
203  SDNode *BV = N->getOperand(0).getNode();
204  EVT EltTy = N->getValueType(0).getVectorElementType();
205
206  return selectVSplat(BV, Imm, EltTy.getSizeInBits()) &&
207         Imm.getBitWidth() == EltTy.getSizeInBits() && Imm == 1;
208}]>;
209
210def vsplati64 : PatFrag<(ops node:$e0),
211                        (v2i64 (build_vector node:$e0, node:$e0))>;
212
213def vsplati64_splat_d : PatFrag<(ops node:$e0),
214                                (v2i64 (bitconvert
215                                         (v4i32 (and
216                                           (v4i32 (build_vector node:$e0,
217                                                                node:$e0,
218                                                                node:$e0,
219                                                                node:$e0)),
220                                           vsplati64_imm_eq_1))))>;
221
222def vsplatf32 : PatFrag<(ops node:$e0),
223                        (v4f32 (build_vector node:$e0, node:$e0,
224                                             node:$e0, node:$e0))>;
225def vsplatf64 : PatFrag<(ops node:$e0),
226                        (v2f64 (build_vector node:$e0, node:$e0))>;
227
228def vsplati8_elt  : PatFrag<(ops node:$v, node:$i),
229                            (MipsVSHF (vsplati8 node:$i), node:$v, node:$v)>;
230def vsplati16_elt : PatFrag<(ops node:$v, node:$i),
231                            (MipsVSHF (vsplati16 node:$i), node:$v, node:$v)>;
232def vsplati32_elt : PatFrag<(ops node:$v, node:$i),
233                            (MipsVSHF (vsplati32 node:$i), node:$v, node:$v)>;
234def vsplati64_elt : PatFrag<(ops node:$v, node:$i),
235                            (MipsVSHF (vsplati64_splat_d node:$i),
236                                      node:$v, node:$v)>;
237
238class SplatPatLeaf<Operand opclass, dag frag, code pred = [{}],
239                   SDNodeXForm xform = NOOP_SDNodeXForm>
240  : PatLeaf<frag, pred, xform> {
241  Operand OpClass = opclass;
242}
243
244class SplatComplexPattern<Operand opclass, ValueType ty, int numops, string fn,
245                          list<SDNode> roots = [],
246                          list<SDNodeProperty> props = []> :
247  ComplexPattern<ty, numops, fn, roots, props> {
248  Operand OpClass = opclass;
249}
250
251def vsplati8_uimm3 : SplatComplexPattern<vsplat_uimm3, v16i8, 1,
252                                         "selectVSplatUimm3",
253                                         [build_vector, bitconvert]>;
254
255def vsplati8_uimm4 : SplatComplexPattern<vsplat_uimm4, v16i8, 1,
256                                         "selectVSplatUimm4",
257                                         [build_vector, bitconvert]>;
258
259def vsplati8_uimm5 : SplatComplexPattern<vsplat_uimm5, v16i8, 1,
260                                         "selectVSplatUimm5",
261                                         [build_vector, bitconvert]>;
262
263def vsplati8_uimm8 : SplatComplexPattern<vsplat_uimm8, v16i8, 1,
264                                         "selectVSplatUimm8",
265                                         [build_vector, bitconvert]>;
266
267def vsplati8_simm5 : SplatComplexPattern<vsplat_simm5, v16i8, 1,
268                                         "selectVSplatSimm5",
269                                         [build_vector, bitconvert]>;
270
271def vsplati16_uimm3 : SplatComplexPattern<vsplat_uimm3, v8i16, 1,
272                                          "selectVSplatUimm3",
273                                          [build_vector, bitconvert]>;
274
275def vsplati16_uimm4 : SplatComplexPattern<vsplat_uimm4, v8i16, 1,
276                                          "selectVSplatUimm4",
277                                          [build_vector, bitconvert]>;
278
279def vsplati16_uimm5 : SplatComplexPattern<vsplat_uimm5, v8i16, 1,
280                                          "selectVSplatUimm5",
281                                          [build_vector, bitconvert]>;
282
283def vsplati16_simm5 : SplatComplexPattern<vsplat_simm5, v8i16, 1,
284                                          "selectVSplatSimm5",
285                                          [build_vector, bitconvert]>;
286
287def vsplati32_uimm2 : SplatComplexPattern<vsplat_uimm2, v4i32, 1,
288                                          "selectVSplatUimm2",
289                                          [build_vector, bitconvert]>;
290
291def vsplati32_uimm5 : SplatComplexPattern<vsplat_uimm5, v4i32, 1,
292                                          "selectVSplatUimm5",
293                                          [build_vector, bitconvert]>;
294
295def vsplati32_simm5 : SplatComplexPattern<vsplat_simm5, v4i32, 1,
296                                          "selectVSplatSimm5",
297                                          [build_vector, bitconvert]>;
298
299def vsplati64_uimm1 : SplatComplexPattern<vsplat_uimm1, v2i64, 1,
300                                          "selectVSplatUimm1",
301                                          [build_vector, bitconvert]>;
302
303def vsplati64_uimm5 : SplatComplexPattern<vsplat_uimm5, v2i64, 1,
304                                          "selectVSplatUimm5",
305                                          [build_vector, bitconvert]>;
306
307def vsplati64_uimm6 : SplatComplexPattern<vsplat_uimm6, v2i64, 1,
308                                          "selectVSplatUimm6",
309                                          [build_vector, bitconvert]>;
310
311def vsplati64_simm5 : SplatComplexPattern<vsplat_simm5, v2i64, 1,
312                                          "selectVSplatSimm5",
313                                          [build_vector, bitconvert]>;
314
315// Any build_vector that is a constant splat with a value that is an exact
316// power of 2
317def vsplat_uimm_pow2 : ComplexPattern<vAny, 1, "selectVSplatUimmPow2",
318                                      [build_vector, bitconvert]>;
319
320// Any build_vector that is a constant splat with a value that is the bitwise
321// inverse of an exact power of 2
322def vsplat_uimm_inv_pow2 : ComplexPattern<vAny, 1, "selectVSplatUimmInvPow2",
323                                          [build_vector, bitconvert]>;
324
325// Any build_vector that is a constant splat with only a consecutive sequence
326// of left-most bits set.
327def vsplat_maskl_bits_uimm3
328    : SplatComplexPattern<vsplat_uimm3, vAny, 1, "selectVSplatMaskL",
329                          [build_vector, bitconvert]>;
330def vsplat_maskl_bits_uimm4
331    : SplatComplexPattern<vsplat_uimm4, vAny, 1, "selectVSplatMaskL",
332                          [build_vector, bitconvert]>;
333def vsplat_maskl_bits_uimm5
334    : SplatComplexPattern<vsplat_uimm5, vAny, 1, "selectVSplatMaskL",
335                          [build_vector, bitconvert]>;
336def vsplat_maskl_bits_uimm6
337    : SplatComplexPattern<vsplat_uimm6, vAny, 1, "selectVSplatMaskL",
338                          [build_vector, bitconvert]>;
339
340// Any build_vector that is a constant splat with only a consecutive sequence
341// of right-most bits set.
342def vsplat_maskr_bits_uimm3
343    : SplatComplexPattern<vsplat_uimm3, vAny, 1, "selectVSplatMaskR",
344                          [build_vector, bitconvert]>;
345def vsplat_maskr_bits_uimm4
346    : SplatComplexPattern<vsplat_uimm4, vAny, 1, "selectVSplatMaskR",
347                          [build_vector, bitconvert]>;
348def vsplat_maskr_bits_uimm5
349    : SplatComplexPattern<vsplat_uimm5, vAny, 1, "selectVSplatMaskR",
350                          [build_vector, bitconvert]>;
351def vsplat_maskr_bits_uimm6
352    : SplatComplexPattern<vsplat_uimm6, vAny, 1, "selectVSplatMaskR",
353                          [build_vector, bitconvert]>;
354
355// Any build_vector that is a constant splat with a value that equals 1
356// FIXME: These should be a ComplexPattern but we can't use them because the
357//        ISel generator requires the uses to have a name, but providing a name
358//        causes other errors ("used in pattern but not operand list")
359def vsplat_imm_eq_1 : PatLeaf<(build_vector), [{
360  APInt Imm;
361  EVT EltTy = N->getValueType(0).getVectorElementType();
362
363  return selectVSplat(N, Imm, EltTy.getSizeInBits()) &&
364         Imm.getBitWidth() == EltTy.getSizeInBits() && Imm == 1;
365}]>;
366
367def vbclr_b : PatFrag<(ops node:$ws, node:$wt),
368                      (and node:$ws, (xor (shl vsplat_imm_eq_1, node:$wt),
369                                          immAllOnesV))>;
370def vbclr_h : PatFrag<(ops node:$ws, node:$wt),
371                      (and node:$ws, (xor (shl vsplat_imm_eq_1, node:$wt),
372                                          immAllOnesV))>;
373def vbclr_w : PatFrag<(ops node:$ws, node:$wt),
374                      (and node:$ws, (xor (shl vsplat_imm_eq_1, node:$wt),
375                                          immAllOnesV))>;
376def vbclr_d : PatFrag<(ops node:$ws, node:$wt),
377                      (and node:$ws, (xor (shl (v2i64 vsplati64_imm_eq_1),
378                                               node:$wt),
379                                          (bitconvert (v4i32 immAllOnesV))))>;
380
381def vbneg_b : PatFrag<(ops node:$ws, node:$wt),
382                      (xor node:$ws, (shl vsplat_imm_eq_1, node:$wt))>;
383def vbneg_h : PatFrag<(ops node:$ws, node:$wt),
384                      (xor node:$ws, (shl vsplat_imm_eq_1, node:$wt))>;
385def vbneg_w : PatFrag<(ops node:$ws, node:$wt),
386                      (xor node:$ws, (shl vsplat_imm_eq_1, node:$wt))>;
387def vbneg_d : PatFrag<(ops node:$ws, node:$wt),
388                      (xor node:$ws, (shl (v2i64 vsplati64_imm_eq_1),
389                                          node:$wt))>;
390
391def vbset_b : PatFrag<(ops node:$ws, node:$wt),
392                      (or node:$ws, (shl vsplat_imm_eq_1, node:$wt))>;
393def vbset_h : PatFrag<(ops node:$ws, node:$wt),
394                      (or node:$ws, (shl vsplat_imm_eq_1, node:$wt))>;
395def vbset_w : PatFrag<(ops node:$ws, node:$wt),
396                      (or node:$ws, (shl vsplat_imm_eq_1, node:$wt))>;
397def vbset_d : PatFrag<(ops node:$ws, node:$wt),
398                      (or node:$ws, (shl (v2i64 vsplati64_imm_eq_1),
399                                         node:$wt))>;
400
401def muladd : PatFrag<(ops node:$wd, node:$ws, node:$wt),
402                     (add node:$wd, (mul node:$ws, node:$wt))>;
403
404def mulsub : PatFrag<(ops node:$wd, node:$ws, node:$wt),
405                     (sub node:$wd, (mul node:$ws, node:$wt))>;
406
407def mul_fexp2 : PatFrag<(ops node:$ws, node:$wt),
408                        (fmul node:$ws, (fexp2 node:$wt))>;
409
410// Instruction encoding.
411class ADD_A_B_ENC : MSA_3R_FMT<0b000, 0b00, 0b010000>;
412class ADD_A_H_ENC : MSA_3R_FMT<0b000, 0b01, 0b010000>;
413class ADD_A_W_ENC : MSA_3R_FMT<0b000, 0b10, 0b010000>;
414class ADD_A_D_ENC : MSA_3R_FMT<0b000, 0b11, 0b010000>;
415
416class ADDS_A_B_ENC : MSA_3R_FMT<0b001, 0b00, 0b010000>;
417class ADDS_A_H_ENC : MSA_3R_FMT<0b001, 0b01, 0b010000>;
418class ADDS_A_W_ENC : MSA_3R_FMT<0b001, 0b10, 0b010000>;
419class ADDS_A_D_ENC : MSA_3R_FMT<0b001, 0b11, 0b010000>;
420
421class ADDS_S_B_ENC : MSA_3R_FMT<0b010, 0b00, 0b010000>;
422class ADDS_S_H_ENC : MSA_3R_FMT<0b010, 0b01, 0b010000>;
423class ADDS_S_W_ENC : MSA_3R_FMT<0b010, 0b10, 0b010000>;
424class ADDS_S_D_ENC : MSA_3R_FMT<0b010, 0b11, 0b010000>;
425
426class ADDS_U_B_ENC : MSA_3R_FMT<0b011, 0b00, 0b010000>;
427class ADDS_U_H_ENC : MSA_3R_FMT<0b011, 0b01, 0b010000>;
428class ADDS_U_W_ENC : MSA_3R_FMT<0b011, 0b10, 0b010000>;
429class ADDS_U_D_ENC : MSA_3R_FMT<0b011, 0b11, 0b010000>;
430
431class ADDV_B_ENC : MSA_3R_FMT<0b000, 0b00, 0b001110>;
432class ADDV_H_ENC : MSA_3R_FMT<0b000, 0b01, 0b001110>;
433class ADDV_W_ENC : MSA_3R_FMT<0b000, 0b10, 0b001110>;
434class ADDV_D_ENC : MSA_3R_FMT<0b000, 0b11, 0b001110>;
435
436class ADDVI_B_ENC : MSA_I5_FMT<0b000, 0b00, 0b000110>;
437class ADDVI_H_ENC : MSA_I5_FMT<0b000, 0b01, 0b000110>;
438class ADDVI_W_ENC : MSA_I5_FMT<0b000, 0b10, 0b000110>;
439class ADDVI_D_ENC : MSA_I5_FMT<0b000, 0b11, 0b000110>;
440
441class AND_V_ENC : MSA_VEC_FMT<0b00000, 0b011110>;
442
443class ANDI_B_ENC : MSA_I8_FMT<0b00, 0b000000>;
444
445class ASUB_S_B_ENC : MSA_3R_FMT<0b100, 0b00, 0b010001>;
446class ASUB_S_H_ENC : MSA_3R_FMT<0b100, 0b01, 0b010001>;
447class ASUB_S_W_ENC : MSA_3R_FMT<0b100, 0b10, 0b010001>;
448class ASUB_S_D_ENC : MSA_3R_FMT<0b100, 0b11, 0b010001>;
449
450class ASUB_U_B_ENC : MSA_3R_FMT<0b101, 0b00, 0b010001>;
451class ASUB_U_H_ENC : MSA_3R_FMT<0b101, 0b01, 0b010001>;
452class ASUB_U_W_ENC : MSA_3R_FMT<0b101, 0b10, 0b010001>;
453class ASUB_U_D_ENC : MSA_3R_FMT<0b101, 0b11, 0b010001>;
454
455class AVE_S_B_ENC : MSA_3R_FMT<0b100, 0b00, 0b010000>;
456class AVE_S_H_ENC : MSA_3R_FMT<0b100, 0b01, 0b010000>;
457class AVE_S_W_ENC : MSA_3R_FMT<0b100, 0b10, 0b010000>;
458class AVE_S_D_ENC : MSA_3R_FMT<0b100, 0b11, 0b010000>;
459
460class AVE_U_B_ENC : MSA_3R_FMT<0b101, 0b00, 0b010000>;
461class AVE_U_H_ENC : MSA_3R_FMT<0b101, 0b01, 0b010000>;
462class AVE_U_W_ENC : MSA_3R_FMT<0b101, 0b10, 0b010000>;
463class AVE_U_D_ENC : MSA_3R_FMT<0b101, 0b11, 0b010000>;
464
465class AVER_S_B_ENC : MSA_3R_FMT<0b110, 0b00, 0b010000>;
466class AVER_S_H_ENC : MSA_3R_FMT<0b110, 0b01, 0b010000>;
467class AVER_S_W_ENC : MSA_3R_FMT<0b110, 0b10, 0b010000>;
468class AVER_S_D_ENC : MSA_3R_FMT<0b110, 0b11, 0b010000>;
469
470class AVER_U_B_ENC : MSA_3R_FMT<0b111, 0b00, 0b010000>;
471class AVER_U_H_ENC : MSA_3R_FMT<0b111, 0b01, 0b010000>;
472class AVER_U_W_ENC : MSA_3R_FMT<0b111, 0b10, 0b010000>;
473class AVER_U_D_ENC : MSA_3R_FMT<0b111, 0b11, 0b010000>;
474
475class BCLR_B_ENC : MSA_3R_FMT<0b011, 0b00, 0b001101>;
476class BCLR_H_ENC : MSA_3R_FMT<0b011, 0b01, 0b001101>;
477class BCLR_W_ENC : MSA_3R_FMT<0b011, 0b10, 0b001101>;
478class BCLR_D_ENC : MSA_3R_FMT<0b011, 0b11, 0b001101>;
479
480class BCLRI_B_ENC : MSA_BIT_B_FMT<0b011, 0b001001>;
481class BCLRI_H_ENC : MSA_BIT_H_FMT<0b011, 0b001001>;
482class BCLRI_W_ENC : MSA_BIT_W_FMT<0b011, 0b001001>;
483class BCLRI_D_ENC : MSA_BIT_D_FMT<0b011, 0b001001>;
484
485class BINSL_B_ENC : MSA_3R_FMT<0b110, 0b00, 0b001101>;
486class BINSL_H_ENC : MSA_3R_FMT<0b110, 0b01, 0b001101>;
487class BINSL_W_ENC : MSA_3R_FMT<0b110, 0b10, 0b001101>;
488class BINSL_D_ENC : MSA_3R_FMT<0b110, 0b11, 0b001101>;
489
490class BINSLI_B_ENC : MSA_BIT_B_FMT<0b110, 0b001001>;
491class BINSLI_H_ENC : MSA_BIT_H_FMT<0b110, 0b001001>;
492class BINSLI_W_ENC : MSA_BIT_W_FMT<0b110, 0b001001>;
493class BINSLI_D_ENC : MSA_BIT_D_FMT<0b110, 0b001001>;
494
495class BINSR_B_ENC : MSA_3R_FMT<0b111, 0b00, 0b001101>;
496class BINSR_H_ENC : MSA_3R_FMT<0b111, 0b01, 0b001101>;
497class BINSR_W_ENC : MSA_3R_FMT<0b111, 0b10, 0b001101>;
498class BINSR_D_ENC : MSA_3R_FMT<0b111, 0b11, 0b001101>;
499
500class BINSRI_B_ENC : MSA_BIT_B_FMT<0b111, 0b001001>;
501class BINSRI_H_ENC : MSA_BIT_H_FMT<0b111, 0b001001>;
502class BINSRI_W_ENC : MSA_BIT_W_FMT<0b111, 0b001001>;
503class BINSRI_D_ENC : MSA_BIT_D_FMT<0b111, 0b001001>;
504
505class BMNZ_V_ENC : MSA_VEC_FMT<0b00100, 0b011110>;
506
507class BMNZI_B_ENC : MSA_I8_FMT<0b00, 0b000001>;
508
509class BMZ_V_ENC : MSA_VEC_FMT<0b00101, 0b011110>;
510
511class BMZI_B_ENC : MSA_I8_FMT<0b01, 0b000001>;
512
513class BNEG_B_ENC : MSA_3R_FMT<0b101, 0b00, 0b001101>;
514class BNEG_H_ENC : MSA_3R_FMT<0b101, 0b01, 0b001101>;
515class BNEG_W_ENC : MSA_3R_FMT<0b101, 0b10, 0b001101>;
516class BNEG_D_ENC : MSA_3R_FMT<0b101, 0b11, 0b001101>;
517
518class BNEGI_B_ENC : MSA_BIT_B_FMT<0b101, 0b001001>;
519class BNEGI_H_ENC : MSA_BIT_H_FMT<0b101, 0b001001>;
520class BNEGI_W_ENC : MSA_BIT_W_FMT<0b101, 0b001001>;
521class BNEGI_D_ENC : MSA_BIT_D_FMT<0b101, 0b001001>;
522
523class BNZ_B_ENC : MSA_CBRANCH_FMT<0b111, 0b00>;
524class BNZ_H_ENC : MSA_CBRANCH_FMT<0b111, 0b01>;
525class BNZ_W_ENC : MSA_CBRANCH_FMT<0b111, 0b10>;
526class BNZ_D_ENC : MSA_CBRANCH_FMT<0b111, 0b11>;
527
528class BNZ_V_ENC : MSA_CBRANCH_V_FMT<0b01111>;
529
530class BSEL_V_ENC : MSA_VEC_FMT<0b00110, 0b011110>;
531
532class BSELI_B_ENC : MSA_I8_FMT<0b10, 0b000001>;
533
534class BSET_B_ENC : MSA_3R_FMT<0b100, 0b00, 0b001101>;
535class BSET_H_ENC : MSA_3R_FMT<0b100, 0b01, 0b001101>;
536class BSET_W_ENC : MSA_3R_FMT<0b100, 0b10, 0b001101>;
537class BSET_D_ENC : MSA_3R_FMT<0b100, 0b11, 0b001101>;
538
539class BSETI_B_ENC : MSA_BIT_B_FMT<0b100, 0b001001>;
540class BSETI_H_ENC : MSA_BIT_H_FMT<0b100, 0b001001>;
541class BSETI_W_ENC : MSA_BIT_W_FMT<0b100, 0b001001>;
542class BSETI_D_ENC : MSA_BIT_D_FMT<0b100, 0b001001>;
543
544class BZ_B_ENC : MSA_CBRANCH_FMT<0b110, 0b00>;
545class BZ_H_ENC : MSA_CBRANCH_FMT<0b110, 0b01>;
546class BZ_W_ENC : MSA_CBRANCH_FMT<0b110, 0b10>;
547class BZ_D_ENC : MSA_CBRANCH_FMT<0b110, 0b11>;
548
549class BZ_V_ENC : MSA_CBRANCH_V_FMT<0b01011>;
550
551class CEQ_B_ENC : MSA_3R_FMT<0b000, 0b00, 0b001111>;
552class CEQ_H_ENC : MSA_3R_FMT<0b000, 0b01, 0b001111>;
553class CEQ_W_ENC : MSA_3R_FMT<0b000, 0b10, 0b001111>;
554class CEQ_D_ENC : MSA_3R_FMT<0b000, 0b11, 0b001111>;
555
556class CEQI_B_ENC : MSA_I5_FMT<0b000, 0b00, 0b000111>;
557class CEQI_H_ENC : MSA_I5_FMT<0b000, 0b01, 0b000111>;
558class CEQI_W_ENC : MSA_I5_FMT<0b000, 0b10, 0b000111>;
559class CEQI_D_ENC : MSA_I5_FMT<0b000, 0b11, 0b000111>;
560
561class CFCMSA_ENC : MSA_ELM_CFCMSA_FMT<0b0001111110, 0b011001>;
562
563class CLE_S_B_ENC : MSA_3R_FMT<0b100, 0b00, 0b001111>;
564class CLE_S_H_ENC : MSA_3R_FMT<0b100, 0b01, 0b001111>;
565class CLE_S_W_ENC : MSA_3R_FMT<0b100, 0b10, 0b001111>;
566class CLE_S_D_ENC : MSA_3R_FMT<0b100, 0b11, 0b001111>;
567
568class CLE_U_B_ENC : MSA_3R_FMT<0b101, 0b00, 0b001111>;
569class CLE_U_H_ENC : MSA_3R_FMT<0b101, 0b01, 0b001111>;
570class CLE_U_W_ENC : MSA_3R_FMT<0b101, 0b10, 0b001111>;
571class CLE_U_D_ENC : MSA_3R_FMT<0b101, 0b11, 0b001111>;
572
573class CLEI_S_B_ENC : MSA_I5_FMT<0b100, 0b00, 0b000111>;
574class CLEI_S_H_ENC : MSA_I5_FMT<0b100, 0b01, 0b000111>;
575class CLEI_S_W_ENC : MSA_I5_FMT<0b100, 0b10, 0b000111>;
576class CLEI_S_D_ENC : MSA_I5_FMT<0b100, 0b11, 0b000111>;
577
578class CLEI_U_B_ENC : MSA_I5_FMT<0b101, 0b00, 0b000111>;
579class CLEI_U_H_ENC : MSA_I5_FMT<0b101, 0b01, 0b000111>;
580class CLEI_U_W_ENC : MSA_I5_FMT<0b101, 0b10, 0b000111>;
581class CLEI_U_D_ENC : MSA_I5_FMT<0b101, 0b11, 0b000111>;
582
583class CLT_S_B_ENC : MSA_3R_FMT<0b010, 0b00, 0b001111>;
584class CLT_S_H_ENC : MSA_3R_FMT<0b010, 0b01, 0b001111>;
585class CLT_S_W_ENC : MSA_3R_FMT<0b010, 0b10, 0b001111>;
586class CLT_S_D_ENC : MSA_3R_FMT<0b010, 0b11, 0b001111>;
587
588class CLT_U_B_ENC : MSA_3R_FMT<0b011, 0b00, 0b001111>;
589class CLT_U_H_ENC : MSA_3R_FMT<0b011, 0b01, 0b001111>;
590class CLT_U_W_ENC : MSA_3R_FMT<0b011, 0b10, 0b001111>;
591class CLT_U_D_ENC : MSA_3R_FMT<0b011, 0b11, 0b001111>;
592
593class CLTI_S_B_ENC : MSA_I5_FMT<0b010, 0b00, 0b000111>;
594class CLTI_S_H_ENC : MSA_I5_FMT<0b010, 0b01, 0b000111>;
595class CLTI_S_W_ENC : MSA_I5_FMT<0b010, 0b10, 0b000111>;
596class CLTI_S_D_ENC : MSA_I5_FMT<0b010, 0b11, 0b000111>;
597
598class CLTI_U_B_ENC : MSA_I5_FMT<0b011, 0b00, 0b000111>;
599class CLTI_U_H_ENC : MSA_I5_FMT<0b011, 0b01, 0b000111>;
600class CLTI_U_W_ENC : MSA_I5_FMT<0b011, 0b10, 0b000111>;
601class CLTI_U_D_ENC : MSA_I5_FMT<0b011, 0b11, 0b000111>;
602
603class COPY_S_B_ENC : MSA_ELM_COPY_B_FMT<0b0010, 0b011001>;
604class COPY_S_H_ENC : MSA_ELM_COPY_H_FMT<0b0010, 0b011001>;
605class COPY_S_W_ENC : MSA_ELM_COPY_W_FMT<0b0010, 0b011001>;
606class COPY_S_D_ENC : MSA_ELM_COPY_D_FMT<0b0010, 0b011001>;
607
608class COPY_U_B_ENC : MSA_ELM_COPY_B_FMT<0b0011, 0b011001>;
609class COPY_U_H_ENC : MSA_ELM_COPY_H_FMT<0b0011, 0b011001>;
610class COPY_U_W_ENC : MSA_ELM_COPY_W_FMT<0b0011, 0b011001>;
611
612class CTCMSA_ENC : MSA_ELM_CTCMSA_FMT<0b0000111110, 0b011001>;
613
614class DIV_S_B_ENC : MSA_3R_FMT<0b100, 0b00, 0b010010>;
615class DIV_S_H_ENC : MSA_3R_FMT<0b100, 0b01, 0b010010>;
616class DIV_S_W_ENC : MSA_3R_FMT<0b100, 0b10, 0b010010>;
617class DIV_S_D_ENC : MSA_3R_FMT<0b100, 0b11, 0b010010>;
618
619class DIV_U_B_ENC : MSA_3R_FMT<0b101, 0b00, 0b010010>;
620class DIV_U_H_ENC : MSA_3R_FMT<0b101, 0b01, 0b010010>;
621class DIV_U_W_ENC : MSA_3R_FMT<0b101, 0b10, 0b010010>;
622class DIV_U_D_ENC : MSA_3R_FMT<0b101, 0b11, 0b010010>;
623
624class DOTP_S_H_ENC : MSA_3R_FMT<0b000, 0b01, 0b010011>;
625class DOTP_S_W_ENC : MSA_3R_FMT<0b000, 0b10, 0b010011>;
626class DOTP_S_D_ENC : MSA_3R_FMT<0b000, 0b11, 0b010011>;
627
628class DOTP_U_H_ENC : MSA_3R_FMT<0b001, 0b01, 0b010011>;
629class DOTP_U_W_ENC : MSA_3R_FMT<0b001, 0b10, 0b010011>;
630class DOTP_U_D_ENC : MSA_3R_FMT<0b001, 0b11, 0b010011>;
631
632class DPADD_S_H_ENC : MSA_3R_FMT<0b010, 0b01, 0b010011>;
633class DPADD_S_W_ENC : MSA_3R_FMT<0b010, 0b10, 0b010011>;
634class DPADD_S_D_ENC : MSA_3R_FMT<0b010, 0b11, 0b010011>;
635
636class DPADD_U_H_ENC : MSA_3R_FMT<0b011, 0b01, 0b010011>;
637class DPADD_U_W_ENC : MSA_3R_FMT<0b011, 0b10, 0b010011>;
638class DPADD_U_D_ENC : MSA_3R_FMT<0b011, 0b11, 0b010011>;
639
640class DPSUB_S_H_ENC : MSA_3R_FMT<0b100, 0b01, 0b010011>;
641class DPSUB_S_W_ENC : MSA_3R_FMT<0b100, 0b10, 0b010011>;
642class DPSUB_S_D_ENC : MSA_3R_FMT<0b100, 0b11, 0b010011>;
643
644class DPSUB_U_H_ENC : MSA_3R_FMT<0b101, 0b01, 0b010011>;
645class DPSUB_U_W_ENC : MSA_3R_FMT<0b101, 0b10, 0b010011>;
646class DPSUB_U_D_ENC : MSA_3R_FMT<0b101, 0b11, 0b010011>;
647
648class FADD_W_ENC : MSA_3RF_FMT<0b0000, 0b0, 0b011011>;
649class FADD_D_ENC : MSA_3RF_FMT<0b0000, 0b1, 0b011011>;
650
651class FCAF_W_ENC : MSA_3RF_FMT<0b0000, 0b0, 0b011010>;
652class FCAF_D_ENC : MSA_3RF_FMT<0b0000, 0b1, 0b011010>;
653
654class FCEQ_W_ENC : MSA_3RF_FMT<0b0010, 0b0, 0b011010>;
655class FCEQ_D_ENC : MSA_3RF_FMT<0b0010, 0b1, 0b011010>;
656
657class FCLASS_W_ENC : MSA_2RF_FMT<0b110010000, 0b0, 0b011110>;
658class FCLASS_D_ENC : MSA_2RF_FMT<0b110010000, 0b1, 0b011110>;
659
660class FCLE_W_ENC : MSA_3RF_FMT<0b0110, 0b0, 0b011010>;
661class FCLE_D_ENC : MSA_3RF_FMT<0b0110, 0b1, 0b011010>;
662
663class FCLT_W_ENC : MSA_3RF_FMT<0b0100, 0b0, 0b011010>;
664class FCLT_D_ENC : MSA_3RF_FMT<0b0100, 0b1, 0b011010>;
665
666class FCNE_W_ENC : MSA_3RF_FMT<0b0011, 0b0, 0b011100>;
667class FCNE_D_ENC : MSA_3RF_FMT<0b0011, 0b1, 0b011100>;
668
669class FCOR_W_ENC : MSA_3RF_FMT<0b0001, 0b0, 0b011100>;
670class FCOR_D_ENC : MSA_3RF_FMT<0b0001, 0b1, 0b011100>;
671
672class FCUEQ_W_ENC : MSA_3RF_FMT<0b0011, 0b0, 0b011010>;
673class FCUEQ_D_ENC : MSA_3RF_FMT<0b0011, 0b1, 0b011010>;
674
675class FCULE_W_ENC : MSA_3RF_FMT<0b0111, 0b0, 0b011010>;
676class FCULE_D_ENC : MSA_3RF_FMT<0b0111, 0b1, 0b011010>;
677
678class FCULT_W_ENC : MSA_3RF_FMT<0b0101, 0b0, 0b011010>;
679class FCULT_D_ENC : MSA_3RF_FMT<0b0101, 0b1, 0b011010>;
680
681class FCUN_W_ENC : MSA_3RF_FMT<0b0001, 0b0, 0b011010>;
682class FCUN_D_ENC : MSA_3RF_FMT<0b0001, 0b1, 0b011010>;
683
684class FCUNE_W_ENC : MSA_3RF_FMT<0b0010, 0b0, 0b011100>;
685class FCUNE_D_ENC : MSA_3RF_FMT<0b0010, 0b1, 0b011100>;
686
687class FDIV_W_ENC : MSA_3RF_FMT<0b0011, 0b0, 0b011011>;
688class FDIV_D_ENC : MSA_3RF_FMT<0b0011, 0b1, 0b011011>;
689
690class FEXDO_H_ENC : MSA_3RF_FMT<0b1000, 0b0, 0b011011>;
691class FEXDO_W_ENC : MSA_3RF_FMT<0b1000, 0b1, 0b011011>;
692
693class FEXP2_W_ENC : MSA_3RF_FMT<0b0111, 0b0, 0b011011>;
694class FEXP2_D_ENC : MSA_3RF_FMT<0b0111, 0b1, 0b011011>;
695
696class FEXUPL_W_ENC : MSA_2RF_FMT<0b110011000, 0b0, 0b011110>;
697class FEXUPL_D_ENC : MSA_2RF_FMT<0b110011000, 0b1, 0b011110>;
698
699class FEXUPR_W_ENC : MSA_2RF_FMT<0b110011001, 0b0, 0b011110>;
700class FEXUPR_D_ENC : MSA_2RF_FMT<0b110011001, 0b1, 0b011110>;
701
702class FFINT_S_W_ENC : MSA_2RF_FMT<0b110011110, 0b0, 0b011110>;
703class FFINT_S_D_ENC : MSA_2RF_FMT<0b110011110, 0b1, 0b011110>;
704
705class FFINT_U_W_ENC : MSA_2RF_FMT<0b110011111, 0b0, 0b011110>;
706class FFINT_U_D_ENC : MSA_2RF_FMT<0b110011111, 0b1, 0b011110>;
707
708class FFQL_W_ENC : MSA_2RF_FMT<0b110011010, 0b0, 0b011110>;
709class FFQL_D_ENC : MSA_2RF_FMT<0b110011010, 0b1, 0b011110>;
710
711class FFQR_W_ENC : MSA_2RF_FMT<0b110011011, 0b0, 0b011110>;
712class FFQR_D_ENC : MSA_2RF_FMT<0b110011011, 0b1, 0b011110>;
713
714class FILL_B_ENC : MSA_2R_FILL_FMT<0b11000000, 0b00, 0b011110>;
715class FILL_H_ENC : MSA_2R_FILL_FMT<0b11000000, 0b01, 0b011110>;
716class FILL_W_ENC : MSA_2R_FILL_FMT<0b11000000, 0b10, 0b011110>;
717class FILL_D_ENC : MSA_2R_FILL_D_FMT<0b11000000, 0b11, 0b011110>;
718
719class FLOG2_W_ENC : MSA_2RF_FMT<0b110010111, 0b0, 0b011110>;
720class FLOG2_D_ENC : MSA_2RF_FMT<0b110010111, 0b1, 0b011110>;
721
722class FMADD_W_ENC : MSA_3RF_FMT<0b0100, 0b0, 0b011011>;
723class FMADD_D_ENC : MSA_3RF_FMT<0b0100, 0b1, 0b011011>;
724
725class FMAX_W_ENC : MSA_3RF_FMT<0b1110, 0b0, 0b011011>;
726class FMAX_D_ENC : MSA_3RF_FMT<0b1110, 0b1, 0b011011>;
727
728class FMAX_A_W_ENC : MSA_3RF_FMT<0b1111, 0b0, 0b011011>;
729class FMAX_A_D_ENC : MSA_3RF_FMT<0b1111, 0b1, 0b011011>;
730
731class FMIN_W_ENC : MSA_3RF_FMT<0b1100, 0b0, 0b011011>;
732class FMIN_D_ENC : MSA_3RF_FMT<0b1100, 0b1, 0b011011>;
733
734class FMIN_A_W_ENC : MSA_3RF_FMT<0b1101, 0b0, 0b011011>;
735class FMIN_A_D_ENC : MSA_3RF_FMT<0b1101, 0b1, 0b011011>;
736
737class FMSUB_W_ENC : MSA_3RF_FMT<0b0101, 0b0, 0b011011>;
738class FMSUB_D_ENC : MSA_3RF_FMT<0b0101, 0b1, 0b011011>;
739
740class FMUL_W_ENC : MSA_3RF_FMT<0b0010, 0b0, 0b011011>;
741class FMUL_D_ENC : MSA_3RF_FMT<0b0010, 0b1, 0b011011>;
742
743class FRINT_W_ENC : MSA_2RF_FMT<0b110010110, 0b0, 0b011110>;
744class FRINT_D_ENC : MSA_2RF_FMT<0b110010110, 0b1, 0b011110>;
745
746class FRCP_W_ENC : MSA_2RF_FMT<0b110010101, 0b0, 0b011110>;
747class FRCP_D_ENC : MSA_2RF_FMT<0b110010101, 0b1, 0b011110>;
748
749class FRSQRT_W_ENC : MSA_2RF_FMT<0b110010100, 0b0, 0b011110>;
750class FRSQRT_D_ENC : MSA_2RF_FMT<0b110010100, 0b1, 0b011110>;
751
752class FSAF_W_ENC : MSA_3RF_FMT<0b1000, 0b0, 0b011010>;
753class FSAF_D_ENC : MSA_3RF_FMT<0b1000, 0b1, 0b011010>;
754
755class FSEQ_W_ENC : MSA_3RF_FMT<0b1010, 0b0, 0b011010>;
756class FSEQ_D_ENC : MSA_3RF_FMT<0b1010, 0b1, 0b011010>;
757
758class FSLE_W_ENC : MSA_3RF_FMT<0b1110, 0b0, 0b011010>;
759class FSLE_D_ENC : MSA_3RF_FMT<0b1110, 0b1, 0b011010>;
760
761class FSLT_W_ENC : MSA_3RF_FMT<0b1100, 0b0, 0b011010>;
762class FSLT_D_ENC : MSA_3RF_FMT<0b1100, 0b1, 0b011010>;
763
764class FSNE_W_ENC : MSA_3RF_FMT<0b1011, 0b0, 0b011100>;
765class FSNE_D_ENC : MSA_3RF_FMT<0b1011, 0b1, 0b011100>;
766
767class FSOR_W_ENC : MSA_3RF_FMT<0b1001, 0b0, 0b011100>;
768class FSOR_D_ENC : MSA_3RF_FMT<0b1001, 0b1, 0b011100>;
769
770class FSQRT_W_ENC : MSA_2RF_FMT<0b110010011, 0b0, 0b011110>;
771class FSQRT_D_ENC : MSA_2RF_FMT<0b110010011, 0b1, 0b011110>;
772
773class FSUB_W_ENC : MSA_3RF_FMT<0b0001, 0b0, 0b011011>;
774class FSUB_D_ENC : MSA_3RF_FMT<0b0001, 0b1, 0b011011>;
775
776class FSUEQ_W_ENC : MSA_3RF_FMT<0b1011, 0b0, 0b011010>;
777class FSUEQ_D_ENC : MSA_3RF_FMT<0b1011, 0b1, 0b011010>;
778
779class FSULE_W_ENC : MSA_3RF_FMT<0b1111, 0b0, 0b011010>;
780class FSULE_D_ENC : MSA_3RF_FMT<0b1111, 0b1, 0b011010>;
781
782class FSULT_W_ENC : MSA_3RF_FMT<0b1101, 0b0, 0b011010>;
783class FSULT_D_ENC : MSA_3RF_FMT<0b1101, 0b1, 0b011010>;
784
785class FSUN_W_ENC : MSA_3RF_FMT<0b1001, 0b0, 0b011010>;
786class FSUN_D_ENC : MSA_3RF_FMT<0b1001, 0b1, 0b011010>;
787
788class FSUNE_W_ENC : MSA_3RF_FMT<0b1010, 0b0, 0b011100>;
789class FSUNE_D_ENC : MSA_3RF_FMT<0b1010, 0b1, 0b011100>;
790
791class FTINT_S_W_ENC : MSA_2RF_FMT<0b110011100, 0b0, 0b011110>;
792class FTINT_S_D_ENC : MSA_2RF_FMT<0b110011100, 0b1, 0b011110>;
793
794class FTINT_U_W_ENC : MSA_2RF_FMT<0b110011101, 0b0, 0b011110>;
795class FTINT_U_D_ENC : MSA_2RF_FMT<0b110011101, 0b1, 0b011110>;
796
797class FTQ_H_ENC : MSA_3RF_FMT<0b1010, 0b0, 0b011011>;
798class FTQ_W_ENC : MSA_3RF_FMT<0b1010, 0b1, 0b011011>;
799
800class FTRUNC_S_W_ENC : MSA_2RF_FMT<0b110010001, 0b0, 0b011110>;
801class FTRUNC_S_D_ENC : MSA_2RF_FMT<0b110010001, 0b1, 0b011110>;
802
803class FTRUNC_U_W_ENC : MSA_2RF_FMT<0b110010010, 0b0, 0b011110>;
804class FTRUNC_U_D_ENC : MSA_2RF_FMT<0b110010010, 0b1, 0b011110>;
805
806class HADD_S_H_ENC : MSA_3R_FMT<0b100, 0b01, 0b010101>;
807class HADD_S_W_ENC : MSA_3R_FMT<0b100, 0b10, 0b010101>;
808class HADD_S_D_ENC : MSA_3R_FMT<0b100, 0b11, 0b010101>;
809
810class HADD_U_H_ENC : MSA_3R_FMT<0b101, 0b01, 0b010101>;
811class HADD_U_W_ENC : MSA_3R_FMT<0b101, 0b10, 0b010101>;
812class HADD_U_D_ENC : MSA_3R_FMT<0b101, 0b11, 0b010101>;
813
814class HSUB_S_H_ENC : MSA_3R_FMT<0b110, 0b01, 0b010101>;
815class HSUB_S_W_ENC : MSA_3R_FMT<0b110, 0b10, 0b010101>;
816class HSUB_S_D_ENC : MSA_3R_FMT<0b110, 0b11, 0b010101>;
817
818class HSUB_U_H_ENC : MSA_3R_FMT<0b111, 0b01, 0b010101>;
819class HSUB_U_W_ENC : MSA_3R_FMT<0b111, 0b10, 0b010101>;
820class HSUB_U_D_ENC : MSA_3R_FMT<0b111, 0b11, 0b010101>;
821
822class ILVEV_B_ENC : MSA_3R_FMT<0b110, 0b00, 0b010100>;
823class ILVEV_H_ENC : MSA_3R_FMT<0b110, 0b01, 0b010100>;
824class ILVEV_W_ENC : MSA_3R_FMT<0b110, 0b10, 0b010100>;
825class ILVEV_D_ENC : MSA_3R_FMT<0b110, 0b11, 0b010100>;
826
827class ILVL_B_ENC : MSA_3R_FMT<0b100, 0b00, 0b010100>;
828class ILVL_H_ENC : MSA_3R_FMT<0b100, 0b01, 0b010100>;
829class ILVL_W_ENC : MSA_3R_FMT<0b100, 0b10, 0b010100>;
830class ILVL_D_ENC : MSA_3R_FMT<0b100, 0b11, 0b010100>;
831
832class ILVOD_B_ENC : MSA_3R_FMT<0b111, 0b00, 0b010100>;
833class ILVOD_H_ENC : MSA_3R_FMT<0b111, 0b01, 0b010100>;
834class ILVOD_W_ENC : MSA_3R_FMT<0b111, 0b10, 0b010100>;
835class ILVOD_D_ENC : MSA_3R_FMT<0b111, 0b11, 0b010100>;
836
837class ILVR_B_ENC : MSA_3R_FMT<0b101, 0b00, 0b010100>;
838class ILVR_H_ENC : MSA_3R_FMT<0b101, 0b01, 0b010100>;
839class ILVR_W_ENC : MSA_3R_FMT<0b101, 0b10, 0b010100>;
840class ILVR_D_ENC : MSA_3R_FMT<0b101, 0b11, 0b010100>;
841
842class INSERT_B_ENC : MSA_ELM_INSERT_B_FMT<0b0100, 0b011001>;
843class INSERT_H_ENC : MSA_ELM_INSERT_H_FMT<0b0100, 0b011001>;
844class INSERT_W_ENC : MSA_ELM_INSERT_W_FMT<0b0100, 0b011001>;
845class INSERT_D_ENC : MSA_ELM_INSERT_D_FMT<0b0100, 0b011001>;
846
847class INSVE_B_ENC : MSA_ELM_B_FMT<0b0101, 0b011001>;
848class INSVE_H_ENC : MSA_ELM_H_FMT<0b0101, 0b011001>;
849class INSVE_W_ENC : MSA_ELM_W_FMT<0b0101, 0b011001>;
850class INSVE_D_ENC : MSA_ELM_D_FMT<0b0101, 0b011001>;
851
852class LD_B_ENC   : MSA_MI10_FMT<0b00, 0b1000>;
853class LD_H_ENC   : MSA_MI10_FMT<0b01, 0b1000>;
854class LD_W_ENC   : MSA_MI10_FMT<0b10, 0b1000>;
855class LD_D_ENC   : MSA_MI10_FMT<0b11, 0b1000>;
856
857class LDI_B_ENC  : MSA_I10_FMT<0b110, 0b00, 0b000111>;
858class LDI_H_ENC  : MSA_I10_FMT<0b110, 0b01, 0b000111>;
859class LDI_W_ENC  : MSA_I10_FMT<0b110, 0b10, 0b000111>;
860class LDI_D_ENC  : MSA_I10_FMT<0b110, 0b11, 0b000111>;
861
862class LSA_ENC : SPECIAL_LSA_FMT<0b000101>;
863class DLSA_ENC : SPECIAL_DLSA_FMT<0b010101>;
864
865class MADD_Q_H_ENC : MSA_3RF_FMT<0b0101, 0b0, 0b011100>;
866class MADD_Q_W_ENC : MSA_3RF_FMT<0b0101, 0b1, 0b011100>;
867
868class MADDR_Q_H_ENC : MSA_3RF_FMT<0b1101, 0b0, 0b011100>;
869class MADDR_Q_W_ENC : MSA_3RF_FMT<0b1101, 0b1, 0b011100>;
870
871class MADDV_B_ENC : MSA_3R_FMT<0b001, 0b00, 0b010010>;
872class MADDV_H_ENC : MSA_3R_FMT<0b001, 0b01, 0b010010>;
873class MADDV_W_ENC : MSA_3R_FMT<0b001, 0b10, 0b010010>;
874class MADDV_D_ENC : MSA_3R_FMT<0b001, 0b11, 0b010010>;
875
876class MAX_A_B_ENC : MSA_3R_FMT<0b110, 0b00, 0b001110>;
877class MAX_A_H_ENC : MSA_3R_FMT<0b110, 0b01, 0b001110>;
878class MAX_A_W_ENC : MSA_3R_FMT<0b110, 0b10, 0b001110>;
879class MAX_A_D_ENC : MSA_3R_FMT<0b110, 0b11, 0b001110>;
880
881class MAX_S_B_ENC : MSA_3R_FMT<0b010, 0b00, 0b001110>;
882class MAX_S_H_ENC : MSA_3R_FMT<0b010, 0b01, 0b001110>;
883class MAX_S_W_ENC : MSA_3R_FMT<0b010, 0b10, 0b001110>;
884class MAX_S_D_ENC : MSA_3R_FMT<0b010, 0b11, 0b001110>;
885
886class MAX_U_B_ENC : MSA_3R_FMT<0b011, 0b00, 0b001110>;
887class MAX_U_H_ENC : MSA_3R_FMT<0b011, 0b01, 0b001110>;
888class MAX_U_W_ENC : MSA_3R_FMT<0b011, 0b10, 0b001110>;
889class MAX_U_D_ENC : MSA_3R_FMT<0b011, 0b11, 0b001110>;
890
891class MAXI_S_B_ENC : MSA_I5_FMT<0b010, 0b00, 0b000110>;
892class MAXI_S_H_ENC : MSA_I5_FMT<0b010, 0b01, 0b000110>;
893class MAXI_S_W_ENC : MSA_I5_FMT<0b010, 0b10, 0b000110>;
894class MAXI_S_D_ENC : MSA_I5_FMT<0b010, 0b11, 0b000110>;
895
896class MAXI_U_B_ENC : MSA_I5_FMT<0b011, 0b00, 0b000110>;
897class MAXI_U_H_ENC : MSA_I5_FMT<0b011, 0b01, 0b000110>;
898class MAXI_U_W_ENC : MSA_I5_FMT<0b011, 0b10, 0b000110>;
899class MAXI_U_D_ENC : MSA_I5_FMT<0b011, 0b11, 0b000110>;
900
901class MIN_A_B_ENC : MSA_3R_FMT<0b111, 0b00, 0b001110>;
902class MIN_A_H_ENC : MSA_3R_FMT<0b111, 0b01, 0b001110>;
903class MIN_A_W_ENC : MSA_3R_FMT<0b111, 0b10, 0b001110>;
904class MIN_A_D_ENC : MSA_3R_FMT<0b111, 0b11, 0b001110>;
905
906class MIN_S_B_ENC : MSA_3R_FMT<0b100, 0b00, 0b001110>;
907class MIN_S_H_ENC : MSA_3R_FMT<0b100, 0b01, 0b001110>;
908class MIN_S_W_ENC : MSA_3R_FMT<0b100, 0b10, 0b001110>;
909class MIN_S_D_ENC : MSA_3R_FMT<0b100, 0b11, 0b001110>;
910
911class MIN_U_B_ENC : MSA_3R_FMT<0b101, 0b00, 0b001110>;
912class MIN_U_H_ENC : MSA_3R_FMT<0b101, 0b01, 0b001110>;
913class MIN_U_W_ENC : MSA_3R_FMT<0b101, 0b10, 0b001110>;
914class MIN_U_D_ENC : MSA_3R_FMT<0b101, 0b11, 0b001110>;
915
916class MINI_S_B_ENC : MSA_I5_FMT<0b100, 0b00, 0b000110>;
917class MINI_S_H_ENC : MSA_I5_FMT<0b100, 0b01, 0b000110>;
918class MINI_S_W_ENC : MSA_I5_FMT<0b100, 0b10, 0b000110>;
919class MINI_S_D_ENC : MSA_I5_FMT<0b100, 0b11, 0b000110>;
920
921class MINI_U_B_ENC : MSA_I5_FMT<0b101, 0b00, 0b000110>;
922class MINI_U_H_ENC : MSA_I5_FMT<0b101, 0b01, 0b000110>;
923class MINI_U_W_ENC : MSA_I5_FMT<0b101, 0b10, 0b000110>;
924class MINI_U_D_ENC : MSA_I5_FMT<0b101, 0b11, 0b000110>;
925
926class MOD_S_B_ENC : MSA_3R_FMT<0b110, 0b00, 0b010010>;
927class MOD_S_H_ENC : MSA_3R_FMT<0b110, 0b01, 0b010010>;
928class MOD_S_W_ENC : MSA_3R_FMT<0b110, 0b10, 0b010010>;
929class MOD_S_D_ENC : MSA_3R_FMT<0b110, 0b11, 0b010010>;
930
931class MOD_U_B_ENC : MSA_3R_FMT<0b111, 0b00, 0b010010>;
932class MOD_U_H_ENC : MSA_3R_FMT<0b111, 0b01, 0b010010>;
933class MOD_U_W_ENC : MSA_3R_FMT<0b111, 0b10, 0b010010>;
934class MOD_U_D_ENC : MSA_3R_FMT<0b111, 0b11, 0b010010>;
935
936class MOVE_V_ENC : MSA_ELM_FMT<0b0010111110, 0b011001>;
937
938class MSUB_Q_H_ENC : MSA_3RF_FMT<0b0110, 0b0, 0b011100>;
939class MSUB_Q_W_ENC : MSA_3RF_FMT<0b0110, 0b1, 0b011100>;
940
941class MSUBR_Q_H_ENC : MSA_3RF_FMT<0b1110, 0b0, 0b011100>;
942class MSUBR_Q_W_ENC : MSA_3RF_FMT<0b1110, 0b1, 0b011100>;
943
944class MSUBV_B_ENC : MSA_3R_FMT<0b010, 0b00, 0b010010>;
945class MSUBV_H_ENC : MSA_3R_FMT<0b010, 0b01, 0b010010>;
946class MSUBV_W_ENC : MSA_3R_FMT<0b010, 0b10, 0b010010>;
947class MSUBV_D_ENC : MSA_3R_FMT<0b010, 0b11, 0b010010>;
948
949class MUL_Q_H_ENC : MSA_3RF_FMT<0b0100, 0b0, 0b011100>;
950class MUL_Q_W_ENC : MSA_3RF_FMT<0b0100, 0b1, 0b011100>;
951
952class MULR_Q_H_ENC : MSA_3RF_FMT<0b1100, 0b0, 0b011100>;
953class MULR_Q_W_ENC : MSA_3RF_FMT<0b1100, 0b1, 0b011100>;
954
955class MULV_B_ENC : MSA_3R_FMT<0b000, 0b00, 0b010010>;
956class MULV_H_ENC : MSA_3R_FMT<0b000, 0b01, 0b010010>;
957class MULV_W_ENC : MSA_3R_FMT<0b000, 0b10, 0b010010>;
958class MULV_D_ENC : MSA_3R_FMT<0b000, 0b11, 0b010010>;
959
960class NLOC_B_ENC : MSA_2R_FMT<0b11000010, 0b00, 0b011110>;
961class NLOC_H_ENC : MSA_2R_FMT<0b11000010, 0b01, 0b011110>;
962class NLOC_W_ENC : MSA_2R_FMT<0b11000010, 0b10, 0b011110>;
963class NLOC_D_ENC : MSA_2R_FMT<0b11000010, 0b11, 0b011110>;
964
965class NLZC_B_ENC : MSA_2R_FMT<0b11000011, 0b00, 0b011110>;
966class NLZC_H_ENC : MSA_2R_FMT<0b11000011, 0b01, 0b011110>;
967class NLZC_W_ENC : MSA_2R_FMT<0b11000011, 0b10, 0b011110>;
968class NLZC_D_ENC : MSA_2R_FMT<0b11000011, 0b11, 0b011110>;
969
970class NOR_V_ENC : MSA_VEC_FMT<0b00010, 0b011110>;
971
972class NORI_B_ENC : MSA_I8_FMT<0b10, 0b000000>;
973
974class OR_V_ENC : MSA_VEC_FMT<0b00001, 0b011110>;
975
976class ORI_B_ENC  : MSA_I8_FMT<0b01, 0b000000>;
977
978class PCKEV_B_ENC : MSA_3R_FMT<0b010, 0b00, 0b010100>;
979class PCKEV_H_ENC : MSA_3R_FMT<0b010, 0b01, 0b010100>;
980class PCKEV_W_ENC : MSA_3R_FMT<0b010, 0b10, 0b010100>;
981class PCKEV_D_ENC : MSA_3R_FMT<0b010, 0b11, 0b010100>;
982
983class PCKOD_B_ENC : MSA_3R_FMT<0b011, 0b00, 0b010100>;
984class PCKOD_H_ENC : MSA_3R_FMT<0b011, 0b01, 0b010100>;
985class PCKOD_W_ENC : MSA_3R_FMT<0b011, 0b10, 0b010100>;
986class PCKOD_D_ENC : MSA_3R_FMT<0b011, 0b11, 0b010100>;
987
988class PCNT_B_ENC : MSA_2R_FMT<0b11000001, 0b00, 0b011110>;
989class PCNT_H_ENC : MSA_2R_FMT<0b11000001, 0b01, 0b011110>;
990class PCNT_W_ENC : MSA_2R_FMT<0b11000001, 0b10, 0b011110>;
991class PCNT_D_ENC : MSA_2R_FMT<0b11000001, 0b11, 0b011110>;
992
993class SAT_S_B_ENC : MSA_BIT_B_FMT<0b000, 0b001010>;
994class SAT_S_H_ENC : MSA_BIT_H_FMT<0b000, 0b001010>;
995class SAT_S_W_ENC : MSA_BIT_W_FMT<0b000, 0b001010>;
996class SAT_S_D_ENC : MSA_BIT_D_FMT<0b000, 0b001010>;
997
998class SAT_U_B_ENC : MSA_BIT_B_FMT<0b001, 0b001010>;
999class SAT_U_H_ENC : MSA_BIT_H_FMT<0b001, 0b001010>;
1000class SAT_U_W_ENC : MSA_BIT_W_FMT<0b001, 0b001010>;
1001class SAT_U_D_ENC : MSA_BIT_D_FMT<0b001, 0b001010>;
1002
1003class SHF_B_ENC  : MSA_I8_FMT<0b00, 0b000010>;
1004class SHF_H_ENC  : MSA_I8_FMT<0b01, 0b000010>;
1005class SHF_W_ENC  : MSA_I8_FMT<0b10, 0b000010>;
1006
1007class SLD_B_ENC : MSA_3R_INDEX_FMT<0b000, 0b00, 0b010100>;
1008class SLD_H_ENC : MSA_3R_INDEX_FMT<0b000, 0b01, 0b010100>;
1009class SLD_W_ENC : MSA_3R_INDEX_FMT<0b000, 0b10, 0b010100>;
1010class SLD_D_ENC : MSA_3R_INDEX_FMT<0b000, 0b11, 0b010100>;
1011
1012class SLDI_B_ENC : MSA_ELM_B_FMT<0b0000, 0b011001>;
1013class SLDI_H_ENC : MSA_ELM_H_FMT<0b0000, 0b011001>;
1014class SLDI_W_ENC : MSA_ELM_W_FMT<0b0000, 0b011001>;
1015class SLDI_D_ENC : MSA_ELM_D_FMT<0b0000, 0b011001>;
1016
1017class SLL_B_ENC : MSA_3R_FMT<0b000, 0b00, 0b001101>;
1018class SLL_H_ENC : MSA_3R_FMT<0b000, 0b01, 0b001101>;
1019class SLL_W_ENC : MSA_3R_FMT<0b000, 0b10, 0b001101>;
1020class SLL_D_ENC : MSA_3R_FMT<0b000, 0b11, 0b001101>;
1021
1022class SLLI_B_ENC : MSA_BIT_B_FMT<0b000, 0b001001>;
1023class SLLI_H_ENC : MSA_BIT_H_FMT<0b000, 0b001001>;
1024class SLLI_W_ENC : MSA_BIT_W_FMT<0b000, 0b001001>;
1025class SLLI_D_ENC : MSA_BIT_D_FMT<0b000, 0b001001>;
1026
1027class SPLAT_B_ENC : MSA_3R_INDEX_FMT<0b001, 0b00, 0b010100>;
1028class SPLAT_H_ENC : MSA_3R_INDEX_FMT<0b001, 0b01, 0b010100>;
1029class SPLAT_W_ENC : MSA_3R_INDEX_FMT<0b001, 0b10, 0b010100>;
1030class SPLAT_D_ENC : MSA_3R_INDEX_FMT<0b001, 0b11, 0b010100>;
1031
1032class SPLATI_B_ENC : MSA_ELM_B_FMT<0b0001, 0b011001>;
1033class SPLATI_H_ENC : MSA_ELM_H_FMT<0b0001, 0b011001>;
1034class SPLATI_W_ENC : MSA_ELM_W_FMT<0b0001, 0b011001>;
1035class SPLATI_D_ENC : MSA_ELM_D_FMT<0b0001, 0b011001>;
1036
1037class SRA_B_ENC : MSA_3R_FMT<0b001, 0b00, 0b001101>;
1038class SRA_H_ENC : MSA_3R_FMT<0b001, 0b01, 0b001101>;
1039class SRA_W_ENC : MSA_3R_FMT<0b001, 0b10, 0b001101>;
1040class SRA_D_ENC : MSA_3R_FMT<0b001, 0b11, 0b001101>;
1041
1042class SRAI_B_ENC : MSA_BIT_B_FMT<0b001, 0b001001>;
1043class SRAI_H_ENC : MSA_BIT_H_FMT<0b001, 0b001001>;
1044class SRAI_W_ENC : MSA_BIT_W_FMT<0b001, 0b001001>;
1045class SRAI_D_ENC : MSA_BIT_D_FMT<0b001, 0b001001>;
1046
1047class SRAR_B_ENC : MSA_3R_FMT<0b001, 0b00, 0b010101>;
1048class SRAR_H_ENC : MSA_3R_FMT<0b001, 0b01, 0b010101>;
1049class SRAR_W_ENC : MSA_3R_FMT<0b001, 0b10, 0b010101>;
1050class SRAR_D_ENC : MSA_3R_FMT<0b001, 0b11, 0b010101>;
1051
1052class SRARI_B_ENC : MSA_BIT_B_FMT<0b010, 0b001010>;
1053class SRARI_H_ENC : MSA_BIT_H_FMT<0b010, 0b001010>;
1054class SRARI_W_ENC : MSA_BIT_W_FMT<0b010, 0b001010>;
1055class SRARI_D_ENC : MSA_BIT_D_FMT<0b010, 0b001010>;
1056
1057class SRL_B_ENC : MSA_3R_FMT<0b010, 0b00, 0b001101>;
1058class SRL_H_ENC : MSA_3R_FMT<0b010, 0b01, 0b001101>;
1059class SRL_W_ENC : MSA_3R_FMT<0b010, 0b10, 0b001101>;
1060class SRL_D_ENC : MSA_3R_FMT<0b010, 0b11, 0b001101>;
1061
1062class SRLI_B_ENC : MSA_BIT_B_FMT<0b010, 0b001001>;
1063class SRLI_H_ENC : MSA_BIT_H_FMT<0b010, 0b001001>;
1064class SRLI_W_ENC : MSA_BIT_W_FMT<0b010, 0b001001>;
1065class SRLI_D_ENC : MSA_BIT_D_FMT<0b010, 0b001001>;
1066
1067class SRLR_B_ENC : MSA_3R_FMT<0b010, 0b00, 0b010101>;
1068class SRLR_H_ENC : MSA_3R_FMT<0b010, 0b01, 0b010101>;
1069class SRLR_W_ENC : MSA_3R_FMT<0b010, 0b10, 0b010101>;
1070class SRLR_D_ENC : MSA_3R_FMT<0b010, 0b11, 0b010101>;
1071
1072class SRLRI_B_ENC : MSA_BIT_B_FMT<0b011, 0b001010>;
1073class SRLRI_H_ENC : MSA_BIT_H_FMT<0b011, 0b001010>;
1074class SRLRI_W_ENC : MSA_BIT_W_FMT<0b011, 0b001010>;
1075class SRLRI_D_ENC : MSA_BIT_D_FMT<0b011, 0b001010>;
1076
1077class ST_B_ENC   : MSA_MI10_FMT<0b00, 0b1001>;
1078class ST_H_ENC   : MSA_MI10_FMT<0b01, 0b1001>;
1079class ST_W_ENC   : MSA_MI10_FMT<0b10, 0b1001>;
1080class ST_D_ENC   : MSA_MI10_FMT<0b11, 0b1001>;
1081
1082class SUBS_S_B_ENC : MSA_3R_FMT<0b000, 0b00, 0b010001>;
1083class SUBS_S_H_ENC : MSA_3R_FMT<0b000, 0b01, 0b010001>;
1084class SUBS_S_W_ENC : MSA_3R_FMT<0b000, 0b10, 0b010001>;
1085class SUBS_S_D_ENC : MSA_3R_FMT<0b000, 0b11, 0b010001>;
1086
1087class SUBS_U_B_ENC : MSA_3R_FMT<0b001, 0b00, 0b010001>;
1088class SUBS_U_H_ENC : MSA_3R_FMT<0b001, 0b01, 0b010001>;
1089class SUBS_U_W_ENC : MSA_3R_FMT<0b001, 0b10, 0b010001>;
1090class SUBS_U_D_ENC : MSA_3R_FMT<0b001, 0b11, 0b010001>;
1091
1092class SUBSUS_U_B_ENC : MSA_3R_FMT<0b010, 0b00, 0b010001>;
1093class SUBSUS_U_H_ENC : MSA_3R_FMT<0b010, 0b01, 0b010001>;
1094class SUBSUS_U_W_ENC : MSA_3R_FMT<0b010, 0b10, 0b010001>;
1095class SUBSUS_U_D_ENC : MSA_3R_FMT<0b010, 0b11, 0b010001>;
1096
1097class SUBSUU_S_B_ENC : MSA_3R_FMT<0b011, 0b00, 0b010001>;
1098class SUBSUU_S_H_ENC : MSA_3R_FMT<0b011, 0b01, 0b010001>;
1099class SUBSUU_S_W_ENC : MSA_3R_FMT<0b011, 0b10, 0b010001>;
1100class SUBSUU_S_D_ENC : MSA_3R_FMT<0b011, 0b11, 0b010001>;
1101
1102class SUBV_B_ENC : MSA_3R_FMT<0b001, 0b00, 0b001110>;
1103class SUBV_H_ENC : MSA_3R_FMT<0b001, 0b01, 0b001110>;
1104class SUBV_W_ENC : MSA_3R_FMT<0b001, 0b10, 0b001110>;
1105class SUBV_D_ENC : MSA_3R_FMT<0b001, 0b11, 0b001110>;
1106
1107class SUBVI_B_ENC : MSA_I5_FMT<0b001, 0b00, 0b000110>;
1108class SUBVI_H_ENC : MSA_I5_FMT<0b001, 0b01, 0b000110>;
1109class SUBVI_W_ENC : MSA_I5_FMT<0b001, 0b10, 0b000110>;
1110class SUBVI_D_ENC : MSA_I5_FMT<0b001, 0b11, 0b000110>;
1111
1112class VSHF_B_ENC : MSA_3R_FMT<0b000, 0b00, 0b010101>;
1113class VSHF_H_ENC : MSA_3R_FMT<0b000, 0b01, 0b010101>;
1114class VSHF_W_ENC : MSA_3R_FMT<0b000, 0b10, 0b010101>;
1115class VSHF_D_ENC : MSA_3R_FMT<0b000, 0b11, 0b010101>;
1116
1117class XOR_V_ENC : MSA_VEC_FMT<0b00011, 0b011110>;
1118
1119class XORI_B_ENC : MSA_I8_FMT<0b11, 0b000000>;
1120
1121// Instruction desc.
1122class MSA_BIT_B_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
1123                          ComplexPattern Imm, RegisterOperand ROWD,
1124                          RegisterOperand ROWS = ROWD,
1125                          InstrItinClass itin = NoItinerary> {
1126  dag OutOperandList = (outs ROWD:$wd);
1127  dag InOperandList = (ins ROWS:$ws, vsplat_uimm3:$m);
1128  string AsmString = !strconcat(instr_asm, "\t$wd, $ws, $m");
1129  list<dag> Pattern = [(set ROWD:$wd, (OpNode ROWS:$ws, Imm:$m))];
1130  InstrItinClass Itinerary = itin;
1131}
1132
1133class MSA_BIT_H_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
1134                          ComplexPattern Imm, RegisterOperand ROWD,
1135                          RegisterOperand ROWS = ROWD,
1136                          InstrItinClass itin = NoItinerary> {
1137  dag OutOperandList = (outs ROWD:$wd);
1138  dag InOperandList = (ins ROWS:$ws, vsplat_uimm4:$m);
1139  string AsmString = !strconcat(instr_asm, "\t$wd, $ws, $m");
1140  list<dag> Pattern = [(set ROWD:$wd, (OpNode ROWS:$ws, Imm:$m))];
1141  InstrItinClass Itinerary = itin;
1142}
1143
1144class MSA_BIT_W_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
1145                          ComplexPattern Imm, RegisterOperand ROWD,
1146                          RegisterOperand ROWS = ROWD,
1147                          InstrItinClass itin = NoItinerary> {
1148  dag OutOperandList = (outs ROWD:$wd);
1149  dag InOperandList = (ins ROWS:$ws, vsplat_uimm5:$m);
1150  string AsmString = !strconcat(instr_asm, "\t$wd, $ws, $m");
1151  list<dag> Pattern = [(set ROWD:$wd, (OpNode ROWS:$ws, Imm:$m))];
1152  InstrItinClass Itinerary = itin;
1153}
1154
1155class MSA_BIT_D_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
1156                          ComplexPattern Imm, RegisterOperand ROWD,
1157                          RegisterOperand ROWS = ROWD,
1158                          InstrItinClass itin = NoItinerary> {
1159  dag OutOperandList = (outs ROWD:$wd);
1160  dag InOperandList = (ins ROWS:$ws, vsplat_uimm6:$m);
1161  string AsmString = !strconcat(instr_asm, "\t$wd, $ws, $m");
1162  list<dag> Pattern = [(set ROWD:$wd, (OpNode ROWS:$ws, Imm:$m))];
1163  InstrItinClass Itinerary = itin;
1164}
1165
1166class MSA_BIT_X_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
1167                          Operand ImmOp, ImmLeaf Imm, RegisterOperand ROWD,
1168                          RegisterOperand ROWS = ROWD,
1169                          InstrItinClass itin = NoItinerary> {
1170  dag OutOperandList = (outs ROWD:$wd);
1171  dag InOperandList = (ins ROWS:$ws, ImmOp:$m);
1172  string AsmString = !strconcat(instr_asm, "\t$wd, $ws, $m");
1173  list<dag> Pattern = [(set ROWD:$wd, (OpNode ROWS:$ws, Imm:$m))];
1174  InstrItinClass Itinerary = itin;
1175}
1176
1177class MSA_BIT_BINSXI_DESC_BASE<string instr_asm, ValueType Ty,
1178                               SplatComplexPattern Mask, RegisterOperand ROWD,
1179                               RegisterOperand ROWS = ROWD,
1180                               InstrItinClass itin = NoItinerary> {
1181  dag OutOperandList = (outs ROWD:$wd);
1182  dag InOperandList = (ins ROWD:$wd_in, ROWS:$ws, Mask.OpClass:$m);
1183  string AsmString = !strconcat(instr_asm, "\t$wd, $ws, $m");
1184  // Note that binsxi and vselect treat the condition operand the opposite
1185  // way to each other.
1186  //   (vselect cond, if_set, if_clear)
1187  //   (BSEL_V cond, if_clear, if_set)
1188  list<dag> Pattern = [(set ROWD:$wd, (vselect (Ty Mask:$m), (Ty ROWD:$ws),
1189                                               ROWS:$wd_in))];
1190  InstrItinClass Itinerary = itin;
1191  string Constraints = "$wd = $wd_in";
1192}
1193
1194class MSA_BIT_BINSLI_DESC_BASE<string instr_asm, ValueType Ty,
1195                               SplatComplexPattern ImmOp, RegisterOperand ROWD,
1196                               RegisterOperand ROWS = ROWD,
1197                               InstrItinClass itin = NoItinerary> :
1198  MSA_BIT_BINSXI_DESC_BASE<instr_asm, Ty, ImmOp, ROWD, ROWS, itin>;
1199
1200class MSA_BIT_BINSRI_DESC_BASE<string instr_asm, ValueType Ty,
1201                               SplatComplexPattern ImmOp, RegisterOperand ROWD,
1202                               RegisterOperand ROWS = ROWD,
1203                               InstrItinClass itin = NoItinerary> :
1204  MSA_BIT_BINSXI_DESC_BASE<instr_asm, Ty, ImmOp, ROWD, ROWS, itin>;
1205
1206class MSA_BIT_SPLAT_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
1207                              SplatComplexPattern SplatImm,
1208                              RegisterOperand ROWD, RegisterOperand ROWS = ROWD,
1209                              InstrItinClass itin = NoItinerary> {
1210  dag OutOperandList = (outs ROWD:$wd);
1211  dag InOperandList = (ins ROWS:$ws, SplatImm.OpClass:$m);
1212  string AsmString = !strconcat(instr_asm, "\t$wd, $ws, $m");
1213  list<dag> Pattern = [(set ROWD:$wd, (OpNode ROWS:$ws, SplatImm:$m))];
1214  InstrItinClass Itinerary = itin;
1215}
1216
1217class MSA_COPY_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
1218                         ValueType VecTy, Operand ImmOp, ImmLeaf Imm,
1219                         RegisterOperand ROD, RegisterOperand ROWS,
1220                         InstrItinClass itin = NoItinerary> {
1221  dag OutOperandList = (outs ROD:$rd);
1222  dag InOperandList = (ins ROWS:$ws, ImmOp:$n);
1223  string AsmString = !strconcat(instr_asm, "\t$rd, $ws[$n]");
1224  list<dag> Pattern = [(set ROD:$rd, (OpNode (VecTy ROWS:$ws), Imm:$n))];
1225  InstrItinClass Itinerary = itin;
1226}
1227
1228class MSA_ELM_SLD_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
1229                            RegisterOperand ROWD, RegisterOperand ROWS,
1230                            Operand ImmOp, ImmLeaf Imm,
1231                            InstrItinClass itin = NoItinerary> {
1232  dag OutOperandList = (outs ROWD:$wd);
1233  dag InOperandList = (ins ROWD:$wd_in, ROWS:$ws, ImmOp:$n);
1234  string AsmString = !strconcat(instr_asm, "\t$wd, $ws[$n]");
1235  list<dag> Pattern = [(set ROWD:$wd, (OpNode ROWD:$wd_in, ROWS:$ws,
1236                                              Imm:$n))];
1237  string Constraints = "$wd = $wd_in";
1238  InstrItinClass Itinerary = itin;
1239}
1240
1241class MSA_COPY_PSEUDO_BASE<SDPatternOperator OpNode, ValueType VecTy,
1242                           Operand ImmOp, ImmLeaf Imm, RegisterClass RCD,
1243                           RegisterClass RCWS> :
1244      MSAPseudo<(outs RCD:$wd), (ins RCWS:$ws, ImmOp:$n),
1245                [(set RCD:$wd, (OpNode (VecTy RCWS:$ws), Imm:$n))]> {
1246  bit usesCustomInserter = 1;
1247  bit hasNoSchedulingInfo = 1;
1248}
1249
1250class MSA_I5_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
1251                       SplatComplexPattern SplatImm, RegisterOperand ROWD,
1252                       RegisterOperand ROWS = ROWD,
1253                       InstrItinClass itin = NoItinerary> {
1254  dag OutOperandList = (outs ROWD:$wd);
1255  dag InOperandList = (ins ROWS:$ws, SplatImm.OpClass:$imm);
1256  string AsmString = !strconcat(instr_asm, "\t$wd, $ws, $imm");
1257  list<dag> Pattern = [(set ROWD:$wd, (OpNode ROWS:$ws, SplatImm:$imm))];
1258  InstrItinClass Itinerary = itin;
1259}
1260
1261class MSA_I8_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
1262                       SplatComplexPattern SplatImm, RegisterOperand ROWD,
1263                       RegisterOperand ROWS = ROWD,
1264                       InstrItinClass itin = NoItinerary> {
1265  dag OutOperandList = (outs ROWD:$wd);
1266  dag InOperandList = (ins ROWS:$ws, SplatImm.OpClass:$u8);
1267  string AsmString = !strconcat(instr_asm, "\t$wd, $ws, $u8");
1268  list<dag> Pattern = [(set ROWD:$wd, (OpNode ROWS:$ws, SplatImm:$u8))];
1269  InstrItinClass Itinerary = itin;
1270}
1271
1272class MSA_I8_SHF_DESC_BASE<string instr_asm, RegisterOperand ROWD,
1273                           RegisterOperand ROWS = ROWD,
1274                           InstrItinClass itin = NoItinerary> {
1275  dag OutOperandList = (outs ROWD:$wd);
1276  dag InOperandList = (ins ROWS:$ws, uimm8:$u8);
1277  string AsmString = !strconcat(instr_asm, "\t$wd, $ws, $u8");
1278  list<dag> Pattern = [(set ROWD:$wd, (MipsSHF timmZExt8:$u8, ROWS:$ws))];
1279  InstrItinClass Itinerary = itin;
1280}
1281
1282class MSA_I10_LDI_DESC_BASE<string instr_asm, RegisterOperand ROWD,
1283                            InstrItinClass itin = NoItinerary> {
1284  dag OutOperandList = (outs ROWD:$wd);
1285  dag InOperandList = (ins vsplat_simm10:$s10);
1286  string AsmString = !strconcat(instr_asm, "\t$wd, $s10");
1287  // LDI is matched using custom matching code in MipsSEISelDAGToDAG.cpp
1288  list<dag> Pattern = [];
1289  bit hasSideEffects = 0;
1290  bit isReMaterializable = 1;
1291  InstrItinClass Itinerary = itin;
1292}
1293
1294class MSA_2R_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
1295                       RegisterOperand ROWD, RegisterOperand ROWS = ROWD,
1296                       InstrItinClass itin = NoItinerary> {
1297  dag OutOperandList = (outs ROWD:$wd);
1298  dag InOperandList = (ins ROWS:$ws);
1299  string AsmString = !strconcat(instr_asm, "\t$wd, $ws");
1300  list<dag> Pattern = [(set ROWD:$wd, (OpNode ROWS:$ws))];
1301  InstrItinClass Itinerary = itin;
1302}
1303
1304class MSA_2R_FILL_DESC_BASE<string instr_asm, ValueType VT,
1305                            SDPatternOperator OpNode, RegisterOperand ROWD,
1306                            RegisterOperand ROS = ROWD,
1307                            InstrItinClass itin = NoItinerary> {
1308  dag OutOperandList = (outs ROWD:$wd);
1309  dag InOperandList = (ins ROS:$rs);
1310  string AsmString = !strconcat(instr_asm, "\t$wd, $rs");
1311  list<dag> Pattern = [(set ROWD:$wd, (VT (OpNode ROS:$rs)))];
1312  InstrItinClass Itinerary = itin;
1313}
1314
1315class MSA_2R_FILL_PSEUDO_BASE<ValueType VT, SDPatternOperator OpNode,
1316                              RegisterClass RCWD, RegisterClass RCWS = RCWD> :
1317      MSAPseudo<(outs RCWD:$wd), (ins RCWS:$fs),
1318                [(set RCWD:$wd, (OpNode RCWS:$fs))]> {
1319  let usesCustomInserter = 1;
1320}
1321
1322class MSA_2RF_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
1323                        RegisterOperand ROWD, RegisterOperand ROWS = ROWD,
1324                        InstrItinClass itin = NoItinerary> {
1325  dag OutOperandList = (outs ROWD:$wd);
1326  dag InOperandList = (ins ROWS:$ws);
1327  string AsmString = !strconcat(instr_asm, "\t$wd, $ws");
1328  list<dag> Pattern = [(set ROWD:$wd, (OpNode ROWS:$ws))];
1329  InstrItinClass Itinerary = itin;
1330}
1331
1332class MSA_3R_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
1333                       RegisterOperand ROWD, RegisterOperand ROWS = ROWD,
1334                       RegisterOperand ROWT = ROWD,
1335                       InstrItinClass itin = NoItinerary> {
1336  dag OutOperandList = (outs ROWD:$wd);
1337  dag InOperandList = (ins ROWS:$ws, ROWT:$wt);
1338  string AsmString = !strconcat(instr_asm, "\t$wd, $ws, $wt");
1339  list<dag> Pattern = [(set ROWD:$wd, (OpNode ROWS:$ws, ROWT:$wt))];
1340  InstrItinClass Itinerary = itin;
1341}
1342
1343class MSA_3R_BINSX_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
1344                             RegisterOperand ROWD, RegisterOperand ROWS = ROWD,
1345                             RegisterOperand ROWT = ROWD,
1346                             InstrItinClass itin = NoItinerary> {
1347  dag OutOperandList = (outs ROWD:$wd);
1348  dag InOperandList = (ins ROWD:$wd_in, ROWS:$ws, ROWT:$wt);
1349  string AsmString = !strconcat(instr_asm, "\t$wd, $ws, $wt");
1350  list<dag> Pattern = [(set ROWD:$wd, (OpNode ROWD:$wd_in, ROWS:$ws,
1351                                              ROWT:$wt))];
1352  string Constraints = "$wd = $wd_in";
1353  InstrItinClass Itinerary = itin;
1354}
1355
1356class MSA_3R_SPLAT_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
1357                             RegisterOperand ROWD, RegisterOperand ROWS = ROWD,
1358                             InstrItinClass itin = NoItinerary> {
1359  dag OutOperandList = (outs ROWD:$wd);
1360  dag InOperandList = (ins ROWS:$ws, GPR32Opnd:$rt);
1361  string AsmString = !strconcat(instr_asm, "\t$wd, $ws[$rt]");
1362  list<dag> Pattern = [(set ROWD:$wd, (OpNode ROWS:$ws, GPR32Opnd:$rt))];
1363  InstrItinClass Itinerary = itin;
1364}
1365
1366class MSA_3R_VSHF_DESC_BASE<string instr_asm, RegisterOperand ROWD,
1367                            RegisterOperand ROWS = ROWD,
1368                            RegisterOperand ROWT = ROWD,
1369                            InstrItinClass itin = NoItinerary> {
1370  dag OutOperandList = (outs ROWD:$wd);
1371  dag InOperandList = (ins ROWD:$wd_in, ROWS:$ws, ROWT:$wt);
1372  string AsmString = !strconcat(instr_asm, "\t$wd, $ws, $wt");
1373  list<dag> Pattern = [(set ROWD:$wd, (MipsVSHF ROWD:$wd_in, ROWS:$ws,
1374                                                ROWT:$wt))];
1375  string Constraints = "$wd = $wd_in";
1376  InstrItinClass Itinerary = itin;
1377}
1378
1379class MSA_3R_SLD_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
1380                           RegisterOperand ROWD, RegisterOperand ROWS = ROWD,
1381                           InstrItinClass itin = NoItinerary> {
1382  dag OutOperandList = (outs ROWD:$wd);
1383  dag InOperandList = (ins ROWD:$wd_in, ROWS:$ws, GPR32Opnd:$rt);
1384  string AsmString = !strconcat(instr_asm, "\t$wd, $ws[$rt]");
1385  list<dag> Pattern = [(set ROWD:$wd, (OpNode ROWD:$wd_in, ROWS:$ws,
1386                                              GPR32Opnd:$rt))];
1387  InstrItinClass Itinerary = itin;
1388  string Constraints = "$wd = $wd_in";
1389}
1390
1391class MSA_3R_4R_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
1392                          RegisterOperand ROWD, RegisterOperand ROWS = ROWD,
1393                          RegisterOperand ROWT = ROWD,
1394                          InstrItinClass itin = NoItinerary> {
1395  dag OutOperandList = (outs ROWD:$wd);
1396  dag InOperandList = (ins ROWD:$wd_in, ROWS:$ws, ROWT:$wt);
1397  string AsmString = !strconcat(instr_asm, "\t$wd, $ws, $wt");
1398  list<dag> Pattern = [(set ROWD:$wd, (OpNode ROWD:$wd_in, ROWS:$ws,
1399                                              ROWT:$wt))];
1400  InstrItinClass Itinerary = itin;
1401  string Constraints = "$wd = $wd_in";
1402}
1403
1404class MSA_3RF_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
1405                        RegisterOperand ROWD, RegisterOperand ROWS = ROWD,
1406                        RegisterOperand ROWT = ROWD,
1407                        InstrItinClass itin = NoItinerary> :
1408  MSA_3R_DESC_BASE<instr_asm, OpNode, ROWD, ROWS, ROWT, itin>;
1409
1410class MSA_3RF_4RF_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
1411                            RegisterOperand ROWD, RegisterOperand ROWS = ROWD,
1412                            RegisterOperand ROWT = ROWD,
1413                            InstrItinClass itin = NoItinerary> :
1414  MSA_3R_4R_DESC_BASE<instr_asm, OpNode, ROWD, ROWS, ROWT, itin>;
1415
1416class MSA_CBRANCH_DESC_BASE<string instr_asm, RegisterOperand ROWD> {
1417  dag OutOperandList = (outs);
1418  dag InOperandList = (ins ROWD:$wt, brtarget:$offset);
1419  string AsmString = !strconcat(instr_asm, "\t$wt, $offset");
1420  list<dag> Pattern = [];
1421  InstrItinClass Itinerary = NoItinerary;
1422  bit isBranch = 1;
1423  bit isTerminator = 1;
1424  bit hasDelaySlot = 1;
1425  list<Register> Defs = [AT];
1426}
1427
1428class MSA_INSERT_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
1429                           Operand ImmOp, ImmLeaf Imm, RegisterOperand ROWD,
1430                           RegisterOperand ROS,
1431                           InstrItinClass itin = NoItinerary> {
1432  dag OutOperandList = (outs ROWD:$wd);
1433  dag InOperandList = (ins ROWD:$wd_in, ROS:$rs, ImmOp:$n);
1434  string AsmString = !strconcat(instr_asm, "\t$wd[$n], $rs");
1435  list<dag> Pattern = [(set ROWD:$wd, (OpNode ROWD:$wd_in, ROS:$rs, Imm:$n))];
1436  InstrItinClass Itinerary = itin;
1437  string Constraints = "$wd = $wd_in";
1438}
1439
1440class MSA_INSERT_PSEUDO_BASE<SDPatternOperator OpNode, ValueType Ty,
1441                             Operand ImmOp, ImmLeaf Imm, RegisterOperand ROWD,
1442                             RegisterOperand ROFS> :
1443      MSAPseudo<(outs ROWD:$wd), (ins ROWD:$wd_in, ImmOp:$n, ROFS:$fs),
1444                [(set ROWD:$wd, (OpNode (Ty ROWD:$wd_in), ROFS:$fs, Imm:$n))]> {
1445  bit usesCustomInserter = 1;
1446  string Constraints = "$wd = $wd_in";
1447}
1448
1449class MSA_INSERT_VIDX_PSEUDO_BASE<SDPatternOperator OpNode, ValueType Ty,
1450                                  RegisterOperand ROWD, RegisterOperand ROFS,
1451                                  RegisterOperand ROIdx> :
1452      MSAPseudo<(outs ROWD:$wd), (ins ROWD:$wd_in, ROIdx:$n, ROFS:$fs),
1453                [(set ROWD:$wd, (OpNode (Ty ROWD:$wd_in), ROFS:$fs,
1454                                        ROIdx:$n))]> {
1455  bit usesCustomInserter = 1;
1456  bit hasNoSchedulingInfo = 1;
1457  string Constraints = "$wd = $wd_in";
1458}
1459
1460class MSA_INSVE_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
1461                          Operand ImmOp, ImmLeaf Imm, RegisterOperand ROWD,
1462                          RegisterOperand ROWS = ROWD,
1463                          InstrItinClass itin = NoItinerary> {
1464  dag OutOperandList = (outs ROWD:$wd);
1465  dag InOperandList = (ins ROWD:$wd_in, ImmOp:$n, ROWS:$ws, uimmz:$n2);
1466  string AsmString = !strconcat(instr_asm, "\t$wd[$n], $ws[$n2]");
1467  list<dag> Pattern = [(set ROWD:$wd, (OpNode ROWD:$wd_in,
1468                                              Imm:$n,
1469                                              ROWS:$ws,
1470                                              immz:$n2))];
1471  InstrItinClass Itinerary = itin;
1472  string Constraints = "$wd = $wd_in";
1473}
1474
1475class MSA_VEC_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
1476                        RegisterOperand ROWD, RegisterOperand ROWS = ROWD,
1477                        RegisterOperand ROWT = ROWD,
1478                        InstrItinClass itin = NoItinerary> {
1479  dag OutOperandList = (outs ROWD:$wd);
1480  dag InOperandList = (ins ROWS:$ws, ROWT:$wt);
1481  string AsmString = !strconcat(instr_asm, "\t$wd, $ws, $wt");
1482  list<dag> Pattern = [(set ROWD:$wd, (OpNode ROWS:$ws, ROWT:$wt))];
1483  InstrItinClass Itinerary = itin;
1484}
1485
1486class MSA_ELM_SPLAT_DESC_BASE<string instr_asm, SplatComplexPattern SplatImm,
1487                              RegisterOperand ROWD,
1488                              RegisterOperand ROWS = ROWD,
1489                              InstrItinClass itin = NoItinerary> {
1490  dag OutOperandList = (outs ROWD:$wd);
1491  dag InOperandList = (ins ROWS:$ws, SplatImm.OpClass:$n);
1492  string AsmString = !strconcat(instr_asm, "\t$wd, $ws[$n]");
1493  list<dag> Pattern = [(set ROWD:$wd, (MipsVSHF SplatImm:$n, ROWS:$ws,
1494                                                ROWS:$ws))];
1495  InstrItinClass Itinerary = itin;
1496}
1497
1498class MSA_VEC_PSEUDO_BASE<SDPatternOperator OpNode, RegisterOperand ROWD,
1499                          RegisterOperand ROWS = ROWD,
1500                          RegisterOperand ROWT = ROWD> :
1501      MSAPseudo<(outs ROWD:$wd), (ins ROWS:$ws, ROWT:$wt),
1502                [(set ROWD:$wd, (OpNode ROWS:$ws, ROWT:$wt))]>;
1503
1504class ADD_A_B_DESC : MSA_3R_DESC_BASE<"add_a.b", int_mips_add_a_b, MSA128BOpnd>,
1505                     IsCommutable;
1506class ADD_A_H_DESC : MSA_3R_DESC_BASE<"add_a.h", int_mips_add_a_h, MSA128HOpnd>,
1507                     IsCommutable;
1508class ADD_A_W_DESC : MSA_3R_DESC_BASE<"add_a.w", int_mips_add_a_w, MSA128WOpnd>,
1509                     IsCommutable;
1510class ADD_A_D_DESC : MSA_3R_DESC_BASE<"add_a.d", int_mips_add_a_d, MSA128DOpnd>,
1511                     IsCommutable;
1512
1513class ADDS_A_B_DESC : MSA_3R_DESC_BASE<"adds_a.b", int_mips_adds_a_b,
1514                                       MSA128BOpnd>, IsCommutable;
1515class ADDS_A_H_DESC : MSA_3R_DESC_BASE<"adds_a.h", int_mips_adds_a_h,
1516                                       MSA128HOpnd>, IsCommutable;
1517class ADDS_A_W_DESC : MSA_3R_DESC_BASE<"adds_a.w", int_mips_adds_a_w,
1518                                       MSA128WOpnd>, IsCommutable;
1519class ADDS_A_D_DESC : MSA_3R_DESC_BASE<"adds_a.d", int_mips_adds_a_d,
1520                                       MSA128DOpnd>, IsCommutable;
1521
1522class ADDS_S_B_DESC : MSA_3R_DESC_BASE<"adds_s.b", int_mips_adds_s_b,
1523                                       MSA128BOpnd>, IsCommutable;
1524class ADDS_S_H_DESC : MSA_3R_DESC_BASE<"adds_s.h", int_mips_adds_s_h,
1525                                       MSA128HOpnd>, IsCommutable;
1526class ADDS_S_W_DESC : MSA_3R_DESC_BASE<"adds_s.w", int_mips_adds_s_w,
1527                                       MSA128WOpnd>, IsCommutable;
1528class ADDS_S_D_DESC : MSA_3R_DESC_BASE<"adds_s.d", int_mips_adds_s_d,
1529                                       MSA128DOpnd>, IsCommutable;
1530
1531class ADDS_U_B_DESC : MSA_3R_DESC_BASE<"adds_u.b", int_mips_adds_u_b,
1532                                       MSA128BOpnd>, IsCommutable;
1533class ADDS_U_H_DESC : MSA_3R_DESC_BASE<"adds_u.h", int_mips_adds_u_h,
1534                                       MSA128HOpnd>, IsCommutable;
1535class ADDS_U_W_DESC : MSA_3R_DESC_BASE<"adds_u.w", int_mips_adds_u_w,
1536                                       MSA128WOpnd>, IsCommutable;
1537class ADDS_U_D_DESC : MSA_3R_DESC_BASE<"adds_u.d", int_mips_adds_u_d,
1538                                       MSA128DOpnd>, IsCommutable;
1539
1540class ADDV_B_DESC : MSA_3R_DESC_BASE<"addv.b", add, MSA128BOpnd>, IsCommutable;
1541class ADDV_H_DESC : MSA_3R_DESC_BASE<"addv.h", add, MSA128HOpnd>, IsCommutable;
1542class ADDV_W_DESC : MSA_3R_DESC_BASE<"addv.w", add, MSA128WOpnd>, IsCommutable;
1543class ADDV_D_DESC : MSA_3R_DESC_BASE<"addv.d", add, MSA128DOpnd>, IsCommutable;
1544
1545class ADDVI_B_DESC : MSA_I5_DESC_BASE<"addvi.b", add, vsplati8_uimm5,
1546                                      MSA128BOpnd>;
1547class ADDVI_H_DESC : MSA_I5_DESC_BASE<"addvi.h", add, vsplati16_uimm5,
1548                                      MSA128HOpnd>;
1549class ADDVI_W_DESC : MSA_I5_DESC_BASE<"addvi.w", add, vsplati32_uimm5,
1550                                      MSA128WOpnd>;
1551class ADDVI_D_DESC : MSA_I5_DESC_BASE<"addvi.d", add, vsplati64_uimm5,
1552                                      MSA128DOpnd>;
1553
1554class AND_V_DESC : MSA_VEC_DESC_BASE<"and.v", and, MSA128BOpnd>;
1555class AND_V_H_PSEUDO_DESC : MSA_VEC_PSEUDO_BASE<and, MSA128HOpnd>;
1556class AND_V_W_PSEUDO_DESC : MSA_VEC_PSEUDO_BASE<and, MSA128WOpnd>;
1557class AND_V_D_PSEUDO_DESC : MSA_VEC_PSEUDO_BASE<and, MSA128DOpnd>;
1558
1559class ANDI_B_DESC : MSA_I8_DESC_BASE<"andi.b", and, vsplati8_uimm8,
1560                                     MSA128BOpnd>;
1561
1562class ASUB_S_B_DESC : MSA_3R_DESC_BASE<"asub_s.b", int_mips_asub_s_b,
1563                                       MSA128BOpnd>;
1564class ASUB_S_H_DESC : MSA_3R_DESC_BASE<"asub_s.h", int_mips_asub_s_h,
1565                                       MSA128HOpnd>;
1566class ASUB_S_W_DESC : MSA_3R_DESC_BASE<"asub_s.w", int_mips_asub_s_w,
1567                                       MSA128WOpnd>;
1568class ASUB_S_D_DESC : MSA_3R_DESC_BASE<"asub_s.d", int_mips_asub_s_d,
1569                                       MSA128DOpnd>;
1570
1571class ASUB_U_B_DESC : MSA_3R_DESC_BASE<"asub_u.b", int_mips_asub_u_b,
1572                                       MSA128BOpnd>;
1573class ASUB_U_H_DESC : MSA_3R_DESC_BASE<"asub_u.h", int_mips_asub_u_h,
1574                                       MSA128HOpnd>;
1575class ASUB_U_W_DESC : MSA_3R_DESC_BASE<"asub_u.w", int_mips_asub_u_w,
1576                                       MSA128WOpnd>;
1577class ASUB_U_D_DESC : MSA_3R_DESC_BASE<"asub_u.d", int_mips_asub_u_d,
1578                                       MSA128DOpnd>;
1579
1580class AVE_S_B_DESC : MSA_3R_DESC_BASE<"ave_s.b", int_mips_ave_s_b, MSA128BOpnd>,
1581                     IsCommutable;
1582class AVE_S_H_DESC : MSA_3R_DESC_BASE<"ave_s.h", int_mips_ave_s_h, MSA128HOpnd>,
1583                     IsCommutable;
1584class AVE_S_W_DESC : MSA_3R_DESC_BASE<"ave_s.w", int_mips_ave_s_w, MSA128WOpnd>,
1585                     IsCommutable;
1586class AVE_S_D_DESC : MSA_3R_DESC_BASE<"ave_s.d", int_mips_ave_s_d, MSA128DOpnd>,
1587                     IsCommutable;
1588
1589class AVE_U_B_DESC : MSA_3R_DESC_BASE<"ave_u.b", int_mips_ave_u_b, MSA128BOpnd>,
1590                     IsCommutable;
1591class AVE_U_H_DESC : MSA_3R_DESC_BASE<"ave_u.h", int_mips_ave_u_h, MSA128HOpnd>,
1592                     IsCommutable;
1593class AVE_U_W_DESC : MSA_3R_DESC_BASE<"ave_u.w", int_mips_ave_u_w, MSA128WOpnd>,
1594                     IsCommutable;
1595class AVE_U_D_DESC : MSA_3R_DESC_BASE<"ave_u.d", int_mips_ave_u_d, MSA128DOpnd>,
1596                     IsCommutable;
1597
1598class AVER_S_B_DESC : MSA_3R_DESC_BASE<"aver_s.b", int_mips_aver_s_b,
1599                                       MSA128BOpnd>, IsCommutable;
1600class AVER_S_H_DESC : MSA_3R_DESC_BASE<"aver_s.h", int_mips_aver_s_h,
1601                                       MSA128HOpnd>, IsCommutable;
1602class AVER_S_W_DESC : MSA_3R_DESC_BASE<"aver_s.w", int_mips_aver_s_w,
1603                                       MSA128WOpnd>, IsCommutable;
1604class AVER_S_D_DESC : MSA_3R_DESC_BASE<"aver_s.d", int_mips_aver_s_d,
1605                                       MSA128DOpnd>, IsCommutable;
1606
1607class AVER_U_B_DESC : MSA_3R_DESC_BASE<"aver_u.b", int_mips_aver_u_b,
1608                                       MSA128BOpnd>, IsCommutable;
1609class AVER_U_H_DESC : MSA_3R_DESC_BASE<"aver_u.h", int_mips_aver_u_h,
1610                                       MSA128HOpnd>, IsCommutable;
1611class AVER_U_W_DESC : MSA_3R_DESC_BASE<"aver_u.w", int_mips_aver_u_w,
1612                                       MSA128WOpnd>, IsCommutable;
1613class AVER_U_D_DESC : MSA_3R_DESC_BASE<"aver_u.d", int_mips_aver_u_d,
1614                                       MSA128DOpnd>, IsCommutable;
1615
1616class BCLR_B_DESC : MSA_3R_DESC_BASE<"bclr.b", vbclr_b, MSA128BOpnd>;
1617class BCLR_H_DESC : MSA_3R_DESC_BASE<"bclr.h", vbclr_h, MSA128HOpnd>;
1618class BCLR_W_DESC : MSA_3R_DESC_BASE<"bclr.w", vbclr_w, MSA128WOpnd>;
1619class BCLR_D_DESC : MSA_3R_DESC_BASE<"bclr.d", vbclr_d, MSA128DOpnd>;
1620
1621class BCLRI_B_DESC : MSA_BIT_B_DESC_BASE<"bclri.b", and, vsplat_uimm_inv_pow2,
1622                                         MSA128BOpnd>;
1623class BCLRI_H_DESC : MSA_BIT_H_DESC_BASE<"bclri.h", and, vsplat_uimm_inv_pow2,
1624                                         MSA128HOpnd>;
1625class BCLRI_W_DESC : MSA_BIT_W_DESC_BASE<"bclri.w", and, vsplat_uimm_inv_pow2,
1626                                         MSA128WOpnd>;
1627class BCLRI_D_DESC : MSA_BIT_D_DESC_BASE<"bclri.d", and, vsplat_uimm_inv_pow2,
1628                                         MSA128DOpnd>;
1629
1630class BINSL_B_DESC : MSA_3R_BINSX_DESC_BASE<"binsl.b", int_mips_binsl_b,
1631                                            MSA128BOpnd>;
1632class BINSL_H_DESC : MSA_3R_BINSX_DESC_BASE<"binsl.h", int_mips_binsl_h,
1633                                            MSA128HOpnd>;
1634class BINSL_W_DESC : MSA_3R_BINSX_DESC_BASE<"binsl.w", int_mips_binsl_w,
1635                                            MSA128WOpnd>;
1636class BINSL_D_DESC : MSA_3R_BINSX_DESC_BASE<"binsl.d", int_mips_binsl_d,
1637                                            MSA128DOpnd>;
1638
1639class BINSLI_B_DESC : MSA_BIT_BINSLI_DESC_BASE<"binsli.b", v16i8, vsplat_maskl_bits_uimm3, MSA128BOpnd>;
1640class BINSLI_H_DESC : MSA_BIT_BINSLI_DESC_BASE<"binsli.h", v8i16, vsplat_maskl_bits_uimm4, MSA128HOpnd>;
1641class BINSLI_W_DESC : MSA_BIT_BINSLI_DESC_BASE<"binsli.w", v4i32, vsplat_maskl_bits_uimm5, MSA128WOpnd>;
1642class BINSLI_D_DESC : MSA_BIT_BINSLI_DESC_BASE<"binsli.d", v2i64, vsplat_maskl_bits_uimm6, MSA128DOpnd>;
1643
1644class BINSR_B_DESC : MSA_3R_BINSX_DESC_BASE<"binsr.b", int_mips_binsr_b,
1645                                            MSA128BOpnd>;
1646class BINSR_H_DESC : MSA_3R_BINSX_DESC_BASE<"binsr.h", int_mips_binsr_h,
1647                                            MSA128HOpnd>;
1648class BINSR_W_DESC : MSA_3R_BINSX_DESC_BASE<"binsr.w", int_mips_binsr_w,
1649                                            MSA128WOpnd>;
1650class BINSR_D_DESC : MSA_3R_BINSX_DESC_BASE<"binsr.d", int_mips_binsr_d,
1651                                            MSA128DOpnd>;
1652
1653class BINSRI_B_DESC
1654    : MSA_BIT_BINSRI_DESC_BASE<"binsri.b", v16i8, vsplat_maskr_bits_uimm3,
1655                               MSA128BOpnd>;
1656class BINSRI_H_DESC
1657    : MSA_BIT_BINSRI_DESC_BASE<"binsri.h", v8i16, vsplat_maskr_bits_uimm4,
1658                               MSA128HOpnd>;
1659class BINSRI_W_DESC
1660    : MSA_BIT_BINSRI_DESC_BASE<"binsri.w", v4i32, vsplat_maskr_bits_uimm5,
1661                               MSA128WOpnd>;
1662class BINSRI_D_DESC
1663    : MSA_BIT_BINSRI_DESC_BASE<"binsri.d", v2i64, vsplat_maskr_bits_uimm6,
1664                               MSA128DOpnd>;
1665
1666class BMNZ_V_DESC {
1667  dag OutOperandList = (outs MSA128BOpnd:$wd);
1668  dag InOperandList = (ins MSA128BOpnd:$wd_in, MSA128BOpnd:$ws,
1669                       MSA128BOpnd:$wt);
1670  string AsmString = "bmnz.v\t$wd, $ws, $wt";
1671  list<dag> Pattern = [(set MSA128BOpnd:$wd, (vselect MSA128BOpnd:$wt,
1672                                                      MSA128BOpnd:$ws,
1673                                                      MSA128BOpnd:$wd_in))];
1674  InstrItinClass Itinerary = NoItinerary;
1675  string Constraints = "$wd = $wd_in";
1676}
1677
1678class BMNZI_B_DESC {
1679  dag OutOperandList = (outs MSA128BOpnd:$wd);
1680  dag InOperandList = (ins MSA128BOpnd:$wd_in, MSA128BOpnd:$ws,
1681                           vsplat_uimm8:$u8);
1682  string AsmString = "bmnzi.b\t$wd, $ws, $u8";
1683  list<dag> Pattern = [(set MSA128BOpnd:$wd, (vselect vsplati8_uimm8:$u8,
1684                                                      MSA128BOpnd:$ws,
1685                                                      MSA128BOpnd:$wd_in))];
1686  InstrItinClass Itinerary = NoItinerary;
1687  string Constraints = "$wd = $wd_in";
1688}
1689
1690class BMZ_V_DESC {
1691  dag OutOperandList = (outs MSA128BOpnd:$wd);
1692  dag InOperandList = (ins MSA128BOpnd:$wd_in, MSA128BOpnd:$ws,
1693                       MSA128BOpnd:$wt);
1694  string AsmString = "bmz.v\t$wd, $ws, $wt";
1695  list<dag> Pattern = [(set MSA128BOpnd:$wd, (vselect MSA128BOpnd:$wt,
1696                                                      MSA128BOpnd:$wd_in,
1697                                                      MSA128BOpnd:$ws))];
1698  InstrItinClass Itinerary = NoItinerary;
1699  string Constraints = "$wd = $wd_in";
1700}
1701
1702class BMZI_B_DESC {
1703  dag OutOperandList = (outs MSA128BOpnd:$wd);
1704  dag InOperandList = (ins MSA128BOpnd:$wd_in, MSA128BOpnd:$ws,
1705                           vsplat_uimm8:$u8);
1706  string AsmString = "bmzi.b\t$wd, $ws, $u8";
1707  list<dag> Pattern = [(set MSA128BOpnd:$wd, (vselect vsplati8_uimm8:$u8,
1708                                                      MSA128BOpnd:$wd_in,
1709                                                      MSA128BOpnd:$ws))];
1710  InstrItinClass Itinerary = NoItinerary;
1711  string Constraints = "$wd = $wd_in";
1712}
1713
1714class BNEG_B_DESC : MSA_3R_DESC_BASE<"bneg.b", vbneg_b, MSA128BOpnd>;
1715class BNEG_H_DESC : MSA_3R_DESC_BASE<"bneg.h", vbneg_h, MSA128HOpnd>;
1716class BNEG_W_DESC : MSA_3R_DESC_BASE<"bneg.w", vbneg_w, MSA128WOpnd>;
1717class BNEG_D_DESC : MSA_3R_DESC_BASE<"bneg.d", vbneg_d, MSA128DOpnd>;
1718
1719class BNEGI_B_DESC : MSA_BIT_B_DESC_BASE<"bnegi.b", xor, vsplat_uimm_pow2,
1720                                         MSA128BOpnd>;
1721class BNEGI_H_DESC : MSA_BIT_H_DESC_BASE<"bnegi.h", xor, vsplat_uimm_pow2,
1722                                         MSA128HOpnd>;
1723class BNEGI_W_DESC : MSA_BIT_W_DESC_BASE<"bnegi.w", xor, vsplat_uimm_pow2,
1724                                         MSA128WOpnd>;
1725class BNEGI_D_DESC : MSA_BIT_D_DESC_BASE<"bnegi.d", xor, vsplat_uimm_pow2,
1726                                         MSA128DOpnd>;
1727
1728class BNZ_B_DESC : MSA_CBRANCH_DESC_BASE<"bnz.b", MSA128BOpnd>;
1729class BNZ_H_DESC : MSA_CBRANCH_DESC_BASE<"bnz.h", MSA128HOpnd>;
1730class BNZ_W_DESC : MSA_CBRANCH_DESC_BASE<"bnz.w", MSA128WOpnd>;
1731class BNZ_D_DESC : MSA_CBRANCH_DESC_BASE<"bnz.d", MSA128DOpnd>;
1732
1733class BNZ_V_DESC : MSA_CBRANCH_DESC_BASE<"bnz.v", MSA128BOpnd>;
1734
1735class BSEL_V_DESC {
1736  dag OutOperandList = (outs MSA128BOpnd:$wd);
1737  dag InOperandList = (ins MSA128BOpnd:$wd_in, MSA128BOpnd:$ws,
1738                       MSA128BOpnd:$wt);
1739  string AsmString = "bsel.v\t$wd, $ws, $wt";
1740  // Note that vselect and BSEL_V treat the condition operand the opposite way
1741  // from each other.
1742  //   (vselect cond, if_set, if_clear)
1743  //   (BSEL_V cond, if_clear, if_set)
1744  list<dag> Pattern = [(set MSA128BOpnd:$wd,
1745                        (vselect MSA128BOpnd:$wd_in, MSA128BOpnd:$wt,
1746                                                     MSA128BOpnd:$ws))];
1747  InstrItinClass Itinerary = NoItinerary;
1748  string Constraints = "$wd = $wd_in";
1749}
1750
1751class BSELI_B_DESC {
1752  dag OutOperandList = (outs MSA128BOpnd:$wd);
1753  dag InOperandList = (ins MSA128BOpnd:$wd_in, MSA128BOpnd:$ws,
1754                           vsplat_uimm8:$u8);
1755  string AsmString = "bseli.b\t$wd, $ws, $u8";
1756  // Note that vselect and BSEL_V treat the condition operand the opposite way
1757  // from each other.
1758  //   (vselect cond, if_set, if_clear)
1759  //   (BSEL_V cond, if_clear, if_set)
1760  list<dag> Pattern = [(set MSA128BOpnd:$wd, (vselect MSA128BOpnd:$wd_in,
1761                                                      vsplati8_uimm8:$u8,
1762                                                      MSA128BOpnd:$ws))];
1763  InstrItinClass Itinerary = NoItinerary;
1764  string Constraints = "$wd = $wd_in";
1765}
1766
1767class BSET_B_DESC : MSA_3R_DESC_BASE<"bset.b", vbset_b, MSA128BOpnd>;
1768class BSET_H_DESC : MSA_3R_DESC_BASE<"bset.h", vbset_h, MSA128HOpnd>;
1769class BSET_W_DESC : MSA_3R_DESC_BASE<"bset.w", vbset_w, MSA128WOpnd>;
1770class BSET_D_DESC : MSA_3R_DESC_BASE<"bset.d", vbset_d, MSA128DOpnd>;
1771
1772class BSETI_B_DESC : MSA_BIT_B_DESC_BASE<"bseti.b", or, vsplat_uimm_pow2,
1773                                         MSA128BOpnd>;
1774class BSETI_H_DESC : MSA_BIT_H_DESC_BASE<"bseti.h", or, vsplat_uimm_pow2,
1775                                         MSA128HOpnd>;
1776class BSETI_W_DESC : MSA_BIT_W_DESC_BASE<"bseti.w", or, vsplat_uimm_pow2,
1777                                         MSA128WOpnd>;
1778class BSETI_D_DESC : MSA_BIT_D_DESC_BASE<"bseti.d", or, vsplat_uimm_pow2,
1779                                         MSA128DOpnd>;
1780
1781class BZ_B_DESC : MSA_CBRANCH_DESC_BASE<"bz.b", MSA128BOpnd>;
1782class BZ_H_DESC : MSA_CBRANCH_DESC_BASE<"bz.h", MSA128HOpnd>;
1783class BZ_W_DESC : MSA_CBRANCH_DESC_BASE<"bz.w", MSA128WOpnd>;
1784class BZ_D_DESC : MSA_CBRANCH_DESC_BASE<"bz.d", MSA128DOpnd>;
1785
1786class BZ_V_DESC : MSA_CBRANCH_DESC_BASE<"bz.v", MSA128BOpnd>;
1787
1788class CEQ_B_DESC : MSA_3R_DESC_BASE<"ceq.b", vseteq_v16i8, MSA128BOpnd>,
1789                   IsCommutable;
1790class CEQ_H_DESC : MSA_3R_DESC_BASE<"ceq.h", vseteq_v8i16, MSA128HOpnd>,
1791                   IsCommutable;
1792class CEQ_W_DESC : MSA_3R_DESC_BASE<"ceq.w", vseteq_v4i32, MSA128WOpnd>,
1793                   IsCommutable;
1794class CEQ_D_DESC : MSA_3R_DESC_BASE<"ceq.d", vseteq_v2i64, MSA128DOpnd>,
1795                   IsCommutable;
1796
1797class CEQI_B_DESC : MSA_I5_DESC_BASE<"ceqi.b", vseteq_v16i8, vsplati8_simm5,
1798                                     MSA128BOpnd>;
1799class CEQI_H_DESC : MSA_I5_DESC_BASE<"ceqi.h", vseteq_v8i16, vsplati16_simm5,
1800                                     MSA128HOpnd>;
1801class CEQI_W_DESC : MSA_I5_DESC_BASE<"ceqi.w", vseteq_v4i32, vsplati32_simm5,
1802                                     MSA128WOpnd>;
1803class CEQI_D_DESC : MSA_I5_DESC_BASE<"ceqi.d", vseteq_v2i64, vsplati64_simm5,
1804                                     MSA128DOpnd>;
1805
1806class CFCMSA_DESC {
1807  dag OutOperandList = (outs GPR32Opnd:$rd);
1808  dag InOperandList = (ins MSA128CROpnd:$cs);
1809  string AsmString = "cfcmsa\t$rd, $cs";
1810  InstrItinClass Itinerary = NoItinerary;
1811  bit hasSideEffects = 1;
1812  bit isMoveReg = 1;
1813}
1814
1815class CLE_S_B_DESC : MSA_3R_DESC_BASE<"cle_s.b", vsetle_v16i8, MSA128BOpnd>;
1816class CLE_S_H_DESC : MSA_3R_DESC_BASE<"cle_s.h", vsetle_v8i16, MSA128HOpnd>;
1817class CLE_S_W_DESC : MSA_3R_DESC_BASE<"cle_s.w", vsetle_v4i32, MSA128WOpnd>;
1818class CLE_S_D_DESC : MSA_3R_DESC_BASE<"cle_s.d", vsetle_v2i64, MSA128DOpnd>;
1819
1820class CLE_U_B_DESC : MSA_3R_DESC_BASE<"cle_u.b", vsetule_v16i8, MSA128BOpnd>;
1821class CLE_U_H_DESC : MSA_3R_DESC_BASE<"cle_u.h", vsetule_v8i16, MSA128HOpnd>;
1822class CLE_U_W_DESC : MSA_3R_DESC_BASE<"cle_u.w", vsetule_v4i32, MSA128WOpnd>;
1823class CLE_U_D_DESC : MSA_3R_DESC_BASE<"cle_u.d", vsetule_v2i64, MSA128DOpnd>;
1824
1825class CLEI_S_B_DESC : MSA_I5_DESC_BASE<"clei_s.b", vsetle_v16i8,
1826                                       vsplati8_simm5,  MSA128BOpnd>;
1827class CLEI_S_H_DESC : MSA_I5_DESC_BASE<"clei_s.h", vsetle_v8i16,
1828                                       vsplati16_simm5, MSA128HOpnd>;
1829class CLEI_S_W_DESC : MSA_I5_DESC_BASE<"clei_s.w", vsetle_v4i32,
1830                                       vsplati32_simm5, MSA128WOpnd>;
1831class CLEI_S_D_DESC : MSA_I5_DESC_BASE<"clei_s.d", vsetle_v2i64,
1832                                       vsplati64_simm5, MSA128DOpnd>;
1833
1834class CLEI_U_B_DESC : MSA_I5_DESC_BASE<"clei_u.b", vsetule_v16i8,
1835                                       vsplati8_uimm5,  MSA128BOpnd>;
1836class CLEI_U_H_DESC : MSA_I5_DESC_BASE<"clei_u.h", vsetule_v8i16,
1837                                       vsplati16_uimm5, MSA128HOpnd>;
1838class CLEI_U_W_DESC : MSA_I5_DESC_BASE<"clei_u.w", vsetule_v4i32,
1839                                       vsplati32_uimm5, MSA128WOpnd>;
1840class CLEI_U_D_DESC : MSA_I5_DESC_BASE<"clei_u.d", vsetule_v2i64,
1841                                       vsplati64_uimm5, MSA128DOpnd>;
1842
1843class CLT_S_B_DESC : MSA_3R_DESC_BASE<"clt_s.b", vsetlt_v16i8, MSA128BOpnd>;
1844class CLT_S_H_DESC : MSA_3R_DESC_BASE<"clt_s.h", vsetlt_v8i16, MSA128HOpnd>;
1845class CLT_S_W_DESC : MSA_3R_DESC_BASE<"clt_s.w", vsetlt_v4i32, MSA128WOpnd>;
1846class CLT_S_D_DESC : MSA_3R_DESC_BASE<"clt_s.d", vsetlt_v2i64, MSA128DOpnd>;
1847
1848class CLT_U_B_DESC : MSA_3R_DESC_BASE<"clt_u.b", vsetult_v16i8, MSA128BOpnd>;
1849class CLT_U_H_DESC : MSA_3R_DESC_BASE<"clt_u.h", vsetult_v8i16, MSA128HOpnd>;
1850class CLT_U_W_DESC : MSA_3R_DESC_BASE<"clt_u.w", vsetult_v4i32, MSA128WOpnd>;
1851class CLT_U_D_DESC : MSA_3R_DESC_BASE<"clt_u.d", vsetult_v2i64, MSA128DOpnd>;
1852
1853class CLTI_S_B_DESC : MSA_I5_DESC_BASE<"clti_s.b", vsetlt_v16i8,
1854                                       vsplati8_simm5, MSA128BOpnd>;
1855class CLTI_S_H_DESC : MSA_I5_DESC_BASE<"clti_s.h", vsetlt_v8i16,
1856                                       vsplati16_simm5, MSA128HOpnd>;
1857class CLTI_S_W_DESC : MSA_I5_DESC_BASE<"clti_s.w", vsetlt_v4i32,
1858                                       vsplati32_simm5, MSA128WOpnd>;
1859class CLTI_S_D_DESC : MSA_I5_DESC_BASE<"clti_s.d", vsetlt_v2i64,
1860                                       vsplati64_simm5, MSA128DOpnd>;
1861
1862class CLTI_U_B_DESC : MSA_I5_DESC_BASE<"clti_u.b", vsetult_v16i8,
1863                                       vsplati8_uimm5, MSA128BOpnd>;
1864class CLTI_U_H_DESC : MSA_I5_DESC_BASE<"clti_u.h", vsetult_v8i16,
1865                                       vsplati16_uimm5, MSA128HOpnd>;
1866class CLTI_U_W_DESC : MSA_I5_DESC_BASE<"clti_u.w", vsetult_v4i32,
1867                                       vsplati32_uimm5, MSA128WOpnd>;
1868class CLTI_U_D_DESC : MSA_I5_DESC_BASE<"clti_u.d", vsetult_v2i64,
1869                                       vsplati64_uimm5, MSA128DOpnd>;
1870
1871class COPY_S_B_DESC : MSA_COPY_DESC_BASE<"copy_s.b", vextract_sext_i8,  v16i8,
1872                                         uimm4_ptr, immZExt4Ptr, GPR32Opnd,
1873                                         MSA128BOpnd>;
1874class COPY_S_H_DESC : MSA_COPY_DESC_BASE<"copy_s.h", vextract_sext_i16, v8i16,
1875                                         uimm3_ptr, immZExt3Ptr, GPR32Opnd,
1876                                         MSA128HOpnd>;
1877class COPY_S_W_DESC : MSA_COPY_DESC_BASE<"copy_s.w", vextract_sext_i32, v4i32,
1878                                         uimm2_ptr, immZExt2Ptr, GPR32Opnd,
1879                                         MSA128WOpnd>;
1880class COPY_S_D_DESC : MSA_COPY_DESC_BASE<"copy_s.d", vextract_sext_i64, v2i64,
1881                                         uimm1_ptr, immZExt1Ptr, GPR64Opnd,
1882                                         MSA128DOpnd>;
1883
1884class COPY_U_B_DESC : MSA_COPY_DESC_BASE<"copy_u.b", vextract_zext_i8,  v16i8,
1885                                         uimm4_ptr, immZExt4Ptr, GPR32Opnd,
1886                                         MSA128BOpnd>;
1887class COPY_U_H_DESC : MSA_COPY_DESC_BASE<"copy_u.h", vextract_zext_i16, v8i16,
1888                                         uimm3_ptr, immZExt3Ptr, GPR32Opnd,
1889                                         MSA128HOpnd>;
1890class COPY_U_W_DESC : MSA_COPY_DESC_BASE<"copy_u.w", vextract_zext_i32, v4i32,
1891                                         uimm2_ptr, immZExt2Ptr, GPR32Opnd,
1892                                         MSA128WOpnd>;
1893
1894class COPY_FW_PSEUDO_DESC : MSA_COPY_PSEUDO_BASE<vector_extract, v4f32,
1895                                                 uimm2_ptr, immZExt2Ptr, FGR32,
1896                                                 MSA128W>;
1897class COPY_FD_PSEUDO_DESC : MSA_COPY_PSEUDO_BASE<vector_extract, v2f64,
1898                                                 uimm1_ptr, immZExt1Ptr, FGR64,
1899                                                 MSA128D>;
1900
1901class CTCMSA_DESC {
1902  dag OutOperandList = (outs);
1903  dag InOperandList = (ins MSA128CROpnd:$cd, GPR32Opnd:$rs);
1904  string AsmString = "ctcmsa\t$cd, $rs";
1905  InstrItinClass Itinerary = NoItinerary;
1906  bit hasSideEffects = 1;
1907  bit isMoveReg = 1;
1908}
1909
1910class DIV_S_B_DESC : MSA_3R_DESC_BASE<"div_s.b", sdiv, MSA128BOpnd>;
1911class DIV_S_H_DESC : MSA_3R_DESC_BASE<"div_s.h", sdiv, MSA128HOpnd>;
1912class DIV_S_W_DESC : MSA_3R_DESC_BASE<"div_s.w", sdiv, MSA128WOpnd>;
1913class DIV_S_D_DESC : MSA_3R_DESC_BASE<"div_s.d", sdiv, MSA128DOpnd>;
1914
1915class DIV_U_B_DESC : MSA_3R_DESC_BASE<"div_u.b", udiv, MSA128BOpnd>;
1916class DIV_U_H_DESC : MSA_3R_DESC_BASE<"div_u.h", udiv, MSA128HOpnd>;
1917class DIV_U_W_DESC : MSA_3R_DESC_BASE<"div_u.w", udiv, MSA128WOpnd>;
1918class DIV_U_D_DESC : MSA_3R_DESC_BASE<"div_u.d", udiv, MSA128DOpnd>;
1919
1920class DOTP_S_H_DESC : MSA_3R_DESC_BASE<"dotp_s.h", int_mips_dotp_s_h,
1921                                       MSA128HOpnd, MSA128BOpnd, MSA128BOpnd>,
1922                      IsCommutable;
1923class DOTP_S_W_DESC : MSA_3R_DESC_BASE<"dotp_s.w", int_mips_dotp_s_w,
1924                                       MSA128WOpnd, MSA128HOpnd, MSA128HOpnd>,
1925                      IsCommutable;
1926class DOTP_S_D_DESC : MSA_3R_DESC_BASE<"dotp_s.d", int_mips_dotp_s_d,
1927                                       MSA128DOpnd, MSA128WOpnd, MSA128WOpnd>,
1928                      IsCommutable;
1929
1930class DOTP_U_H_DESC : MSA_3R_DESC_BASE<"dotp_u.h", int_mips_dotp_u_h,
1931                                       MSA128HOpnd, MSA128BOpnd, MSA128BOpnd>,
1932                      IsCommutable;
1933class DOTP_U_W_DESC : MSA_3R_DESC_BASE<"dotp_u.w", int_mips_dotp_u_w,
1934                                       MSA128WOpnd, MSA128HOpnd, MSA128HOpnd>,
1935                      IsCommutable;
1936class DOTP_U_D_DESC : MSA_3R_DESC_BASE<"dotp_u.d", int_mips_dotp_u_d,
1937                                       MSA128DOpnd, MSA128WOpnd, MSA128WOpnd>,
1938                      IsCommutable;
1939
1940class DPADD_S_H_DESC : MSA_3R_4R_DESC_BASE<"dpadd_s.h", int_mips_dpadd_s_h,
1941                                           MSA128HOpnd, MSA128BOpnd,
1942                                           MSA128BOpnd>, IsCommutable;
1943class DPADD_S_W_DESC : MSA_3R_4R_DESC_BASE<"dpadd_s.w", int_mips_dpadd_s_w,
1944                                           MSA128WOpnd, MSA128HOpnd,
1945                                           MSA128HOpnd>, IsCommutable;
1946class DPADD_S_D_DESC : MSA_3R_4R_DESC_BASE<"dpadd_s.d", int_mips_dpadd_s_d,
1947                                           MSA128DOpnd, MSA128WOpnd,
1948                                           MSA128WOpnd>, IsCommutable;
1949
1950class DPADD_U_H_DESC : MSA_3R_4R_DESC_BASE<"dpadd_u.h", int_mips_dpadd_u_h,
1951                                           MSA128HOpnd, MSA128BOpnd,
1952                                           MSA128BOpnd>, IsCommutable;
1953class DPADD_U_W_DESC : MSA_3R_4R_DESC_BASE<"dpadd_u.w", int_mips_dpadd_u_w,
1954                                           MSA128WOpnd, MSA128HOpnd,
1955                                           MSA128HOpnd>, IsCommutable;
1956class DPADD_U_D_DESC : MSA_3R_4R_DESC_BASE<"dpadd_u.d", int_mips_dpadd_u_d,
1957                                           MSA128DOpnd, MSA128WOpnd,
1958                                           MSA128WOpnd>, IsCommutable;
1959
1960class DPSUB_S_H_DESC : MSA_3R_4R_DESC_BASE<"dpsub_s.h", int_mips_dpsub_s_h,
1961                                           MSA128HOpnd, MSA128BOpnd,
1962                                           MSA128BOpnd>;
1963class DPSUB_S_W_DESC : MSA_3R_4R_DESC_BASE<"dpsub_s.w", int_mips_dpsub_s_w,
1964                                           MSA128WOpnd, MSA128HOpnd,
1965                                           MSA128HOpnd>;
1966class DPSUB_S_D_DESC : MSA_3R_4R_DESC_BASE<"dpsub_s.d", int_mips_dpsub_s_d,
1967                                           MSA128DOpnd, MSA128WOpnd,
1968                                           MSA128WOpnd>;
1969
1970class DPSUB_U_H_DESC : MSA_3R_4R_DESC_BASE<"dpsub_u.h", int_mips_dpsub_u_h,
1971                                           MSA128HOpnd, MSA128BOpnd,
1972                                           MSA128BOpnd>;
1973class DPSUB_U_W_DESC : MSA_3R_4R_DESC_BASE<"dpsub_u.w", int_mips_dpsub_u_w,
1974                                           MSA128WOpnd, MSA128HOpnd,
1975                                           MSA128HOpnd>;
1976class DPSUB_U_D_DESC : MSA_3R_4R_DESC_BASE<"dpsub_u.d", int_mips_dpsub_u_d,
1977                                           MSA128DOpnd, MSA128WOpnd,
1978                                           MSA128WOpnd>;
1979
1980class FADD_W_DESC : MSA_3RF_DESC_BASE<"fadd.w", fadd, MSA128WOpnd>,
1981                    IsCommutable;
1982class FADD_D_DESC : MSA_3RF_DESC_BASE<"fadd.d", fadd, MSA128DOpnd>,
1983                    IsCommutable;
1984
1985class FCAF_W_DESC : MSA_3RF_DESC_BASE<"fcaf.w", int_mips_fcaf_w, MSA128WOpnd>,
1986                    IsCommutable;
1987class FCAF_D_DESC : MSA_3RF_DESC_BASE<"fcaf.d", int_mips_fcaf_d, MSA128DOpnd>,
1988                    IsCommutable;
1989
1990class FCEQ_W_DESC : MSA_3RF_DESC_BASE<"fceq.w", vfsetoeq_v4f32, MSA128WOpnd>,
1991                    IsCommutable;
1992class FCEQ_D_DESC : MSA_3RF_DESC_BASE<"fceq.d", vfsetoeq_v2f64, MSA128DOpnd>,
1993                    IsCommutable;
1994
1995class FCLASS_W_DESC : MSA_2RF_DESC_BASE<"fclass.w", int_mips_fclass_w,
1996                                        MSA128WOpnd>;
1997class FCLASS_D_DESC : MSA_2RF_DESC_BASE<"fclass.d", int_mips_fclass_d,
1998                                        MSA128DOpnd>;
1999
2000class FCLE_W_DESC : MSA_3RF_DESC_BASE<"fcle.w", vfsetole_v4f32, MSA128WOpnd>;
2001class FCLE_D_DESC : MSA_3RF_DESC_BASE<"fcle.d", vfsetole_v2f64, MSA128DOpnd>;
2002
2003class FCLT_W_DESC : MSA_3RF_DESC_BASE<"fclt.w", vfsetolt_v4f32, MSA128WOpnd>;
2004class FCLT_D_DESC : MSA_3RF_DESC_BASE<"fclt.d", vfsetolt_v2f64, MSA128DOpnd>;
2005
2006class FCNE_W_DESC : MSA_3RF_DESC_BASE<"fcne.w", vfsetone_v4f32, MSA128WOpnd>,
2007                    IsCommutable;
2008class FCNE_D_DESC : MSA_3RF_DESC_BASE<"fcne.d", vfsetone_v2f64, MSA128DOpnd>,
2009                    IsCommutable;
2010
2011class FCOR_W_DESC : MSA_3RF_DESC_BASE<"fcor.w", vfsetord_v4f32, MSA128WOpnd>,
2012                    IsCommutable;
2013class FCOR_D_DESC : MSA_3RF_DESC_BASE<"fcor.d", vfsetord_v2f64, MSA128DOpnd>,
2014                    IsCommutable;
2015
2016class FCUEQ_W_DESC : MSA_3RF_DESC_BASE<"fcueq.w", vfsetueq_v4f32, MSA128WOpnd>,
2017                     IsCommutable;
2018class FCUEQ_D_DESC : MSA_3RF_DESC_BASE<"fcueq.d", vfsetueq_v2f64, MSA128DOpnd>,
2019                     IsCommutable;
2020
2021class FCULE_W_DESC : MSA_3RF_DESC_BASE<"fcule.w", vfsetule_v4f32, MSA128WOpnd>,
2022                     IsCommutable;
2023class FCULE_D_DESC : MSA_3RF_DESC_BASE<"fcule.d", vfsetule_v2f64, MSA128DOpnd>,
2024                     IsCommutable;
2025
2026class FCULT_W_DESC : MSA_3RF_DESC_BASE<"fcult.w", vfsetult_v4f32, MSA128WOpnd>,
2027                     IsCommutable;
2028class FCULT_D_DESC : MSA_3RF_DESC_BASE<"fcult.d", vfsetult_v2f64, MSA128DOpnd>,
2029                     IsCommutable;
2030
2031class FCUN_W_DESC : MSA_3RF_DESC_BASE<"fcun.w", vfsetun_v4f32, MSA128WOpnd>,
2032                    IsCommutable;
2033class FCUN_D_DESC : MSA_3RF_DESC_BASE<"fcun.d", vfsetun_v2f64, MSA128DOpnd>,
2034                    IsCommutable;
2035
2036class FCUNE_W_DESC : MSA_3RF_DESC_BASE<"fcune.w", vfsetune_v4f32, MSA128WOpnd>,
2037                     IsCommutable;
2038class FCUNE_D_DESC : MSA_3RF_DESC_BASE<"fcune.d", vfsetune_v2f64, MSA128DOpnd>,
2039                     IsCommutable;
2040
2041class FDIV_W_DESC : MSA_3RF_DESC_BASE<"fdiv.w", fdiv, MSA128WOpnd>;
2042class FDIV_D_DESC : MSA_3RF_DESC_BASE<"fdiv.d", fdiv, MSA128DOpnd>;
2043
2044class FEXDO_H_DESC : MSA_3RF_DESC_BASE<"fexdo.h", int_mips_fexdo_h,
2045                                       MSA128HOpnd, MSA128WOpnd, MSA128WOpnd>;
2046class FEXDO_W_DESC : MSA_3RF_DESC_BASE<"fexdo.w", int_mips_fexdo_w,
2047                                       MSA128WOpnd, MSA128DOpnd, MSA128DOpnd>;
2048
2049// The fexp2.df instruction multiplies the first operand by 2 to the power of
2050// the second operand. We therefore need a pseudo-insn in order to invent the
2051// 1.0 when we only need to match ISD::FEXP2.
2052class FEXP2_W_DESC : MSA_3RF_DESC_BASE<"fexp2.w", mul_fexp2, MSA128WOpnd>;
2053class FEXP2_D_DESC : MSA_3RF_DESC_BASE<"fexp2.d", mul_fexp2, MSA128DOpnd>;
2054let usesCustomInserter = 1, hasNoSchedulingInfo = 1 in {
2055  class FEXP2_W_1_PSEUDO_DESC :
2056      MSAPseudo<(outs MSA128W:$wd), (ins MSA128W:$ws),
2057                [(set MSA128W:$wd, (fexp2 MSA128W:$ws))]>;
2058  class FEXP2_D_1_PSEUDO_DESC :
2059      MSAPseudo<(outs MSA128D:$wd), (ins MSA128D:$ws),
2060                [(set MSA128D:$wd, (fexp2 MSA128D:$ws))]>;
2061}
2062
2063class FEXUPL_W_DESC : MSA_2RF_DESC_BASE<"fexupl.w", int_mips_fexupl_w,
2064                                        MSA128WOpnd, MSA128HOpnd>;
2065class FEXUPL_D_DESC : MSA_2RF_DESC_BASE<"fexupl.d", int_mips_fexupl_d,
2066                                        MSA128DOpnd, MSA128WOpnd>;
2067
2068class FEXUPR_W_DESC : MSA_2RF_DESC_BASE<"fexupr.w", int_mips_fexupr_w,
2069                                        MSA128WOpnd, MSA128HOpnd>;
2070class FEXUPR_D_DESC : MSA_2RF_DESC_BASE<"fexupr.d", int_mips_fexupr_d,
2071                                        MSA128DOpnd, MSA128WOpnd>;
2072
2073class FFINT_S_W_DESC : MSA_2RF_DESC_BASE<"ffint_s.w", sint_to_fp, MSA128WOpnd>;
2074class FFINT_S_D_DESC : MSA_2RF_DESC_BASE<"ffint_s.d", sint_to_fp, MSA128DOpnd>;
2075
2076class FFINT_U_W_DESC : MSA_2RF_DESC_BASE<"ffint_u.w", uint_to_fp, MSA128WOpnd>;
2077class FFINT_U_D_DESC : MSA_2RF_DESC_BASE<"ffint_u.d", uint_to_fp, MSA128DOpnd>;
2078
2079class FFQL_W_DESC : MSA_2RF_DESC_BASE<"ffql.w", int_mips_ffql_w,
2080                                      MSA128WOpnd, MSA128HOpnd>;
2081class FFQL_D_DESC : MSA_2RF_DESC_BASE<"ffql.d", int_mips_ffql_d,
2082                                      MSA128DOpnd, MSA128WOpnd>;
2083
2084class FFQR_W_DESC : MSA_2RF_DESC_BASE<"ffqr.w", int_mips_ffqr_w,
2085                                      MSA128WOpnd, MSA128HOpnd>;
2086class FFQR_D_DESC : MSA_2RF_DESC_BASE<"ffqr.d", int_mips_ffqr_d,
2087                                      MSA128DOpnd, MSA128WOpnd>;
2088
2089class FILL_B_DESC : MSA_2R_FILL_DESC_BASE<"fill.b", v16i8, vsplati8,
2090                                          MSA128BOpnd, GPR32Opnd>;
2091class FILL_H_DESC : MSA_2R_FILL_DESC_BASE<"fill.h", v8i16, vsplati16,
2092                                          MSA128HOpnd, GPR32Opnd>;
2093class FILL_W_DESC : MSA_2R_FILL_DESC_BASE<"fill.w", v4i32, vsplati32,
2094                                          MSA128WOpnd, GPR32Opnd>;
2095class FILL_D_DESC : MSA_2R_FILL_DESC_BASE<"fill.d", v2i64, vsplati64,
2096                                          MSA128DOpnd, GPR64Opnd>;
2097
2098class FILL_FW_PSEUDO_DESC : MSA_2R_FILL_PSEUDO_BASE<v4f32, vsplatf32, MSA128W,
2099                                                    FGR32>;
2100class FILL_FD_PSEUDO_DESC : MSA_2R_FILL_PSEUDO_BASE<v2f64, vsplatf64, MSA128D,
2101                                                    FGR64>;
2102
2103class FLOG2_W_DESC : MSA_2RF_DESC_BASE<"flog2.w", flog2, MSA128WOpnd>;
2104class FLOG2_D_DESC : MSA_2RF_DESC_BASE<"flog2.d", flog2, MSA128DOpnd>;
2105
2106class FMADD_W_DESC : MSA_3RF_4RF_DESC_BASE<"fmadd.w", fma, MSA128WOpnd>;
2107class FMADD_D_DESC : MSA_3RF_4RF_DESC_BASE<"fmadd.d", fma, MSA128DOpnd>;
2108
2109class FMAX_W_DESC : MSA_3RF_DESC_BASE<"fmax.w", int_mips_fmax_w, MSA128WOpnd>;
2110class FMAX_D_DESC : MSA_3RF_DESC_BASE<"fmax.d", int_mips_fmax_d, MSA128DOpnd>;
2111
2112class FMAX_A_W_DESC : MSA_3RF_DESC_BASE<"fmax_a.w", int_mips_fmax_a_w,
2113                                        MSA128WOpnd>;
2114class FMAX_A_D_DESC : MSA_3RF_DESC_BASE<"fmax_a.d", int_mips_fmax_a_d,
2115                                        MSA128DOpnd>;
2116
2117class FMIN_W_DESC : MSA_3RF_DESC_BASE<"fmin.w", int_mips_fmin_w, MSA128WOpnd>;
2118class FMIN_D_DESC : MSA_3RF_DESC_BASE<"fmin.d", int_mips_fmin_d, MSA128DOpnd>;
2119
2120class FMIN_A_W_DESC : MSA_3RF_DESC_BASE<"fmin_a.w", int_mips_fmin_a_w,
2121                                        MSA128WOpnd>;
2122class FMIN_A_D_DESC : MSA_3RF_DESC_BASE<"fmin_a.d", int_mips_fmin_a_d,
2123                                        MSA128DOpnd>;
2124
2125class FMSUB_W_DESC : MSA_3RF_4RF_DESC_BASE<"fmsub.w", MipsFMS, MSA128WOpnd>;
2126class FMSUB_D_DESC : MSA_3RF_4RF_DESC_BASE<"fmsub.d", MipsFMS, MSA128DOpnd>;
2127
2128class FMUL_W_DESC : MSA_3RF_DESC_BASE<"fmul.w", fmul, MSA128WOpnd>;
2129class FMUL_D_DESC : MSA_3RF_DESC_BASE<"fmul.d", fmul, MSA128DOpnd>;
2130
2131class FRINT_W_DESC : MSA_2RF_DESC_BASE<"frint.w", frint, MSA128WOpnd>;
2132class FRINT_D_DESC : MSA_2RF_DESC_BASE<"frint.d", frint, MSA128DOpnd>;
2133
2134class FRCP_W_DESC : MSA_2RF_DESC_BASE<"frcp.w", int_mips_frcp_w, MSA128WOpnd>;
2135class FRCP_D_DESC : MSA_2RF_DESC_BASE<"frcp.d", int_mips_frcp_d, MSA128DOpnd>;
2136
2137class FRSQRT_W_DESC : MSA_2RF_DESC_BASE<"frsqrt.w", int_mips_frsqrt_w,
2138                                        MSA128WOpnd>;
2139class FRSQRT_D_DESC : MSA_2RF_DESC_BASE<"frsqrt.d", int_mips_frsqrt_d,
2140                                        MSA128DOpnd>;
2141
2142class FSAF_W_DESC : MSA_3RF_DESC_BASE<"fsaf.w", int_mips_fsaf_w, MSA128WOpnd>;
2143class FSAF_D_DESC : MSA_3RF_DESC_BASE<"fsaf.d", int_mips_fsaf_d, MSA128DOpnd>;
2144
2145class FSEQ_W_DESC : MSA_3RF_DESC_BASE<"fseq.w", int_mips_fseq_w, MSA128WOpnd>;
2146class FSEQ_D_DESC : MSA_3RF_DESC_BASE<"fseq.d", int_mips_fseq_d, MSA128DOpnd>;
2147
2148class FSLE_W_DESC : MSA_3RF_DESC_BASE<"fsle.w", int_mips_fsle_w, MSA128WOpnd>;
2149class FSLE_D_DESC : MSA_3RF_DESC_BASE<"fsle.d", int_mips_fsle_d, MSA128DOpnd>;
2150
2151class FSLT_W_DESC : MSA_3RF_DESC_BASE<"fslt.w", int_mips_fslt_w, MSA128WOpnd>;
2152class FSLT_D_DESC : MSA_3RF_DESC_BASE<"fslt.d", int_mips_fslt_d, MSA128DOpnd>;
2153
2154class FSNE_W_DESC : MSA_3RF_DESC_BASE<"fsne.w", int_mips_fsne_w, MSA128WOpnd>;
2155class FSNE_D_DESC : MSA_3RF_DESC_BASE<"fsne.d", int_mips_fsne_d, MSA128DOpnd>;
2156
2157class FSOR_W_DESC : MSA_3RF_DESC_BASE<"fsor.w", int_mips_fsor_w, MSA128WOpnd>;
2158class FSOR_D_DESC : MSA_3RF_DESC_BASE<"fsor.d", int_mips_fsor_d, MSA128DOpnd>;
2159
2160class FSQRT_W_DESC : MSA_2RF_DESC_BASE<"fsqrt.w", fsqrt, MSA128WOpnd>;
2161class FSQRT_D_DESC : MSA_2RF_DESC_BASE<"fsqrt.d", fsqrt, MSA128DOpnd>;
2162
2163class FSUB_W_DESC : MSA_3RF_DESC_BASE<"fsub.w", fsub, MSA128WOpnd>;
2164class FSUB_D_DESC : MSA_3RF_DESC_BASE<"fsub.d", fsub, MSA128DOpnd>;
2165
2166class FSUEQ_W_DESC : MSA_3RF_DESC_BASE<"fsueq.w", int_mips_fsueq_w,
2167                                       MSA128WOpnd>;
2168class FSUEQ_D_DESC : MSA_3RF_DESC_BASE<"fsueq.d", int_mips_fsueq_d,
2169                                       MSA128DOpnd>;
2170
2171class FSULE_W_DESC : MSA_3RF_DESC_BASE<"fsule.w", int_mips_fsule_w,
2172                                       MSA128WOpnd>;
2173class FSULE_D_DESC : MSA_3RF_DESC_BASE<"fsule.d", int_mips_fsule_d,
2174                                       MSA128DOpnd>;
2175
2176class FSULT_W_DESC : MSA_3RF_DESC_BASE<"fsult.w", int_mips_fsult_w,
2177                                       MSA128WOpnd>;
2178class FSULT_D_DESC : MSA_3RF_DESC_BASE<"fsult.d", int_mips_fsult_d,
2179                                       MSA128DOpnd>;
2180
2181class FSUN_W_DESC : MSA_3RF_DESC_BASE<"fsun.w", int_mips_fsun_w,
2182                                      MSA128WOpnd>;
2183class FSUN_D_DESC : MSA_3RF_DESC_BASE<"fsun.d", int_mips_fsun_d,
2184                                      MSA128DOpnd>;
2185
2186class FSUNE_W_DESC : MSA_3RF_DESC_BASE<"fsune.w", int_mips_fsune_w,
2187                                       MSA128WOpnd>;
2188class FSUNE_D_DESC : MSA_3RF_DESC_BASE<"fsune.d", int_mips_fsune_d,
2189                                       MSA128DOpnd>;
2190
2191class FTINT_S_W_DESC : MSA_2RF_DESC_BASE<"ftint_s.w", int_mips_ftint_s_w,
2192                                         MSA128WOpnd>;
2193class FTINT_S_D_DESC : MSA_2RF_DESC_BASE<"ftint_s.d", int_mips_ftint_s_d,
2194                                         MSA128DOpnd>;
2195
2196class FTINT_U_W_DESC : MSA_2RF_DESC_BASE<"ftint_u.w", int_mips_ftint_u_w,
2197                                         MSA128WOpnd>;
2198class FTINT_U_D_DESC : MSA_2RF_DESC_BASE<"ftint_u.d", int_mips_ftint_u_d,
2199                                         MSA128DOpnd>;
2200
2201class FTQ_H_DESC : MSA_3RF_DESC_BASE<"ftq.h", int_mips_ftq_h,
2202                                     MSA128HOpnd, MSA128WOpnd, MSA128WOpnd>;
2203class FTQ_W_DESC : MSA_3RF_DESC_BASE<"ftq.w", int_mips_ftq_w,
2204                                     MSA128WOpnd, MSA128DOpnd, MSA128DOpnd>;
2205
2206class FTRUNC_S_W_DESC : MSA_2RF_DESC_BASE<"ftrunc_s.w", fp_to_sint,
2207                                          MSA128WOpnd>;
2208class FTRUNC_S_D_DESC : MSA_2RF_DESC_BASE<"ftrunc_s.d", fp_to_sint,
2209                                          MSA128DOpnd>;
2210
2211class FTRUNC_U_W_DESC : MSA_2RF_DESC_BASE<"ftrunc_u.w", fp_to_uint,
2212                                          MSA128WOpnd>;
2213class FTRUNC_U_D_DESC : MSA_2RF_DESC_BASE<"ftrunc_u.d", fp_to_uint,
2214                                          MSA128DOpnd>;
2215
2216class HADD_S_H_DESC : MSA_3R_DESC_BASE<"hadd_s.h", int_mips_hadd_s_h,
2217                                       MSA128HOpnd, MSA128BOpnd, MSA128BOpnd>;
2218class HADD_S_W_DESC : MSA_3R_DESC_BASE<"hadd_s.w", int_mips_hadd_s_w,
2219                                       MSA128WOpnd, MSA128HOpnd, MSA128HOpnd>;
2220class HADD_S_D_DESC : MSA_3R_DESC_BASE<"hadd_s.d", int_mips_hadd_s_d,
2221                                       MSA128DOpnd, MSA128WOpnd, MSA128WOpnd>;
2222
2223class HADD_U_H_DESC : MSA_3R_DESC_BASE<"hadd_u.h", int_mips_hadd_u_h,
2224                                       MSA128HOpnd, MSA128BOpnd, MSA128BOpnd>;
2225class HADD_U_W_DESC : MSA_3R_DESC_BASE<"hadd_u.w", int_mips_hadd_u_w,
2226                                       MSA128WOpnd, MSA128HOpnd, MSA128HOpnd>;
2227class HADD_U_D_DESC : MSA_3R_DESC_BASE<"hadd_u.d", int_mips_hadd_u_d,
2228                                       MSA128DOpnd, MSA128WOpnd, MSA128WOpnd>;
2229
2230class HSUB_S_H_DESC : MSA_3R_DESC_BASE<"hsub_s.h", int_mips_hsub_s_h,
2231                                       MSA128HOpnd, MSA128BOpnd, MSA128BOpnd>;
2232class HSUB_S_W_DESC : MSA_3R_DESC_BASE<"hsub_s.w", int_mips_hsub_s_w,
2233                                       MSA128WOpnd, MSA128HOpnd, MSA128HOpnd>;
2234class HSUB_S_D_DESC : MSA_3R_DESC_BASE<"hsub_s.d", int_mips_hsub_s_d,
2235                                       MSA128DOpnd, MSA128WOpnd, MSA128WOpnd>;
2236
2237class HSUB_U_H_DESC : MSA_3R_DESC_BASE<"hsub_u.h", int_mips_hsub_u_h,
2238                                       MSA128HOpnd, MSA128BOpnd, MSA128BOpnd>;
2239class HSUB_U_W_DESC : MSA_3R_DESC_BASE<"hsub_u.w", int_mips_hsub_u_w,
2240                                       MSA128WOpnd, MSA128HOpnd, MSA128HOpnd>;
2241class HSUB_U_D_DESC : MSA_3R_DESC_BASE<"hsub_u.d", int_mips_hsub_u_d,
2242                                       MSA128DOpnd, MSA128WOpnd, MSA128WOpnd>;
2243
2244class ILVEV_B_DESC : MSA_3R_DESC_BASE<"ilvev.b", MipsILVEV, MSA128BOpnd>;
2245class ILVEV_H_DESC : MSA_3R_DESC_BASE<"ilvev.h", MipsILVEV, MSA128HOpnd>;
2246class ILVEV_W_DESC : MSA_3R_DESC_BASE<"ilvev.w", MipsILVEV, MSA128WOpnd>;
2247class ILVEV_D_DESC : MSA_3R_DESC_BASE<"ilvev.d", MipsILVEV, MSA128DOpnd>;
2248
2249class ILVL_B_DESC : MSA_3R_DESC_BASE<"ilvl.b", MipsILVL, MSA128BOpnd>;
2250class ILVL_H_DESC : MSA_3R_DESC_BASE<"ilvl.h", MipsILVL, MSA128HOpnd>;
2251class ILVL_W_DESC : MSA_3R_DESC_BASE<"ilvl.w", MipsILVL, MSA128WOpnd>;
2252class ILVL_D_DESC : MSA_3R_DESC_BASE<"ilvl.d", MipsILVL, MSA128DOpnd>;
2253
2254class ILVOD_B_DESC : MSA_3R_DESC_BASE<"ilvod.b", MipsILVOD, MSA128BOpnd>;
2255class ILVOD_H_DESC : MSA_3R_DESC_BASE<"ilvod.h", MipsILVOD, MSA128HOpnd>;
2256class ILVOD_W_DESC : MSA_3R_DESC_BASE<"ilvod.w", MipsILVOD, MSA128WOpnd>;
2257class ILVOD_D_DESC : MSA_3R_DESC_BASE<"ilvod.d", MipsILVOD, MSA128DOpnd>;
2258
2259class ILVR_B_DESC : MSA_3R_DESC_BASE<"ilvr.b", MipsILVR, MSA128BOpnd>;
2260class ILVR_H_DESC : MSA_3R_DESC_BASE<"ilvr.h", MipsILVR, MSA128HOpnd>;
2261class ILVR_W_DESC : MSA_3R_DESC_BASE<"ilvr.w", MipsILVR, MSA128WOpnd>;
2262class ILVR_D_DESC : MSA_3R_DESC_BASE<"ilvr.d", MipsILVR, MSA128DOpnd>;
2263
2264class INSERT_B_DESC : MSA_INSERT_DESC_BASE<"insert.b", vinsert_v16i8, uimm4,
2265                                           immZExt4Ptr, MSA128BOpnd, GPR32Opnd>;
2266class INSERT_H_DESC : MSA_INSERT_DESC_BASE<"insert.h", vinsert_v8i16, uimm3,
2267                                           immZExt3Ptr, MSA128HOpnd, GPR32Opnd>;
2268class INSERT_W_DESC : MSA_INSERT_DESC_BASE<"insert.w", vinsert_v4i32, uimm2,
2269                                           immZExt2Ptr, MSA128WOpnd, GPR32Opnd>;
2270class INSERT_D_DESC : MSA_INSERT_DESC_BASE<"insert.d", vinsert_v2i64, uimm1,
2271                                           immZExt1Ptr, MSA128DOpnd, GPR64Opnd>;
2272
2273class INSERT_B_VIDX_PSEUDO_DESC :
2274    MSA_INSERT_VIDX_PSEUDO_BASE<vector_insert, v16i8, MSA128BOpnd, GPR32Opnd, GPR32Opnd>;
2275class INSERT_H_VIDX_PSEUDO_DESC :
2276    MSA_INSERT_VIDX_PSEUDO_BASE<vector_insert, v8i16, MSA128HOpnd, GPR32Opnd, GPR32Opnd>;
2277class INSERT_W_VIDX_PSEUDO_DESC :
2278    MSA_INSERT_VIDX_PSEUDO_BASE<vector_insert, v4i32, MSA128WOpnd, GPR32Opnd, GPR32Opnd>;
2279class INSERT_D_VIDX_PSEUDO_DESC :
2280    MSA_INSERT_VIDX_PSEUDO_BASE<vector_insert, v2i64, MSA128DOpnd, GPR64Opnd, GPR32Opnd>;
2281
2282class INSERT_FW_PSEUDO_DESC : MSA_INSERT_PSEUDO_BASE<vector_insert, v4f32,
2283                                                     uimm2, immZExt2Ptr,
2284                                                     MSA128WOpnd, FGR32Opnd>;
2285class INSERT_FD_PSEUDO_DESC : MSA_INSERT_PSEUDO_BASE<vector_insert, v2f64,
2286                                                     uimm1, immZExt1Ptr,
2287                                                     MSA128DOpnd, FGR64Opnd>;
2288
2289class INSERT_FW_VIDX_PSEUDO_DESC :
2290    MSA_INSERT_VIDX_PSEUDO_BASE<vector_insert, v4f32, MSA128WOpnd, FGR32Opnd, GPR32Opnd>;
2291class INSERT_FD_VIDX_PSEUDO_DESC :
2292    MSA_INSERT_VIDX_PSEUDO_BASE<vector_insert, v2f64, MSA128DOpnd, FGR64Opnd, GPR32Opnd>;
2293
2294class INSERT_B_VIDX64_PSEUDO_DESC :
2295    MSA_INSERT_VIDX_PSEUDO_BASE<vector_insert, v16i8, MSA128BOpnd, GPR32Opnd, GPR64Opnd>;
2296class INSERT_H_VIDX64_PSEUDO_DESC :
2297    MSA_INSERT_VIDX_PSEUDO_BASE<vector_insert, v8i16, MSA128HOpnd, GPR32Opnd, GPR64Opnd>;
2298class INSERT_W_VIDX64_PSEUDO_DESC :
2299    MSA_INSERT_VIDX_PSEUDO_BASE<vector_insert, v4i32, MSA128WOpnd, GPR32Opnd, GPR64Opnd>;
2300class INSERT_D_VIDX64_PSEUDO_DESC :
2301    MSA_INSERT_VIDX_PSEUDO_BASE<vector_insert, v2i64, MSA128DOpnd, GPR64Opnd, GPR64Opnd>;
2302
2303class INSERT_FW_VIDX64_PSEUDO_DESC :
2304    MSA_INSERT_VIDX_PSEUDO_BASE<vector_insert, v4f32, MSA128WOpnd, FGR32Opnd, GPR64Opnd>;
2305class INSERT_FD_VIDX64_PSEUDO_DESC :
2306    MSA_INSERT_VIDX_PSEUDO_BASE<vector_insert, v2f64, MSA128DOpnd, FGR64Opnd, GPR64Opnd>;
2307
2308class INSVE_B_DESC : MSA_INSVE_DESC_BASE<"insve.b", insve_v16i8, uimm4, timmZExt4,
2309                                         MSA128BOpnd>;
2310class INSVE_H_DESC : MSA_INSVE_DESC_BASE<"insve.h", insve_v8i16, uimm3, timmZExt3,
2311                                         MSA128HOpnd>;
2312class INSVE_W_DESC : MSA_INSVE_DESC_BASE<"insve.w", insve_v4i32, uimm2, timmZExt2,
2313                                         MSA128WOpnd>;
2314class INSVE_D_DESC : MSA_INSVE_DESC_BASE<"insve.d", insve_v2i64, uimm1, timmZExt1,
2315                                         MSA128DOpnd>;
2316
2317class LD_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
2318                   ValueType TyNode, RegisterOperand ROWD,
2319                   Operand MemOpnd, ComplexPattern Addr = addrimm10,
2320                   InstrItinClass itin = NoItinerary> {
2321  dag OutOperandList = (outs ROWD:$wd);
2322  dag InOperandList = (ins MemOpnd:$addr);
2323  string AsmString = !strconcat(instr_asm, "\t$wd, $addr");
2324  list<dag> Pattern = [(set ROWD:$wd, (TyNode (OpNode Addr:$addr)))];
2325  InstrItinClass Itinerary = itin;
2326  string DecoderMethod = "DecodeMSA128Mem";
2327}
2328
2329class LD_B_DESC : LD_DESC_BASE<"ld.b", load, v16i8, MSA128BOpnd, mem_simm10>;
2330class LD_H_DESC : LD_DESC_BASE<"ld.h", load, v8i16, MSA128HOpnd,
2331                               mem_simm10_lsl1, addrimm10lsl1>;
2332class LD_W_DESC : LD_DESC_BASE<"ld.w", load, v4i32, MSA128WOpnd,
2333                               mem_simm10_lsl2, addrimm10lsl2>;
2334class LD_D_DESC : LD_DESC_BASE<"ld.d", load, v2i64, MSA128DOpnd,
2335                               mem_simm10_lsl3, addrimm10lsl3>;
2336
2337class LDI_B_DESC : MSA_I10_LDI_DESC_BASE<"ldi.b", MSA128BOpnd>;
2338class LDI_H_DESC : MSA_I10_LDI_DESC_BASE<"ldi.h", MSA128HOpnd>;
2339class LDI_W_DESC : MSA_I10_LDI_DESC_BASE<"ldi.w", MSA128WOpnd>;
2340class LDI_D_DESC : MSA_I10_LDI_DESC_BASE<"ldi.d", MSA128DOpnd>;
2341
2342class MSA_LOAD_PSEUDO_BASE<SDPatternOperator intrinsic, RegisterOperand RO> :
2343  PseudoSE<(outs RO:$dst), (ins PtrRC:$ptr, GPR32:$imm),
2344           [(set RO:$dst, (intrinsic iPTR:$ptr, GPR32:$imm))]> {
2345  let hasNoSchedulingInfo = 1;
2346  let usesCustomInserter = 1;
2347}
2348
2349def LDR_D : MSA_LOAD_PSEUDO_BASE<int_mips_ldr_d, MSA128DOpnd>;
2350def LDR_W : MSA_LOAD_PSEUDO_BASE<int_mips_ldr_w, MSA128WOpnd>;
2351
2352class LSA_DESC_BASE<string instr_asm, RegisterOperand RORD,
2353                    InstrItinClass itin = NoItinerary> {
2354  dag OutOperandList = (outs RORD:$rd);
2355  dag InOperandList = (ins RORD:$rs, RORD:$rt, uimm2_plus1:$sa);
2356  string AsmString = !strconcat(instr_asm, "\t$rd, $rs, $rt, $sa");
2357  list<dag> Pattern = [(set RORD:$rd, (add RORD:$rt,
2358                                                (shl RORD:$rs,
2359                                                     immZExt2Lsa:$sa)))];
2360  InstrItinClass Itinerary = itin;
2361}
2362
2363class LSA_DESC : LSA_DESC_BASE<"lsa", GPR32Opnd, II_LSA>;
2364class DLSA_DESC : LSA_DESC_BASE<"dlsa", GPR64Opnd, II_DLSA>;
2365
2366class MADD_Q_H_DESC : MSA_3RF_4RF_DESC_BASE<"madd_q.h", int_mips_madd_q_h,
2367                                            MSA128HOpnd>;
2368class MADD_Q_W_DESC : MSA_3RF_4RF_DESC_BASE<"madd_q.w", int_mips_madd_q_w,
2369                                            MSA128WOpnd>;
2370
2371class MADDR_Q_H_DESC : MSA_3RF_4RF_DESC_BASE<"maddr_q.h", int_mips_maddr_q_h,
2372                                             MSA128HOpnd>;
2373class MADDR_Q_W_DESC : MSA_3RF_4RF_DESC_BASE<"maddr_q.w", int_mips_maddr_q_w,
2374                                             MSA128WOpnd>;
2375
2376class MADDV_B_DESC : MSA_3R_4R_DESC_BASE<"maddv.b", muladd, MSA128BOpnd>;
2377class MADDV_H_DESC : MSA_3R_4R_DESC_BASE<"maddv.h", muladd, MSA128HOpnd>;
2378class MADDV_W_DESC : MSA_3R_4R_DESC_BASE<"maddv.w", muladd, MSA128WOpnd>;
2379class MADDV_D_DESC : MSA_3R_4R_DESC_BASE<"maddv.d", muladd, MSA128DOpnd>;
2380
2381class MAX_A_B_DESC : MSA_3R_DESC_BASE<"max_a.b", int_mips_max_a_b, MSA128BOpnd>;
2382class MAX_A_H_DESC : MSA_3R_DESC_BASE<"max_a.h", int_mips_max_a_h, MSA128HOpnd>;
2383class MAX_A_W_DESC : MSA_3R_DESC_BASE<"max_a.w", int_mips_max_a_w, MSA128WOpnd>;
2384class MAX_A_D_DESC : MSA_3R_DESC_BASE<"max_a.d", int_mips_max_a_d, MSA128DOpnd>;
2385
2386class MAX_S_B_DESC : MSA_3R_DESC_BASE<"max_s.b", smax, MSA128BOpnd>;
2387class MAX_S_H_DESC : MSA_3R_DESC_BASE<"max_s.h", smax, MSA128HOpnd>;
2388class MAX_S_W_DESC : MSA_3R_DESC_BASE<"max_s.w", smax, MSA128WOpnd>;
2389class MAX_S_D_DESC : MSA_3R_DESC_BASE<"max_s.d", smax, MSA128DOpnd>;
2390
2391class MAX_U_B_DESC : MSA_3R_DESC_BASE<"max_u.b", umax, MSA128BOpnd>;
2392class MAX_U_H_DESC : MSA_3R_DESC_BASE<"max_u.h", umax, MSA128HOpnd>;
2393class MAX_U_W_DESC : MSA_3R_DESC_BASE<"max_u.w", umax, MSA128WOpnd>;
2394class MAX_U_D_DESC : MSA_3R_DESC_BASE<"max_u.d", umax, MSA128DOpnd>;
2395
2396class MAXI_S_B_DESC : MSA_I5_DESC_BASE<"maxi_s.b", smax, vsplati8_simm5,
2397                                       MSA128BOpnd>;
2398class MAXI_S_H_DESC : MSA_I5_DESC_BASE<"maxi_s.h", smax, vsplati16_simm5,
2399                                       MSA128HOpnd>;
2400class MAXI_S_W_DESC : MSA_I5_DESC_BASE<"maxi_s.w", smax, vsplati32_simm5,
2401                                       MSA128WOpnd>;
2402class MAXI_S_D_DESC : MSA_I5_DESC_BASE<"maxi_s.d", smax, vsplati64_simm5,
2403                                       MSA128DOpnd>;
2404
2405class MAXI_U_B_DESC : MSA_I5_DESC_BASE<"maxi_u.b", umax, vsplati8_uimm5,
2406                                       MSA128BOpnd>;
2407class MAXI_U_H_DESC : MSA_I5_DESC_BASE<"maxi_u.h", umax, vsplati16_uimm5,
2408                                       MSA128HOpnd>;
2409class MAXI_U_W_DESC : MSA_I5_DESC_BASE<"maxi_u.w", umax, vsplati32_uimm5,
2410                                       MSA128WOpnd>;
2411class MAXI_U_D_DESC : MSA_I5_DESC_BASE<"maxi_u.d", umax, vsplati64_uimm5,
2412                                       MSA128DOpnd>;
2413
2414class MIN_A_B_DESC : MSA_3R_DESC_BASE<"min_a.b", int_mips_min_a_b, MSA128BOpnd>;
2415class MIN_A_H_DESC : MSA_3R_DESC_BASE<"min_a.h", int_mips_min_a_h, MSA128HOpnd>;
2416class MIN_A_W_DESC : MSA_3R_DESC_BASE<"min_a.w", int_mips_min_a_w, MSA128WOpnd>;
2417class MIN_A_D_DESC : MSA_3R_DESC_BASE<"min_a.d", int_mips_min_a_d, MSA128DOpnd>;
2418
2419class MIN_S_B_DESC : MSA_3R_DESC_BASE<"min_s.b", smin, MSA128BOpnd>;
2420class MIN_S_H_DESC : MSA_3R_DESC_BASE<"min_s.h", smin, MSA128HOpnd>;
2421class MIN_S_W_DESC : MSA_3R_DESC_BASE<"min_s.w", smin, MSA128WOpnd>;
2422class MIN_S_D_DESC : MSA_3R_DESC_BASE<"min_s.d", smin, MSA128DOpnd>;
2423
2424class MIN_U_B_DESC : MSA_3R_DESC_BASE<"min_u.b", umin, MSA128BOpnd>;
2425class MIN_U_H_DESC : MSA_3R_DESC_BASE<"min_u.h", umin, MSA128HOpnd>;
2426class MIN_U_W_DESC : MSA_3R_DESC_BASE<"min_u.w", umin, MSA128WOpnd>;
2427class MIN_U_D_DESC : MSA_3R_DESC_BASE<"min_u.d", umin, MSA128DOpnd>;
2428
2429class MINI_S_B_DESC : MSA_I5_DESC_BASE<"mini_s.b", smin, vsplati8_simm5,
2430                                       MSA128BOpnd>;
2431class MINI_S_H_DESC : MSA_I5_DESC_BASE<"mini_s.h", smin, vsplati16_simm5,
2432                                       MSA128HOpnd>;
2433class MINI_S_W_DESC : MSA_I5_DESC_BASE<"mini_s.w", smin, vsplati32_simm5,
2434                                       MSA128WOpnd>;
2435class MINI_S_D_DESC : MSA_I5_DESC_BASE<"mini_s.d", smin, vsplati64_simm5,
2436                                       MSA128DOpnd>;
2437
2438class MINI_U_B_DESC : MSA_I5_DESC_BASE<"mini_u.b", umin, vsplati8_uimm5,
2439                                       MSA128BOpnd>;
2440class MINI_U_H_DESC : MSA_I5_DESC_BASE<"mini_u.h", umin, vsplati16_uimm5,
2441                                       MSA128HOpnd>;
2442class MINI_U_W_DESC : MSA_I5_DESC_BASE<"mini_u.w", umin, vsplati32_uimm5,
2443                                       MSA128WOpnd>;
2444class MINI_U_D_DESC : MSA_I5_DESC_BASE<"mini_u.d", umin, vsplati64_uimm5,
2445                                       MSA128DOpnd>;
2446
2447class MOD_S_B_DESC : MSA_3R_DESC_BASE<"mod_s.b", srem, MSA128BOpnd>;
2448class MOD_S_H_DESC : MSA_3R_DESC_BASE<"mod_s.h", srem, MSA128HOpnd>;
2449class MOD_S_W_DESC : MSA_3R_DESC_BASE<"mod_s.w", srem, MSA128WOpnd>;
2450class MOD_S_D_DESC : MSA_3R_DESC_BASE<"mod_s.d", srem, MSA128DOpnd>;
2451
2452class MOD_U_B_DESC : MSA_3R_DESC_BASE<"mod_u.b", urem, MSA128BOpnd>;
2453class MOD_U_H_DESC : MSA_3R_DESC_BASE<"mod_u.h", urem, MSA128HOpnd>;
2454class MOD_U_W_DESC : MSA_3R_DESC_BASE<"mod_u.w", urem, MSA128WOpnd>;
2455class MOD_U_D_DESC : MSA_3R_DESC_BASE<"mod_u.d", urem, MSA128DOpnd>;
2456
2457class MOVE_V_DESC {
2458  dag OutOperandList = (outs MSA128BOpnd:$wd);
2459  dag InOperandList = (ins MSA128BOpnd:$ws);
2460  string AsmString = "move.v\t$wd, $ws";
2461  list<dag> Pattern = [];
2462  InstrItinClass Itinerary = NoItinerary;
2463  bit isMoveReg = 1;
2464}
2465
2466class MSUB_Q_H_DESC : MSA_3RF_4RF_DESC_BASE<"msub_q.h", int_mips_msub_q_h,
2467                                            MSA128HOpnd>;
2468class MSUB_Q_W_DESC : MSA_3RF_4RF_DESC_BASE<"msub_q.w", int_mips_msub_q_w,
2469                                            MSA128WOpnd>;
2470
2471class MSUBR_Q_H_DESC : MSA_3RF_4RF_DESC_BASE<"msubr_q.h", int_mips_msubr_q_h,
2472                                             MSA128HOpnd>;
2473class MSUBR_Q_W_DESC : MSA_3RF_4RF_DESC_BASE<"msubr_q.w", int_mips_msubr_q_w,
2474                                             MSA128WOpnd>;
2475
2476class MSUBV_B_DESC : MSA_3R_4R_DESC_BASE<"msubv.b", mulsub, MSA128BOpnd>;
2477class MSUBV_H_DESC : MSA_3R_4R_DESC_BASE<"msubv.h", mulsub, MSA128HOpnd>;
2478class MSUBV_W_DESC : MSA_3R_4R_DESC_BASE<"msubv.w", mulsub, MSA128WOpnd>;
2479class MSUBV_D_DESC : MSA_3R_4R_DESC_BASE<"msubv.d", mulsub, MSA128DOpnd>;
2480
2481class MUL_Q_H_DESC : MSA_3RF_DESC_BASE<"mul_q.h", int_mips_mul_q_h,
2482                                       MSA128HOpnd>;
2483class MUL_Q_W_DESC : MSA_3RF_DESC_BASE<"mul_q.w", int_mips_mul_q_w,
2484                                       MSA128WOpnd>;
2485
2486class MULR_Q_H_DESC : MSA_3RF_DESC_BASE<"mulr_q.h", int_mips_mulr_q_h,
2487                                        MSA128HOpnd>;
2488class MULR_Q_W_DESC : MSA_3RF_DESC_BASE<"mulr_q.w", int_mips_mulr_q_w,
2489                                        MSA128WOpnd>;
2490
2491class MULV_B_DESC : MSA_3R_DESC_BASE<"mulv.b", mul, MSA128BOpnd>;
2492class MULV_H_DESC : MSA_3R_DESC_BASE<"mulv.h", mul, MSA128HOpnd>;
2493class MULV_W_DESC : MSA_3R_DESC_BASE<"mulv.w", mul, MSA128WOpnd>;
2494class MULV_D_DESC : MSA_3R_DESC_BASE<"mulv.d", mul, MSA128DOpnd>;
2495
2496class NLOC_B_DESC : MSA_2R_DESC_BASE<"nloc.b", int_mips_nloc_b, MSA128BOpnd>;
2497class NLOC_H_DESC : MSA_2R_DESC_BASE<"nloc.h", int_mips_nloc_h, MSA128HOpnd>;
2498class NLOC_W_DESC : MSA_2R_DESC_BASE<"nloc.w", int_mips_nloc_w, MSA128WOpnd>;
2499class NLOC_D_DESC : MSA_2R_DESC_BASE<"nloc.d", int_mips_nloc_d, MSA128DOpnd>;
2500
2501class NLZC_B_DESC : MSA_2R_DESC_BASE<"nlzc.b", ctlz, MSA128BOpnd>;
2502class NLZC_H_DESC : MSA_2R_DESC_BASE<"nlzc.h", ctlz, MSA128HOpnd>;
2503class NLZC_W_DESC : MSA_2R_DESC_BASE<"nlzc.w", ctlz, MSA128WOpnd>;
2504class NLZC_D_DESC : MSA_2R_DESC_BASE<"nlzc.d", ctlz, MSA128DOpnd>;
2505
2506class NOR_V_DESC : MSA_VEC_DESC_BASE<"nor.v", MipsVNOR, MSA128BOpnd>;
2507class NOR_V_H_PSEUDO_DESC : MSA_VEC_PSEUDO_BASE<MipsVNOR, MSA128HOpnd>;
2508class NOR_V_W_PSEUDO_DESC : MSA_VEC_PSEUDO_BASE<MipsVNOR, MSA128WOpnd>;
2509class NOR_V_D_PSEUDO_DESC : MSA_VEC_PSEUDO_BASE<MipsVNOR, MSA128DOpnd>;
2510
2511class NORI_B_DESC : MSA_I8_DESC_BASE<"nori.b", MipsVNOR, vsplati8_uimm8,
2512                                     MSA128BOpnd>;
2513
2514class OR_V_DESC : MSA_VEC_DESC_BASE<"or.v", or, MSA128BOpnd>;
2515class OR_V_H_PSEUDO_DESC : MSA_VEC_PSEUDO_BASE<or, MSA128HOpnd>;
2516class OR_V_W_PSEUDO_DESC : MSA_VEC_PSEUDO_BASE<or, MSA128WOpnd>;
2517class OR_V_D_PSEUDO_DESC : MSA_VEC_PSEUDO_BASE<or, MSA128DOpnd>;
2518
2519class ORI_B_DESC : MSA_I8_DESC_BASE<"ori.b", or, vsplati8_uimm8, MSA128BOpnd>;
2520
2521class PCKEV_B_DESC : MSA_3R_DESC_BASE<"pckev.b", MipsPCKEV, MSA128BOpnd>;
2522class PCKEV_H_DESC : MSA_3R_DESC_BASE<"pckev.h", MipsPCKEV, MSA128HOpnd>;
2523class PCKEV_W_DESC : MSA_3R_DESC_BASE<"pckev.w", MipsPCKEV, MSA128WOpnd>;
2524class PCKEV_D_DESC : MSA_3R_DESC_BASE<"pckev.d", MipsPCKEV, MSA128DOpnd>;
2525
2526class PCKOD_B_DESC : MSA_3R_DESC_BASE<"pckod.b", MipsPCKOD, MSA128BOpnd>;
2527class PCKOD_H_DESC : MSA_3R_DESC_BASE<"pckod.h", MipsPCKOD, MSA128HOpnd>;
2528class PCKOD_W_DESC : MSA_3R_DESC_BASE<"pckod.w", MipsPCKOD, MSA128WOpnd>;
2529class PCKOD_D_DESC : MSA_3R_DESC_BASE<"pckod.d", MipsPCKOD, MSA128DOpnd>;
2530
2531class PCNT_B_DESC : MSA_2R_DESC_BASE<"pcnt.b", ctpop, MSA128BOpnd>;
2532class PCNT_H_DESC : MSA_2R_DESC_BASE<"pcnt.h", ctpop, MSA128HOpnd>;
2533class PCNT_W_DESC : MSA_2R_DESC_BASE<"pcnt.w", ctpop, MSA128WOpnd>;
2534class PCNT_D_DESC : MSA_2R_DESC_BASE<"pcnt.d", ctpop, MSA128DOpnd>;
2535
2536class SAT_S_B_DESC : MSA_BIT_X_DESC_BASE<"sat_s.b", int_mips_sat_s_b, uimm3,
2537                                         timmZExt3, MSA128BOpnd>;
2538class SAT_S_H_DESC : MSA_BIT_X_DESC_BASE<"sat_s.h", int_mips_sat_s_h, uimm4,
2539                                         timmZExt4, MSA128HOpnd>;
2540class SAT_S_W_DESC : MSA_BIT_X_DESC_BASE<"sat_s.w", int_mips_sat_s_w, uimm5,
2541                                         timmZExt5, MSA128WOpnd>;
2542class SAT_S_D_DESC : MSA_BIT_X_DESC_BASE<"sat_s.d", int_mips_sat_s_d, uimm6,
2543                                         timmZExt6, MSA128DOpnd>;
2544
2545class SAT_U_B_DESC : MSA_BIT_X_DESC_BASE<"sat_u.b", int_mips_sat_u_b, uimm3,
2546                                         timmZExt3, MSA128BOpnd>;
2547class SAT_U_H_DESC : MSA_BIT_X_DESC_BASE<"sat_u.h", int_mips_sat_u_h, uimm4,
2548                                         timmZExt4, MSA128HOpnd>;
2549class SAT_U_W_DESC : MSA_BIT_X_DESC_BASE<"sat_u.w", int_mips_sat_u_w, uimm5,
2550                                         timmZExt5, MSA128WOpnd>;
2551class SAT_U_D_DESC : MSA_BIT_X_DESC_BASE<"sat_u.d", int_mips_sat_u_d, uimm6,
2552                                         timmZExt6, MSA128DOpnd>;
2553
2554class SHF_B_DESC : MSA_I8_SHF_DESC_BASE<"shf.b", MSA128BOpnd>;
2555class SHF_H_DESC : MSA_I8_SHF_DESC_BASE<"shf.h", MSA128HOpnd>;
2556class SHF_W_DESC : MSA_I8_SHF_DESC_BASE<"shf.w", MSA128WOpnd>;
2557
2558class SLD_B_DESC : MSA_3R_SLD_DESC_BASE<"sld.b", int_mips_sld_b, MSA128BOpnd>;
2559class SLD_H_DESC : MSA_3R_SLD_DESC_BASE<"sld.h", int_mips_sld_h, MSA128HOpnd>;
2560class SLD_W_DESC : MSA_3R_SLD_DESC_BASE<"sld.w", int_mips_sld_w, MSA128WOpnd>;
2561class SLD_D_DESC : MSA_3R_SLD_DESC_BASE<"sld.d", int_mips_sld_d, MSA128DOpnd>;
2562
2563class SLDI_B_DESC : MSA_ELM_SLD_DESC_BASE<"sldi.b", int_mips_sldi_b,
2564                                          MSA128BOpnd, MSA128BOpnd, uimm4,
2565                                          timmZExt4>;
2566class SLDI_H_DESC : MSA_ELM_SLD_DESC_BASE<"sldi.h", int_mips_sldi_h,
2567                                          MSA128HOpnd, MSA128HOpnd, uimm3,
2568                                          timmZExt3>;
2569class SLDI_W_DESC : MSA_ELM_SLD_DESC_BASE<"sldi.w", int_mips_sldi_w,
2570                                          MSA128WOpnd, MSA128WOpnd, uimm2,
2571                                          timmZExt2>;
2572class SLDI_D_DESC : MSA_ELM_SLD_DESC_BASE<"sldi.d", int_mips_sldi_d,
2573                                          MSA128DOpnd, MSA128DOpnd, uimm1,
2574                                          timmZExt1>;
2575
2576class SLL_B_DESC : MSA_3R_DESC_BASE<"sll.b", shl, MSA128BOpnd>;
2577class SLL_H_DESC : MSA_3R_DESC_BASE<"sll.h", shl, MSA128HOpnd>;
2578class SLL_W_DESC : MSA_3R_DESC_BASE<"sll.w", shl, MSA128WOpnd>;
2579class SLL_D_DESC : MSA_3R_DESC_BASE<"sll.d", shl, MSA128DOpnd>;
2580
2581class SLLI_B_DESC : MSA_BIT_SPLAT_DESC_BASE<"slli.b", shl, vsplati8_uimm3,
2582                                            MSA128BOpnd>;
2583class SLLI_H_DESC : MSA_BIT_SPLAT_DESC_BASE<"slli.h", shl, vsplati16_uimm4,
2584                                            MSA128HOpnd>;
2585class SLLI_W_DESC : MSA_BIT_SPLAT_DESC_BASE<"slli.w", shl, vsplati32_uimm5,
2586                                            MSA128WOpnd>;
2587class SLLI_D_DESC : MSA_BIT_SPLAT_DESC_BASE<"slli.d", shl, vsplati64_uimm6,
2588                                            MSA128DOpnd>;
2589
2590class SPLAT_B_DESC : MSA_3R_SPLAT_DESC_BASE<"splat.b", vsplati8_elt,
2591                                            MSA128BOpnd>;
2592class SPLAT_H_DESC : MSA_3R_SPLAT_DESC_BASE<"splat.h", vsplati16_elt,
2593                                            MSA128HOpnd>;
2594class SPLAT_W_DESC : MSA_3R_SPLAT_DESC_BASE<"splat.w", vsplati32_elt,
2595                                            MSA128WOpnd>;
2596class SPLAT_D_DESC : MSA_3R_SPLAT_DESC_BASE<"splat.d", vsplati64_elt,
2597                                            MSA128DOpnd>;
2598
2599class SPLATI_B_DESC : MSA_ELM_SPLAT_DESC_BASE<"splati.b", vsplati8_uimm4,
2600                                              MSA128BOpnd>;
2601class SPLATI_H_DESC : MSA_ELM_SPLAT_DESC_BASE<"splati.h", vsplati16_uimm3,
2602                                              MSA128HOpnd>;
2603class SPLATI_W_DESC : MSA_ELM_SPLAT_DESC_BASE<"splati.w", vsplati32_uimm2,
2604                                              MSA128WOpnd>;
2605class SPLATI_D_DESC : MSA_ELM_SPLAT_DESC_BASE<"splati.d", vsplati64_uimm1,
2606                                              MSA128DOpnd>;
2607
2608class SRA_B_DESC : MSA_3R_DESC_BASE<"sra.b", sra, MSA128BOpnd>;
2609class SRA_H_DESC : MSA_3R_DESC_BASE<"sra.h", sra, MSA128HOpnd>;
2610class SRA_W_DESC : MSA_3R_DESC_BASE<"sra.w", sra, MSA128WOpnd>;
2611class SRA_D_DESC : MSA_3R_DESC_BASE<"sra.d", sra, MSA128DOpnd>;
2612
2613class SRAI_B_DESC : MSA_BIT_SPLAT_DESC_BASE<"srai.b", sra, vsplati8_uimm3,
2614                                            MSA128BOpnd>;
2615class SRAI_H_DESC : MSA_BIT_SPLAT_DESC_BASE<"srai.h", sra, vsplati16_uimm4,
2616                                            MSA128HOpnd>;
2617class SRAI_W_DESC : MSA_BIT_SPLAT_DESC_BASE<"srai.w", sra, vsplati32_uimm5,
2618                                            MSA128WOpnd>;
2619class SRAI_D_DESC : MSA_BIT_SPLAT_DESC_BASE<"srai.d", sra, vsplati64_uimm6,
2620                                            MSA128DOpnd>;
2621
2622class SRAR_B_DESC : MSA_3R_DESC_BASE<"srar.b", int_mips_srar_b, MSA128BOpnd>;
2623class SRAR_H_DESC : MSA_3R_DESC_BASE<"srar.h", int_mips_srar_h, MSA128HOpnd>;
2624class SRAR_W_DESC : MSA_3R_DESC_BASE<"srar.w", int_mips_srar_w, MSA128WOpnd>;
2625class SRAR_D_DESC : MSA_3R_DESC_BASE<"srar.d", int_mips_srar_d, MSA128DOpnd>;
2626
2627class SRARI_B_DESC : MSA_BIT_X_DESC_BASE<"srari.b", int_mips_srari_b, uimm3,
2628                                         timmZExt3, MSA128BOpnd>;
2629class SRARI_H_DESC : MSA_BIT_X_DESC_BASE<"srari.h", int_mips_srari_h, uimm4,
2630                                         timmZExt4, MSA128HOpnd>;
2631class SRARI_W_DESC : MSA_BIT_X_DESC_BASE<"srari.w", int_mips_srari_w, uimm5,
2632                                         timmZExt5, MSA128WOpnd>;
2633class SRARI_D_DESC : MSA_BIT_X_DESC_BASE<"srari.d", int_mips_srari_d, uimm6,
2634                                         timmZExt6, MSA128DOpnd>;
2635
2636class SRL_B_DESC : MSA_3R_DESC_BASE<"srl.b", srl, MSA128BOpnd>;
2637class SRL_H_DESC : MSA_3R_DESC_BASE<"srl.h", srl, MSA128HOpnd>;
2638class SRL_W_DESC : MSA_3R_DESC_BASE<"srl.w", srl, MSA128WOpnd>;
2639class SRL_D_DESC : MSA_3R_DESC_BASE<"srl.d", srl, MSA128DOpnd>;
2640
2641class SRLI_B_DESC : MSA_BIT_SPLAT_DESC_BASE<"srli.b", srl, vsplati8_uimm3,
2642                                            MSA128BOpnd>;
2643class SRLI_H_DESC : MSA_BIT_SPLAT_DESC_BASE<"srli.h", srl, vsplati16_uimm4,
2644                                            MSA128HOpnd>;
2645class SRLI_W_DESC : MSA_BIT_SPLAT_DESC_BASE<"srli.w", srl, vsplati32_uimm5,
2646                                            MSA128WOpnd>;
2647class SRLI_D_DESC : MSA_BIT_SPLAT_DESC_BASE<"srli.d", srl, vsplati64_uimm6,
2648                                            MSA128DOpnd>;
2649
2650class SRLR_B_DESC : MSA_3R_DESC_BASE<"srlr.b", int_mips_srlr_b, MSA128BOpnd>;
2651class SRLR_H_DESC : MSA_3R_DESC_BASE<"srlr.h", int_mips_srlr_h, MSA128HOpnd>;
2652class SRLR_W_DESC : MSA_3R_DESC_BASE<"srlr.w", int_mips_srlr_w, MSA128WOpnd>;
2653class SRLR_D_DESC : MSA_3R_DESC_BASE<"srlr.d", int_mips_srlr_d, MSA128DOpnd>;
2654
2655class SRLRI_B_DESC : MSA_BIT_X_DESC_BASE<"srlri.b", int_mips_srlri_b, uimm3,
2656                                         timmZExt3, MSA128BOpnd>;
2657class SRLRI_H_DESC : MSA_BIT_X_DESC_BASE<"srlri.h", int_mips_srlri_h, uimm4,
2658                                         timmZExt4, MSA128HOpnd>;
2659class SRLRI_W_DESC : MSA_BIT_X_DESC_BASE<"srlri.w", int_mips_srlri_w, uimm5,
2660                                         timmZExt5, MSA128WOpnd>;
2661class SRLRI_D_DESC : MSA_BIT_X_DESC_BASE<"srlri.d", int_mips_srlri_d, uimm6,
2662                                         timmZExt6, MSA128DOpnd>;
2663
2664class ST_DESC_BASE<string instr_asm, SDPatternOperator OpNode,
2665                   ValueType TyNode, RegisterOperand ROWD,
2666                   Operand MemOpnd, ComplexPattern Addr = addrimm10,
2667                   InstrItinClass itin = NoItinerary> {
2668  dag OutOperandList = (outs);
2669  dag InOperandList = (ins ROWD:$wd, MemOpnd:$addr);
2670  string AsmString = !strconcat(instr_asm, "\t$wd, $addr");
2671  list<dag> Pattern = [(OpNode (TyNode ROWD:$wd), Addr:$addr)];
2672  InstrItinClass Itinerary = itin;
2673  string DecoderMethod = "DecodeMSA128Mem";
2674}
2675
2676class ST_B_DESC : ST_DESC_BASE<"st.b", store, v16i8, MSA128BOpnd, mem_simm10>;
2677class ST_H_DESC : ST_DESC_BASE<"st.h", store, v8i16, MSA128HOpnd,
2678                               mem_simm10_lsl1, addrimm10lsl1>;
2679class ST_W_DESC : ST_DESC_BASE<"st.w", store, v4i32, MSA128WOpnd,
2680                               mem_simm10_lsl2, addrimm10lsl2>;
2681class ST_D_DESC : ST_DESC_BASE<"st.d", store, v2i64, MSA128DOpnd,
2682                               mem_simm10_lsl3, addrimm10lsl3>;
2683
2684class MSA_STORE_PSEUDO_BASE<SDPatternOperator intrinsic, RegisterOperand RO> :
2685  PseudoSE<(outs), (ins RO:$dst, PtrRC:$ptr, GPR32:$imm),
2686           [(intrinsic RO:$dst, iPTR:$ptr, GPR32:$imm)]> {
2687  let hasNoSchedulingInfo = 1;
2688  let usesCustomInserter = 1;
2689}
2690
2691def STR_D : MSA_STORE_PSEUDO_BASE<int_mips_str_d, MSA128DOpnd>;
2692def STR_W : MSA_STORE_PSEUDO_BASE<int_mips_str_w, MSA128WOpnd>;
2693
2694class SUBS_S_B_DESC : MSA_3R_DESC_BASE<"subs_s.b", int_mips_subs_s_b,
2695                                       MSA128BOpnd>;
2696class SUBS_S_H_DESC : MSA_3R_DESC_BASE<"subs_s.h", int_mips_subs_s_h,
2697                                       MSA128HOpnd>;
2698class SUBS_S_W_DESC : MSA_3R_DESC_BASE<"subs_s.w", int_mips_subs_s_w,
2699                                       MSA128WOpnd>;
2700class SUBS_S_D_DESC : MSA_3R_DESC_BASE<"subs_s.d", int_mips_subs_s_d,
2701                                       MSA128DOpnd>;
2702
2703class SUBS_U_B_DESC : MSA_3R_DESC_BASE<"subs_u.b", int_mips_subs_u_b,
2704                                       MSA128BOpnd>;
2705class SUBS_U_H_DESC : MSA_3R_DESC_BASE<"subs_u.h", int_mips_subs_u_h,
2706                                       MSA128HOpnd>;
2707class SUBS_U_W_DESC : MSA_3R_DESC_BASE<"subs_u.w", int_mips_subs_u_w,
2708                                       MSA128WOpnd>;
2709class SUBS_U_D_DESC : MSA_3R_DESC_BASE<"subs_u.d", int_mips_subs_u_d,
2710                                       MSA128DOpnd>;
2711
2712class SUBSUS_U_B_DESC : MSA_3R_DESC_BASE<"subsus_u.b", int_mips_subsus_u_b,
2713                                         MSA128BOpnd>;
2714class SUBSUS_U_H_DESC : MSA_3R_DESC_BASE<"subsus_u.h", int_mips_subsus_u_h,
2715                                         MSA128HOpnd>;
2716class SUBSUS_U_W_DESC : MSA_3R_DESC_BASE<"subsus_u.w", int_mips_subsus_u_w,
2717                                         MSA128WOpnd>;
2718class SUBSUS_U_D_DESC : MSA_3R_DESC_BASE<"subsus_u.d", int_mips_subsus_u_d,
2719                                         MSA128DOpnd>;
2720
2721class SUBSUU_S_B_DESC : MSA_3R_DESC_BASE<"subsuu_s.b", int_mips_subsuu_s_b,
2722                                         MSA128BOpnd>;
2723class SUBSUU_S_H_DESC : MSA_3R_DESC_BASE<"subsuu_s.h", int_mips_subsuu_s_h,
2724                                         MSA128HOpnd>;
2725class SUBSUU_S_W_DESC : MSA_3R_DESC_BASE<"subsuu_s.w", int_mips_subsuu_s_w,
2726                                         MSA128WOpnd>;
2727class SUBSUU_S_D_DESC : MSA_3R_DESC_BASE<"subsuu_s.d", int_mips_subsuu_s_d,
2728                                         MSA128DOpnd>;
2729
2730class SUBV_B_DESC : MSA_3R_DESC_BASE<"subv.b", sub, MSA128BOpnd>;
2731class SUBV_H_DESC : MSA_3R_DESC_BASE<"subv.h", sub, MSA128HOpnd>;
2732class SUBV_W_DESC : MSA_3R_DESC_BASE<"subv.w", sub, MSA128WOpnd>;
2733class SUBV_D_DESC : MSA_3R_DESC_BASE<"subv.d", sub, MSA128DOpnd>;
2734
2735class SUBVI_B_DESC : MSA_I5_DESC_BASE<"subvi.b", sub, vsplati8_uimm5,
2736                                      MSA128BOpnd>;
2737class SUBVI_H_DESC : MSA_I5_DESC_BASE<"subvi.h", sub, vsplati16_uimm5,
2738                                      MSA128HOpnd>;
2739class SUBVI_W_DESC : MSA_I5_DESC_BASE<"subvi.w", sub, vsplati32_uimm5,
2740                                      MSA128WOpnd>;
2741class SUBVI_D_DESC : MSA_I5_DESC_BASE<"subvi.d", sub, vsplati64_uimm5,
2742                                      MSA128DOpnd>;
2743
2744class VSHF_B_DESC : MSA_3R_VSHF_DESC_BASE<"vshf.b", MSA128BOpnd>;
2745class VSHF_H_DESC : MSA_3R_VSHF_DESC_BASE<"vshf.h", MSA128HOpnd>;
2746class VSHF_W_DESC : MSA_3R_VSHF_DESC_BASE<"vshf.w", MSA128WOpnd>;
2747class VSHF_D_DESC : MSA_3R_VSHF_DESC_BASE<"vshf.d", MSA128DOpnd>;
2748
2749class XOR_V_DESC : MSA_VEC_DESC_BASE<"xor.v", xor, MSA128BOpnd>;
2750class XOR_V_H_PSEUDO_DESC : MSA_VEC_PSEUDO_BASE<xor, MSA128HOpnd>;
2751class XOR_V_W_PSEUDO_DESC : MSA_VEC_PSEUDO_BASE<xor, MSA128WOpnd>;
2752class XOR_V_D_PSEUDO_DESC : MSA_VEC_PSEUDO_BASE<xor, MSA128DOpnd>;
2753
2754class XORI_B_DESC : MSA_I8_DESC_BASE<"xori.b", xor, vsplati8_uimm8,
2755                                     MSA128BOpnd>;
2756
2757// Instruction defs.
2758def ADD_A_B : ADD_A_B_ENC, ADD_A_B_DESC;
2759def ADD_A_H : ADD_A_H_ENC, ADD_A_H_DESC;
2760def ADD_A_W : ADD_A_W_ENC, ADD_A_W_DESC;
2761def ADD_A_D : ADD_A_D_ENC, ADD_A_D_DESC;
2762
2763def ADDS_A_B : ADDS_A_B_ENC, ADDS_A_B_DESC;
2764def ADDS_A_H : ADDS_A_H_ENC, ADDS_A_H_DESC;
2765def ADDS_A_W : ADDS_A_W_ENC, ADDS_A_W_DESC;
2766def ADDS_A_D : ADDS_A_D_ENC, ADDS_A_D_DESC;
2767
2768def ADDS_S_B : ADDS_S_B_ENC, ADDS_S_B_DESC;
2769def ADDS_S_H : ADDS_S_H_ENC, ADDS_S_H_DESC;
2770def ADDS_S_W : ADDS_S_W_ENC, ADDS_S_W_DESC;
2771def ADDS_S_D : ADDS_S_D_ENC, ADDS_S_D_DESC;
2772
2773def ADDS_U_B : ADDS_U_B_ENC, ADDS_U_B_DESC;
2774def ADDS_U_H : ADDS_U_H_ENC, ADDS_U_H_DESC;
2775def ADDS_U_W : ADDS_U_W_ENC, ADDS_U_W_DESC;
2776def ADDS_U_D : ADDS_U_D_ENC, ADDS_U_D_DESC;
2777
2778def ADDV_B : ADDV_B_ENC, ADDV_B_DESC;
2779def ADDV_H : ADDV_H_ENC, ADDV_H_DESC;
2780def ADDV_W : ADDV_W_ENC, ADDV_W_DESC;
2781def ADDV_D : ADDV_D_ENC, ADDV_D_DESC;
2782
2783def ADDVI_B : ADDVI_B_ENC, ADDVI_B_DESC;
2784def ADDVI_H : ADDVI_H_ENC, ADDVI_H_DESC;
2785def ADDVI_W : ADDVI_W_ENC, ADDVI_W_DESC;
2786def ADDVI_D : ADDVI_D_ENC, ADDVI_D_DESC;
2787
2788def AND_V : AND_V_ENC, AND_V_DESC;
2789def AND_V_H_PSEUDO : AND_V_H_PSEUDO_DESC,
2790                     PseudoInstExpansion<(AND_V MSA128BOpnd:$wd,
2791                                                MSA128BOpnd:$ws,
2792                                                MSA128BOpnd:$wt)>;
2793def AND_V_W_PSEUDO : AND_V_W_PSEUDO_DESC,
2794                     PseudoInstExpansion<(AND_V MSA128BOpnd:$wd,
2795                                                MSA128BOpnd:$ws,
2796                                                MSA128BOpnd:$wt)>;
2797def AND_V_D_PSEUDO : AND_V_D_PSEUDO_DESC,
2798                     PseudoInstExpansion<(AND_V MSA128BOpnd:$wd,
2799                                                MSA128BOpnd:$ws,
2800                                                MSA128BOpnd:$wt)>;
2801
2802def ANDI_B : ANDI_B_ENC, ANDI_B_DESC;
2803
2804def ASUB_S_B : ASUB_S_B_ENC, ASUB_S_B_DESC;
2805def ASUB_S_H : ASUB_S_H_ENC, ASUB_S_H_DESC;
2806def ASUB_S_W : ASUB_S_W_ENC, ASUB_S_W_DESC;
2807def ASUB_S_D : ASUB_S_D_ENC, ASUB_S_D_DESC;
2808
2809def ASUB_U_B : ASUB_U_B_ENC, ASUB_U_B_DESC;
2810def ASUB_U_H : ASUB_U_H_ENC, ASUB_U_H_DESC;
2811def ASUB_U_W : ASUB_U_W_ENC, ASUB_U_W_DESC;
2812def ASUB_U_D : ASUB_U_D_ENC, ASUB_U_D_DESC;
2813
2814def AVE_S_B : AVE_S_B_ENC, AVE_S_B_DESC;
2815def AVE_S_H : AVE_S_H_ENC, AVE_S_H_DESC;
2816def AVE_S_W : AVE_S_W_ENC, AVE_S_W_DESC;
2817def AVE_S_D : AVE_S_D_ENC, AVE_S_D_DESC;
2818
2819def AVE_U_B : AVE_U_B_ENC, AVE_U_B_DESC;
2820def AVE_U_H : AVE_U_H_ENC, AVE_U_H_DESC;
2821def AVE_U_W : AVE_U_W_ENC, AVE_U_W_DESC;
2822def AVE_U_D : AVE_U_D_ENC, AVE_U_D_DESC;
2823
2824def AVER_S_B : AVER_S_B_ENC, AVER_S_B_DESC;
2825def AVER_S_H : AVER_S_H_ENC, AVER_S_H_DESC;
2826def AVER_S_W : AVER_S_W_ENC, AVER_S_W_DESC;
2827def AVER_S_D : AVER_S_D_ENC, AVER_S_D_DESC;
2828
2829def AVER_U_B : AVER_U_B_ENC, AVER_U_B_DESC;
2830def AVER_U_H : AVER_U_H_ENC, AVER_U_H_DESC;
2831def AVER_U_W : AVER_U_W_ENC, AVER_U_W_DESC;
2832def AVER_U_D : AVER_U_D_ENC, AVER_U_D_DESC;
2833
2834def BCLR_B : BCLR_B_ENC, BCLR_B_DESC;
2835def BCLR_H : BCLR_H_ENC, BCLR_H_DESC;
2836def BCLR_W : BCLR_W_ENC, BCLR_W_DESC;
2837def BCLR_D : BCLR_D_ENC, BCLR_D_DESC;
2838
2839def BCLRI_B : BCLRI_B_ENC, BCLRI_B_DESC;
2840def BCLRI_H : BCLRI_H_ENC, BCLRI_H_DESC;
2841def BCLRI_W : BCLRI_W_ENC, BCLRI_W_DESC;
2842def BCLRI_D : BCLRI_D_ENC, BCLRI_D_DESC;
2843
2844def BINSL_B : BINSL_B_ENC, BINSL_B_DESC;
2845def BINSL_H : BINSL_H_ENC, BINSL_H_DESC;
2846def BINSL_W : BINSL_W_ENC, BINSL_W_DESC;
2847def BINSL_D : BINSL_D_ENC, BINSL_D_DESC;
2848
2849def BINSLI_B : BINSLI_B_ENC, BINSLI_B_DESC;
2850def BINSLI_H : BINSLI_H_ENC, BINSLI_H_DESC;
2851def BINSLI_W : BINSLI_W_ENC, BINSLI_W_DESC;
2852def BINSLI_D : BINSLI_D_ENC, BINSLI_D_DESC;
2853
2854def BINSR_B : BINSR_B_ENC, BINSR_B_DESC;
2855def BINSR_H : BINSR_H_ENC, BINSR_H_DESC;
2856def BINSR_W : BINSR_W_ENC, BINSR_W_DESC;
2857def BINSR_D : BINSR_D_ENC, BINSR_D_DESC;
2858
2859def BINSRI_B : BINSRI_B_ENC, BINSRI_B_DESC;
2860def BINSRI_H : BINSRI_H_ENC, BINSRI_H_DESC;
2861def BINSRI_W : BINSRI_W_ENC, BINSRI_W_DESC;
2862def BINSRI_D : BINSRI_D_ENC, BINSRI_D_DESC;
2863
2864def BMNZ_V : BMNZ_V_ENC, BMNZ_V_DESC;
2865
2866def BMNZI_B : BMNZI_B_ENC, BMNZI_B_DESC;
2867
2868def BMZ_V : BMZ_V_ENC, BMZ_V_DESC;
2869
2870def BMZI_B : BMZI_B_ENC, BMZI_B_DESC;
2871
2872def BNEG_B : BNEG_B_ENC, BNEG_B_DESC;
2873def BNEG_H : BNEG_H_ENC, BNEG_H_DESC;
2874def BNEG_W : BNEG_W_ENC, BNEG_W_DESC;
2875def BNEG_D : BNEG_D_ENC, BNEG_D_DESC;
2876
2877def BNEGI_B : BNEGI_B_ENC, BNEGI_B_DESC;
2878def BNEGI_H : BNEGI_H_ENC, BNEGI_H_DESC;
2879def BNEGI_W : BNEGI_W_ENC, BNEGI_W_DESC;
2880def BNEGI_D : BNEGI_D_ENC, BNEGI_D_DESC;
2881
2882def BNZ_B : BNZ_B_ENC, BNZ_B_DESC;
2883def BNZ_H : BNZ_H_ENC, BNZ_H_DESC;
2884def BNZ_W : BNZ_W_ENC, BNZ_W_DESC;
2885def BNZ_D : BNZ_D_ENC, BNZ_D_DESC;
2886
2887def BNZ_V : BNZ_V_ENC, BNZ_V_DESC;
2888
2889def BSEL_V : BSEL_V_ENC, BSEL_V_DESC;
2890
2891class MSA_BSEL_PSEUDO_BASE<RegisterOperand RO, ValueType Ty> :
2892  MSAPseudo<(outs RO:$wd), (ins RO:$wd_in, RO:$ws, RO:$wt),
2893            [(set RO:$wd, (Ty (vselect RO:$wd_in, RO:$wt, RO:$ws)))]>,
2894  // Note that vselect and BSEL_V treat the condition operand the opposite way
2895  // from each other.
2896  //   (vselect cond, if_set, if_clear)
2897  //   (BSEL_V cond, if_clear, if_set)
2898  PseudoInstExpansion<(BSEL_V MSA128BOpnd:$wd, MSA128BOpnd:$wd_in,
2899                              MSA128BOpnd:$ws, MSA128BOpnd:$wt)> {
2900  let Constraints = "$wd_in = $wd";
2901}
2902
2903def BSEL_H_PSEUDO : MSA_BSEL_PSEUDO_BASE<MSA128HOpnd, v8i16>;
2904def BSEL_W_PSEUDO : MSA_BSEL_PSEUDO_BASE<MSA128WOpnd, v4i32>;
2905def BSEL_D_PSEUDO : MSA_BSEL_PSEUDO_BASE<MSA128DOpnd, v2i64>;
2906def BSEL_FW_PSEUDO : MSA_BSEL_PSEUDO_BASE<MSA128WOpnd, v4f32>;
2907def BSEL_FD_PSEUDO : MSA_BSEL_PSEUDO_BASE<MSA128DOpnd, v2f64>;
2908
2909def BSELI_B : BSELI_B_ENC, BSELI_B_DESC;
2910
2911def BSET_B : BSET_B_ENC, BSET_B_DESC;
2912def BSET_H : BSET_H_ENC, BSET_H_DESC;
2913def BSET_W : BSET_W_ENC, BSET_W_DESC;
2914def BSET_D : BSET_D_ENC, BSET_D_DESC;
2915
2916def BSETI_B : BSETI_B_ENC, BSETI_B_DESC;
2917def BSETI_H : BSETI_H_ENC, BSETI_H_DESC;
2918def BSETI_W : BSETI_W_ENC, BSETI_W_DESC;
2919def BSETI_D : BSETI_D_ENC, BSETI_D_DESC;
2920
2921def BZ_B : BZ_B_ENC, BZ_B_DESC;
2922def BZ_H : BZ_H_ENC, BZ_H_DESC;
2923def BZ_W : BZ_W_ENC, BZ_W_DESC;
2924def BZ_D : BZ_D_ENC, BZ_D_DESC;
2925
2926def BZ_V : BZ_V_ENC, BZ_V_DESC;
2927
2928def CEQ_B : CEQ_B_ENC, CEQ_B_DESC;
2929def CEQ_H : CEQ_H_ENC, CEQ_H_DESC;
2930def CEQ_W : CEQ_W_ENC, CEQ_W_DESC;
2931def CEQ_D : CEQ_D_ENC, CEQ_D_DESC;
2932
2933def CEQI_B : CEQI_B_ENC, CEQI_B_DESC;
2934def CEQI_H : CEQI_H_ENC, CEQI_H_DESC;
2935def CEQI_W : CEQI_W_ENC, CEQI_W_DESC;
2936def CEQI_D : CEQI_D_ENC, CEQI_D_DESC;
2937
2938def CFCMSA : CFCMSA_ENC, CFCMSA_DESC;
2939
2940def CLE_S_B : CLE_S_B_ENC, CLE_S_B_DESC;
2941def CLE_S_H : CLE_S_H_ENC, CLE_S_H_DESC;
2942def CLE_S_W : CLE_S_W_ENC, CLE_S_W_DESC;
2943def CLE_S_D : CLE_S_D_ENC, CLE_S_D_DESC;
2944
2945def CLE_U_B : CLE_U_B_ENC, CLE_U_B_DESC;
2946def CLE_U_H : CLE_U_H_ENC, CLE_U_H_DESC;
2947def CLE_U_W : CLE_U_W_ENC, CLE_U_W_DESC;
2948def CLE_U_D : CLE_U_D_ENC, CLE_U_D_DESC;
2949
2950def CLEI_S_B : CLEI_S_B_ENC, CLEI_S_B_DESC;
2951def CLEI_S_H : CLEI_S_H_ENC, CLEI_S_H_DESC;
2952def CLEI_S_W : CLEI_S_W_ENC, CLEI_S_W_DESC;
2953def CLEI_S_D : CLEI_S_D_ENC, CLEI_S_D_DESC;
2954
2955def CLEI_U_B : CLEI_U_B_ENC, CLEI_U_B_DESC;
2956def CLEI_U_H : CLEI_U_H_ENC, CLEI_U_H_DESC;
2957def CLEI_U_W : CLEI_U_W_ENC, CLEI_U_W_DESC;
2958def CLEI_U_D : CLEI_U_D_ENC, CLEI_U_D_DESC;
2959
2960def CLT_S_B : CLT_S_B_ENC, CLT_S_B_DESC;
2961def CLT_S_H : CLT_S_H_ENC, CLT_S_H_DESC;
2962def CLT_S_W : CLT_S_W_ENC, CLT_S_W_DESC;
2963def CLT_S_D : CLT_S_D_ENC, CLT_S_D_DESC;
2964
2965def CLT_U_B : CLT_U_B_ENC, CLT_U_B_DESC;
2966def CLT_U_H : CLT_U_H_ENC, CLT_U_H_DESC;
2967def CLT_U_W : CLT_U_W_ENC, CLT_U_W_DESC;
2968def CLT_U_D : CLT_U_D_ENC, CLT_U_D_DESC;
2969
2970def CLTI_S_B : CLTI_S_B_ENC, CLTI_S_B_DESC;
2971def CLTI_S_H : CLTI_S_H_ENC, CLTI_S_H_DESC;
2972def CLTI_S_W : CLTI_S_W_ENC, CLTI_S_W_DESC;
2973def CLTI_S_D : CLTI_S_D_ENC, CLTI_S_D_DESC;
2974
2975def CLTI_U_B : CLTI_U_B_ENC, CLTI_U_B_DESC;
2976def CLTI_U_H : CLTI_U_H_ENC, CLTI_U_H_DESC;
2977def CLTI_U_W : CLTI_U_W_ENC, CLTI_U_W_DESC;
2978def CLTI_U_D : CLTI_U_D_ENC, CLTI_U_D_DESC;
2979
2980def COPY_S_B : COPY_S_B_ENC, COPY_S_B_DESC;
2981def COPY_S_H : COPY_S_H_ENC, COPY_S_H_DESC;
2982def COPY_S_W : COPY_S_W_ENC, COPY_S_W_DESC;
2983def COPY_S_D : COPY_S_D_ENC, COPY_S_D_DESC, ASE_MSA64;
2984
2985def COPY_U_B : COPY_U_B_ENC, COPY_U_B_DESC;
2986def COPY_U_H : COPY_U_H_ENC, COPY_U_H_DESC;
2987def COPY_U_W : COPY_U_W_ENC, COPY_U_W_DESC, ASE_MSA64;
2988
2989def COPY_FW_PSEUDO : COPY_FW_PSEUDO_DESC;
2990def COPY_FD_PSEUDO : COPY_FD_PSEUDO_DESC;
2991
2992def CTCMSA : CTCMSA_ENC, CTCMSA_DESC;
2993
2994def DIV_S_B : DIV_S_B_ENC, DIV_S_B_DESC;
2995def DIV_S_H : DIV_S_H_ENC, DIV_S_H_DESC;
2996def DIV_S_W : DIV_S_W_ENC, DIV_S_W_DESC;
2997def DIV_S_D : DIV_S_D_ENC, DIV_S_D_DESC;
2998
2999def DIV_U_B : DIV_U_B_ENC, DIV_U_B_DESC;
3000def DIV_U_H : DIV_U_H_ENC, DIV_U_H_DESC;
3001def DIV_U_W : DIV_U_W_ENC, DIV_U_W_DESC;
3002def DIV_U_D : DIV_U_D_ENC, DIV_U_D_DESC;
3003
3004def DOTP_S_H : DOTP_S_H_ENC, DOTP_S_H_DESC;
3005def DOTP_S_W : DOTP_S_W_ENC, DOTP_S_W_DESC;
3006def DOTP_S_D : DOTP_S_D_ENC, DOTP_S_D_DESC;
3007
3008def DOTP_U_H : DOTP_U_H_ENC, DOTP_U_H_DESC;
3009def DOTP_U_W : DOTP_U_W_ENC, DOTP_U_W_DESC;
3010def DOTP_U_D : DOTP_U_D_ENC, DOTP_U_D_DESC;
3011
3012def DPADD_S_H : DPADD_S_H_ENC, DPADD_S_H_DESC;
3013def DPADD_S_W : DPADD_S_W_ENC, DPADD_S_W_DESC;
3014def DPADD_S_D : DPADD_S_D_ENC, DPADD_S_D_DESC;
3015
3016def DPADD_U_H : DPADD_U_H_ENC, DPADD_U_H_DESC;
3017def DPADD_U_W : DPADD_U_W_ENC, DPADD_U_W_DESC;
3018def DPADD_U_D : DPADD_U_D_ENC, DPADD_U_D_DESC;
3019
3020def DPSUB_S_H : DPSUB_S_H_ENC, DPSUB_S_H_DESC;
3021def DPSUB_S_W : DPSUB_S_W_ENC, DPSUB_S_W_DESC;
3022def DPSUB_S_D : DPSUB_S_D_ENC, DPSUB_S_D_DESC;
3023
3024def DPSUB_U_H : DPSUB_U_H_ENC, DPSUB_U_H_DESC;
3025def DPSUB_U_W : DPSUB_U_W_ENC, DPSUB_U_W_DESC;
3026def DPSUB_U_D : DPSUB_U_D_ENC, DPSUB_U_D_DESC;
3027
3028def FADD_W : FADD_W_ENC, FADD_W_DESC;
3029def FADD_D : FADD_D_ENC, FADD_D_DESC;
3030
3031def FCAF_W : FCAF_W_ENC, FCAF_W_DESC;
3032def FCAF_D : FCAF_D_ENC, FCAF_D_DESC;
3033
3034def FCEQ_W : FCEQ_W_ENC, FCEQ_W_DESC;
3035def FCEQ_D : FCEQ_D_ENC, FCEQ_D_DESC;
3036
3037def FCLE_W : FCLE_W_ENC, FCLE_W_DESC;
3038def FCLE_D : FCLE_D_ENC, FCLE_D_DESC;
3039
3040def FCLT_W : FCLT_W_ENC, FCLT_W_DESC;
3041def FCLT_D : FCLT_D_ENC, FCLT_D_DESC;
3042
3043def FCLASS_W : FCLASS_W_ENC, FCLASS_W_DESC;
3044def FCLASS_D : FCLASS_D_ENC, FCLASS_D_DESC;
3045
3046def FCNE_W : FCNE_W_ENC, FCNE_W_DESC;
3047def FCNE_D : FCNE_D_ENC, FCNE_D_DESC;
3048
3049def FCOR_W : FCOR_W_ENC, FCOR_W_DESC;
3050def FCOR_D : FCOR_D_ENC, FCOR_D_DESC;
3051
3052def FCUEQ_W : FCUEQ_W_ENC, FCUEQ_W_DESC;
3053def FCUEQ_D : FCUEQ_D_ENC, FCUEQ_D_DESC;
3054
3055def FCULE_W : FCULE_W_ENC, FCULE_W_DESC;
3056def FCULE_D : FCULE_D_ENC, FCULE_D_DESC;
3057
3058def FCULT_W : FCULT_W_ENC, FCULT_W_DESC;
3059def FCULT_D : FCULT_D_ENC, FCULT_D_DESC;
3060
3061def FCUN_W : FCUN_W_ENC, FCUN_W_DESC;
3062def FCUN_D : FCUN_D_ENC, FCUN_D_DESC;
3063
3064def FCUNE_W : FCUNE_W_ENC, FCUNE_W_DESC;
3065def FCUNE_D : FCUNE_D_ENC, FCUNE_D_DESC;
3066
3067def FDIV_W : FDIV_W_ENC, FDIV_W_DESC;
3068def FDIV_D : FDIV_D_ENC, FDIV_D_DESC;
3069
3070def FEXDO_H : FEXDO_H_ENC, FEXDO_H_DESC;
3071def FEXDO_W : FEXDO_W_ENC, FEXDO_W_DESC;
3072
3073def FEXP2_W : FEXP2_W_ENC, FEXP2_W_DESC;
3074def FEXP2_D : FEXP2_D_ENC, FEXP2_D_DESC;
3075def FEXP2_W_1_PSEUDO : FEXP2_W_1_PSEUDO_DESC;
3076def FEXP2_D_1_PSEUDO : FEXP2_D_1_PSEUDO_DESC;
3077
3078def FEXUPL_W : FEXUPL_W_ENC, FEXUPL_W_DESC;
3079def FEXUPL_D : FEXUPL_D_ENC, FEXUPL_D_DESC;
3080
3081def FEXUPR_W : FEXUPR_W_ENC, FEXUPR_W_DESC;
3082def FEXUPR_D : FEXUPR_D_ENC, FEXUPR_D_DESC;
3083
3084def FFINT_S_W : FFINT_S_W_ENC, FFINT_S_W_DESC;
3085def FFINT_S_D : FFINT_S_D_ENC, FFINT_S_D_DESC;
3086
3087def FFINT_U_W : FFINT_U_W_ENC, FFINT_U_W_DESC;
3088def FFINT_U_D : FFINT_U_D_ENC, FFINT_U_D_DESC;
3089
3090def FFQL_W : FFQL_W_ENC, FFQL_W_DESC;
3091def FFQL_D : FFQL_D_ENC, FFQL_D_DESC;
3092
3093def FFQR_W : FFQR_W_ENC, FFQR_W_DESC;
3094def FFQR_D : FFQR_D_ENC, FFQR_D_DESC;
3095
3096def FILL_B : FILL_B_ENC, FILL_B_DESC;
3097def FILL_H : FILL_H_ENC, FILL_H_DESC;
3098def FILL_W : FILL_W_ENC, FILL_W_DESC;
3099def FILL_D : FILL_D_ENC, FILL_D_DESC, ASE_MSA64;
3100def FILL_FW_PSEUDO : FILL_FW_PSEUDO_DESC;
3101def FILL_FD_PSEUDO : FILL_FD_PSEUDO_DESC;
3102
3103def FLOG2_W : FLOG2_W_ENC, FLOG2_W_DESC;
3104def FLOG2_D : FLOG2_D_ENC, FLOG2_D_DESC;
3105
3106def FMADD_W : FMADD_W_ENC, FMADD_W_DESC;
3107def FMADD_D : FMADD_D_ENC, FMADD_D_DESC;
3108
3109def FMAX_W : FMAX_W_ENC, FMAX_W_DESC;
3110def FMAX_D : FMAX_D_ENC, FMAX_D_DESC;
3111
3112def FMAX_A_W : FMAX_A_W_ENC, FMAX_A_W_DESC;
3113def FMAX_A_D : FMAX_A_D_ENC, FMAX_A_D_DESC;
3114
3115def FMIN_W : FMIN_W_ENC, FMIN_W_DESC;
3116def FMIN_D : FMIN_D_ENC, FMIN_D_DESC;
3117
3118def FMIN_A_W : FMIN_A_W_ENC, FMIN_A_W_DESC;
3119def FMIN_A_D : FMIN_A_D_ENC, FMIN_A_D_DESC;
3120
3121def FMSUB_W : FMSUB_W_ENC, FMSUB_W_DESC;
3122def FMSUB_D : FMSUB_D_ENC, FMSUB_D_DESC;
3123
3124def FMUL_W : FMUL_W_ENC, FMUL_W_DESC;
3125def FMUL_D : FMUL_D_ENC, FMUL_D_DESC;
3126
3127def FRINT_W : FRINT_W_ENC, FRINT_W_DESC;
3128def FRINT_D : FRINT_D_ENC, FRINT_D_DESC;
3129
3130def FRCP_W : FRCP_W_ENC, FRCP_W_DESC;
3131def FRCP_D : FRCP_D_ENC, FRCP_D_DESC;
3132
3133def FRSQRT_W : FRSQRT_W_ENC, FRSQRT_W_DESC;
3134def FRSQRT_D : FRSQRT_D_ENC, FRSQRT_D_DESC;
3135
3136def FSAF_W : FSAF_W_ENC, FSAF_W_DESC;
3137def FSAF_D : FSAF_D_ENC, FSAF_D_DESC;
3138
3139def FSEQ_W : FSEQ_W_ENC, FSEQ_W_DESC;
3140def FSEQ_D : FSEQ_D_ENC, FSEQ_D_DESC;
3141
3142def FSLE_W : FSLE_W_ENC, FSLE_W_DESC;
3143def FSLE_D : FSLE_D_ENC, FSLE_D_DESC;
3144
3145def FSLT_W : FSLT_W_ENC, FSLT_W_DESC;
3146def FSLT_D : FSLT_D_ENC, FSLT_D_DESC;
3147
3148def FSNE_W : FSNE_W_ENC, FSNE_W_DESC;
3149def FSNE_D : FSNE_D_ENC, FSNE_D_DESC;
3150
3151def FSOR_W : FSOR_W_ENC, FSOR_W_DESC;
3152def FSOR_D : FSOR_D_ENC, FSOR_D_DESC;
3153
3154def FSQRT_W : FSQRT_W_ENC, FSQRT_W_DESC;
3155def FSQRT_D : FSQRT_D_ENC, FSQRT_D_DESC;
3156
3157def FSUB_W : FSUB_W_ENC, FSUB_W_DESC;
3158def FSUB_D : FSUB_D_ENC, FSUB_D_DESC;
3159
3160def FSUEQ_W : FSUEQ_W_ENC, FSUEQ_W_DESC;
3161def FSUEQ_D : FSUEQ_D_ENC, FSUEQ_D_DESC;
3162
3163def FSULE_W : FSULE_W_ENC, FSULE_W_DESC;
3164def FSULE_D : FSULE_D_ENC, FSULE_D_DESC;
3165
3166def FSULT_W : FSULT_W_ENC, FSULT_W_DESC;
3167def FSULT_D : FSULT_D_ENC, FSULT_D_DESC;
3168
3169def FSUN_W : FSUN_W_ENC, FSUN_W_DESC;
3170def FSUN_D : FSUN_D_ENC, FSUN_D_DESC;
3171
3172def FSUNE_W : FSUNE_W_ENC, FSUNE_W_DESC;
3173def FSUNE_D : FSUNE_D_ENC, FSUNE_D_DESC;
3174
3175def FTINT_S_W : FTINT_S_W_ENC, FTINT_S_W_DESC;
3176def FTINT_S_D : FTINT_S_D_ENC, FTINT_S_D_DESC;
3177
3178def FTINT_U_W : FTINT_U_W_ENC, FTINT_U_W_DESC;
3179def FTINT_U_D : FTINT_U_D_ENC, FTINT_U_D_DESC;
3180
3181def FTQ_H : FTQ_H_ENC, FTQ_H_DESC;
3182def FTQ_W : FTQ_W_ENC, FTQ_W_DESC;
3183
3184def FTRUNC_S_W : FTRUNC_S_W_ENC, FTRUNC_S_W_DESC;
3185def FTRUNC_S_D : FTRUNC_S_D_ENC, FTRUNC_S_D_DESC;
3186
3187def FTRUNC_U_W : FTRUNC_U_W_ENC, FTRUNC_U_W_DESC;
3188def FTRUNC_U_D : FTRUNC_U_D_ENC, FTRUNC_U_D_DESC;
3189
3190def : MipsPat<(fsub MSA128WOpnd:$wd, (fmul MSA128WOpnd:$ws, MSA128WOpnd:$wt)),
3191              (FMSUB_W MSA128WOpnd:$wd, MSA128WOpnd:$ws, MSA128WOpnd:$wt)>,
3192              ISA_MIPS1, ASE_MSA, FPOP_FUSION_FAST;
3193def : MipsPat<(fsub MSA128DOpnd:$wd, (fmul MSA128DOpnd:$ws, MSA128DOpnd:$wt)),
3194              (FMSUB_D MSA128DOpnd:$wd, MSA128DOpnd:$ws, MSA128DOpnd:$wt)>,
3195              ISA_MIPS1, ASE_MSA, FPOP_FUSION_FAST;
3196
3197def : MipsPat<(fadd MSA128WOpnd:$wd, (fmul MSA128WOpnd:$ws, MSA128WOpnd:$wt)),
3198              (FMADD_W MSA128WOpnd:$wd, MSA128WOpnd:$ws, MSA128WOpnd:$wt)>,
3199              ISA_MIPS1, ASE_MSA, FPOP_FUSION_FAST;
3200def : MipsPat<(fadd MSA128DOpnd:$wd, (fmul MSA128DOpnd:$ws, MSA128DOpnd:$wt)),
3201              (FMADD_D MSA128DOpnd:$wd, MSA128DOpnd:$ws, MSA128DOpnd:$wt)>,
3202              ISA_MIPS1, ASE_MSA, FPOP_FUSION_FAST;
3203
3204def HADD_S_H : HADD_S_H_ENC, HADD_S_H_DESC;
3205def HADD_S_W : HADD_S_W_ENC, HADD_S_W_DESC;
3206def HADD_S_D : HADD_S_D_ENC, HADD_S_D_DESC;
3207
3208def HADD_U_H : HADD_U_H_ENC, HADD_U_H_DESC;
3209def HADD_U_W : HADD_U_W_ENC, HADD_U_W_DESC;
3210def HADD_U_D : HADD_U_D_ENC, HADD_U_D_DESC;
3211
3212def HSUB_S_H : HSUB_S_H_ENC, HSUB_S_H_DESC;
3213def HSUB_S_W : HSUB_S_W_ENC, HSUB_S_W_DESC;
3214def HSUB_S_D : HSUB_S_D_ENC, HSUB_S_D_DESC;
3215
3216def HSUB_U_H : HSUB_U_H_ENC, HSUB_U_H_DESC;
3217def HSUB_U_W : HSUB_U_W_ENC, HSUB_U_W_DESC;
3218def HSUB_U_D : HSUB_U_D_ENC, HSUB_U_D_DESC;
3219
3220def ILVEV_B : ILVEV_B_ENC, ILVEV_B_DESC;
3221def ILVEV_H : ILVEV_H_ENC, ILVEV_H_DESC;
3222def ILVEV_W : ILVEV_W_ENC, ILVEV_W_DESC;
3223def ILVEV_D : ILVEV_D_ENC, ILVEV_D_DESC;
3224
3225def ILVL_B : ILVL_B_ENC, ILVL_B_DESC;
3226def ILVL_H : ILVL_H_ENC, ILVL_H_DESC;
3227def ILVL_W : ILVL_W_ENC, ILVL_W_DESC;
3228def ILVL_D : ILVL_D_ENC, ILVL_D_DESC;
3229
3230def ILVOD_B : ILVOD_B_ENC, ILVOD_B_DESC;
3231def ILVOD_H : ILVOD_H_ENC, ILVOD_H_DESC;
3232def ILVOD_W : ILVOD_W_ENC, ILVOD_W_DESC;
3233def ILVOD_D : ILVOD_D_ENC, ILVOD_D_DESC;
3234
3235def ILVR_B : ILVR_B_ENC, ILVR_B_DESC;
3236def ILVR_H : ILVR_H_ENC, ILVR_H_DESC;
3237def ILVR_W : ILVR_W_ENC, ILVR_W_DESC;
3238def ILVR_D : ILVR_D_ENC, ILVR_D_DESC;
3239
3240def INSERT_B : INSERT_B_ENC, INSERT_B_DESC;
3241def INSERT_H : INSERT_H_ENC, INSERT_H_DESC;
3242def INSERT_W : INSERT_W_ENC, INSERT_W_DESC;
3243def INSERT_D : INSERT_D_ENC, INSERT_D_DESC, ASE_MSA64;
3244
3245// INSERT_FW_PSEUDO defined after INSVE_W
3246// INSERT_FD_PSEUDO defined after INSVE_D
3247
3248// There is a fourth operand that is not present in the encoding. Use a
3249// custom decoder to get a chance to add it.
3250let DecoderMethod = "DecodeINSVE_DF" in {
3251  def INSVE_B : INSVE_B_ENC, INSVE_B_DESC;
3252  def INSVE_H : INSVE_H_ENC, INSVE_H_DESC;
3253  def INSVE_W : INSVE_W_ENC, INSVE_W_DESC;
3254  def INSVE_D : INSVE_D_ENC, INSVE_D_DESC;
3255}
3256
3257def INSERT_FW_PSEUDO : INSERT_FW_PSEUDO_DESC;
3258def INSERT_FD_PSEUDO : INSERT_FD_PSEUDO_DESC;
3259
3260def INSERT_B_VIDX_PSEUDO : INSERT_B_VIDX_PSEUDO_DESC;
3261def INSERT_H_VIDX_PSEUDO : INSERT_H_VIDX_PSEUDO_DESC;
3262def INSERT_W_VIDX_PSEUDO : INSERT_W_VIDX_PSEUDO_DESC;
3263def INSERT_D_VIDX_PSEUDO : INSERT_D_VIDX_PSEUDO_DESC;
3264def INSERT_FW_VIDX_PSEUDO : INSERT_FW_VIDX_PSEUDO_DESC;
3265def INSERT_FD_VIDX_PSEUDO : INSERT_FD_VIDX_PSEUDO_DESC;
3266
3267def INSERT_B_VIDX64_PSEUDO : INSERT_B_VIDX64_PSEUDO_DESC;
3268def INSERT_H_VIDX64_PSEUDO : INSERT_H_VIDX64_PSEUDO_DESC;
3269def INSERT_W_VIDX64_PSEUDO : INSERT_W_VIDX64_PSEUDO_DESC;
3270def INSERT_D_VIDX64_PSEUDO : INSERT_D_VIDX64_PSEUDO_DESC;
3271def INSERT_FW_VIDX64_PSEUDO : INSERT_FW_VIDX64_PSEUDO_DESC;
3272def INSERT_FD_VIDX64_PSEUDO : INSERT_FD_VIDX64_PSEUDO_DESC;
3273
3274def LD_B: LD_B_ENC, LD_B_DESC;
3275def LD_H: LD_H_ENC, LD_H_DESC;
3276def LD_W: LD_W_ENC, LD_W_DESC;
3277def LD_D: LD_D_ENC, LD_D_DESC;
3278
3279def LDI_B : LDI_B_ENC, LDI_B_DESC;
3280def LDI_H : LDI_H_ENC, LDI_H_DESC;
3281def LDI_W : LDI_W_ENC, LDI_W_DESC;
3282def LDI_D : LDI_D_ENC, LDI_D_DESC;
3283
3284def LSA : LSA_ENC, LSA_DESC;
3285def DLSA : DLSA_ENC, DLSA_DESC, ASE_MSA64;
3286
3287def MADD_Q_H : MADD_Q_H_ENC, MADD_Q_H_DESC;
3288def MADD_Q_W : MADD_Q_W_ENC, MADD_Q_W_DESC;
3289
3290def MADDR_Q_H : MADDR_Q_H_ENC, MADDR_Q_H_DESC;
3291def MADDR_Q_W : MADDR_Q_W_ENC, MADDR_Q_W_DESC;
3292
3293def MADDV_B : MADDV_B_ENC, MADDV_B_DESC;
3294def MADDV_H : MADDV_H_ENC, MADDV_H_DESC;
3295def MADDV_W : MADDV_W_ENC, MADDV_W_DESC;
3296def MADDV_D : MADDV_D_ENC, MADDV_D_DESC;
3297
3298def MAX_A_B : MAX_A_B_ENC, MAX_A_B_DESC;
3299def MAX_A_H : MAX_A_H_ENC, MAX_A_H_DESC;
3300def MAX_A_W : MAX_A_W_ENC, MAX_A_W_DESC;
3301def MAX_A_D : MAX_A_D_ENC, MAX_A_D_DESC;
3302
3303def MAX_S_B : MAX_S_B_ENC, MAX_S_B_DESC;
3304def MAX_S_H : MAX_S_H_ENC, MAX_S_H_DESC;
3305def MAX_S_W : MAX_S_W_ENC, MAX_S_W_DESC;
3306def MAX_S_D : MAX_S_D_ENC, MAX_S_D_DESC;
3307
3308def MAX_U_B : MAX_U_B_ENC, MAX_U_B_DESC;
3309def MAX_U_H : MAX_U_H_ENC, MAX_U_H_DESC;
3310def MAX_U_W : MAX_U_W_ENC, MAX_U_W_DESC;
3311def MAX_U_D : MAX_U_D_ENC, MAX_U_D_DESC;
3312
3313def MAXI_S_B : MAXI_S_B_ENC, MAXI_S_B_DESC;
3314def MAXI_S_H : MAXI_S_H_ENC, MAXI_S_H_DESC;
3315def MAXI_S_W : MAXI_S_W_ENC, MAXI_S_W_DESC;
3316def MAXI_S_D : MAXI_S_D_ENC, MAXI_S_D_DESC;
3317
3318def MAXI_U_B : MAXI_U_B_ENC, MAXI_U_B_DESC;
3319def MAXI_U_H : MAXI_U_H_ENC, MAXI_U_H_DESC;
3320def MAXI_U_W : MAXI_U_W_ENC, MAXI_U_W_DESC;
3321def MAXI_U_D : MAXI_U_D_ENC, MAXI_U_D_DESC;
3322
3323def MIN_A_B : MIN_A_B_ENC, MIN_A_B_DESC;
3324def MIN_A_H : MIN_A_H_ENC, MIN_A_H_DESC;
3325def MIN_A_W : MIN_A_W_ENC, MIN_A_W_DESC;
3326def MIN_A_D : MIN_A_D_ENC, MIN_A_D_DESC;
3327
3328def MIN_S_B : MIN_S_B_ENC, MIN_S_B_DESC;
3329def MIN_S_H : MIN_S_H_ENC, MIN_S_H_DESC;
3330def MIN_S_W : MIN_S_W_ENC, MIN_S_W_DESC;
3331def MIN_S_D : MIN_S_D_ENC, MIN_S_D_DESC;
3332
3333def MIN_U_B : MIN_U_B_ENC, MIN_U_B_DESC;
3334def MIN_U_H : MIN_U_H_ENC, MIN_U_H_DESC;
3335def MIN_U_W : MIN_U_W_ENC, MIN_U_W_DESC;
3336def MIN_U_D : MIN_U_D_ENC, MIN_U_D_DESC;
3337
3338def MINI_S_B : MINI_S_B_ENC, MINI_S_B_DESC;
3339def MINI_S_H : MINI_S_H_ENC, MINI_S_H_DESC;
3340def MINI_S_W : MINI_S_W_ENC, MINI_S_W_DESC;
3341def MINI_S_D : MINI_S_D_ENC, MINI_S_D_DESC;
3342
3343def MINI_U_B : MINI_U_B_ENC, MINI_U_B_DESC;
3344def MINI_U_H : MINI_U_H_ENC, MINI_U_H_DESC;
3345def MINI_U_W : MINI_U_W_ENC, MINI_U_W_DESC;
3346def MINI_U_D : MINI_U_D_ENC, MINI_U_D_DESC;
3347
3348def MOD_S_B : MOD_S_B_ENC, MOD_S_B_DESC;
3349def MOD_S_H : MOD_S_H_ENC, MOD_S_H_DESC;
3350def MOD_S_W : MOD_S_W_ENC, MOD_S_W_DESC;
3351def MOD_S_D : MOD_S_D_ENC, MOD_S_D_DESC;
3352
3353def MOD_U_B : MOD_U_B_ENC, MOD_U_B_DESC;
3354def MOD_U_H : MOD_U_H_ENC, MOD_U_H_DESC;
3355def MOD_U_W : MOD_U_W_ENC, MOD_U_W_DESC;
3356def MOD_U_D : MOD_U_D_ENC, MOD_U_D_DESC;
3357
3358def MOVE_V : MOVE_V_ENC, MOVE_V_DESC;
3359
3360def MSUB_Q_H : MSUB_Q_H_ENC, MSUB_Q_H_DESC;
3361def MSUB_Q_W : MSUB_Q_W_ENC, MSUB_Q_W_DESC;
3362
3363def MSUBR_Q_H : MSUBR_Q_H_ENC, MSUBR_Q_H_DESC;
3364def MSUBR_Q_W : MSUBR_Q_W_ENC, MSUBR_Q_W_DESC;
3365
3366def MSUBV_B : MSUBV_B_ENC, MSUBV_B_DESC;
3367def MSUBV_H : MSUBV_H_ENC, MSUBV_H_DESC;
3368def MSUBV_W : MSUBV_W_ENC, MSUBV_W_DESC;
3369def MSUBV_D : MSUBV_D_ENC, MSUBV_D_DESC;
3370
3371def MUL_Q_H : MUL_Q_H_ENC, MUL_Q_H_DESC;
3372def MUL_Q_W : MUL_Q_W_ENC, MUL_Q_W_DESC;
3373
3374def MULR_Q_H : MULR_Q_H_ENC, MULR_Q_H_DESC;
3375def MULR_Q_W : MULR_Q_W_ENC, MULR_Q_W_DESC;
3376
3377def MULV_B : MULV_B_ENC, MULV_B_DESC;
3378def MULV_H : MULV_H_ENC, MULV_H_DESC;
3379def MULV_W : MULV_W_ENC, MULV_W_DESC;
3380def MULV_D : MULV_D_ENC, MULV_D_DESC;
3381
3382def NLOC_B : NLOC_B_ENC, NLOC_B_DESC;
3383def NLOC_H : NLOC_H_ENC, NLOC_H_DESC;
3384def NLOC_W : NLOC_W_ENC, NLOC_W_DESC;
3385def NLOC_D : NLOC_D_ENC, NLOC_D_DESC;
3386
3387def NLZC_B : NLZC_B_ENC, NLZC_B_DESC;
3388def NLZC_H : NLZC_H_ENC, NLZC_H_DESC;
3389def NLZC_W : NLZC_W_ENC, NLZC_W_DESC;
3390def NLZC_D : NLZC_D_ENC, NLZC_D_DESC;
3391
3392def NOR_V : NOR_V_ENC, NOR_V_DESC;
3393def NOR_V_H_PSEUDO : NOR_V_H_PSEUDO_DESC,
3394                     PseudoInstExpansion<(NOR_V MSA128BOpnd:$wd,
3395                                                MSA128BOpnd:$ws,
3396                                                MSA128BOpnd:$wt)>;
3397def NOR_V_W_PSEUDO : NOR_V_W_PSEUDO_DESC,
3398                     PseudoInstExpansion<(NOR_V MSA128BOpnd:$wd,
3399                                                MSA128BOpnd:$ws,
3400                                                MSA128BOpnd:$wt)>;
3401def NOR_V_D_PSEUDO : NOR_V_D_PSEUDO_DESC,
3402                     PseudoInstExpansion<(NOR_V MSA128BOpnd:$wd,
3403                                                MSA128BOpnd:$ws,
3404                                                MSA128BOpnd:$wt)>;
3405
3406def NORI_B : NORI_B_ENC, NORI_B_DESC;
3407
3408def OR_V : OR_V_ENC, OR_V_DESC;
3409def OR_V_H_PSEUDO : OR_V_H_PSEUDO_DESC,
3410                    PseudoInstExpansion<(OR_V MSA128BOpnd:$wd,
3411                                              MSA128BOpnd:$ws,
3412                                              MSA128BOpnd:$wt)>;
3413def OR_V_W_PSEUDO : OR_V_W_PSEUDO_DESC,
3414                    PseudoInstExpansion<(OR_V MSA128BOpnd:$wd,
3415                                              MSA128BOpnd:$ws,
3416                                              MSA128BOpnd:$wt)>;
3417def OR_V_D_PSEUDO : OR_V_D_PSEUDO_DESC,
3418                    PseudoInstExpansion<(OR_V MSA128BOpnd:$wd,
3419                                              MSA128BOpnd:$ws,
3420                                              MSA128BOpnd:$wt)>;
3421
3422def ORI_B : ORI_B_ENC, ORI_B_DESC;
3423
3424def PCKEV_B : PCKEV_B_ENC, PCKEV_B_DESC;
3425def PCKEV_H : PCKEV_H_ENC, PCKEV_H_DESC;
3426def PCKEV_W : PCKEV_W_ENC, PCKEV_W_DESC;
3427def PCKEV_D : PCKEV_D_ENC, PCKEV_D_DESC;
3428
3429def PCKOD_B : PCKOD_B_ENC, PCKOD_B_DESC;
3430def PCKOD_H : PCKOD_H_ENC, PCKOD_H_DESC;
3431def PCKOD_W : PCKOD_W_ENC, PCKOD_W_DESC;
3432def PCKOD_D : PCKOD_D_ENC, PCKOD_D_DESC;
3433
3434def PCNT_B : PCNT_B_ENC, PCNT_B_DESC;
3435def PCNT_H : PCNT_H_ENC, PCNT_H_DESC;
3436def PCNT_W : PCNT_W_ENC, PCNT_W_DESC;
3437def PCNT_D : PCNT_D_ENC, PCNT_D_DESC;
3438
3439def SAT_S_B : SAT_S_B_ENC, SAT_S_B_DESC;
3440def SAT_S_H : SAT_S_H_ENC, SAT_S_H_DESC;
3441def SAT_S_W : SAT_S_W_ENC, SAT_S_W_DESC;
3442def SAT_S_D : SAT_S_D_ENC, SAT_S_D_DESC;
3443
3444def SAT_U_B : SAT_U_B_ENC, SAT_U_B_DESC;
3445def SAT_U_H : SAT_U_H_ENC, SAT_U_H_DESC;
3446def SAT_U_W : SAT_U_W_ENC, SAT_U_W_DESC;
3447def SAT_U_D : SAT_U_D_ENC, SAT_U_D_DESC;
3448
3449def SHF_B : SHF_B_ENC, SHF_B_DESC;
3450def SHF_H : SHF_H_ENC, SHF_H_DESC;
3451def SHF_W : SHF_W_ENC, SHF_W_DESC;
3452
3453def SLD_B : SLD_B_ENC, SLD_B_DESC;
3454def SLD_H : SLD_H_ENC, SLD_H_DESC;
3455def SLD_W : SLD_W_ENC, SLD_W_DESC;
3456def SLD_D : SLD_D_ENC, SLD_D_DESC;
3457
3458def SLDI_B : SLDI_B_ENC, SLDI_B_DESC;
3459def SLDI_H : SLDI_H_ENC, SLDI_H_DESC;
3460def SLDI_W : SLDI_W_ENC, SLDI_W_DESC;
3461def SLDI_D : SLDI_D_ENC, SLDI_D_DESC;
3462
3463def SLL_B : SLL_B_ENC, SLL_B_DESC;
3464def SLL_H : SLL_H_ENC, SLL_H_DESC;
3465def SLL_W : SLL_W_ENC, SLL_W_DESC;
3466def SLL_D : SLL_D_ENC, SLL_D_DESC;
3467
3468def SLLI_B : SLLI_B_ENC, SLLI_B_DESC;
3469def SLLI_H : SLLI_H_ENC, SLLI_H_DESC;
3470def SLLI_W : SLLI_W_ENC, SLLI_W_DESC;
3471def SLLI_D : SLLI_D_ENC, SLLI_D_DESC;
3472
3473def SPLAT_B : SPLAT_B_ENC, SPLAT_B_DESC;
3474def SPLAT_H : SPLAT_H_ENC, SPLAT_H_DESC;
3475def SPLAT_W : SPLAT_W_ENC, SPLAT_W_DESC;
3476def SPLAT_D : SPLAT_D_ENC, SPLAT_D_DESC;
3477
3478def SPLATI_B : SPLATI_B_ENC, SPLATI_B_DESC;
3479def SPLATI_H : SPLATI_H_ENC, SPLATI_H_DESC;
3480def SPLATI_W : SPLATI_W_ENC, SPLATI_W_DESC;
3481def SPLATI_D : SPLATI_D_ENC, SPLATI_D_DESC;
3482
3483def SRA_B : SRA_B_ENC, SRA_B_DESC;
3484def SRA_H : SRA_H_ENC, SRA_H_DESC;
3485def SRA_W : SRA_W_ENC, SRA_W_DESC;
3486def SRA_D : SRA_D_ENC, SRA_D_DESC;
3487
3488def SRAI_B : SRAI_B_ENC, SRAI_B_DESC;
3489def SRAI_H : SRAI_H_ENC, SRAI_H_DESC;
3490def SRAI_W : SRAI_W_ENC, SRAI_W_DESC;
3491def SRAI_D : SRAI_D_ENC, SRAI_D_DESC;
3492
3493def SRAR_B : SRAR_B_ENC, SRAR_B_DESC;
3494def SRAR_H : SRAR_H_ENC, SRAR_H_DESC;
3495def SRAR_W : SRAR_W_ENC, SRAR_W_DESC;
3496def SRAR_D : SRAR_D_ENC, SRAR_D_DESC;
3497
3498def SRARI_B : SRARI_B_ENC, SRARI_B_DESC;
3499def SRARI_H : SRARI_H_ENC, SRARI_H_DESC;
3500def SRARI_W : SRARI_W_ENC, SRARI_W_DESC;
3501def SRARI_D : SRARI_D_ENC, SRARI_D_DESC;
3502
3503def SRL_B : SRL_B_ENC, SRL_B_DESC;
3504def SRL_H : SRL_H_ENC, SRL_H_DESC;
3505def SRL_W : SRL_W_ENC, SRL_W_DESC;
3506def SRL_D : SRL_D_ENC, SRL_D_DESC;
3507
3508def SRLI_B : SRLI_B_ENC, SRLI_B_DESC;
3509def SRLI_H : SRLI_H_ENC, SRLI_H_DESC;
3510def SRLI_W : SRLI_W_ENC, SRLI_W_DESC;
3511def SRLI_D : SRLI_D_ENC, SRLI_D_DESC;
3512
3513def SRLR_B : SRLR_B_ENC, SRLR_B_DESC;
3514def SRLR_H : SRLR_H_ENC, SRLR_H_DESC;
3515def SRLR_W : SRLR_W_ENC, SRLR_W_DESC;
3516def SRLR_D : SRLR_D_ENC, SRLR_D_DESC;
3517
3518def SRLRI_B : SRLRI_B_ENC, SRLRI_B_DESC;
3519def SRLRI_H : SRLRI_H_ENC, SRLRI_H_DESC;
3520def SRLRI_W : SRLRI_W_ENC, SRLRI_W_DESC;
3521def SRLRI_D : SRLRI_D_ENC, SRLRI_D_DESC;
3522
3523def ST_B: ST_B_ENC, ST_B_DESC;
3524def ST_H: ST_H_ENC, ST_H_DESC;
3525def ST_W: ST_W_ENC, ST_W_DESC;
3526def ST_D: ST_D_ENC, ST_D_DESC;
3527
3528def SUBS_S_B : SUBS_S_B_ENC, SUBS_S_B_DESC;
3529def SUBS_S_H : SUBS_S_H_ENC, SUBS_S_H_DESC;
3530def SUBS_S_W : SUBS_S_W_ENC, SUBS_S_W_DESC;
3531def SUBS_S_D : SUBS_S_D_ENC, SUBS_S_D_DESC;
3532
3533def SUBS_U_B : SUBS_U_B_ENC, SUBS_U_B_DESC;
3534def SUBS_U_H : SUBS_U_H_ENC, SUBS_U_H_DESC;
3535def SUBS_U_W : SUBS_U_W_ENC, SUBS_U_W_DESC;
3536def SUBS_U_D : SUBS_U_D_ENC, SUBS_U_D_DESC;
3537
3538def SUBSUS_U_B : SUBSUS_U_B_ENC, SUBSUS_U_B_DESC;
3539def SUBSUS_U_H : SUBSUS_U_H_ENC, SUBSUS_U_H_DESC;
3540def SUBSUS_U_W : SUBSUS_U_W_ENC, SUBSUS_U_W_DESC;
3541def SUBSUS_U_D : SUBSUS_U_D_ENC, SUBSUS_U_D_DESC;
3542
3543def SUBSUU_S_B : SUBSUU_S_B_ENC, SUBSUU_S_B_DESC;
3544def SUBSUU_S_H : SUBSUU_S_H_ENC, SUBSUU_S_H_DESC;
3545def SUBSUU_S_W : SUBSUU_S_W_ENC, SUBSUU_S_W_DESC;
3546def SUBSUU_S_D : SUBSUU_S_D_ENC, SUBSUU_S_D_DESC;
3547
3548def SUBV_B : SUBV_B_ENC, SUBV_B_DESC;
3549def SUBV_H : SUBV_H_ENC, SUBV_H_DESC;
3550def SUBV_W : SUBV_W_ENC, SUBV_W_DESC;
3551def SUBV_D : SUBV_D_ENC, SUBV_D_DESC;
3552
3553def SUBVI_B : SUBVI_B_ENC, SUBVI_B_DESC;
3554def SUBVI_H : SUBVI_H_ENC, SUBVI_H_DESC;
3555def SUBVI_W : SUBVI_W_ENC, SUBVI_W_DESC;
3556def SUBVI_D : SUBVI_D_ENC, SUBVI_D_DESC;
3557
3558def VSHF_B : VSHF_B_ENC, VSHF_B_DESC;
3559def VSHF_H : VSHF_H_ENC, VSHF_H_DESC;
3560def VSHF_W : VSHF_W_ENC, VSHF_W_DESC;
3561def VSHF_D : VSHF_D_ENC, VSHF_D_DESC;
3562
3563def XOR_V : XOR_V_ENC, XOR_V_DESC;
3564def XOR_V_H_PSEUDO : XOR_V_H_PSEUDO_DESC,
3565                     PseudoInstExpansion<(XOR_V MSA128BOpnd:$wd,
3566                                                MSA128BOpnd:$ws,
3567                                                MSA128BOpnd:$wt)>;
3568def XOR_V_W_PSEUDO : XOR_V_W_PSEUDO_DESC,
3569                     PseudoInstExpansion<(XOR_V MSA128BOpnd:$wd,
3570                                                MSA128BOpnd:$ws,
3571                                                MSA128BOpnd:$wt)>;
3572def XOR_V_D_PSEUDO : XOR_V_D_PSEUDO_DESC,
3573                     PseudoInstExpansion<(XOR_V MSA128BOpnd:$wd,
3574                                                MSA128BOpnd:$ws,
3575                                                MSA128BOpnd:$wt)>;
3576
3577def XORI_B : XORI_B_ENC, XORI_B_DESC;
3578
3579// Patterns.
3580class MSAPat<dag pattern, dag result, list<Predicate> pred = [HasMSA]> :
3581  Pat<pattern, result>, Requires<pred>;
3582
3583def : MSAPat<(extractelt (v4i32 MSA128W:$ws), immZExt4:$idx),
3584             (COPY_S_W MSA128W:$ws, immZExt4:$idx)>;
3585
3586def : MSAPat<(v8f16 (load addrimm10lsl1:$addr)), (LD_H addrimm10lsl1:$addr)>;
3587def : MSAPat<(v4f32 (load addrimm10lsl2:$addr)), (LD_W addrimm10lsl2:$addr)>;
3588def : MSAPat<(v2f64 (load addrimm10lsl3:$addr)), (LD_D addrimm10lsl3:$addr)>;
3589
3590def ST_FH : MSAPat<(store (v8f16 MSA128H:$ws), addrimm10lsl1:$addr),
3591                   (ST_H MSA128H:$ws, addrimm10lsl1:$addr)>;
3592def ST_FW : MSAPat<(store (v4f32 MSA128W:$ws), addrimm10lsl2:$addr),
3593                   (ST_W MSA128W:$ws, addrimm10lsl2:$addr)>;
3594def ST_FD : MSAPat<(store (v2f64 MSA128D:$ws), addrimm10lsl3:$addr),
3595                   (ST_D MSA128D:$ws, addrimm10lsl3:$addr)>;
3596
3597class MSA_FABS_PSEUDO_DESC_BASE<RegisterOperand ROWD,
3598                                RegisterOperand ROWS = ROWD,
3599                                InstrItinClass itin = NoItinerary> :
3600  MSAPseudo<(outs ROWD:$wd),
3601            (ins ROWS:$ws),
3602            [(set ROWD:$wd, (fabs ROWS:$ws))]> {
3603  InstrItinClass Itinerary = itin;
3604}
3605def FABS_W : MSA_FABS_PSEUDO_DESC_BASE<MSA128WOpnd>,
3606             PseudoInstExpansion<(FMAX_A_W MSA128WOpnd:$wd, MSA128WOpnd:$ws,
3607                                           MSA128WOpnd:$ws)>;
3608def FABS_D : MSA_FABS_PSEUDO_DESC_BASE<MSA128DOpnd>,
3609             PseudoInstExpansion<(FMAX_A_D MSA128DOpnd:$wd, MSA128DOpnd:$ws,
3610                                           MSA128DOpnd:$ws)>;
3611
3612class MSABitconvertPat<ValueType DstVT, ValueType SrcVT,
3613                       RegisterClass DstRC, list<Predicate> preds = [HasMSA]> :
3614   MSAPat<(DstVT (bitconvert SrcVT:$src)),
3615          (COPY_TO_REGCLASS SrcVT:$src, DstRC), preds>;
3616
3617// These are endian-independent because the element size doesnt change
3618def : MSABitconvertPat<v8i16, v8f16, MSA128H>;
3619def : MSABitconvertPat<v4i32, v4f32, MSA128W>;
3620def : MSABitconvertPat<v2i64, v2f64, MSA128D>;
3621def : MSABitconvertPat<v8f16, v8i16, MSA128H>;
3622def : MSABitconvertPat<v4f32, v4i32, MSA128W>;
3623def : MSABitconvertPat<v2f64, v2i64, MSA128D>;
3624
3625// Little endian bitcasts are always no-ops
3626def : MSABitconvertPat<v16i8, v8i16, MSA128B, [HasMSA, IsLE]>;
3627def : MSABitconvertPat<v16i8, v4i32, MSA128B, [HasMSA, IsLE]>;
3628def : MSABitconvertPat<v16i8, v2i64, MSA128B, [HasMSA, IsLE]>;
3629def : MSABitconvertPat<v16i8, v8f16, MSA128B, [HasMSA, IsLE]>;
3630def : MSABitconvertPat<v16i8, v4f32, MSA128B, [HasMSA, IsLE]>;
3631def : MSABitconvertPat<v16i8, v2f64, MSA128B, [HasMSA, IsLE]>;
3632
3633def : MSABitconvertPat<v8i16, v16i8, MSA128H, [HasMSA, IsLE]>;
3634def : MSABitconvertPat<v8i16, v4i32, MSA128H, [HasMSA, IsLE]>;
3635def : MSABitconvertPat<v8i16, v2i64, MSA128H, [HasMSA, IsLE]>;
3636def : MSABitconvertPat<v8i16, v4f32, MSA128H, [HasMSA, IsLE]>;
3637def : MSABitconvertPat<v8i16, v2f64, MSA128H, [HasMSA, IsLE]>;
3638
3639def : MSABitconvertPat<v4i32, v16i8, MSA128W, [HasMSA, IsLE]>;
3640def : MSABitconvertPat<v4i32, v8i16, MSA128W, [HasMSA, IsLE]>;
3641def : MSABitconvertPat<v4i32, v2i64, MSA128W, [HasMSA, IsLE]>;
3642def : MSABitconvertPat<v4i32, v8f16, MSA128W, [HasMSA, IsLE]>;
3643def : MSABitconvertPat<v4i32, v2f64, MSA128W, [HasMSA, IsLE]>;
3644
3645def : MSABitconvertPat<v2i64, v16i8, MSA128D, [HasMSA, IsLE]>;
3646def : MSABitconvertPat<v2i64, v8i16, MSA128D, [HasMSA, IsLE]>;
3647def : MSABitconvertPat<v2i64, v4i32, MSA128D, [HasMSA, IsLE]>;
3648def : MSABitconvertPat<v2i64, v8f16, MSA128D, [HasMSA, IsLE]>;
3649def : MSABitconvertPat<v2i64, v4f32, MSA128D, [HasMSA, IsLE]>;
3650
3651def : MSABitconvertPat<v4f32, v16i8, MSA128W, [HasMSA, IsLE]>;
3652def : MSABitconvertPat<v4f32, v8i16, MSA128W, [HasMSA, IsLE]>;
3653def : MSABitconvertPat<v4f32, v2i64, MSA128W, [HasMSA, IsLE]>;
3654def : MSABitconvertPat<v4f32, v8f16, MSA128W, [HasMSA, IsLE]>;
3655def : MSABitconvertPat<v4f32, v2f64, MSA128W, [HasMSA, IsLE]>;
3656
3657def : MSABitconvertPat<v2f64, v16i8, MSA128D, [HasMSA, IsLE]>;
3658def : MSABitconvertPat<v2f64, v8i16, MSA128D, [HasMSA, IsLE]>;
3659def : MSABitconvertPat<v2f64, v4i32, MSA128D, [HasMSA, IsLE]>;
3660def : MSABitconvertPat<v2f64, v8f16, MSA128D, [HasMSA, IsLE]>;
3661def : MSABitconvertPat<v2f64, v4f32, MSA128D, [HasMSA, IsLE]>;
3662
3663// Big endian bitcasts expand to shuffle instructions.
3664// This is because bitcast is defined to be a store/load sequence and the
3665// vector store/load instructions are mixed-endian with respect to the vector
3666// as a whole (little endian with respect to element order, but big endian
3667// elements).
3668
3669class MSABitconvertReverseQuartersPat<ValueType DstVT, ValueType SrcVT,
3670                                      RegisterClass DstRC, MSAInst Insn,
3671                                      RegisterClass ViaRC> :
3672  MSAPat<(DstVT (bitconvert SrcVT:$src)),
3673         (COPY_TO_REGCLASS (Insn (COPY_TO_REGCLASS SrcVT:$src, ViaRC), 27),
3674                           DstRC),
3675         [HasMSA, IsBE]>;
3676
3677class MSABitconvertReverseHalvesPat<ValueType DstVT, ValueType SrcVT,
3678                                    RegisterClass DstRC, MSAInst Insn,
3679                                    RegisterClass ViaRC> :
3680  MSAPat<(DstVT (bitconvert SrcVT:$src)),
3681         (COPY_TO_REGCLASS (Insn (COPY_TO_REGCLASS SrcVT:$src, ViaRC), 177),
3682                           DstRC),
3683         [HasMSA, IsBE]>;
3684
3685class MSABitconvertReverseBInHPat<ValueType DstVT, ValueType SrcVT,
3686                                  RegisterClass DstRC> :
3687  MSABitconvertReverseHalvesPat<DstVT, SrcVT, DstRC, SHF_B, MSA128B>;
3688
3689class MSABitconvertReverseBInWPat<ValueType DstVT, ValueType SrcVT,
3690                                  RegisterClass DstRC> :
3691  MSABitconvertReverseQuartersPat<DstVT, SrcVT, DstRC, SHF_B, MSA128B>;
3692
3693class MSABitconvertReverseBInDPat<ValueType DstVT, ValueType SrcVT,
3694                                  RegisterClass DstRC> :
3695  MSAPat<(DstVT (bitconvert SrcVT:$src)),
3696         (COPY_TO_REGCLASS
3697           (SHF_W
3698             (COPY_TO_REGCLASS
3699               (SHF_B (COPY_TO_REGCLASS SrcVT:$src, MSA128B), 27),
3700               MSA128W), 177),
3701           DstRC),
3702         [HasMSA, IsBE]>;
3703
3704class MSABitconvertReverseHInWPat<ValueType DstVT, ValueType SrcVT,
3705                                  RegisterClass DstRC> :
3706  MSABitconvertReverseHalvesPat<DstVT, SrcVT, DstRC, SHF_H, MSA128H>;
3707
3708class MSABitconvertReverseHInDPat<ValueType DstVT, ValueType SrcVT,
3709                                  RegisterClass DstRC> :
3710  MSABitconvertReverseQuartersPat<DstVT, SrcVT, DstRC, SHF_H, MSA128H>;
3711
3712class MSABitconvertReverseWInDPat<ValueType DstVT, ValueType SrcVT,
3713                                  RegisterClass DstRC> :
3714  MSABitconvertReverseHalvesPat<DstVT, SrcVT, DstRC, SHF_W, MSA128W>;
3715
3716def : MSABitconvertReverseBInHPat<v8i16, v16i8, MSA128H>;
3717def : MSABitconvertReverseBInHPat<v8f16, v16i8, MSA128H>;
3718def : MSABitconvertReverseBInWPat<v4i32, v16i8, MSA128W>;
3719def : MSABitconvertReverseBInWPat<v4f32, v16i8, MSA128W>;
3720def : MSABitconvertReverseBInDPat<v2i64, v16i8, MSA128D>;
3721def : MSABitconvertReverseBInDPat<v2f64, v16i8, MSA128D>;
3722
3723def : MSABitconvertReverseBInHPat<v16i8, v8i16, MSA128B>;
3724def : MSABitconvertReverseHInWPat<v4i32, v8i16, MSA128W>;
3725def : MSABitconvertReverseHInWPat<v4f32, v8i16, MSA128W>;
3726def : MSABitconvertReverseHInDPat<v2i64, v8i16, MSA128D>;
3727def : MSABitconvertReverseHInDPat<v2f64, v8i16, MSA128D>;
3728
3729def : MSABitconvertReverseBInHPat<v16i8, v8f16, MSA128B>;
3730def : MSABitconvertReverseHInWPat<v4i32, v8f16, MSA128W>;
3731def : MSABitconvertReverseHInWPat<v4f32, v8f16, MSA128W>;
3732def : MSABitconvertReverseHInDPat<v2i64, v8f16, MSA128D>;
3733def : MSABitconvertReverseHInDPat<v2f64, v8f16, MSA128D>;
3734
3735def : MSABitconvertReverseBInWPat<v16i8, v4i32, MSA128B>;
3736def : MSABitconvertReverseHInWPat<v8i16, v4i32, MSA128H>;
3737def : MSABitconvertReverseHInWPat<v8f16, v4i32, MSA128H>;
3738def : MSABitconvertReverseWInDPat<v2i64, v4i32, MSA128D>;
3739def : MSABitconvertReverseWInDPat<v2f64, v4i32, MSA128D>;
3740
3741def : MSABitconvertReverseBInWPat<v16i8, v4f32, MSA128B>;
3742def : MSABitconvertReverseHInWPat<v8i16, v4f32, MSA128H>;
3743def : MSABitconvertReverseHInWPat<v8f16, v4f32, MSA128H>;
3744def : MSABitconvertReverseWInDPat<v2i64, v4f32, MSA128D>;
3745def : MSABitconvertReverseWInDPat<v2f64, v4f32, MSA128D>;
3746
3747def : MSABitconvertReverseBInDPat<v16i8, v2i64, MSA128B>;
3748def : MSABitconvertReverseHInDPat<v8i16, v2i64, MSA128H>;
3749def : MSABitconvertReverseHInDPat<v8f16, v2i64, MSA128H>;
3750def : MSABitconvertReverseWInDPat<v4i32, v2i64, MSA128W>;
3751def : MSABitconvertReverseWInDPat<v4f32, v2i64, MSA128W>;
3752
3753def : MSABitconvertReverseBInDPat<v16i8, v2f64, MSA128B>;
3754def : MSABitconvertReverseHInDPat<v8i16, v2f64, MSA128H>;
3755def : MSABitconvertReverseHInDPat<v8f16, v2f64, MSA128H>;
3756def : MSABitconvertReverseWInDPat<v4i32, v2f64, MSA128W>;
3757def : MSABitconvertReverseWInDPat<v4f32, v2f64, MSA128W>;
3758
3759// Pseudos used to implement BNZ.df, and BZ.df
3760
3761class MSA_CBRANCH_PSEUDO_DESC_BASE<SDPatternOperator OpNode, ValueType TyNode,
3762                                   RegisterClass RCWS,
3763                                   InstrItinClass itin = NoItinerary> :
3764  MipsPseudo<(outs GPR32:$dst),
3765             (ins RCWS:$ws),
3766             [(set GPR32:$dst, (OpNode (TyNode RCWS:$ws)))]> {
3767  bit usesCustomInserter = 1;
3768  bit hasNoSchedulingInfo = 1;
3769}
3770
3771def SNZ_B_PSEUDO : MSA_CBRANCH_PSEUDO_DESC_BASE<MipsVAllNonZero, v16i8,
3772                                                MSA128B, NoItinerary>;
3773def SNZ_H_PSEUDO : MSA_CBRANCH_PSEUDO_DESC_BASE<MipsVAllNonZero, v8i16,
3774                                                MSA128H, NoItinerary>;
3775def SNZ_W_PSEUDO : MSA_CBRANCH_PSEUDO_DESC_BASE<MipsVAllNonZero, v4i32,
3776                                                MSA128W, NoItinerary>;
3777def SNZ_D_PSEUDO : MSA_CBRANCH_PSEUDO_DESC_BASE<MipsVAllNonZero, v2i64,
3778                                                MSA128D, NoItinerary>;
3779def SNZ_V_PSEUDO : MSA_CBRANCH_PSEUDO_DESC_BASE<MipsVAnyNonZero, v16i8,
3780                                                MSA128B, NoItinerary>;
3781
3782def SZ_B_PSEUDO : MSA_CBRANCH_PSEUDO_DESC_BASE<MipsVAllZero, v16i8,
3783                                               MSA128B, NoItinerary>;
3784def SZ_H_PSEUDO : MSA_CBRANCH_PSEUDO_DESC_BASE<MipsVAllZero, v8i16,
3785                                               MSA128H, NoItinerary>;
3786def SZ_W_PSEUDO : MSA_CBRANCH_PSEUDO_DESC_BASE<MipsVAllZero, v4i32,
3787                                               MSA128W, NoItinerary>;
3788def SZ_D_PSEUDO : MSA_CBRANCH_PSEUDO_DESC_BASE<MipsVAllZero, v2i64,
3789                                               MSA128D, NoItinerary>;
3790def SZ_V_PSEUDO : MSA_CBRANCH_PSEUDO_DESC_BASE<MipsVAnyZero, v16i8,
3791                                               MSA128B, NoItinerary>;
3792
3793// Pseudoes used to implement transparent fp16 support.
3794
3795let ASEPredicate = [HasMSA] in {
3796  let usesCustomInserter = 1 in {
3797    def ST_F16 :
3798        MipsPseudo<(outs), (ins MSA128F16:$ws, mem_simm10:$addr),
3799                   [(store (f16 MSA128F16:$ws), (addrimm10:$addr))]>;
3800    def LD_F16 :
3801        MipsPseudo<(outs MSA128F16:$ws), (ins mem_simm10:$addr),
3802                   [(set MSA128F16:$ws, (f16 (load addrimm10:$addr)))]>;
3803  }
3804
3805  let usesCustomInserter = 1, hasNoSchedulingInfo = 1 in {
3806    def MSA_FP_EXTEND_W_PSEUDO :
3807        MipsPseudo<(outs FGR32Opnd:$fd), (ins MSA128F16:$ws),
3808                   [(set FGR32Opnd:$fd, (f32 (fpextend MSA128F16:$ws)))]>;
3809    def MSA_FP_ROUND_W_PSEUDO :
3810        MipsPseudo<(outs MSA128F16:$wd), (ins FGR32Opnd:$fs),
3811                   [(set MSA128F16:$wd, (f16 (fpround FGR32Opnd:$fs)))]>;
3812    def MSA_FP_EXTEND_D_PSEUDO :
3813        MipsPseudo<(outs FGR64Opnd:$fd), (ins MSA128F16:$ws),
3814                   [(set FGR64Opnd:$fd, (f64 (fpextend MSA128F16:$ws)))]>;
3815    def MSA_FP_ROUND_D_PSEUDO :
3816        MipsPseudo<(outs MSA128F16:$wd), (ins FGR64Opnd:$fs),
3817                   [(set MSA128F16:$wd, (f16 (fpround FGR64Opnd:$fs)))]>;
3818  }
3819
3820  def : MipsPat<(MipsTruncIntFP MSA128F16:$ws),
3821                (TRUNC_W_D64 (MSA_FP_EXTEND_D_PSEUDO MSA128F16:$ws))>,
3822        ISA_MIPS1, ASE_MSA;
3823
3824  def : MipsPat<(MipsFPCmp MSA128F16:$ws, MSA128F16:$wt, imm:$cond),
3825                (FCMP_S32 (MSA_FP_EXTEND_W_PSEUDO MSA128F16:$ws),
3826                          (MSA_FP_EXTEND_W_PSEUDO MSA128F16:$wt), imm:$cond)>,
3827        ISA_MIPS1_NOT_32R6_64R6, ASE_MSA;
3828}
3829
3830def vsplati64_imm_eq_63 : PatLeaf<(bitconvert (v4i32 (build_vector))), [{
3831  APInt Imm;
3832  SDNode *BV = N->getOperand(0).getNode();
3833  EVT EltTy = N->getValueType(0).getVectorElementType();
3834
3835  return selectVSplat(BV, Imm, EltTy.getSizeInBits()) &&
3836         Imm.getBitWidth() == EltTy.getSizeInBits() && Imm == 63;
3837}]>;
3838
3839def immi32Cst7  : ImmLeaf<i32, [{return isUInt<32>(Imm) && Imm == 7;}]>;
3840def immi32Cst15 : ImmLeaf<i32, [{return isUInt<32>(Imm) && Imm == 15;}]>;
3841def immi32Cst31 : ImmLeaf<i32, [{return isUInt<32>(Imm) && Imm == 31;}]>;
3842
3843def vsplati8imm7 :   PatFrag<(ops node:$wt),
3844                             (and node:$wt, (vsplati8 immi32Cst7))>;
3845def vsplati16imm15 : PatFrag<(ops node:$wt),
3846                             (and node:$wt, (vsplati16 immi32Cst15))>;
3847def vsplati32imm31 : PatFrag<(ops node:$wt),
3848                             (and node:$wt, (vsplati32 immi32Cst31))>;
3849def vsplati64imm63 : PatFrag<(ops node:$wt),
3850                             (and node:$wt, vsplati64_imm_eq_63)>;
3851
3852class MSAShiftPat<SDNode Node, ValueType VT, MSAInst Insn, dag Vec> :
3853  MSAPat<(VT (Node VT:$ws, (VT (and VT:$wt, Vec)))),
3854         (VT (Insn VT:$ws, VT:$wt))>;
3855
3856class MSABitPat<SDNode Node, ValueType VT, MSAInst Insn, PatFrag Frag> :
3857  MSAPat<(VT (Node VT:$ws, (shl vsplat_imm_eq_1, (Frag VT:$wt)))),
3858         (VT (Insn VT:$ws, VT:$wt))>;
3859
3860multiclass MSAShiftPats<SDNode Node, string Insn> {
3861  def : MSAShiftPat<Node, v16i8, !cast<MSAInst>(Insn#_B),
3862                    (vsplati8 immi32Cst7)>;
3863  def : MSAShiftPat<Node, v8i16, !cast<MSAInst>(Insn#_H),
3864                    (vsplati16 immi32Cst15)>;
3865  def : MSAShiftPat<Node, v4i32, !cast<MSAInst>(Insn#_W),
3866                    (vsplati32 immi32Cst31)>;
3867  def : MSAPat<(v2i64 (Node v2i64:$ws, (v2i64 (and v2i64:$wt,
3868                                                   vsplati64_imm_eq_63)))),
3869               (v2i64 (!cast<MSAInst>(Insn#_D) v2i64:$ws, v2i64:$wt))>;
3870}
3871
3872multiclass MSABitPats<SDNode Node, string Insn> {
3873  def : MSABitPat<Node, v16i8, !cast<MSAInst>(Insn#_B), vsplati8imm7>;
3874  def : MSABitPat<Node, v8i16, !cast<MSAInst>(Insn#_H), vsplati16imm15>;
3875  def : MSABitPat<Node, v4i32, !cast<MSAInst>(Insn#_W), vsplati32imm31>;
3876  def : MSAPat<(Node v2i64:$ws, (shl (v2i64 vsplati64_imm_eq_1),
3877                                     (vsplati64imm63 v2i64:$wt))),
3878               (v2i64 (!cast<MSAInst>(Insn#_D) v2i64:$ws, v2i64:$wt))>;
3879}
3880
3881defm : MSAShiftPats<shl, "SLL">;
3882defm : MSAShiftPats<srl, "SRL">;
3883defm : MSAShiftPats<sra, "SRA">;
3884defm : MSABitPats<xor, "BNEG">;
3885defm : MSABitPats<or, "BSET">;
3886
3887def : MSAPat<(and v16i8:$ws, (xor (shl vsplat_imm_eq_1,
3888                                       (vsplati8imm7 v16i8:$wt)),
3889                                  immAllOnesV)),
3890             (v16i8 (BCLR_B v16i8:$ws, v16i8:$wt))>;
3891def : MSAPat<(and v8i16:$ws, (xor (shl vsplat_imm_eq_1,
3892                                       (vsplati16imm15 v8i16:$wt)),
3893                             immAllOnesV)),
3894             (v8i16 (BCLR_H v8i16:$ws, v8i16:$wt))>;
3895def : MSAPat<(and v4i32:$ws, (xor (shl vsplat_imm_eq_1,
3896                                       (vsplati32imm31 v4i32:$wt)),
3897                             immAllOnesV)),
3898             (v4i32 (BCLR_W v4i32:$ws, v4i32:$wt))>;
3899def : MSAPat<(and v2i64:$ws, (xor (shl (v2i64 vsplati64_imm_eq_1),
3900                                       (vsplati64imm63 v2i64:$wt)),
3901                                  (bitconvert (v4i32 immAllOnesV)))),
3902             (v2i64 (BCLR_D v2i64:$ws, v2i64:$wt))>;
3903
3904// Vector extraction with fixed index.
3905//
3906// Extracting 32-bit values on MSA32 should always use COPY_S_W rather than
3907// COPY_U_W, even for the zero-extended case. This is because our forward
3908// compatibility strategy is to consider registers to be infinitely
3909// sign-extended so that a MIPS64 can execute MIPS32 code without getting
3910// different register values.
3911def : MSAPat<(vextract_zext_i32 (v4i32 MSA128W:$ws), immZExt2Ptr:$idx),
3912             (COPY_S_W MSA128W:$ws, immZExt2:$idx)>, ASE_MSA_NOT_MSA64;
3913def : MSAPat<(vextract_zext_i32 (v4f32 MSA128W:$ws), immZExt2Ptr:$idx),
3914             (COPY_S_W MSA128W:$ws, immZExt2:$idx)>, ASE_MSA_NOT_MSA64;
3915
3916// Extracting 64-bit values on MSA64 should always use COPY_S_D rather than
3917// COPY_U_D, even for the zero-extended case. This is because our forward
3918// compatibility strategy is to consider registers to be infinitely
3919// sign-extended so that a hypothetical MIPS128 would be able to execute MIPS64
3920// code without getting different register values.
3921def : MSAPat<(vextract_zext_i64 (v2i64 MSA128D:$ws), immZExt1Ptr:$idx),
3922             (COPY_S_D MSA128D:$ws, immZExt1:$idx)>, ASE_MSA64;
3923def : MSAPat<(vextract_zext_i64 (v2f64 MSA128D:$ws), immZExt1Ptr:$idx),
3924             (COPY_S_D MSA128D:$ws, immZExt1:$idx)>, ASE_MSA64;
3925
3926// Vector extraction with variable index
3927def : MSAPat<(i32 (vextract_sext_i8 v16i8:$ws, i32:$idx)),
3928             (SRA (COPY_TO_REGCLASS (i32 (EXTRACT_SUBREG (SPLAT_B v16i8:$ws,
3929                                                                  i32:$idx),
3930                                                         sub_lo)),
3931                                    GPR32), (i32 24))>;
3932def : MSAPat<(i32 (vextract_sext_i16 v8i16:$ws, i32:$idx)),
3933             (SRA (COPY_TO_REGCLASS (i32 (EXTRACT_SUBREG (SPLAT_H v8i16:$ws,
3934                                                                  i32:$idx),
3935                                                         sub_lo)),
3936                                    GPR32), (i32 16))>;
3937def : MSAPat<(i32 (vextract_sext_i32 v4i32:$ws, i32:$idx)),
3938             (COPY_TO_REGCLASS (i32 (EXTRACT_SUBREG (SPLAT_W v4i32:$ws,
3939                                                             i32:$idx),
3940                                                    sub_lo)),
3941                               GPR32)>;
3942def : MSAPat<(i64 (vextract_sext_i64 v2i64:$ws, i32:$idx)),
3943             (COPY_TO_REGCLASS (i64 (EXTRACT_SUBREG (SPLAT_D v2i64:$ws,
3944                                                             i32:$idx),
3945                                                    sub_64)),
3946                               GPR64), [HasMSA, IsGP64bit]>;
3947
3948def : MSAPat<(i32 (vextract_zext_i8 v16i8:$ws, i32:$idx)),
3949             (SRL (COPY_TO_REGCLASS (i32 (EXTRACT_SUBREG (SPLAT_B v16i8:$ws,
3950                                                                  i32:$idx),
3951                                                         sub_lo)),
3952                                    GPR32), (i32 24))>;
3953def : MSAPat<(i32 (vextract_zext_i16 v8i16:$ws, i32:$idx)),
3954             (SRL (COPY_TO_REGCLASS (i32 (EXTRACT_SUBREG (SPLAT_H v8i16:$ws,
3955                                                                  i32:$idx),
3956                                                         sub_lo)),
3957                                    GPR32), (i32 16))>;
3958def : MSAPat<(i32 (vextract_zext_i32 v4i32:$ws, i32:$idx)),
3959             (COPY_TO_REGCLASS (i32 (EXTRACT_SUBREG (SPLAT_W v4i32:$ws,
3960                                                             i32:$idx),
3961                                                    sub_lo)),
3962                               GPR32)>;
3963def : MSAPat<(i64 (vextract_zext_i64 v2i64:$ws, i32:$idx)),
3964             (COPY_TO_REGCLASS (i64 (EXTRACT_SUBREG (SPLAT_D v2i64:$ws,
3965                                                             i32:$idx),
3966                                                    sub_64)),
3967                               GPR64), [HasMSA, IsGP64bit]>;
3968
3969def : MSAPat<(f32 (vector_extract v4f32:$ws, i32:$idx)),
3970             (f32 (EXTRACT_SUBREG (SPLAT_W v4f32:$ws,
3971                                           i32:$idx),
3972                                  sub_lo))>;
3973def : MSAPat<(f64 (vector_extract v2f64:$ws, i32:$idx)),
3974             (f64 (EXTRACT_SUBREG (SPLAT_D v2f64:$ws,
3975                                           i32:$idx),
3976                                  sub_64))>;
3977
3978// Vector extraction with variable index (N64 ABI)
3979def : MSAPat<
3980  (i32 (vextract_sext_i8 v16i8:$ws, i64:$idx)),
3981  (SRA (COPY_TO_REGCLASS
3982         (i32 (EXTRACT_SUBREG
3983                (SPLAT_B v16i8:$ws,
3984                  (COPY_TO_REGCLASS
3985                    (i32 (EXTRACT_SUBREG i64:$idx, sub_32)), GPR32)),
3986                sub_lo)),
3987         GPR32),
3988       (i32 24))>;
3989def : MSAPat<
3990  (i32 (vextract_sext_i16 v8i16:$ws, i64:$idx)),
3991  (SRA (COPY_TO_REGCLASS
3992         (i32 (EXTRACT_SUBREG
3993                (SPLAT_H v8i16:$ws,
3994                  (COPY_TO_REGCLASS
3995                    (i32 (EXTRACT_SUBREG i64:$idx, sub_32)), GPR32)),
3996                sub_lo)),
3997         GPR32),
3998       (i32 16))>;
3999def : MSAPat<
4000  (i32 (vextract_sext_i32 v4i32:$ws, i64:$idx)),
4001  (COPY_TO_REGCLASS
4002    (i32 (EXTRACT_SUBREG
4003           (SPLAT_W v4i32:$ws,
4004             (COPY_TO_REGCLASS
4005               (i32 (EXTRACT_SUBREG i64:$idx, sub_32)), GPR32)),
4006           sub_lo)),
4007    GPR32)>;
4008def : MSAPat<
4009  (i64 (vextract_sext_i64 v2i64:$ws, i64:$idx)),
4010  (COPY_TO_REGCLASS
4011    (i64 (EXTRACT_SUBREG
4012           (SPLAT_D v2i64:$ws,
4013             (COPY_TO_REGCLASS (i32 (EXTRACT_SUBREG i64:$idx, sub_32)), GPR32)),
4014           sub_64)),
4015    GPR64), [HasMSA, IsGP64bit]>;
4016
4017def : MSAPat<
4018  (i32 (vextract_zext_i8 v16i8:$ws, i64:$idx)),
4019  (SRL (COPY_TO_REGCLASS
4020         (i32 (EXTRACT_SUBREG
4021                 (SPLAT_B v16i8:$ws,
4022                   (COPY_TO_REGCLASS
4023                     (i32 (EXTRACT_SUBREG i64:$idx, sub_32)), GPR32)),
4024                 sub_lo)),
4025         GPR32),
4026       (i32 24))>;
4027def : MSAPat<
4028  (i32 (vextract_zext_i16 v8i16:$ws, i64:$idx)),
4029  (SRL (COPY_TO_REGCLASS
4030         (i32 (EXTRACT_SUBREG
4031                (SPLAT_H v8i16:$ws,
4032                  (COPY_TO_REGCLASS
4033                    (i32 (EXTRACT_SUBREG i64:$idx, sub_32)), GPR32)),
4034                sub_lo)),
4035         GPR32),
4036       (i32 16))>;
4037def : MSAPat<
4038  (i32 (vextract_zext_i32 v4i32:$ws, i64:$idx)),
4039  (COPY_TO_REGCLASS
4040    (i32 (EXTRACT_SUBREG
4041           (SPLAT_W v4i32:$ws,
4042             (COPY_TO_REGCLASS (i32 (EXTRACT_SUBREG i64:$idx, sub_32)), GPR32)),
4043           sub_lo)),
4044    GPR32)>;
4045def : MSAPat<
4046  (i64 (vextract_zext_i64 v2i64:$ws, i64:$idx)),
4047  (COPY_TO_REGCLASS
4048    (i64 (EXTRACT_SUBREG
4049           (SPLAT_D v2i64:$ws,
4050             (COPY_TO_REGCLASS (i32 (EXTRACT_SUBREG i64:$idx, sub_32)), GPR32)),
4051           sub_64)),
4052    GPR64),
4053  [HasMSA, IsGP64bit]>;
4054
4055def : MSAPat<
4056  (f32 (vector_extract v4f32:$ws, i64:$idx)),
4057  (f32 (EXTRACT_SUBREG
4058         (SPLAT_W v4f32:$ws,
4059           (COPY_TO_REGCLASS (i32 (EXTRACT_SUBREG i64:$idx, sub_32)), GPR32)),
4060         sub_lo))>;
4061def : MSAPat<
4062  (f64 (vector_extract v2f64:$ws, i64:$idx)),
4063  (f64 (EXTRACT_SUBREG
4064         (SPLAT_D v2f64:$ws,
4065           (COPY_TO_REGCLASS (i32 (EXTRACT_SUBREG i64:$idx, sub_32)), GPR32)),
4066         sub_64))>;
4067
4068def : MSAPat<(vfseteq_v4f32 MSA128WOpnd:$a, MSA128WOpnd:$b),
4069             (FCEQ_W MSA128WOpnd:$a, MSA128WOpnd:$b)>;
4070def : MSAPat<(vfseteq_v2f64 MSA128DOpnd:$a, MSA128DOpnd:$b),
4071             (FCEQ_D MSA128DOpnd:$a, MSA128DOpnd:$b)>;
4072def : MSAPat<(vfsetle_v4f32 MSA128WOpnd:$a, MSA128WOpnd:$b),
4073             (FCLE_W MSA128WOpnd:$a, MSA128WOpnd:$b)>;
4074def : MSAPat<(vfsetle_v2f64 MSA128DOpnd:$a, MSA128DOpnd:$b),
4075             (FCLE_D MSA128DOpnd:$a, MSA128DOpnd:$b)>;
4076def : MSAPat<(vfsetlt_v4f32 MSA128WOpnd:$a, MSA128WOpnd:$b),
4077             (FCLT_W MSA128WOpnd:$a, MSA128WOpnd:$b)>;
4078def : MSAPat<(vfsetlt_v2f64 MSA128DOpnd:$a, MSA128DOpnd:$b),
4079             (FCLT_D MSA128DOpnd:$a, MSA128DOpnd:$b)>;
4080def : MSAPat<(vfsetne_v4f32 MSA128WOpnd:$a, MSA128WOpnd:$b),
4081             (FCNE_W MSA128WOpnd:$a, MSA128WOpnd:$b)>;
4082def : MSAPat<(vfsetne_v2f64 MSA128DOpnd:$a, MSA128DOpnd:$b),
4083             (FCNE_D MSA128DOpnd:$a, MSA128DOpnd:$b)>;
4084