xref: /freebsd/contrib/llvm-project/llvm/lib/Target/LoongArch/LoongArchLSXInstrInfo.td (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
106c3fb27SDimitry Andric//===- LoongArchLSXInstrInfo.td - LoongArch LSX instructions -*- tablegen -*-=//
206c3fb27SDimitry Andric//
306c3fb27SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
406c3fb27SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
506c3fb27SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
606c3fb27SDimitry Andric//
706c3fb27SDimitry Andric//===----------------------------------------------------------------------===//
806c3fb27SDimitry Andric//
906c3fb27SDimitry Andric// This file describes the SIMD extension instructions.
1006c3fb27SDimitry Andric//
1106c3fb27SDimitry Andric//===----------------------------------------------------------------------===//
1206c3fb27SDimitry Andric
135f757f3fSDimitry Andricdef SDT_LoongArchVreplve : SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisVec<0>,
145f757f3fSDimitry Andric                                         SDTCisInt<1>, SDTCisVec<1>,
155f757f3fSDimitry Andric                                         SDTCisSameAs<0, 1>, SDTCisInt<2>]>;
165f757f3fSDimitry Andricdef SDT_LoongArchVecCond : SDTypeProfile<1, 1, [SDTCisInt<0>, SDTCisVec<1>]>;
175f757f3fSDimitry Andric
18*0fca6ea1SDimitry Andricdef SDT_LoongArchVShuf : SDTypeProfile<1, 3, [SDTCisVec<0>,
19*0fca6ea1SDimitry Andric                                         SDTCisInt<1>, SDTCisVec<1>,
20*0fca6ea1SDimitry Andric                                         SDTCisSameAs<0, 2>,
21*0fca6ea1SDimitry Andric                                         SDTCisSameAs<2, 3>]>;
22*0fca6ea1SDimitry Andricdef SDT_LoongArchV2R : SDTypeProfile<1, 2, [SDTCisVec<0>,
23*0fca6ea1SDimitry Andric                                         SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>]>;
24*0fca6ea1SDimitry Andricdef SDT_loongArchV1RUimm: SDTypeProfile<1, 2, [SDTCisVec<0>,
25*0fca6ea1SDimitry Andric                                         SDTCisSameAs<0,1>, SDTCisVT<2, i64>]>;
26*0fca6ea1SDimitry Andric
275f757f3fSDimitry Andric// Target nodes.
285f757f3fSDimitry Andricdef loongarch_vreplve : SDNode<"LoongArchISD::VREPLVE", SDT_LoongArchVreplve>;
295f757f3fSDimitry Andricdef loongarch_vall_nonzero : SDNode<"LoongArchISD::VALL_NONZERO",
305f757f3fSDimitry Andric                                    SDT_LoongArchVecCond>;
315f757f3fSDimitry Andricdef loongarch_vany_nonzero : SDNode<"LoongArchISD::VANY_NONZERO",
325f757f3fSDimitry Andric                                    SDT_LoongArchVecCond>;
335f757f3fSDimitry Andricdef loongarch_vall_zero : SDNode<"LoongArchISD::VALL_ZERO",
345f757f3fSDimitry Andric                                SDT_LoongArchVecCond>;
355f757f3fSDimitry Andricdef loongarch_vany_zero : SDNode<"LoongArchISD::VANY_ZERO",
365f757f3fSDimitry Andric                                SDT_LoongArchVecCond>;
375f757f3fSDimitry Andric
385f757f3fSDimitry Andricdef loongarch_vpick_sext_elt : SDNode<"LoongArchISD::VPICK_SEXT_ELT",
395f757f3fSDimitry Andric                                      SDTypeProfile<1, 3, [SDTCisPtrTy<2>]>>;
405f757f3fSDimitry Andricdef loongarch_vpick_zext_elt : SDNode<"LoongArchISD::VPICK_ZEXT_ELT",
415f757f3fSDimitry Andric                                      SDTypeProfile<1, 3, [SDTCisPtrTy<2>]>>;
425f757f3fSDimitry Andric
43*0fca6ea1SDimitry Andricdef loongarch_vshuf: SDNode<"LoongArchISD::VSHUF", SDT_LoongArchVShuf>;
44*0fca6ea1SDimitry Andricdef loongarch_vpickev: SDNode<"LoongArchISD::VPICKEV", SDT_LoongArchV2R>;
45*0fca6ea1SDimitry Andricdef loongarch_vpickod: SDNode<"LoongArchISD::VPICKOD", SDT_LoongArchV2R>;
46*0fca6ea1SDimitry Andricdef loongarch_vpackev: SDNode<"LoongArchISD::VPACKEV", SDT_LoongArchV2R>;
47*0fca6ea1SDimitry Andricdef loongarch_vpackod: SDNode<"LoongArchISD::VPACKOD", SDT_LoongArchV2R>;
48*0fca6ea1SDimitry Andricdef loongarch_vilvl: SDNode<"LoongArchISD::VILVL", SDT_LoongArchV2R>;
49*0fca6ea1SDimitry Andricdef loongarch_vilvh: SDNode<"LoongArchISD::VILVH", SDT_LoongArchV2R>;
50*0fca6ea1SDimitry Andric
51*0fca6ea1SDimitry Andricdef loongarch_vshuf4i: SDNode<"LoongArchISD::VSHUF4I", SDT_loongArchV1RUimm>;
52*0fca6ea1SDimitry Andricdef loongarch_vreplvei: SDNode<"LoongArchISD::VREPLVEI", SDT_loongArchV1RUimm>;
53*0fca6ea1SDimitry Andric
54*0fca6ea1SDimitry Andricdef immZExt1 : ImmLeaf<i64, [{return isUInt<1>(Imm);}]>;
55*0fca6ea1SDimitry Andricdef immZExt2 : ImmLeaf<i64, [{return isUInt<2>(Imm);}]>;
56*0fca6ea1SDimitry Andricdef immZExt3 : ImmLeaf<i64, [{return isUInt<3>(Imm);}]>;
57*0fca6ea1SDimitry Andricdef immZExt4 : ImmLeaf<i64, [{return isUInt<4>(Imm);}]>;
58*0fca6ea1SDimitry Andricdef immZExt8 : ImmLeaf<i64, [{return isUInt<8>(Imm);}]>;
59*0fca6ea1SDimitry Andric
605f757f3fSDimitry Andricclass VecCond<SDPatternOperator OpNode, ValueType TyNode,
615f757f3fSDimitry Andric              RegisterClass RC = LSX128>
625f757f3fSDimitry Andric    : Pseudo<(outs GPR:$rd), (ins RC:$vj),
635f757f3fSDimitry Andric             [(set GPR:$rd, (OpNode (TyNode RC:$vj)))]> {
645f757f3fSDimitry Andric  let hasSideEffects = 0;
655f757f3fSDimitry Andric  let mayLoad = 0;
665f757f3fSDimitry Andric  let mayStore = 0;
675f757f3fSDimitry Andric  let usesCustomInserter = 1;
685f757f3fSDimitry Andric}
695f757f3fSDimitry Andric
705f757f3fSDimitry Andricdef vsplat_imm_eq_1 : PatFrags<(ops), [(build_vector),
715f757f3fSDimitry Andric                                       (bitconvert (v4i32 (build_vector)))], [{
725f757f3fSDimitry Andric  APInt Imm;
735f757f3fSDimitry Andric  EVT EltTy = N->getValueType(0).getVectorElementType();
745f757f3fSDimitry Andric
755f757f3fSDimitry Andric  if (N->getOpcode() == ISD::BITCAST)
765f757f3fSDimitry Andric    N = N->getOperand(0).getNode();
775f757f3fSDimitry Andric
785f757f3fSDimitry Andric  return selectVSplat(N, Imm, EltTy.getSizeInBits()) &&
795f757f3fSDimitry Andric         Imm.getBitWidth() == EltTy.getSizeInBits() && Imm == 1;
805f757f3fSDimitry Andric}]>;
815f757f3fSDimitry Andric
825f757f3fSDimitry Andricdef vsplati8_imm_eq_7 : PatFrags<(ops), [(build_vector)], [{
835f757f3fSDimitry Andric  APInt Imm;
845f757f3fSDimitry Andric  EVT EltTy = N->getValueType(0).getVectorElementType();
855f757f3fSDimitry Andric
865f757f3fSDimitry Andric  if (N->getOpcode() == ISD::BITCAST)
875f757f3fSDimitry Andric    N = N->getOperand(0).getNode();
885f757f3fSDimitry Andric
895f757f3fSDimitry Andric  return selectVSplat(N, Imm, EltTy.getSizeInBits()) &&
905f757f3fSDimitry Andric         Imm.getBitWidth() == EltTy.getSizeInBits() && Imm == 7;
915f757f3fSDimitry Andric}]>;
925f757f3fSDimitry Andricdef vsplati16_imm_eq_15 : PatFrags<(ops), [(build_vector)], [{
935f757f3fSDimitry Andric  APInt Imm;
945f757f3fSDimitry Andric  EVT EltTy = N->getValueType(0).getVectorElementType();
955f757f3fSDimitry Andric
965f757f3fSDimitry Andric  if (N->getOpcode() == ISD::BITCAST)
975f757f3fSDimitry Andric    N = N->getOperand(0).getNode();
985f757f3fSDimitry Andric
995f757f3fSDimitry Andric  return selectVSplat(N, Imm, EltTy.getSizeInBits()) &&
1005f757f3fSDimitry Andric         Imm.getBitWidth() == EltTy.getSizeInBits() && Imm == 15;
1015f757f3fSDimitry Andric}]>;
1025f757f3fSDimitry Andricdef vsplati32_imm_eq_31 : PatFrags<(ops), [(build_vector)], [{
1035f757f3fSDimitry Andric  APInt Imm;
1045f757f3fSDimitry Andric  EVT EltTy = N->getValueType(0).getVectorElementType();
1055f757f3fSDimitry Andric
1065f757f3fSDimitry Andric  if (N->getOpcode() == ISD::BITCAST)
1075f757f3fSDimitry Andric    N = N->getOperand(0).getNode();
1085f757f3fSDimitry Andric
1095f757f3fSDimitry Andric  return selectVSplat(N, Imm, EltTy.getSizeInBits()) &&
1105f757f3fSDimitry Andric         Imm.getBitWidth() == EltTy.getSizeInBits() && Imm == 31;
1115f757f3fSDimitry Andric}]>;
1125f757f3fSDimitry Andricdef vsplati64_imm_eq_63 : PatFrags<(ops), [(build_vector),
1135f757f3fSDimitry Andric                                           (bitconvert (v4i32 (build_vector)))], [{
1145f757f3fSDimitry Andric  APInt Imm;
1155f757f3fSDimitry Andric  EVT EltTy = N->getValueType(0).getVectorElementType();
1165f757f3fSDimitry Andric
1175f757f3fSDimitry Andric  if (N->getOpcode() == ISD::BITCAST)
1185f757f3fSDimitry Andric    N = N->getOperand(0).getNode();
1195f757f3fSDimitry Andric
1205f757f3fSDimitry Andric  return selectVSplat(N, Imm, EltTy.getSizeInBits()) &&
1215f757f3fSDimitry Andric         Imm.getBitWidth() == EltTy.getSizeInBits() && Imm == 63;
1225f757f3fSDimitry Andric}]>;
1235f757f3fSDimitry Andric
1245f757f3fSDimitry Andricdef vsplatf32_fpimm_eq_1
1255f757f3fSDimitry Andric  : PatFrags<(ops), [(bitconvert (v4i32 (build_vector))),
1265f757f3fSDimitry Andric                     (bitconvert (v8i32 (build_vector)))], [{
1275f757f3fSDimitry Andric  APInt Imm;
1285f757f3fSDimitry Andric  EVT EltTy = N->getValueType(0).getVectorElementType();
1295f757f3fSDimitry Andric  N = N->getOperand(0).getNode();
1305f757f3fSDimitry Andric
1315f757f3fSDimitry Andric  return selectVSplat(N, Imm, EltTy.getSizeInBits()) &&
1325f757f3fSDimitry Andric         Imm.getBitWidth() == EltTy.getSizeInBits() &&
1335f757f3fSDimitry Andric         Imm == APFloat(+1.0f).bitcastToAPInt();
1345f757f3fSDimitry Andric}]>;
1355f757f3fSDimitry Andricdef vsplatf64_fpimm_eq_1
1365f757f3fSDimitry Andric  : PatFrags<(ops), [(bitconvert (v2i64 (build_vector))),
1375f757f3fSDimitry Andric                     (bitconvert (v4i64 (build_vector)))], [{
1385f757f3fSDimitry Andric  APInt Imm;
1395f757f3fSDimitry Andric  EVT EltTy = N->getValueType(0).getVectorElementType();
1405f757f3fSDimitry Andric  N = N->getOperand(0).getNode();
1415f757f3fSDimitry Andric
1425f757f3fSDimitry Andric  return selectVSplat(N, Imm, EltTy.getSizeInBits()) &&
1435f757f3fSDimitry Andric         Imm.getBitWidth() == EltTy.getSizeInBits() &&
1445f757f3fSDimitry Andric         Imm == APFloat(+1.0).bitcastToAPInt();
1455f757f3fSDimitry Andric}]>;
1465f757f3fSDimitry Andric
1475f757f3fSDimitry Andricdef vsplati8imm7   : PatFrag<(ops node:$reg),
1485f757f3fSDimitry Andric                             (and node:$reg, vsplati8_imm_eq_7)>;
1495f757f3fSDimitry Andricdef vsplati16imm15 : PatFrag<(ops node:$reg),
1505f757f3fSDimitry Andric                             (and node:$reg, vsplati16_imm_eq_15)>;
1515f757f3fSDimitry Andricdef vsplati32imm31 : PatFrag<(ops node:$reg),
1525f757f3fSDimitry Andric                             (and node:$reg, vsplati32_imm_eq_31)>;
1535f757f3fSDimitry Andricdef vsplati64imm63 : PatFrag<(ops node:$reg),
1545f757f3fSDimitry Andric                             (and node:$reg, vsplati64_imm_eq_63)>;
1555f757f3fSDimitry Andric
1565f757f3fSDimitry Andricforeach N = [3, 4, 5, 6, 8] in
1575f757f3fSDimitry Andric  def SplatPat_uimm#N : ComplexPattern<vAny, 1, "selectVSplatImm<"#N#">",
1585f757f3fSDimitry Andric                                       [build_vector, bitconvert], [], 2>;
1595f757f3fSDimitry Andric
1605f757f3fSDimitry Andricforeach N = [5] in
1615f757f3fSDimitry Andric  def SplatPat_simm#N : ComplexPattern<vAny, 1, "selectVSplatImm<"#N#", true>",
1625f757f3fSDimitry Andric                                       [build_vector, bitconvert]>;
1635f757f3fSDimitry Andric
1645f757f3fSDimitry Andricdef vsplat_uimm_inv_pow2 : ComplexPattern<vAny, 1, "selectVSplatUimmInvPow2",
1655f757f3fSDimitry Andric                                          [build_vector, bitconvert]>;
1665f757f3fSDimitry Andric
1675f757f3fSDimitry Andricdef vsplat_uimm_pow2 : ComplexPattern<vAny, 1, "selectVSplatUimmPow2",
1685f757f3fSDimitry Andric                                      [build_vector, bitconvert]>;
1695f757f3fSDimitry Andric
1705f757f3fSDimitry Andricdef muladd : PatFrag<(ops node:$vd, node:$vj, node:$vk),
1715f757f3fSDimitry Andric                     (add node:$vd, (mul node:$vj, node:$vk))>;
1725f757f3fSDimitry Andric
1735f757f3fSDimitry Andricdef mulsub : PatFrag<(ops node:$vd, node:$vj, node:$vk),
1745f757f3fSDimitry Andric                     (sub node:$vd, (mul node:$vj, node:$vk))>;
1755f757f3fSDimitry Andric
1765f757f3fSDimitry Andricdef lsxsplati8  : PatFrag<(ops node:$e0),
1775f757f3fSDimitry Andric                          (v16i8 (build_vector node:$e0, node:$e0,
1785f757f3fSDimitry Andric                                               node:$e0, node:$e0,
1795f757f3fSDimitry Andric                                               node:$e0, node:$e0,
1805f757f3fSDimitry Andric                                               node:$e0, node:$e0,
1815f757f3fSDimitry Andric                                               node:$e0, node:$e0,
1825f757f3fSDimitry Andric                                               node:$e0, node:$e0,
1835f757f3fSDimitry Andric                                               node:$e0, node:$e0,
1845f757f3fSDimitry Andric                                               node:$e0, node:$e0))>;
1855f757f3fSDimitry Andricdef lsxsplati16 : PatFrag<(ops node:$e0),
1865f757f3fSDimitry Andric                          (v8i16 (build_vector node:$e0, node:$e0,
1875f757f3fSDimitry Andric                                               node:$e0, node:$e0,
1885f757f3fSDimitry Andric                                               node:$e0, node:$e0,
1895f757f3fSDimitry Andric                                               node:$e0, node:$e0))>;
1905f757f3fSDimitry Andricdef lsxsplati32 : PatFrag<(ops node:$e0),
1915f757f3fSDimitry Andric                          (v4i32 (build_vector node:$e0, node:$e0,
1925f757f3fSDimitry Andric                                               node:$e0, node:$e0))>;
1935f757f3fSDimitry Andricdef lsxsplati64 : PatFrag<(ops node:$e0),
1945f757f3fSDimitry Andric                          (v2i64 (build_vector node:$e0, node:$e0))>;
1955f757f3fSDimitry Andricdef lsxsplatf32 : PatFrag<(ops node:$e0),
1965f757f3fSDimitry Andric                          (v4f32 (build_vector node:$e0, node:$e0,
1975f757f3fSDimitry Andric                                               node:$e0, node:$e0))>;
1985f757f3fSDimitry Andricdef lsxsplatf64 : PatFrag<(ops node:$e0),
1995f757f3fSDimitry Andric                          (v2f64 (build_vector node:$e0, node:$e0))>;
2005f757f3fSDimitry Andric
2015f757f3fSDimitry Andricdef to_valid_timm : SDNodeXForm<timm, [{
2025f757f3fSDimitry Andric  auto CN = cast<ConstantSDNode>(N);
2035f757f3fSDimitry Andric  return CurDAG->getTargetConstant(CN->getSExtValue(), SDLoc(N), Subtarget->getGRLenVT());
2045f757f3fSDimitry Andric}]>;
2055f757f3fSDimitry Andric
20606c3fb27SDimitry Andric//===----------------------------------------------------------------------===//
20706c3fb27SDimitry Andric// Instruction class templates
20806c3fb27SDimitry Andric//===----------------------------------------------------------------------===//
20906c3fb27SDimitry Andric
21006c3fb27SDimitry Andricclass LSX1RI13_VI<bits<32> op, Operand ImmOpnd = simm13>
21106c3fb27SDimitry Andric    : Fmt1RI13_VI<op, (outs LSX128:$vd), (ins ImmOpnd:$imm13), "$vd, $imm13">;
21206c3fb27SDimitry Andric
21306c3fb27SDimitry Andricclass LSX2R_VV<bits<32> op>
21406c3fb27SDimitry Andric    : Fmt2R_VV<op, (outs LSX128:$vd), (ins LSX128:$vj), "$vd, $vj">;
21506c3fb27SDimitry Andric
21606c3fb27SDimitry Andricclass LSX2R_VR<bits<32> op>
21706c3fb27SDimitry Andric    : Fmt2R_VR<op, (outs LSX128:$vd), (ins GPR:$rj), "$vd, $rj">;
21806c3fb27SDimitry Andric
21906c3fb27SDimitry Andricclass LSX2R_CV<bits<32> op>
22006c3fb27SDimitry Andric    : Fmt2R_CV<op, (outs CFR:$cd), (ins LSX128:$vj), "$cd, $vj">;
22106c3fb27SDimitry Andric
22206c3fb27SDimitry Andricclass LSX2RI1_VVI<bits<32> op, Operand ImmOpnd = uimm1>
22306c3fb27SDimitry Andric    : Fmt2RI1_VVI<op, (outs LSX128:$vd), (ins LSX128:$vj, ImmOpnd:$imm1),
22406c3fb27SDimitry Andric                  "$vd, $vj, $imm1">;
22506c3fb27SDimitry Andric
22606c3fb27SDimitry Andricclass LSX2RI1_RVI<bits<32> op, Operand ImmOpnd = uimm1>
22706c3fb27SDimitry Andric    : Fmt2RI1_RVI<op, (outs GPR:$rd), (ins LSX128:$vj, ImmOpnd:$imm1),
22806c3fb27SDimitry Andric                  "$rd, $vj, $imm1">;
22906c3fb27SDimitry Andric
23006c3fb27SDimitry Andricclass LSX2RI2_VVI<bits<32> op, Operand ImmOpnd = uimm2>
23106c3fb27SDimitry Andric    : Fmt2RI2_VVI<op, (outs LSX128:$vd), (ins LSX128:$vj, ImmOpnd:$imm2),
23206c3fb27SDimitry Andric                  "$vd, $vj, $imm2">;
23306c3fb27SDimitry Andric
23406c3fb27SDimitry Andricclass LSX2RI2_RVI<bits<32> op, Operand ImmOpnd = uimm2>
23506c3fb27SDimitry Andric    : Fmt2RI2_RVI<op, (outs GPR:$rd), (ins LSX128:$vj, ImmOpnd:$imm2),
23606c3fb27SDimitry Andric                  "$rd, $vj, $imm2">;
23706c3fb27SDimitry Andric
23806c3fb27SDimitry Andricclass LSX2RI3_VVI<bits<32> op, Operand ImmOpnd = uimm3>
23906c3fb27SDimitry Andric    : Fmt2RI3_VVI<op, (outs LSX128:$vd), (ins LSX128:$vj, ImmOpnd:$imm3),
24006c3fb27SDimitry Andric                  "$vd, $vj, $imm3">;
24106c3fb27SDimitry Andric
24206c3fb27SDimitry Andricclass LSX2RI3_RVI<bits<32> op, Operand ImmOpnd = uimm3>
24306c3fb27SDimitry Andric    : Fmt2RI3_RVI<op, (outs GPR:$rd), (ins LSX128:$vj, ImmOpnd:$imm3),
24406c3fb27SDimitry Andric                  "$rd, $vj, $imm3">;
24506c3fb27SDimitry Andric
24606c3fb27SDimitry Andricclass LSX2RI4_VVI<bits<32> op, Operand ImmOpnd = uimm4>
24706c3fb27SDimitry Andric    : Fmt2RI4_VVI<op, (outs LSX128:$vd), (ins LSX128:$vj, ImmOpnd:$imm4),
24806c3fb27SDimitry Andric                  "$vd, $vj, $imm4">;
24906c3fb27SDimitry Andric
25006c3fb27SDimitry Andricclass LSX2RI4_RVI<bits<32> op, Operand ImmOpnd = uimm4>
25106c3fb27SDimitry Andric    : Fmt2RI4_RVI<op, (outs GPR:$rd), (ins LSX128:$vj, ImmOpnd:$imm4),
25206c3fb27SDimitry Andric                  "$rd, $vj, $imm4">;
25306c3fb27SDimitry Andric
25406c3fb27SDimitry Andricclass LSX2RI5_VVI<bits<32> op, Operand ImmOpnd = uimm5>
25506c3fb27SDimitry Andric    : Fmt2RI5_VVI<op, (outs LSX128:$vd), (ins LSX128:$vj, ImmOpnd:$imm5),
25606c3fb27SDimitry Andric                  "$vd, $vj, $imm5">;
25706c3fb27SDimitry Andric
25806c3fb27SDimitry Andricclass LSX2RI6_VVI<bits<32> op, Operand ImmOpnd = uimm6>
25906c3fb27SDimitry Andric    : Fmt2RI6_VVI<op, (outs LSX128:$vd), (ins LSX128:$vj, ImmOpnd:$imm6),
26006c3fb27SDimitry Andric                  "$vd, $vj, $imm6">;
26106c3fb27SDimitry Andric
26206c3fb27SDimitry Andricclass LSX2RI8_VVI<bits<32> op, Operand ImmOpnd = uimm8>
26306c3fb27SDimitry Andric    : Fmt2RI8_VVI<op, (outs LSX128:$vd), (ins LSX128:$vj, ImmOpnd:$imm8),
26406c3fb27SDimitry Andric                  "$vd, $vj, $imm8">;
26506c3fb27SDimitry Andric
26606c3fb27SDimitry Andricclass LSX2RI8I1_VRII<bits<32> op, Operand ImmOpnd = simm8,
26706c3fb27SDimitry Andric                     Operand IdxOpnd = uimm1>
26806c3fb27SDimitry Andric    : Fmt2RI8I1_VRII<op, (outs),
26906c3fb27SDimitry Andric                     (ins LSX128:$vd, GPR:$rj, ImmOpnd:$imm8, IdxOpnd:$imm1),
27006c3fb27SDimitry Andric                     "$vd, $rj, $imm8, $imm1">;
27106c3fb27SDimitry Andricclass LSX2RI8I2_VRII<bits<32> op, Operand ImmOpnd = simm8,
27206c3fb27SDimitry Andric                     Operand IdxOpnd = uimm2>
27306c3fb27SDimitry Andric    : Fmt2RI8I2_VRII<op, (outs),
27406c3fb27SDimitry Andric                     (ins LSX128:$vd, GPR:$rj, ImmOpnd:$imm8, IdxOpnd:$imm2),
27506c3fb27SDimitry Andric                     "$vd, $rj, $imm8, $imm2">;
27606c3fb27SDimitry Andricclass LSX2RI8I3_VRII<bits<32> op, Operand ImmOpnd = simm8,
27706c3fb27SDimitry Andric                     Operand IdxOpnd = uimm3>
27806c3fb27SDimitry Andric    : Fmt2RI8I3_VRII<op, (outs),
27906c3fb27SDimitry Andric                     (ins LSX128:$vd, GPR:$rj, ImmOpnd:$imm8, IdxOpnd:$imm3),
28006c3fb27SDimitry Andric                     "$vd, $rj, $imm8, $imm3">;
28106c3fb27SDimitry Andricclass LSX2RI8I4_VRII<bits<32> op, Operand ImmOpnd = simm8,
28206c3fb27SDimitry Andric                     Operand IdxOpnd = uimm4>
28306c3fb27SDimitry Andric    : Fmt2RI8I4_VRII<op, (outs),
28406c3fb27SDimitry Andric                     (ins LSX128:$vd, GPR:$rj, ImmOpnd:$imm8, IdxOpnd:$imm4),
28506c3fb27SDimitry Andric                     "$vd, $rj, $imm8, $imm4">;
28606c3fb27SDimitry Andric
28706c3fb27SDimitry Andricclass LSX3R_VVV<bits<32> op>
28806c3fb27SDimitry Andric    : Fmt3R_VVV<op, (outs LSX128:$vd), (ins LSX128:$vj, LSX128:$vk),
28906c3fb27SDimitry Andric                "$vd, $vj, $vk">;
29006c3fb27SDimitry Andric
29106c3fb27SDimitry Andricclass LSX3R_VVR<bits<32> op>
29206c3fb27SDimitry Andric    : Fmt3R_VVR<op, (outs LSX128:$vd), (ins LSX128:$vj, GPR:$rk),
29306c3fb27SDimitry Andric                "$vd, $vj, $rk">;
29406c3fb27SDimitry Andric
29506c3fb27SDimitry Andricclass LSX4R_VVVV<bits<32> op>
29606c3fb27SDimitry Andric    : Fmt4R_VVVV<op, (outs LSX128:$vd),
29706c3fb27SDimitry Andric                 (ins LSX128:$vj, LSX128:$vk, LSX128:$va),
29806c3fb27SDimitry Andric                 "$vd, $vj, $vk, $va">;
29906c3fb27SDimitry Andric
30006c3fb27SDimitry Andriclet Constraints = "$vd = $dst" in {
30106c3fb27SDimitry Andric
30206c3fb27SDimitry Andricclass LSX2RI1_VVRI<bits<32> op, Operand ImmOpnd = uimm1>
30306c3fb27SDimitry Andric    : Fmt2RI1_VRI<op, (outs LSX128:$dst), (ins LSX128:$vd, GPR:$rj, ImmOpnd:$imm1),
30406c3fb27SDimitry Andric                  "$vd, $rj, $imm1">;
30506c3fb27SDimitry Andricclass LSX2RI2_VVRI<bits<32> op, Operand ImmOpnd = uimm2>
30606c3fb27SDimitry Andric    : Fmt2RI2_VRI<op, (outs LSX128:$dst), (ins LSX128:$vd, GPR:$rj, ImmOpnd:$imm2),
30706c3fb27SDimitry Andric                  "$vd, $rj, $imm2">;
30806c3fb27SDimitry Andricclass LSX2RI3_VVRI<bits<32> op, Operand ImmOpnd = uimm3>
30906c3fb27SDimitry Andric    : Fmt2RI3_VRI<op, (outs LSX128:$dst), (ins LSX128:$vd, GPR:$rj, ImmOpnd:$imm3),
31006c3fb27SDimitry Andric                  "$vd, $rj, $imm3">;
31106c3fb27SDimitry Andricclass LSX2RI4_VVRI<bits<32> op, Operand ImmOpnd = uimm4>
31206c3fb27SDimitry Andric    : Fmt2RI4_VRI<op, (outs LSX128:$dst), (ins LSX128:$vd, GPR:$rj, ImmOpnd:$imm4),
31306c3fb27SDimitry Andric                  "$vd, $rj, $imm4">;
31406c3fb27SDimitry Andric
31506c3fb27SDimitry Andricclass LSX2RI4_VVVI<bits<32> op, Operand ImmOpnd = uimm4>
31606c3fb27SDimitry Andric    : Fmt2RI4_VVI<op, (outs LSX128:$dst), (ins LSX128:$vd, LSX128:$vj, ImmOpnd:$imm4),
31706c3fb27SDimitry Andric                  "$vd, $vj, $imm4">;
31806c3fb27SDimitry Andricclass LSX2RI5_VVVI<bits<32> op, Operand ImmOpnd = uimm5>
31906c3fb27SDimitry Andric    : Fmt2RI5_VVI<op, (outs LSX128:$dst), (ins LSX128:$vd, LSX128:$vj, ImmOpnd:$imm5),
32006c3fb27SDimitry Andric                  "$vd, $vj, $imm5">;
32106c3fb27SDimitry Andricclass LSX2RI6_VVVI<bits<32> op, Operand ImmOpnd = uimm6>
32206c3fb27SDimitry Andric    : Fmt2RI6_VVI<op, (outs LSX128:$dst), (ins LSX128:$vd, LSX128:$vj, ImmOpnd:$imm6),
32306c3fb27SDimitry Andric                  "$vd, $vj, $imm6">;
32406c3fb27SDimitry Andricclass LSX2RI7_VVVI<bits<32> op, Operand ImmOpnd = uimm7>
32506c3fb27SDimitry Andric    : Fmt2RI7_VVI<op, (outs LSX128:$dst), (ins LSX128:$vd, LSX128:$vj, ImmOpnd:$imm7),
32606c3fb27SDimitry Andric                  "$vd, $vj, $imm7">;
32706c3fb27SDimitry Andric
32806c3fb27SDimitry Andricclass LSX2RI8_VVVI<bits<32> op, Operand ImmOpnd = uimm8>
32906c3fb27SDimitry Andric    : Fmt2RI8_VVI<op, (outs LSX128:$dst), (ins LSX128:$vd, LSX128:$vj, ImmOpnd:$imm8),
33006c3fb27SDimitry Andric                  "$vd, $vj, $imm8">;
33106c3fb27SDimitry Andric
33206c3fb27SDimitry Andricclass LSX3R_VVVV<bits<32> op>
33306c3fb27SDimitry Andric    : Fmt3R_VVV<op, (outs LSX128:$dst), (ins LSX128:$vd, LSX128:$vj, LSX128:$vk),
33406c3fb27SDimitry Andric                "$vd, $vj, $vk">;
33506c3fb27SDimitry Andric
33606c3fb27SDimitry Andric} // Constraints = "$vd = $dst"
33706c3fb27SDimitry Andric
33806c3fb27SDimitry Andricclass LSX2RI9_Load<bits<32> op, Operand ImmOpnd = simm9_lsl3>
33906c3fb27SDimitry Andric    : Fmt2RI9_VRI<op, (outs LSX128:$vd), (ins GPR:$rj, ImmOpnd:$imm9),
34006c3fb27SDimitry Andric                  "$vd, $rj, $imm9">;
34106c3fb27SDimitry Andricclass LSX2RI10_Load<bits<32> op, Operand ImmOpnd = simm10_lsl2>
34206c3fb27SDimitry Andric    : Fmt2RI10_VRI<op, (outs LSX128:$vd), (ins GPR:$rj, ImmOpnd:$imm10),
34306c3fb27SDimitry Andric                  "$vd, $rj, $imm10">;
34406c3fb27SDimitry Andricclass LSX2RI11_Load<bits<32> op, Operand ImmOpnd = simm11_lsl1>
34506c3fb27SDimitry Andric    : Fmt2RI11_VRI<op, (outs LSX128:$vd), (ins GPR:$rj, ImmOpnd:$imm11),
34606c3fb27SDimitry Andric                  "$vd, $rj, $imm11">;
34706c3fb27SDimitry Andricclass LSX2RI12_Load<bits<32> op, Operand ImmOpnd = simm12>
34806c3fb27SDimitry Andric    : Fmt2RI12_VRI<op, (outs LSX128:$vd), (ins GPR:$rj, ImmOpnd:$imm12),
34906c3fb27SDimitry Andric                  "$vd, $rj, $imm12">;
35006c3fb27SDimitry Andricclass LSX2RI12_Store<bits<32> op, Operand ImmOpnd = simm12>
35106c3fb27SDimitry Andric    : Fmt2RI12_VRI<op, (outs), (ins LSX128:$vd, GPR:$rj, ImmOpnd:$imm12),
35206c3fb27SDimitry Andric                  "$vd, $rj, $imm12">;
35306c3fb27SDimitry Andric
35406c3fb27SDimitry Andricclass LSX3R_Load<bits<32> op>
35506c3fb27SDimitry Andric    : Fmt3R_VRR<op, (outs LSX128:$vd), (ins GPR:$rj, GPR:$rk),
35606c3fb27SDimitry Andric                "$vd, $rj, $rk">;
35706c3fb27SDimitry Andricclass LSX3R_Store<bits<32> op>
35806c3fb27SDimitry Andric    : Fmt3R_VRR<op, (outs), (ins LSX128:$vd, GPR:$rj, GPR:$rk),
35906c3fb27SDimitry Andric                "$vd, $rj, $rk">;
36006c3fb27SDimitry Andric
36106c3fb27SDimitry Andric//===----------------------------------------------------------------------===//
36206c3fb27SDimitry Andric// Instructions
36306c3fb27SDimitry Andric//===----------------------------------------------------------------------===//
36406c3fb27SDimitry Andric
36506c3fb27SDimitry Andriclet hasSideEffects = 0, Predicates = [HasExtLSX] in {
36606c3fb27SDimitry Andric
36706c3fb27SDimitry Andriclet mayLoad = 0, mayStore = 0 in {
36806c3fb27SDimitry Andric
36906c3fb27SDimitry Andricdef VADD_B : LSX3R_VVV<0x700a0000>;
37006c3fb27SDimitry Andricdef VADD_H : LSX3R_VVV<0x700a8000>;
37106c3fb27SDimitry Andricdef VADD_W : LSX3R_VVV<0x700b0000>;
37206c3fb27SDimitry Andricdef VADD_D : LSX3R_VVV<0x700b8000>;
37306c3fb27SDimitry Andricdef VADD_Q : LSX3R_VVV<0x712d0000>;
37406c3fb27SDimitry Andric
37506c3fb27SDimitry Andricdef VSUB_B : LSX3R_VVV<0x700c0000>;
37606c3fb27SDimitry Andricdef VSUB_H : LSX3R_VVV<0x700c8000>;
37706c3fb27SDimitry Andricdef VSUB_W : LSX3R_VVV<0x700d0000>;
37806c3fb27SDimitry Andricdef VSUB_D : LSX3R_VVV<0x700d8000>;
37906c3fb27SDimitry Andricdef VSUB_Q : LSX3R_VVV<0x712d8000>;
38006c3fb27SDimitry Andric
38106c3fb27SDimitry Andricdef VADDI_BU : LSX2RI5_VVI<0x728a0000>;
38206c3fb27SDimitry Andricdef VADDI_HU : LSX2RI5_VVI<0x728a8000>;
38306c3fb27SDimitry Andricdef VADDI_WU : LSX2RI5_VVI<0x728b0000>;
38406c3fb27SDimitry Andricdef VADDI_DU : LSX2RI5_VVI<0x728b8000>;
38506c3fb27SDimitry Andric
38606c3fb27SDimitry Andricdef VSUBI_BU : LSX2RI5_VVI<0x728c0000>;
38706c3fb27SDimitry Andricdef VSUBI_HU : LSX2RI5_VVI<0x728c8000>;
38806c3fb27SDimitry Andricdef VSUBI_WU : LSX2RI5_VVI<0x728d0000>;
38906c3fb27SDimitry Andricdef VSUBI_DU : LSX2RI5_VVI<0x728d8000>;
39006c3fb27SDimitry Andric
39106c3fb27SDimitry Andricdef VNEG_B : LSX2R_VV<0x729c3000>;
39206c3fb27SDimitry Andricdef VNEG_H : LSX2R_VV<0x729c3400>;
39306c3fb27SDimitry Andricdef VNEG_W : LSX2R_VV<0x729c3800>;
39406c3fb27SDimitry Andricdef VNEG_D : LSX2R_VV<0x729c3c00>;
39506c3fb27SDimitry Andric
39606c3fb27SDimitry Andricdef VSADD_B : LSX3R_VVV<0x70460000>;
39706c3fb27SDimitry Andricdef VSADD_H : LSX3R_VVV<0x70468000>;
39806c3fb27SDimitry Andricdef VSADD_W : LSX3R_VVV<0x70470000>;
39906c3fb27SDimitry Andricdef VSADD_D : LSX3R_VVV<0x70478000>;
40006c3fb27SDimitry Andricdef VSADD_BU : LSX3R_VVV<0x704a0000>;
40106c3fb27SDimitry Andricdef VSADD_HU : LSX3R_VVV<0x704a8000>;
40206c3fb27SDimitry Andricdef VSADD_WU : LSX3R_VVV<0x704b0000>;
40306c3fb27SDimitry Andricdef VSADD_DU : LSX3R_VVV<0x704b8000>;
40406c3fb27SDimitry Andric
40506c3fb27SDimitry Andricdef VSSUB_B : LSX3R_VVV<0x70480000>;
40606c3fb27SDimitry Andricdef VSSUB_H : LSX3R_VVV<0x70488000>;
40706c3fb27SDimitry Andricdef VSSUB_W : LSX3R_VVV<0x70490000>;
40806c3fb27SDimitry Andricdef VSSUB_D : LSX3R_VVV<0x70498000>;
40906c3fb27SDimitry Andricdef VSSUB_BU : LSX3R_VVV<0x704c0000>;
41006c3fb27SDimitry Andricdef VSSUB_HU : LSX3R_VVV<0x704c8000>;
41106c3fb27SDimitry Andricdef VSSUB_WU : LSX3R_VVV<0x704d0000>;
41206c3fb27SDimitry Andricdef VSSUB_DU : LSX3R_VVV<0x704d8000>;
41306c3fb27SDimitry Andric
41406c3fb27SDimitry Andricdef VHADDW_H_B : LSX3R_VVV<0x70540000>;
41506c3fb27SDimitry Andricdef VHADDW_W_H : LSX3R_VVV<0x70548000>;
41606c3fb27SDimitry Andricdef VHADDW_D_W : LSX3R_VVV<0x70550000>;
41706c3fb27SDimitry Andricdef VHADDW_Q_D : LSX3R_VVV<0x70558000>;
41806c3fb27SDimitry Andricdef VHADDW_HU_BU : LSX3R_VVV<0x70580000>;
41906c3fb27SDimitry Andricdef VHADDW_WU_HU : LSX3R_VVV<0x70588000>;
42006c3fb27SDimitry Andricdef VHADDW_DU_WU : LSX3R_VVV<0x70590000>;
42106c3fb27SDimitry Andricdef VHADDW_QU_DU : LSX3R_VVV<0x70598000>;
42206c3fb27SDimitry Andric
42306c3fb27SDimitry Andricdef VHSUBW_H_B : LSX3R_VVV<0x70560000>;
42406c3fb27SDimitry Andricdef VHSUBW_W_H : LSX3R_VVV<0x70568000>;
42506c3fb27SDimitry Andricdef VHSUBW_D_W : LSX3R_VVV<0x70570000>;
42606c3fb27SDimitry Andricdef VHSUBW_Q_D : LSX3R_VVV<0x70578000>;
42706c3fb27SDimitry Andricdef VHSUBW_HU_BU : LSX3R_VVV<0x705a0000>;
42806c3fb27SDimitry Andricdef VHSUBW_WU_HU : LSX3R_VVV<0x705a8000>;
42906c3fb27SDimitry Andricdef VHSUBW_DU_WU : LSX3R_VVV<0x705b0000>;
43006c3fb27SDimitry Andricdef VHSUBW_QU_DU : LSX3R_VVV<0x705b8000>;
43106c3fb27SDimitry Andric
43206c3fb27SDimitry Andricdef VADDWEV_H_B : LSX3R_VVV<0x701e0000>;
43306c3fb27SDimitry Andricdef VADDWEV_W_H : LSX3R_VVV<0x701e8000>;
43406c3fb27SDimitry Andricdef VADDWEV_D_W : LSX3R_VVV<0x701f0000>;
43506c3fb27SDimitry Andricdef VADDWEV_Q_D : LSX3R_VVV<0x701f8000>;
43606c3fb27SDimitry Andricdef VADDWOD_H_B : LSX3R_VVV<0x70220000>;
43706c3fb27SDimitry Andricdef VADDWOD_W_H : LSX3R_VVV<0x70228000>;
43806c3fb27SDimitry Andricdef VADDWOD_D_W : LSX3R_VVV<0x70230000>;
43906c3fb27SDimitry Andricdef VADDWOD_Q_D : LSX3R_VVV<0x70238000>;
44006c3fb27SDimitry Andric
44106c3fb27SDimitry Andricdef VSUBWEV_H_B : LSX3R_VVV<0x70200000>;
44206c3fb27SDimitry Andricdef VSUBWEV_W_H : LSX3R_VVV<0x70208000>;
44306c3fb27SDimitry Andricdef VSUBWEV_D_W : LSX3R_VVV<0x70210000>;
44406c3fb27SDimitry Andricdef VSUBWEV_Q_D : LSX3R_VVV<0x70218000>;
44506c3fb27SDimitry Andricdef VSUBWOD_H_B : LSX3R_VVV<0x70240000>;
44606c3fb27SDimitry Andricdef VSUBWOD_W_H : LSX3R_VVV<0x70248000>;
44706c3fb27SDimitry Andricdef VSUBWOD_D_W : LSX3R_VVV<0x70250000>;
44806c3fb27SDimitry Andricdef VSUBWOD_Q_D : LSX3R_VVV<0x70258000>;
44906c3fb27SDimitry Andric
45006c3fb27SDimitry Andricdef VADDWEV_H_BU : LSX3R_VVV<0x702e0000>;
45106c3fb27SDimitry Andricdef VADDWEV_W_HU : LSX3R_VVV<0x702e8000>;
45206c3fb27SDimitry Andricdef VADDWEV_D_WU : LSX3R_VVV<0x702f0000>;
45306c3fb27SDimitry Andricdef VADDWEV_Q_DU : LSX3R_VVV<0x702f8000>;
45406c3fb27SDimitry Andricdef VADDWOD_H_BU : LSX3R_VVV<0x70320000>;
45506c3fb27SDimitry Andricdef VADDWOD_W_HU : LSX3R_VVV<0x70328000>;
45606c3fb27SDimitry Andricdef VADDWOD_D_WU : LSX3R_VVV<0x70330000>;
45706c3fb27SDimitry Andricdef VADDWOD_Q_DU : LSX3R_VVV<0x70338000>;
45806c3fb27SDimitry Andric
45906c3fb27SDimitry Andricdef VSUBWEV_H_BU : LSX3R_VVV<0x70300000>;
46006c3fb27SDimitry Andricdef VSUBWEV_W_HU : LSX3R_VVV<0x70308000>;
46106c3fb27SDimitry Andricdef VSUBWEV_D_WU : LSX3R_VVV<0x70310000>;
46206c3fb27SDimitry Andricdef VSUBWEV_Q_DU : LSX3R_VVV<0x70318000>;
46306c3fb27SDimitry Andricdef VSUBWOD_H_BU : LSX3R_VVV<0x70340000>;
46406c3fb27SDimitry Andricdef VSUBWOD_W_HU : LSX3R_VVV<0x70348000>;
46506c3fb27SDimitry Andricdef VSUBWOD_D_WU : LSX3R_VVV<0x70350000>;
46606c3fb27SDimitry Andricdef VSUBWOD_Q_DU : LSX3R_VVV<0x70358000>;
46706c3fb27SDimitry Andric
46806c3fb27SDimitry Andricdef VADDWEV_H_BU_B : LSX3R_VVV<0x703e0000>;
46906c3fb27SDimitry Andricdef VADDWEV_W_HU_H : LSX3R_VVV<0x703e8000>;
47006c3fb27SDimitry Andricdef VADDWEV_D_WU_W : LSX3R_VVV<0x703f0000>;
47106c3fb27SDimitry Andricdef VADDWEV_Q_DU_D : LSX3R_VVV<0x703f8000>;
47206c3fb27SDimitry Andricdef VADDWOD_H_BU_B : LSX3R_VVV<0x70400000>;
47306c3fb27SDimitry Andricdef VADDWOD_W_HU_H : LSX3R_VVV<0x70408000>;
47406c3fb27SDimitry Andricdef VADDWOD_D_WU_W : LSX3R_VVV<0x70410000>;
47506c3fb27SDimitry Andricdef VADDWOD_Q_DU_D : LSX3R_VVV<0x70418000>;
47606c3fb27SDimitry Andric
47706c3fb27SDimitry Andricdef VAVG_B : LSX3R_VVV<0x70640000>;
47806c3fb27SDimitry Andricdef VAVG_H : LSX3R_VVV<0x70648000>;
47906c3fb27SDimitry Andricdef VAVG_W : LSX3R_VVV<0x70650000>;
48006c3fb27SDimitry Andricdef VAVG_D : LSX3R_VVV<0x70658000>;
48106c3fb27SDimitry Andricdef VAVG_BU : LSX3R_VVV<0x70660000>;
48206c3fb27SDimitry Andricdef VAVG_HU : LSX3R_VVV<0x70668000>;
48306c3fb27SDimitry Andricdef VAVG_WU : LSX3R_VVV<0x70670000>;
48406c3fb27SDimitry Andricdef VAVG_DU : LSX3R_VVV<0x70678000>;
48506c3fb27SDimitry Andricdef VAVGR_B : LSX3R_VVV<0x70680000>;
48606c3fb27SDimitry Andricdef VAVGR_H : LSX3R_VVV<0x70688000>;
48706c3fb27SDimitry Andricdef VAVGR_W : LSX3R_VVV<0x70690000>;
48806c3fb27SDimitry Andricdef VAVGR_D : LSX3R_VVV<0x70698000>;
48906c3fb27SDimitry Andricdef VAVGR_BU : LSX3R_VVV<0x706a0000>;
49006c3fb27SDimitry Andricdef VAVGR_HU : LSX3R_VVV<0x706a8000>;
49106c3fb27SDimitry Andricdef VAVGR_WU : LSX3R_VVV<0x706b0000>;
49206c3fb27SDimitry Andricdef VAVGR_DU : LSX3R_VVV<0x706b8000>;
49306c3fb27SDimitry Andric
49406c3fb27SDimitry Andricdef VABSD_B : LSX3R_VVV<0x70600000>;
49506c3fb27SDimitry Andricdef VABSD_H : LSX3R_VVV<0x70608000>;
49606c3fb27SDimitry Andricdef VABSD_W : LSX3R_VVV<0x70610000>;
49706c3fb27SDimitry Andricdef VABSD_D : LSX3R_VVV<0x70618000>;
49806c3fb27SDimitry Andricdef VABSD_BU : LSX3R_VVV<0x70620000>;
49906c3fb27SDimitry Andricdef VABSD_HU : LSX3R_VVV<0x70628000>;
50006c3fb27SDimitry Andricdef VABSD_WU : LSX3R_VVV<0x70630000>;
50106c3fb27SDimitry Andricdef VABSD_DU : LSX3R_VVV<0x70638000>;
50206c3fb27SDimitry Andric
50306c3fb27SDimitry Andricdef VADDA_B : LSX3R_VVV<0x705c0000>;
50406c3fb27SDimitry Andricdef VADDA_H : LSX3R_VVV<0x705c8000>;
50506c3fb27SDimitry Andricdef VADDA_W : LSX3R_VVV<0x705d0000>;
50606c3fb27SDimitry Andricdef VADDA_D : LSX3R_VVV<0x705d8000>;
50706c3fb27SDimitry Andric
50806c3fb27SDimitry Andricdef VMAX_B : LSX3R_VVV<0x70700000>;
50906c3fb27SDimitry Andricdef VMAX_H : LSX3R_VVV<0x70708000>;
51006c3fb27SDimitry Andricdef VMAX_W : LSX3R_VVV<0x70710000>;
51106c3fb27SDimitry Andricdef VMAX_D : LSX3R_VVV<0x70718000>;
51206c3fb27SDimitry Andricdef VMAXI_B : LSX2RI5_VVI<0x72900000, simm5>;
51306c3fb27SDimitry Andricdef VMAXI_H : LSX2RI5_VVI<0x72908000, simm5>;
51406c3fb27SDimitry Andricdef VMAXI_W : LSX2RI5_VVI<0x72910000, simm5>;
51506c3fb27SDimitry Andricdef VMAXI_D : LSX2RI5_VVI<0x72918000, simm5>;
51606c3fb27SDimitry Andricdef VMAX_BU : LSX3R_VVV<0x70740000>;
51706c3fb27SDimitry Andricdef VMAX_HU : LSX3R_VVV<0x70748000>;
51806c3fb27SDimitry Andricdef VMAX_WU : LSX3R_VVV<0x70750000>;
51906c3fb27SDimitry Andricdef VMAX_DU : LSX3R_VVV<0x70758000>;
52006c3fb27SDimitry Andricdef VMAXI_BU : LSX2RI5_VVI<0x72940000>;
52106c3fb27SDimitry Andricdef VMAXI_HU : LSX2RI5_VVI<0x72948000>;
52206c3fb27SDimitry Andricdef VMAXI_WU : LSX2RI5_VVI<0x72950000>;
52306c3fb27SDimitry Andricdef VMAXI_DU : LSX2RI5_VVI<0x72958000>;
52406c3fb27SDimitry Andric
52506c3fb27SDimitry Andricdef VMIN_B : LSX3R_VVV<0x70720000>;
52606c3fb27SDimitry Andricdef VMIN_H : LSX3R_VVV<0x70728000>;
52706c3fb27SDimitry Andricdef VMIN_W : LSX3R_VVV<0x70730000>;
52806c3fb27SDimitry Andricdef VMIN_D : LSX3R_VVV<0x70738000>;
52906c3fb27SDimitry Andricdef VMINI_B : LSX2RI5_VVI<0x72920000, simm5>;
53006c3fb27SDimitry Andricdef VMINI_H : LSX2RI5_VVI<0x72928000, simm5>;
53106c3fb27SDimitry Andricdef VMINI_W : LSX2RI5_VVI<0x72930000, simm5>;
53206c3fb27SDimitry Andricdef VMINI_D : LSX2RI5_VVI<0x72938000, simm5>;
53306c3fb27SDimitry Andricdef VMIN_BU : LSX3R_VVV<0x70760000>;
53406c3fb27SDimitry Andricdef VMIN_HU : LSX3R_VVV<0x70768000>;
53506c3fb27SDimitry Andricdef VMIN_WU : LSX3R_VVV<0x70770000>;
53606c3fb27SDimitry Andricdef VMIN_DU : LSX3R_VVV<0x70778000>;
53706c3fb27SDimitry Andricdef VMINI_BU : LSX2RI5_VVI<0x72960000>;
53806c3fb27SDimitry Andricdef VMINI_HU : LSX2RI5_VVI<0x72968000>;
53906c3fb27SDimitry Andricdef VMINI_WU : LSX2RI5_VVI<0x72970000>;
54006c3fb27SDimitry Andricdef VMINI_DU : LSX2RI5_VVI<0x72978000>;
54106c3fb27SDimitry Andric
54206c3fb27SDimitry Andricdef VMUL_B : LSX3R_VVV<0x70840000>;
54306c3fb27SDimitry Andricdef VMUL_H : LSX3R_VVV<0x70848000>;
54406c3fb27SDimitry Andricdef VMUL_W : LSX3R_VVV<0x70850000>;
54506c3fb27SDimitry Andricdef VMUL_D : LSX3R_VVV<0x70858000>;
54606c3fb27SDimitry Andric
54706c3fb27SDimitry Andricdef VMUH_B : LSX3R_VVV<0x70860000>;
54806c3fb27SDimitry Andricdef VMUH_H : LSX3R_VVV<0x70868000>;
54906c3fb27SDimitry Andricdef VMUH_W : LSX3R_VVV<0x70870000>;
55006c3fb27SDimitry Andricdef VMUH_D : LSX3R_VVV<0x70878000>;
55106c3fb27SDimitry Andricdef VMUH_BU : LSX3R_VVV<0x70880000>;
55206c3fb27SDimitry Andricdef VMUH_HU : LSX3R_VVV<0x70888000>;
55306c3fb27SDimitry Andricdef VMUH_WU : LSX3R_VVV<0x70890000>;
55406c3fb27SDimitry Andricdef VMUH_DU : LSX3R_VVV<0x70898000>;
55506c3fb27SDimitry Andric
55606c3fb27SDimitry Andricdef VMULWEV_H_B : LSX3R_VVV<0x70900000>;
55706c3fb27SDimitry Andricdef VMULWEV_W_H : LSX3R_VVV<0x70908000>;
55806c3fb27SDimitry Andricdef VMULWEV_D_W : LSX3R_VVV<0x70910000>;
55906c3fb27SDimitry Andricdef VMULWEV_Q_D : LSX3R_VVV<0x70918000>;
56006c3fb27SDimitry Andricdef VMULWOD_H_B : LSX3R_VVV<0x70920000>;
56106c3fb27SDimitry Andricdef VMULWOD_W_H : LSX3R_VVV<0x70928000>;
56206c3fb27SDimitry Andricdef VMULWOD_D_W : LSX3R_VVV<0x70930000>;
56306c3fb27SDimitry Andricdef VMULWOD_Q_D : LSX3R_VVV<0x70938000>;
56406c3fb27SDimitry Andricdef VMULWEV_H_BU : LSX3R_VVV<0x70980000>;
56506c3fb27SDimitry Andricdef VMULWEV_W_HU : LSX3R_VVV<0x70988000>;
56606c3fb27SDimitry Andricdef VMULWEV_D_WU : LSX3R_VVV<0x70990000>;
56706c3fb27SDimitry Andricdef VMULWEV_Q_DU : LSX3R_VVV<0x70998000>;
56806c3fb27SDimitry Andricdef VMULWOD_H_BU : LSX3R_VVV<0x709a0000>;
56906c3fb27SDimitry Andricdef VMULWOD_W_HU : LSX3R_VVV<0x709a8000>;
57006c3fb27SDimitry Andricdef VMULWOD_D_WU : LSX3R_VVV<0x709b0000>;
57106c3fb27SDimitry Andricdef VMULWOD_Q_DU : LSX3R_VVV<0x709b8000>;
57206c3fb27SDimitry Andricdef VMULWEV_H_BU_B : LSX3R_VVV<0x70a00000>;
57306c3fb27SDimitry Andricdef VMULWEV_W_HU_H : LSX3R_VVV<0x70a08000>;
57406c3fb27SDimitry Andricdef VMULWEV_D_WU_W : LSX3R_VVV<0x70a10000>;
57506c3fb27SDimitry Andricdef VMULWEV_Q_DU_D : LSX3R_VVV<0x70a18000>;
57606c3fb27SDimitry Andricdef VMULWOD_H_BU_B : LSX3R_VVV<0x70a20000>;
57706c3fb27SDimitry Andricdef VMULWOD_W_HU_H : LSX3R_VVV<0x70a28000>;
57806c3fb27SDimitry Andricdef VMULWOD_D_WU_W : LSX3R_VVV<0x70a30000>;
57906c3fb27SDimitry Andricdef VMULWOD_Q_DU_D : LSX3R_VVV<0x70a38000>;
58006c3fb27SDimitry Andric
58106c3fb27SDimitry Andricdef VMADD_B : LSX3R_VVVV<0x70a80000>;
58206c3fb27SDimitry Andricdef VMADD_H : LSX3R_VVVV<0x70a88000>;
58306c3fb27SDimitry Andricdef VMADD_W : LSX3R_VVVV<0x70a90000>;
58406c3fb27SDimitry Andricdef VMADD_D : LSX3R_VVVV<0x70a98000>;
58506c3fb27SDimitry Andric
58606c3fb27SDimitry Andricdef VMSUB_B : LSX3R_VVVV<0x70aa0000>;
58706c3fb27SDimitry Andricdef VMSUB_H : LSX3R_VVVV<0x70aa8000>;
58806c3fb27SDimitry Andricdef VMSUB_W : LSX3R_VVVV<0x70ab0000>;
58906c3fb27SDimitry Andricdef VMSUB_D : LSX3R_VVVV<0x70ab8000>;
59006c3fb27SDimitry Andric
59106c3fb27SDimitry Andricdef VMADDWEV_H_B : LSX3R_VVVV<0x70ac0000>;
59206c3fb27SDimitry Andricdef VMADDWEV_W_H : LSX3R_VVVV<0x70ac8000>;
59306c3fb27SDimitry Andricdef VMADDWEV_D_W : LSX3R_VVVV<0x70ad0000>;
59406c3fb27SDimitry Andricdef VMADDWEV_Q_D : LSX3R_VVVV<0x70ad8000>;
59506c3fb27SDimitry Andricdef VMADDWOD_H_B : LSX3R_VVVV<0x70ae0000>;
59606c3fb27SDimitry Andricdef VMADDWOD_W_H : LSX3R_VVVV<0x70ae8000>;
59706c3fb27SDimitry Andricdef VMADDWOD_D_W : LSX3R_VVVV<0x70af0000>;
59806c3fb27SDimitry Andricdef VMADDWOD_Q_D : LSX3R_VVVV<0x70af8000>;
59906c3fb27SDimitry Andricdef VMADDWEV_H_BU : LSX3R_VVVV<0x70b40000>;
60006c3fb27SDimitry Andricdef VMADDWEV_W_HU : LSX3R_VVVV<0x70b48000>;
60106c3fb27SDimitry Andricdef VMADDWEV_D_WU : LSX3R_VVVV<0x70b50000>;
60206c3fb27SDimitry Andricdef VMADDWEV_Q_DU : LSX3R_VVVV<0x70b58000>;
60306c3fb27SDimitry Andricdef VMADDWOD_H_BU : LSX3R_VVVV<0x70b60000>;
60406c3fb27SDimitry Andricdef VMADDWOD_W_HU : LSX3R_VVVV<0x70b68000>;
60506c3fb27SDimitry Andricdef VMADDWOD_D_WU : LSX3R_VVVV<0x70b70000>;
60606c3fb27SDimitry Andricdef VMADDWOD_Q_DU : LSX3R_VVVV<0x70b78000>;
60706c3fb27SDimitry Andricdef VMADDWEV_H_BU_B : LSX3R_VVVV<0x70bc0000>;
60806c3fb27SDimitry Andricdef VMADDWEV_W_HU_H : LSX3R_VVVV<0x70bc8000>;
60906c3fb27SDimitry Andricdef VMADDWEV_D_WU_W : LSX3R_VVVV<0x70bd0000>;
61006c3fb27SDimitry Andricdef VMADDWEV_Q_DU_D : LSX3R_VVVV<0x70bd8000>;
61106c3fb27SDimitry Andricdef VMADDWOD_H_BU_B : LSX3R_VVVV<0x70be0000>;
61206c3fb27SDimitry Andricdef VMADDWOD_W_HU_H : LSX3R_VVVV<0x70be8000>;
61306c3fb27SDimitry Andricdef VMADDWOD_D_WU_W : LSX3R_VVVV<0x70bf0000>;
61406c3fb27SDimitry Andricdef VMADDWOD_Q_DU_D : LSX3R_VVVV<0x70bf8000>;
61506c3fb27SDimitry Andric
61606c3fb27SDimitry Andricdef VDIV_B : LSX3R_VVV<0x70e00000>;
61706c3fb27SDimitry Andricdef VDIV_H : LSX3R_VVV<0x70e08000>;
61806c3fb27SDimitry Andricdef VDIV_W : LSX3R_VVV<0x70e10000>;
61906c3fb27SDimitry Andricdef VDIV_D : LSX3R_VVV<0x70e18000>;
62006c3fb27SDimitry Andricdef VDIV_BU : LSX3R_VVV<0x70e40000>;
62106c3fb27SDimitry Andricdef VDIV_HU : LSX3R_VVV<0x70e48000>;
62206c3fb27SDimitry Andricdef VDIV_WU : LSX3R_VVV<0x70e50000>;
62306c3fb27SDimitry Andricdef VDIV_DU : LSX3R_VVV<0x70e58000>;
62406c3fb27SDimitry Andric
62506c3fb27SDimitry Andricdef VMOD_B : LSX3R_VVV<0x70e20000>;
62606c3fb27SDimitry Andricdef VMOD_H : LSX3R_VVV<0x70e28000>;
62706c3fb27SDimitry Andricdef VMOD_W : LSX3R_VVV<0x70e30000>;
62806c3fb27SDimitry Andricdef VMOD_D : LSX3R_VVV<0x70e38000>;
62906c3fb27SDimitry Andricdef VMOD_BU : LSX3R_VVV<0x70e60000>;
63006c3fb27SDimitry Andricdef VMOD_HU : LSX3R_VVV<0x70e68000>;
63106c3fb27SDimitry Andricdef VMOD_WU : LSX3R_VVV<0x70e70000>;
63206c3fb27SDimitry Andricdef VMOD_DU : LSX3R_VVV<0x70e78000>;
63306c3fb27SDimitry Andric
63406c3fb27SDimitry Andricdef VSAT_B : LSX2RI3_VVI<0x73242000>;
63506c3fb27SDimitry Andricdef VSAT_H : LSX2RI4_VVI<0x73244000>;
63606c3fb27SDimitry Andricdef VSAT_W : LSX2RI5_VVI<0x73248000>;
63706c3fb27SDimitry Andricdef VSAT_D : LSX2RI6_VVI<0x73250000>;
63806c3fb27SDimitry Andricdef VSAT_BU : LSX2RI3_VVI<0x73282000>;
63906c3fb27SDimitry Andricdef VSAT_HU : LSX2RI4_VVI<0x73284000>;
64006c3fb27SDimitry Andricdef VSAT_WU : LSX2RI5_VVI<0x73288000>;
64106c3fb27SDimitry Andricdef VSAT_DU : LSX2RI6_VVI<0x73290000>;
64206c3fb27SDimitry Andric
64306c3fb27SDimitry Andricdef VEXTH_H_B : LSX2R_VV<0x729ee000>;
64406c3fb27SDimitry Andricdef VEXTH_W_H : LSX2R_VV<0x729ee400>;
64506c3fb27SDimitry Andricdef VEXTH_D_W : LSX2R_VV<0x729ee800>;
64606c3fb27SDimitry Andricdef VEXTH_Q_D : LSX2R_VV<0x729eec00>;
64706c3fb27SDimitry Andricdef VEXTH_HU_BU : LSX2R_VV<0x729ef000>;
64806c3fb27SDimitry Andricdef VEXTH_WU_HU : LSX2R_VV<0x729ef400>;
64906c3fb27SDimitry Andricdef VEXTH_DU_WU : LSX2R_VV<0x729ef800>;
65006c3fb27SDimitry Andricdef VEXTH_QU_DU : LSX2R_VV<0x729efc00>;
65106c3fb27SDimitry Andric
65206c3fb27SDimitry Andricdef VSIGNCOV_B : LSX3R_VVV<0x712e0000>;
65306c3fb27SDimitry Andricdef VSIGNCOV_H : LSX3R_VVV<0x712e8000>;
65406c3fb27SDimitry Andricdef VSIGNCOV_W : LSX3R_VVV<0x712f0000>;
65506c3fb27SDimitry Andricdef VSIGNCOV_D : LSX3R_VVV<0x712f8000>;
65606c3fb27SDimitry Andric
65706c3fb27SDimitry Andricdef VMSKLTZ_B : LSX2R_VV<0x729c4000>;
65806c3fb27SDimitry Andricdef VMSKLTZ_H : LSX2R_VV<0x729c4400>;
65906c3fb27SDimitry Andricdef VMSKLTZ_W : LSX2R_VV<0x729c4800>;
66006c3fb27SDimitry Andricdef VMSKLTZ_D : LSX2R_VV<0x729c4c00>;
66106c3fb27SDimitry Andric
66206c3fb27SDimitry Andricdef VMSKGEZ_B : LSX2R_VV<0x729c5000>;
66306c3fb27SDimitry Andric
66406c3fb27SDimitry Andricdef VMSKNZ_B : LSX2R_VV<0x729c6000>;
66506c3fb27SDimitry Andric
66606c3fb27SDimitry Andricdef VLDI : LSX1RI13_VI<0x73e00000>;
66706c3fb27SDimitry Andric
66806c3fb27SDimitry Andricdef VAND_V : LSX3R_VVV<0x71260000>;
66906c3fb27SDimitry Andricdef VOR_V : LSX3R_VVV<0x71268000>;
67006c3fb27SDimitry Andricdef VXOR_V : LSX3R_VVV<0x71270000>;
67106c3fb27SDimitry Andricdef VNOR_V : LSX3R_VVV<0x71278000>;
67206c3fb27SDimitry Andricdef VANDN_V : LSX3R_VVV<0x71280000>;
67306c3fb27SDimitry Andricdef VORN_V : LSX3R_VVV<0x71288000>;
67406c3fb27SDimitry Andric
67506c3fb27SDimitry Andricdef VANDI_B : LSX2RI8_VVI<0x73d00000>;
67606c3fb27SDimitry Andricdef VORI_B : LSX2RI8_VVI<0x73d40000>;
67706c3fb27SDimitry Andricdef VXORI_B : LSX2RI8_VVI<0x73d80000>;
67806c3fb27SDimitry Andricdef VNORI_B : LSX2RI8_VVI<0x73dc0000>;
67906c3fb27SDimitry Andric
68006c3fb27SDimitry Andricdef VSLL_B : LSX3R_VVV<0x70e80000>;
68106c3fb27SDimitry Andricdef VSLL_H : LSX3R_VVV<0x70e88000>;
68206c3fb27SDimitry Andricdef VSLL_W : LSX3R_VVV<0x70e90000>;
68306c3fb27SDimitry Andricdef VSLL_D : LSX3R_VVV<0x70e98000>;
68406c3fb27SDimitry Andricdef VSLLI_B : LSX2RI3_VVI<0x732c2000>;
68506c3fb27SDimitry Andricdef VSLLI_H : LSX2RI4_VVI<0x732c4000>;
68606c3fb27SDimitry Andricdef VSLLI_W : LSX2RI5_VVI<0x732c8000>;
68706c3fb27SDimitry Andricdef VSLLI_D : LSX2RI6_VVI<0x732d0000>;
68806c3fb27SDimitry Andric
68906c3fb27SDimitry Andricdef VSRL_B : LSX3R_VVV<0x70ea0000>;
69006c3fb27SDimitry Andricdef VSRL_H : LSX3R_VVV<0x70ea8000>;
69106c3fb27SDimitry Andricdef VSRL_W : LSX3R_VVV<0x70eb0000>;
69206c3fb27SDimitry Andricdef VSRL_D : LSX3R_VVV<0x70eb8000>;
69306c3fb27SDimitry Andricdef VSRLI_B : LSX2RI3_VVI<0x73302000>;
69406c3fb27SDimitry Andricdef VSRLI_H : LSX2RI4_VVI<0x73304000>;
69506c3fb27SDimitry Andricdef VSRLI_W : LSX2RI5_VVI<0x73308000>;
69606c3fb27SDimitry Andricdef VSRLI_D : LSX2RI6_VVI<0x73310000>;
69706c3fb27SDimitry Andric
69806c3fb27SDimitry Andricdef VSRA_B : LSX3R_VVV<0x70ec0000>;
69906c3fb27SDimitry Andricdef VSRA_H : LSX3R_VVV<0x70ec8000>;
70006c3fb27SDimitry Andricdef VSRA_W : LSX3R_VVV<0x70ed0000>;
70106c3fb27SDimitry Andricdef VSRA_D : LSX3R_VVV<0x70ed8000>;
70206c3fb27SDimitry Andricdef VSRAI_B : LSX2RI3_VVI<0x73342000>;
70306c3fb27SDimitry Andricdef VSRAI_H : LSX2RI4_VVI<0x73344000>;
70406c3fb27SDimitry Andricdef VSRAI_W : LSX2RI5_VVI<0x73348000>;
70506c3fb27SDimitry Andricdef VSRAI_D : LSX2RI6_VVI<0x73350000>;
70606c3fb27SDimitry Andric
70706c3fb27SDimitry Andricdef VROTR_B : LSX3R_VVV<0x70ee0000>;
70806c3fb27SDimitry Andricdef VROTR_H : LSX3R_VVV<0x70ee8000>;
70906c3fb27SDimitry Andricdef VROTR_W : LSX3R_VVV<0x70ef0000>;
71006c3fb27SDimitry Andricdef VROTR_D : LSX3R_VVV<0x70ef8000>;
71106c3fb27SDimitry Andricdef VROTRI_B : LSX2RI3_VVI<0x72a02000>;
71206c3fb27SDimitry Andricdef VROTRI_H : LSX2RI4_VVI<0x72a04000>;
71306c3fb27SDimitry Andricdef VROTRI_W : LSX2RI5_VVI<0x72a08000>;
71406c3fb27SDimitry Andricdef VROTRI_D : LSX2RI6_VVI<0x72a10000>;
71506c3fb27SDimitry Andric
71606c3fb27SDimitry Andricdef VSLLWIL_H_B : LSX2RI3_VVI<0x73082000>;
71706c3fb27SDimitry Andricdef VSLLWIL_W_H : LSX2RI4_VVI<0x73084000>;
71806c3fb27SDimitry Andricdef VSLLWIL_D_W : LSX2RI5_VVI<0x73088000>;
71906c3fb27SDimitry Andricdef VEXTL_Q_D : LSX2R_VV<0x73090000>;
72006c3fb27SDimitry Andricdef VSLLWIL_HU_BU : LSX2RI3_VVI<0x730c2000>;
72106c3fb27SDimitry Andricdef VSLLWIL_WU_HU : LSX2RI4_VVI<0x730c4000>;
72206c3fb27SDimitry Andricdef VSLLWIL_DU_WU : LSX2RI5_VVI<0x730c8000>;
72306c3fb27SDimitry Andricdef VEXTL_QU_DU : LSX2R_VV<0x730d0000>;
72406c3fb27SDimitry Andric
72506c3fb27SDimitry Andricdef VSRLR_B : LSX3R_VVV<0x70f00000>;
72606c3fb27SDimitry Andricdef VSRLR_H : LSX3R_VVV<0x70f08000>;
72706c3fb27SDimitry Andricdef VSRLR_W : LSX3R_VVV<0x70f10000>;
72806c3fb27SDimitry Andricdef VSRLR_D : LSX3R_VVV<0x70f18000>;
72906c3fb27SDimitry Andricdef VSRLRI_B : LSX2RI3_VVI<0x72a42000>;
73006c3fb27SDimitry Andricdef VSRLRI_H : LSX2RI4_VVI<0x72a44000>;
73106c3fb27SDimitry Andricdef VSRLRI_W : LSX2RI5_VVI<0x72a48000>;
73206c3fb27SDimitry Andricdef VSRLRI_D : LSX2RI6_VVI<0x72a50000>;
73306c3fb27SDimitry Andric
73406c3fb27SDimitry Andricdef VSRAR_B : LSX3R_VVV<0x70f20000>;
73506c3fb27SDimitry Andricdef VSRAR_H : LSX3R_VVV<0x70f28000>;
73606c3fb27SDimitry Andricdef VSRAR_W : LSX3R_VVV<0x70f30000>;
73706c3fb27SDimitry Andricdef VSRAR_D : LSX3R_VVV<0x70f38000>;
73806c3fb27SDimitry Andricdef VSRARI_B : LSX2RI3_VVI<0x72a82000>;
73906c3fb27SDimitry Andricdef VSRARI_H : LSX2RI4_VVI<0x72a84000>;
74006c3fb27SDimitry Andricdef VSRARI_W : LSX2RI5_VVI<0x72a88000>;
74106c3fb27SDimitry Andricdef VSRARI_D : LSX2RI6_VVI<0x72a90000>;
74206c3fb27SDimitry Andric
74306c3fb27SDimitry Andricdef VSRLN_B_H : LSX3R_VVV<0x70f48000>;
74406c3fb27SDimitry Andricdef VSRLN_H_W : LSX3R_VVV<0x70f50000>;
74506c3fb27SDimitry Andricdef VSRLN_W_D : LSX3R_VVV<0x70f58000>;
74606c3fb27SDimitry Andricdef VSRAN_B_H : LSX3R_VVV<0x70f68000>;
74706c3fb27SDimitry Andricdef VSRAN_H_W : LSX3R_VVV<0x70f70000>;
74806c3fb27SDimitry Andricdef VSRAN_W_D : LSX3R_VVV<0x70f78000>;
74906c3fb27SDimitry Andric
75006c3fb27SDimitry Andricdef VSRLNI_B_H : LSX2RI4_VVVI<0x73404000>;
75106c3fb27SDimitry Andricdef VSRLNI_H_W : LSX2RI5_VVVI<0x73408000>;
75206c3fb27SDimitry Andricdef VSRLNI_W_D : LSX2RI6_VVVI<0x73410000>;
75306c3fb27SDimitry Andricdef VSRLNI_D_Q : LSX2RI7_VVVI<0x73420000>;
75406c3fb27SDimitry Andricdef VSRANI_B_H : LSX2RI4_VVVI<0x73584000>;
75506c3fb27SDimitry Andricdef VSRANI_H_W : LSX2RI5_VVVI<0x73588000>;
75606c3fb27SDimitry Andricdef VSRANI_W_D : LSX2RI6_VVVI<0x73590000>;
75706c3fb27SDimitry Andricdef VSRANI_D_Q : LSX2RI7_VVVI<0x735a0000>;
75806c3fb27SDimitry Andric
75906c3fb27SDimitry Andricdef VSRLRN_B_H : LSX3R_VVV<0x70f88000>;
76006c3fb27SDimitry Andricdef VSRLRN_H_W : LSX3R_VVV<0x70f90000>;
76106c3fb27SDimitry Andricdef VSRLRN_W_D : LSX3R_VVV<0x70f98000>;
76206c3fb27SDimitry Andricdef VSRARN_B_H : LSX3R_VVV<0x70fa8000>;
76306c3fb27SDimitry Andricdef VSRARN_H_W : LSX3R_VVV<0x70fb0000>;
76406c3fb27SDimitry Andricdef VSRARN_W_D : LSX3R_VVV<0x70fb8000>;
76506c3fb27SDimitry Andric
76606c3fb27SDimitry Andricdef VSRLRNI_B_H : LSX2RI4_VVVI<0x73444000>;
76706c3fb27SDimitry Andricdef VSRLRNI_H_W : LSX2RI5_VVVI<0x73448000>;
76806c3fb27SDimitry Andricdef VSRLRNI_W_D : LSX2RI6_VVVI<0x73450000>;
76906c3fb27SDimitry Andricdef VSRLRNI_D_Q : LSX2RI7_VVVI<0x73460000>;
77006c3fb27SDimitry Andricdef VSRARNI_B_H : LSX2RI4_VVVI<0x735c4000>;
77106c3fb27SDimitry Andricdef VSRARNI_H_W : LSX2RI5_VVVI<0x735c8000>;
77206c3fb27SDimitry Andricdef VSRARNI_W_D : LSX2RI6_VVVI<0x735d0000>;
77306c3fb27SDimitry Andricdef VSRARNI_D_Q : LSX2RI7_VVVI<0x735e0000>;
77406c3fb27SDimitry Andric
77506c3fb27SDimitry Andricdef VSSRLN_B_H : LSX3R_VVV<0x70fc8000>;
77606c3fb27SDimitry Andricdef VSSRLN_H_W : LSX3R_VVV<0x70fd0000>;
77706c3fb27SDimitry Andricdef VSSRLN_W_D : LSX3R_VVV<0x70fd8000>;
77806c3fb27SDimitry Andricdef VSSRAN_B_H : LSX3R_VVV<0x70fe8000>;
77906c3fb27SDimitry Andricdef VSSRAN_H_W : LSX3R_VVV<0x70ff0000>;
78006c3fb27SDimitry Andricdef VSSRAN_W_D : LSX3R_VVV<0x70ff8000>;
78106c3fb27SDimitry Andricdef VSSRLN_BU_H : LSX3R_VVV<0x71048000>;
78206c3fb27SDimitry Andricdef VSSRLN_HU_W : LSX3R_VVV<0x71050000>;
78306c3fb27SDimitry Andricdef VSSRLN_WU_D : LSX3R_VVV<0x71058000>;
78406c3fb27SDimitry Andricdef VSSRAN_BU_H : LSX3R_VVV<0x71068000>;
78506c3fb27SDimitry Andricdef VSSRAN_HU_W : LSX3R_VVV<0x71070000>;
78606c3fb27SDimitry Andricdef VSSRAN_WU_D : LSX3R_VVV<0x71078000>;
78706c3fb27SDimitry Andric
78806c3fb27SDimitry Andricdef VSSRLNI_B_H : LSX2RI4_VVVI<0x73484000>;
78906c3fb27SDimitry Andricdef VSSRLNI_H_W : LSX2RI5_VVVI<0x73488000>;
79006c3fb27SDimitry Andricdef VSSRLNI_W_D : LSX2RI6_VVVI<0x73490000>;
79106c3fb27SDimitry Andricdef VSSRLNI_D_Q : LSX2RI7_VVVI<0x734a0000>;
79206c3fb27SDimitry Andricdef VSSRANI_B_H : LSX2RI4_VVVI<0x73604000>;
79306c3fb27SDimitry Andricdef VSSRANI_H_W : LSX2RI5_VVVI<0x73608000>;
79406c3fb27SDimitry Andricdef VSSRANI_W_D : LSX2RI6_VVVI<0x73610000>;
79506c3fb27SDimitry Andricdef VSSRANI_D_Q : LSX2RI7_VVVI<0x73620000>;
79606c3fb27SDimitry Andricdef VSSRLNI_BU_H : LSX2RI4_VVVI<0x734c4000>;
79706c3fb27SDimitry Andricdef VSSRLNI_HU_W : LSX2RI5_VVVI<0x734c8000>;
79806c3fb27SDimitry Andricdef VSSRLNI_WU_D : LSX2RI6_VVVI<0x734d0000>;
79906c3fb27SDimitry Andricdef VSSRLNI_DU_Q : LSX2RI7_VVVI<0x734e0000>;
80006c3fb27SDimitry Andricdef VSSRANI_BU_H : LSX2RI4_VVVI<0x73644000>;
80106c3fb27SDimitry Andricdef VSSRANI_HU_W : LSX2RI5_VVVI<0x73648000>;
80206c3fb27SDimitry Andricdef VSSRANI_WU_D : LSX2RI6_VVVI<0x73650000>;
80306c3fb27SDimitry Andricdef VSSRANI_DU_Q : LSX2RI7_VVVI<0x73660000>;
80406c3fb27SDimitry Andric
80506c3fb27SDimitry Andricdef VSSRLRN_B_H : LSX3R_VVV<0x71008000>;
80606c3fb27SDimitry Andricdef VSSRLRN_H_W : LSX3R_VVV<0x71010000>;
80706c3fb27SDimitry Andricdef VSSRLRN_W_D : LSX3R_VVV<0x71018000>;
80806c3fb27SDimitry Andricdef VSSRARN_B_H : LSX3R_VVV<0x71028000>;
80906c3fb27SDimitry Andricdef VSSRARN_H_W : LSX3R_VVV<0x71030000>;
81006c3fb27SDimitry Andricdef VSSRARN_W_D : LSX3R_VVV<0x71038000>;
81106c3fb27SDimitry Andricdef VSSRLRN_BU_H : LSX3R_VVV<0x71088000>;
81206c3fb27SDimitry Andricdef VSSRLRN_HU_W : LSX3R_VVV<0x71090000>;
81306c3fb27SDimitry Andricdef VSSRLRN_WU_D : LSX3R_VVV<0x71098000>;
81406c3fb27SDimitry Andricdef VSSRARN_BU_H : LSX3R_VVV<0x710a8000>;
81506c3fb27SDimitry Andricdef VSSRARN_HU_W : LSX3R_VVV<0x710b0000>;
81606c3fb27SDimitry Andricdef VSSRARN_WU_D : LSX3R_VVV<0x710b8000>;
81706c3fb27SDimitry Andric
81806c3fb27SDimitry Andricdef VSSRLRNI_B_H : LSX2RI4_VVVI<0x73504000>;
81906c3fb27SDimitry Andricdef VSSRLRNI_H_W : LSX2RI5_VVVI<0x73508000>;
82006c3fb27SDimitry Andricdef VSSRLRNI_W_D : LSX2RI6_VVVI<0x73510000>;
82106c3fb27SDimitry Andricdef VSSRLRNI_D_Q : LSX2RI7_VVVI<0x73520000>;
82206c3fb27SDimitry Andricdef VSSRARNI_B_H : LSX2RI4_VVVI<0x73684000>;
82306c3fb27SDimitry Andricdef VSSRARNI_H_W : LSX2RI5_VVVI<0x73688000>;
82406c3fb27SDimitry Andricdef VSSRARNI_W_D : LSX2RI6_VVVI<0x73690000>;
82506c3fb27SDimitry Andricdef VSSRARNI_D_Q : LSX2RI7_VVVI<0x736a0000>;
82606c3fb27SDimitry Andricdef VSSRLRNI_BU_H : LSX2RI4_VVVI<0x73544000>;
82706c3fb27SDimitry Andricdef VSSRLRNI_HU_W : LSX2RI5_VVVI<0x73548000>;
82806c3fb27SDimitry Andricdef VSSRLRNI_WU_D : LSX2RI6_VVVI<0x73550000>;
82906c3fb27SDimitry Andricdef VSSRLRNI_DU_Q : LSX2RI7_VVVI<0x73560000>;
83006c3fb27SDimitry Andricdef VSSRARNI_BU_H : LSX2RI4_VVVI<0x736c4000>;
83106c3fb27SDimitry Andricdef VSSRARNI_HU_W : LSX2RI5_VVVI<0x736c8000>;
83206c3fb27SDimitry Andricdef VSSRARNI_WU_D : LSX2RI6_VVVI<0x736d0000>;
83306c3fb27SDimitry Andricdef VSSRARNI_DU_Q : LSX2RI7_VVVI<0x736e0000>;
83406c3fb27SDimitry Andric
83506c3fb27SDimitry Andricdef VCLO_B : LSX2R_VV<0x729c0000>;
83606c3fb27SDimitry Andricdef VCLO_H : LSX2R_VV<0x729c0400>;
83706c3fb27SDimitry Andricdef VCLO_W : LSX2R_VV<0x729c0800>;
83806c3fb27SDimitry Andricdef VCLO_D : LSX2R_VV<0x729c0c00>;
83906c3fb27SDimitry Andricdef VCLZ_B : LSX2R_VV<0x729c1000>;
84006c3fb27SDimitry Andricdef VCLZ_H : LSX2R_VV<0x729c1400>;
84106c3fb27SDimitry Andricdef VCLZ_W : LSX2R_VV<0x729c1800>;
84206c3fb27SDimitry Andricdef VCLZ_D : LSX2R_VV<0x729c1c00>;
84306c3fb27SDimitry Andric
84406c3fb27SDimitry Andricdef VPCNT_B : LSX2R_VV<0x729c2000>;
84506c3fb27SDimitry Andricdef VPCNT_H : LSX2R_VV<0x729c2400>;
84606c3fb27SDimitry Andricdef VPCNT_W : LSX2R_VV<0x729c2800>;
84706c3fb27SDimitry Andricdef VPCNT_D : LSX2R_VV<0x729c2c00>;
84806c3fb27SDimitry Andric
84906c3fb27SDimitry Andricdef VBITCLR_B : LSX3R_VVV<0x710c0000>;
85006c3fb27SDimitry Andricdef VBITCLR_H : LSX3R_VVV<0x710c8000>;
85106c3fb27SDimitry Andricdef VBITCLR_W : LSX3R_VVV<0x710d0000>;
85206c3fb27SDimitry Andricdef VBITCLR_D : LSX3R_VVV<0x710d8000>;
85306c3fb27SDimitry Andricdef VBITCLRI_B : LSX2RI3_VVI<0x73102000>;
85406c3fb27SDimitry Andricdef VBITCLRI_H : LSX2RI4_VVI<0x73104000>;
85506c3fb27SDimitry Andricdef VBITCLRI_W : LSX2RI5_VVI<0x73108000>;
85606c3fb27SDimitry Andricdef VBITCLRI_D : LSX2RI6_VVI<0x73110000>;
85706c3fb27SDimitry Andric
85806c3fb27SDimitry Andricdef VBITSET_B : LSX3R_VVV<0x710e0000>;
85906c3fb27SDimitry Andricdef VBITSET_H : LSX3R_VVV<0x710e8000>;
86006c3fb27SDimitry Andricdef VBITSET_W : LSX3R_VVV<0x710f0000>;
86106c3fb27SDimitry Andricdef VBITSET_D : LSX3R_VVV<0x710f8000>;
86206c3fb27SDimitry Andricdef VBITSETI_B : LSX2RI3_VVI<0x73142000>;
86306c3fb27SDimitry Andricdef VBITSETI_H : LSX2RI4_VVI<0x73144000>;
86406c3fb27SDimitry Andricdef VBITSETI_W : LSX2RI5_VVI<0x73148000>;
86506c3fb27SDimitry Andricdef VBITSETI_D : LSX2RI6_VVI<0x73150000>;
86606c3fb27SDimitry Andric
86706c3fb27SDimitry Andricdef VBITREV_B : LSX3R_VVV<0x71100000>;
86806c3fb27SDimitry Andricdef VBITREV_H : LSX3R_VVV<0x71108000>;
86906c3fb27SDimitry Andricdef VBITREV_W : LSX3R_VVV<0x71110000>;
87006c3fb27SDimitry Andricdef VBITREV_D : LSX3R_VVV<0x71118000>;
87106c3fb27SDimitry Andricdef VBITREVI_B : LSX2RI3_VVI<0x73182000>;
87206c3fb27SDimitry Andricdef VBITREVI_H : LSX2RI4_VVI<0x73184000>;
87306c3fb27SDimitry Andricdef VBITREVI_W : LSX2RI5_VVI<0x73188000>;
87406c3fb27SDimitry Andricdef VBITREVI_D : LSX2RI6_VVI<0x73190000>;
87506c3fb27SDimitry Andric
87606c3fb27SDimitry Andricdef VFRSTP_B : LSX3R_VVVV<0x712b0000>;
87706c3fb27SDimitry Andricdef VFRSTP_H : LSX3R_VVVV<0x712b8000>;
87806c3fb27SDimitry Andricdef VFRSTPI_B : LSX2RI5_VVVI<0x729a0000>;
87906c3fb27SDimitry Andricdef VFRSTPI_H : LSX2RI5_VVVI<0x729a8000>;
88006c3fb27SDimitry Andric
88106c3fb27SDimitry Andricdef VFADD_S : LSX3R_VVV<0x71308000>;
88206c3fb27SDimitry Andricdef VFADD_D : LSX3R_VVV<0x71310000>;
88306c3fb27SDimitry Andricdef VFSUB_S : LSX3R_VVV<0x71328000>;
88406c3fb27SDimitry Andricdef VFSUB_D : LSX3R_VVV<0x71330000>;
88506c3fb27SDimitry Andricdef VFMUL_S : LSX3R_VVV<0x71388000>;
88606c3fb27SDimitry Andricdef VFMUL_D : LSX3R_VVV<0x71390000>;
88706c3fb27SDimitry Andricdef VFDIV_S : LSX3R_VVV<0x713a8000>;
88806c3fb27SDimitry Andricdef VFDIV_D : LSX3R_VVV<0x713b0000>;
88906c3fb27SDimitry Andric
89006c3fb27SDimitry Andricdef VFMADD_S : LSX4R_VVVV<0x09100000>;
89106c3fb27SDimitry Andricdef VFMADD_D : LSX4R_VVVV<0x09200000>;
89206c3fb27SDimitry Andricdef VFMSUB_S : LSX4R_VVVV<0x09500000>;
89306c3fb27SDimitry Andricdef VFMSUB_D : LSX4R_VVVV<0x09600000>;
89406c3fb27SDimitry Andricdef VFNMADD_S : LSX4R_VVVV<0x09900000>;
89506c3fb27SDimitry Andricdef VFNMADD_D : LSX4R_VVVV<0x09a00000>;
89606c3fb27SDimitry Andricdef VFNMSUB_S : LSX4R_VVVV<0x09d00000>;
89706c3fb27SDimitry Andricdef VFNMSUB_D : LSX4R_VVVV<0x09e00000>;
89806c3fb27SDimitry Andric
89906c3fb27SDimitry Andricdef VFMAX_S : LSX3R_VVV<0x713c8000>;
90006c3fb27SDimitry Andricdef VFMAX_D : LSX3R_VVV<0x713d0000>;
90106c3fb27SDimitry Andricdef VFMIN_S : LSX3R_VVV<0x713e8000>;
90206c3fb27SDimitry Andricdef VFMIN_D : LSX3R_VVV<0x713f0000>;
90306c3fb27SDimitry Andric
90406c3fb27SDimitry Andricdef VFMAXA_S : LSX3R_VVV<0x71408000>;
90506c3fb27SDimitry Andricdef VFMAXA_D : LSX3R_VVV<0x71410000>;
90606c3fb27SDimitry Andricdef VFMINA_S : LSX3R_VVV<0x71428000>;
90706c3fb27SDimitry Andricdef VFMINA_D : LSX3R_VVV<0x71430000>;
90806c3fb27SDimitry Andric
90906c3fb27SDimitry Andricdef VFLOGB_S : LSX2R_VV<0x729cc400>;
91006c3fb27SDimitry Andricdef VFLOGB_D : LSX2R_VV<0x729cc800>;
91106c3fb27SDimitry Andric
91206c3fb27SDimitry Andricdef VFCLASS_S : LSX2R_VV<0x729cd400>;
91306c3fb27SDimitry Andricdef VFCLASS_D : LSX2R_VV<0x729cd800>;
91406c3fb27SDimitry Andric
91506c3fb27SDimitry Andricdef VFSQRT_S : LSX2R_VV<0x729ce400>;
91606c3fb27SDimitry Andricdef VFSQRT_D : LSX2R_VV<0x729ce800>;
91706c3fb27SDimitry Andricdef VFRECIP_S : LSX2R_VV<0x729cf400>;
91806c3fb27SDimitry Andricdef VFRECIP_D : LSX2R_VV<0x729cf800>;
91906c3fb27SDimitry Andricdef VFRSQRT_S : LSX2R_VV<0x729d0400>;
92006c3fb27SDimitry Andricdef VFRSQRT_D : LSX2R_VV<0x729d0800>;
9217a6dacacSDimitry Andricdef VFRECIPE_S : LSX2R_VV<0x729d1400>;
9227a6dacacSDimitry Andricdef VFRECIPE_D : LSX2R_VV<0x729d1800>;
9237a6dacacSDimitry Andricdef VFRSQRTE_S : LSX2R_VV<0x729d2400>;
9247a6dacacSDimitry Andricdef VFRSQRTE_D : LSX2R_VV<0x729d2800>;
92506c3fb27SDimitry Andric
92606c3fb27SDimitry Andricdef VFCVTL_S_H : LSX2R_VV<0x729de800>;
92706c3fb27SDimitry Andricdef VFCVTH_S_H : LSX2R_VV<0x729dec00>;
92806c3fb27SDimitry Andricdef VFCVTL_D_S : LSX2R_VV<0x729df000>;
92906c3fb27SDimitry Andricdef VFCVTH_D_S : LSX2R_VV<0x729df400>;
93006c3fb27SDimitry Andricdef VFCVT_H_S : LSX3R_VVV<0x71460000>;
93106c3fb27SDimitry Andricdef VFCVT_S_D : LSX3R_VVV<0x71468000>;
93206c3fb27SDimitry Andric
93306c3fb27SDimitry Andricdef VFRINTRNE_S : LSX2R_VV<0x729d7400>;
93406c3fb27SDimitry Andricdef VFRINTRNE_D : LSX2R_VV<0x729d7800>;
93506c3fb27SDimitry Andricdef VFRINTRZ_S : LSX2R_VV<0x729d6400>;
93606c3fb27SDimitry Andricdef VFRINTRZ_D : LSX2R_VV<0x729d6800>;
93706c3fb27SDimitry Andricdef VFRINTRP_S : LSX2R_VV<0x729d5400>;
93806c3fb27SDimitry Andricdef VFRINTRP_D : LSX2R_VV<0x729d5800>;
93906c3fb27SDimitry Andricdef VFRINTRM_S : LSX2R_VV<0x729d4400>;
94006c3fb27SDimitry Andricdef VFRINTRM_D : LSX2R_VV<0x729d4800>;
94106c3fb27SDimitry Andricdef VFRINT_S : LSX2R_VV<0x729d3400>;
94206c3fb27SDimitry Andricdef VFRINT_D : LSX2R_VV<0x729d3800>;
94306c3fb27SDimitry Andric
94406c3fb27SDimitry Andricdef VFTINTRNE_W_S : LSX2R_VV<0x729e5000>;
94506c3fb27SDimitry Andricdef VFTINTRNE_L_D : LSX2R_VV<0x729e5400>;
94606c3fb27SDimitry Andricdef VFTINTRZ_W_S : LSX2R_VV<0x729e4800>;
94706c3fb27SDimitry Andricdef VFTINTRZ_L_D : LSX2R_VV<0x729e4c00>;
94806c3fb27SDimitry Andricdef VFTINTRP_W_S : LSX2R_VV<0x729e4000>;
94906c3fb27SDimitry Andricdef VFTINTRP_L_D : LSX2R_VV<0x729e4400>;
95006c3fb27SDimitry Andricdef VFTINTRM_W_S : LSX2R_VV<0x729e3800>;
95106c3fb27SDimitry Andricdef VFTINTRM_L_D : LSX2R_VV<0x729e3c00>;
95206c3fb27SDimitry Andricdef VFTINT_W_S : LSX2R_VV<0x729e3000>;
95306c3fb27SDimitry Andricdef VFTINT_L_D : LSX2R_VV<0x729e3400>;
95406c3fb27SDimitry Andricdef VFTINTRZ_WU_S : LSX2R_VV<0x729e7000>;
95506c3fb27SDimitry Andricdef VFTINTRZ_LU_D : LSX2R_VV<0x729e7400>;
95606c3fb27SDimitry Andricdef VFTINT_WU_S : LSX2R_VV<0x729e5800>;
95706c3fb27SDimitry Andricdef VFTINT_LU_D : LSX2R_VV<0x729e5c00>;
95806c3fb27SDimitry Andric
95906c3fb27SDimitry Andricdef VFTINTRNE_W_D : LSX3R_VVV<0x714b8000>;
96006c3fb27SDimitry Andricdef VFTINTRZ_W_D : LSX3R_VVV<0x714b0000>;
96106c3fb27SDimitry Andricdef VFTINTRP_W_D : LSX3R_VVV<0x714a8000>;
96206c3fb27SDimitry Andricdef VFTINTRM_W_D : LSX3R_VVV<0x714a0000>;
96306c3fb27SDimitry Andricdef VFTINT_W_D : LSX3R_VVV<0x71498000>;
96406c3fb27SDimitry Andric
96506c3fb27SDimitry Andricdef VFTINTRNEL_L_S : LSX2R_VV<0x729ea000>;
96606c3fb27SDimitry Andricdef VFTINTRNEH_L_S : LSX2R_VV<0x729ea400>;
96706c3fb27SDimitry Andricdef VFTINTRZL_L_S : LSX2R_VV<0x729e9800>;
96806c3fb27SDimitry Andricdef VFTINTRZH_L_S : LSX2R_VV<0x729e9c00>;
96906c3fb27SDimitry Andricdef VFTINTRPL_L_S : LSX2R_VV<0x729e9000>;
97006c3fb27SDimitry Andricdef VFTINTRPH_L_S : LSX2R_VV<0x729e9400>;
97106c3fb27SDimitry Andricdef VFTINTRML_L_S : LSX2R_VV<0x729e8800>;
97206c3fb27SDimitry Andricdef VFTINTRMH_L_S : LSX2R_VV<0x729e8c00>;
97306c3fb27SDimitry Andricdef VFTINTL_L_S : LSX2R_VV<0x729e8000>;
97406c3fb27SDimitry Andricdef VFTINTH_L_S : LSX2R_VV<0x729e8400>;
97506c3fb27SDimitry Andric
97606c3fb27SDimitry Andricdef VFFINT_S_W : LSX2R_VV<0x729e0000>;
97706c3fb27SDimitry Andricdef VFFINT_D_L : LSX2R_VV<0x729e0800>;
97806c3fb27SDimitry Andricdef VFFINT_S_WU : LSX2R_VV<0x729e0400>;
97906c3fb27SDimitry Andricdef VFFINT_D_LU : LSX2R_VV<0x729e0c00>;
98006c3fb27SDimitry Andricdef VFFINTL_D_W : LSX2R_VV<0x729e1000>;
98106c3fb27SDimitry Andricdef VFFINTH_D_W : LSX2R_VV<0x729e1400>;
98206c3fb27SDimitry Andricdef VFFINT_S_L : LSX3R_VVV<0x71480000>;
98306c3fb27SDimitry Andric
98406c3fb27SDimitry Andricdef VSEQ_B : LSX3R_VVV<0x70000000>;
98506c3fb27SDimitry Andricdef VSEQ_H : LSX3R_VVV<0x70008000>;
98606c3fb27SDimitry Andricdef VSEQ_W : LSX3R_VVV<0x70010000>;
98706c3fb27SDimitry Andricdef VSEQ_D : LSX3R_VVV<0x70018000>;
98806c3fb27SDimitry Andricdef VSEQI_B : LSX2RI5_VVI<0x72800000, simm5>;
98906c3fb27SDimitry Andricdef VSEQI_H : LSX2RI5_VVI<0x72808000, simm5>;
99006c3fb27SDimitry Andricdef VSEQI_W : LSX2RI5_VVI<0x72810000, simm5>;
99106c3fb27SDimitry Andricdef VSEQI_D : LSX2RI5_VVI<0x72818000, simm5>;
99206c3fb27SDimitry Andric
99306c3fb27SDimitry Andricdef VSLE_B : LSX3R_VVV<0x70020000>;
99406c3fb27SDimitry Andricdef VSLE_H : LSX3R_VVV<0x70028000>;
99506c3fb27SDimitry Andricdef VSLE_W : LSX3R_VVV<0x70030000>;
99606c3fb27SDimitry Andricdef VSLE_D : LSX3R_VVV<0x70038000>;
99706c3fb27SDimitry Andricdef VSLEI_B : LSX2RI5_VVI<0x72820000, simm5>;
99806c3fb27SDimitry Andricdef VSLEI_H : LSX2RI5_VVI<0x72828000, simm5>;
99906c3fb27SDimitry Andricdef VSLEI_W : LSX2RI5_VVI<0x72830000, simm5>;
100006c3fb27SDimitry Andricdef VSLEI_D : LSX2RI5_VVI<0x72838000, simm5>;
100106c3fb27SDimitry Andric
100206c3fb27SDimitry Andricdef VSLE_BU : LSX3R_VVV<0x70040000>;
100306c3fb27SDimitry Andricdef VSLE_HU : LSX3R_VVV<0x70048000>;
100406c3fb27SDimitry Andricdef VSLE_WU : LSX3R_VVV<0x70050000>;
100506c3fb27SDimitry Andricdef VSLE_DU : LSX3R_VVV<0x70058000>;
100606c3fb27SDimitry Andricdef VSLEI_BU : LSX2RI5_VVI<0x72840000>;
100706c3fb27SDimitry Andricdef VSLEI_HU : LSX2RI5_VVI<0x72848000>;
100806c3fb27SDimitry Andricdef VSLEI_WU : LSX2RI5_VVI<0x72850000>;
100906c3fb27SDimitry Andricdef VSLEI_DU : LSX2RI5_VVI<0x72858000>;
101006c3fb27SDimitry Andric
101106c3fb27SDimitry Andricdef VSLT_B : LSX3R_VVV<0x70060000>;
101206c3fb27SDimitry Andricdef VSLT_H : LSX3R_VVV<0x70068000>;
101306c3fb27SDimitry Andricdef VSLT_W : LSX3R_VVV<0x70070000>;
101406c3fb27SDimitry Andricdef VSLT_D : LSX3R_VVV<0x70078000>;
101506c3fb27SDimitry Andricdef VSLTI_B : LSX2RI5_VVI<0x72860000, simm5>;
101606c3fb27SDimitry Andricdef VSLTI_H : LSX2RI5_VVI<0x72868000, simm5>;
101706c3fb27SDimitry Andricdef VSLTI_W : LSX2RI5_VVI<0x72870000, simm5>;
101806c3fb27SDimitry Andricdef VSLTI_D : LSX2RI5_VVI<0x72878000, simm5>;
101906c3fb27SDimitry Andric
102006c3fb27SDimitry Andricdef VSLT_BU : LSX3R_VVV<0x70080000>;
102106c3fb27SDimitry Andricdef VSLT_HU : LSX3R_VVV<0x70088000>;
102206c3fb27SDimitry Andricdef VSLT_WU : LSX3R_VVV<0x70090000>;
102306c3fb27SDimitry Andricdef VSLT_DU : LSX3R_VVV<0x70098000>;
102406c3fb27SDimitry Andricdef VSLTI_BU : LSX2RI5_VVI<0x72880000>;
102506c3fb27SDimitry Andricdef VSLTI_HU : LSX2RI5_VVI<0x72888000>;
102606c3fb27SDimitry Andricdef VSLTI_WU : LSX2RI5_VVI<0x72890000>;
102706c3fb27SDimitry Andricdef VSLTI_DU : LSX2RI5_VVI<0x72898000>;
102806c3fb27SDimitry Andric
102906c3fb27SDimitry Andricdef VFCMP_CAF_S : LSX3R_VVV<0x0c500000>;
103006c3fb27SDimitry Andricdef VFCMP_SAF_S : LSX3R_VVV<0x0c508000>;
103106c3fb27SDimitry Andricdef VFCMP_CLT_S : LSX3R_VVV<0x0c510000>;
103206c3fb27SDimitry Andricdef VFCMP_SLT_S : LSX3R_VVV<0x0c518000>;
103306c3fb27SDimitry Andricdef VFCMP_CEQ_S : LSX3R_VVV<0x0c520000>;
103406c3fb27SDimitry Andricdef VFCMP_SEQ_S : LSX3R_VVV<0x0c528000>;
103506c3fb27SDimitry Andricdef VFCMP_CLE_S : LSX3R_VVV<0x0c530000>;
103606c3fb27SDimitry Andricdef VFCMP_SLE_S : LSX3R_VVV<0x0c538000>;
103706c3fb27SDimitry Andricdef VFCMP_CUN_S : LSX3R_VVV<0x0c540000>;
103806c3fb27SDimitry Andricdef VFCMP_SUN_S : LSX3R_VVV<0x0c548000>;
103906c3fb27SDimitry Andricdef VFCMP_CULT_S : LSX3R_VVV<0x0c550000>;
104006c3fb27SDimitry Andricdef VFCMP_SULT_S : LSX3R_VVV<0x0c558000>;
104106c3fb27SDimitry Andricdef VFCMP_CUEQ_S : LSX3R_VVV<0x0c560000>;
104206c3fb27SDimitry Andricdef VFCMP_SUEQ_S : LSX3R_VVV<0x0c568000>;
104306c3fb27SDimitry Andricdef VFCMP_CULE_S : LSX3R_VVV<0x0c570000>;
104406c3fb27SDimitry Andricdef VFCMP_SULE_S : LSX3R_VVV<0x0c578000>;
104506c3fb27SDimitry Andricdef VFCMP_CNE_S : LSX3R_VVV<0x0c580000>;
104606c3fb27SDimitry Andricdef VFCMP_SNE_S : LSX3R_VVV<0x0c588000>;
104706c3fb27SDimitry Andricdef VFCMP_COR_S : LSX3R_VVV<0x0c5a0000>;
104806c3fb27SDimitry Andricdef VFCMP_SOR_S : LSX3R_VVV<0x0c5a8000>;
104906c3fb27SDimitry Andricdef VFCMP_CUNE_S : LSX3R_VVV<0x0c5c0000>;
105006c3fb27SDimitry Andricdef VFCMP_SUNE_S : LSX3R_VVV<0x0c5c8000>;
105106c3fb27SDimitry Andric
105206c3fb27SDimitry Andricdef VFCMP_CAF_D : LSX3R_VVV<0x0c600000>;
105306c3fb27SDimitry Andricdef VFCMP_SAF_D : LSX3R_VVV<0x0c608000>;
105406c3fb27SDimitry Andricdef VFCMP_CLT_D : LSX3R_VVV<0x0c610000>;
105506c3fb27SDimitry Andricdef VFCMP_SLT_D : LSX3R_VVV<0x0c618000>;
105606c3fb27SDimitry Andricdef VFCMP_CEQ_D : LSX3R_VVV<0x0c620000>;
105706c3fb27SDimitry Andricdef VFCMP_SEQ_D : LSX3R_VVV<0x0c628000>;
105806c3fb27SDimitry Andricdef VFCMP_CLE_D : LSX3R_VVV<0x0c630000>;
105906c3fb27SDimitry Andricdef VFCMP_SLE_D : LSX3R_VVV<0x0c638000>;
106006c3fb27SDimitry Andricdef VFCMP_CUN_D : LSX3R_VVV<0x0c640000>;
106106c3fb27SDimitry Andricdef VFCMP_SUN_D : LSX3R_VVV<0x0c648000>;
106206c3fb27SDimitry Andricdef VFCMP_CULT_D : LSX3R_VVV<0x0c650000>;
106306c3fb27SDimitry Andricdef VFCMP_SULT_D : LSX3R_VVV<0x0c658000>;
106406c3fb27SDimitry Andricdef VFCMP_CUEQ_D : LSX3R_VVV<0x0c660000>;
106506c3fb27SDimitry Andricdef VFCMP_SUEQ_D : LSX3R_VVV<0x0c668000>;
106606c3fb27SDimitry Andricdef VFCMP_CULE_D : LSX3R_VVV<0x0c670000>;
106706c3fb27SDimitry Andricdef VFCMP_SULE_D : LSX3R_VVV<0x0c678000>;
106806c3fb27SDimitry Andricdef VFCMP_CNE_D : LSX3R_VVV<0x0c680000>;
106906c3fb27SDimitry Andricdef VFCMP_SNE_D : LSX3R_VVV<0x0c688000>;
107006c3fb27SDimitry Andricdef VFCMP_COR_D : LSX3R_VVV<0x0c6a0000>;
107106c3fb27SDimitry Andricdef VFCMP_SOR_D : LSX3R_VVV<0x0c6a8000>;
107206c3fb27SDimitry Andricdef VFCMP_CUNE_D : LSX3R_VVV<0x0c6c0000>;
107306c3fb27SDimitry Andricdef VFCMP_SUNE_D : LSX3R_VVV<0x0c6c8000>;
107406c3fb27SDimitry Andric
107506c3fb27SDimitry Andricdef VBITSEL_V : LSX4R_VVVV<0x0d100000>;
107606c3fb27SDimitry Andric
107706c3fb27SDimitry Andricdef VBITSELI_B : LSX2RI8_VVVI<0x73c40000>;
107806c3fb27SDimitry Andric
107906c3fb27SDimitry Andricdef VSETEQZ_V : LSX2R_CV<0x729c9800>;
108006c3fb27SDimitry Andricdef VSETNEZ_V : LSX2R_CV<0x729c9c00>;
108106c3fb27SDimitry Andricdef VSETANYEQZ_B : LSX2R_CV<0x729ca000>;
108206c3fb27SDimitry Andricdef VSETANYEQZ_H : LSX2R_CV<0x729ca400>;
108306c3fb27SDimitry Andricdef VSETANYEQZ_W : LSX2R_CV<0x729ca800>;
108406c3fb27SDimitry Andricdef VSETANYEQZ_D : LSX2R_CV<0x729cac00>;
108506c3fb27SDimitry Andricdef VSETALLNEZ_B : LSX2R_CV<0x729cb000>;
108606c3fb27SDimitry Andricdef VSETALLNEZ_H : LSX2R_CV<0x729cb400>;
108706c3fb27SDimitry Andricdef VSETALLNEZ_W : LSX2R_CV<0x729cb800>;
108806c3fb27SDimitry Andricdef VSETALLNEZ_D : LSX2R_CV<0x729cbc00>;
108906c3fb27SDimitry Andric
109006c3fb27SDimitry Andricdef VINSGR2VR_B : LSX2RI4_VVRI<0x72eb8000>;
109106c3fb27SDimitry Andricdef VINSGR2VR_H : LSX2RI3_VVRI<0x72ebc000>;
109206c3fb27SDimitry Andricdef VINSGR2VR_W : LSX2RI2_VVRI<0x72ebe000>;
109306c3fb27SDimitry Andricdef VINSGR2VR_D : LSX2RI1_VVRI<0x72ebf000>;
109406c3fb27SDimitry Andricdef VPICKVE2GR_B : LSX2RI4_RVI<0x72ef8000>;
109506c3fb27SDimitry Andricdef VPICKVE2GR_H : LSX2RI3_RVI<0x72efc000>;
109606c3fb27SDimitry Andricdef VPICKVE2GR_W : LSX2RI2_RVI<0x72efe000>;
109706c3fb27SDimitry Andricdef VPICKVE2GR_D : LSX2RI1_RVI<0x72eff000>;
109806c3fb27SDimitry Andricdef VPICKVE2GR_BU : LSX2RI4_RVI<0x72f38000>;
109906c3fb27SDimitry Andricdef VPICKVE2GR_HU : LSX2RI3_RVI<0x72f3c000>;
110006c3fb27SDimitry Andricdef VPICKVE2GR_WU : LSX2RI2_RVI<0x72f3e000>;
110106c3fb27SDimitry Andricdef VPICKVE2GR_DU : LSX2RI1_RVI<0x72f3f000>;
110206c3fb27SDimitry Andric
110306c3fb27SDimitry Andricdef VREPLGR2VR_B : LSX2R_VR<0x729f0000>;
110406c3fb27SDimitry Andricdef VREPLGR2VR_H : LSX2R_VR<0x729f0400>;
110506c3fb27SDimitry Andricdef VREPLGR2VR_W : LSX2R_VR<0x729f0800>;
110606c3fb27SDimitry Andricdef VREPLGR2VR_D : LSX2R_VR<0x729f0c00>;
110706c3fb27SDimitry Andric
110806c3fb27SDimitry Andricdef VREPLVE_B : LSX3R_VVR<0x71220000>;
110906c3fb27SDimitry Andricdef VREPLVE_H : LSX3R_VVR<0x71228000>;
111006c3fb27SDimitry Andricdef VREPLVE_W : LSX3R_VVR<0x71230000>;
111106c3fb27SDimitry Andricdef VREPLVE_D : LSX3R_VVR<0x71238000>;
111206c3fb27SDimitry Andricdef VREPLVEI_B : LSX2RI4_VVI<0x72f78000>;
111306c3fb27SDimitry Andricdef VREPLVEI_H : LSX2RI3_VVI<0x72f7c000>;
111406c3fb27SDimitry Andricdef VREPLVEI_W : LSX2RI2_VVI<0x72f7e000>;
111506c3fb27SDimitry Andricdef VREPLVEI_D : LSX2RI1_VVI<0x72f7f000>;
111606c3fb27SDimitry Andric
111706c3fb27SDimitry Andricdef VBSLL_V : LSX2RI5_VVI<0x728e0000>;
111806c3fb27SDimitry Andricdef VBSRL_V : LSX2RI5_VVI<0x728e8000>;
111906c3fb27SDimitry Andric
112006c3fb27SDimitry Andricdef VPACKEV_B : LSX3R_VVV<0x71160000>;
112106c3fb27SDimitry Andricdef VPACKEV_H : LSX3R_VVV<0x71168000>;
112206c3fb27SDimitry Andricdef VPACKEV_W : LSX3R_VVV<0x71170000>;
112306c3fb27SDimitry Andricdef VPACKEV_D : LSX3R_VVV<0x71178000>;
112406c3fb27SDimitry Andricdef VPACKOD_B : LSX3R_VVV<0x71180000>;
112506c3fb27SDimitry Andricdef VPACKOD_H : LSX3R_VVV<0x71188000>;
112606c3fb27SDimitry Andricdef VPACKOD_W : LSX3R_VVV<0x71190000>;
112706c3fb27SDimitry Andricdef VPACKOD_D : LSX3R_VVV<0x71198000>;
112806c3fb27SDimitry Andric
112906c3fb27SDimitry Andricdef VPICKEV_B : LSX3R_VVV<0x711e0000>;
113006c3fb27SDimitry Andricdef VPICKEV_H : LSX3R_VVV<0x711e8000>;
113106c3fb27SDimitry Andricdef VPICKEV_W : LSX3R_VVV<0x711f0000>;
113206c3fb27SDimitry Andricdef VPICKEV_D : LSX3R_VVV<0x711f8000>;
113306c3fb27SDimitry Andricdef VPICKOD_B : LSX3R_VVV<0x71200000>;
113406c3fb27SDimitry Andricdef VPICKOD_H : LSX3R_VVV<0x71208000>;
113506c3fb27SDimitry Andricdef VPICKOD_W : LSX3R_VVV<0x71210000>;
113606c3fb27SDimitry Andricdef VPICKOD_D : LSX3R_VVV<0x71218000>;
113706c3fb27SDimitry Andric
113806c3fb27SDimitry Andricdef VILVL_B : LSX3R_VVV<0x711a0000>;
113906c3fb27SDimitry Andricdef VILVL_H : LSX3R_VVV<0x711a8000>;
114006c3fb27SDimitry Andricdef VILVL_W : LSX3R_VVV<0x711b0000>;
114106c3fb27SDimitry Andricdef VILVL_D : LSX3R_VVV<0x711b8000>;
114206c3fb27SDimitry Andricdef VILVH_B : LSX3R_VVV<0x711c0000>;
114306c3fb27SDimitry Andricdef VILVH_H : LSX3R_VVV<0x711c8000>;
114406c3fb27SDimitry Andricdef VILVH_W : LSX3R_VVV<0x711d0000>;
114506c3fb27SDimitry Andricdef VILVH_D : LSX3R_VVV<0x711d8000>;
114606c3fb27SDimitry Andric
114706c3fb27SDimitry Andricdef VSHUF_B : LSX4R_VVVV<0x0d500000>;
114806c3fb27SDimitry Andric
114906c3fb27SDimitry Andricdef VSHUF_H : LSX3R_VVVV<0x717a8000>;
115006c3fb27SDimitry Andricdef VSHUF_W : LSX3R_VVVV<0x717b0000>;
115106c3fb27SDimitry Andricdef VSHUF_D : LSX3R_VVVV<0x717b8000>;
115206c3fb27SDimitry Andric
115306c3fb27SDimitry Andricdef VSHUF4I_B : LSX2RI8_VVI<0x73900000>;
115406c3fb27SDimitry Andricdef VSHUF4I_H : LSX2RI8_VVI<0x73940000>;
115506c3fb27SDimitry Andricdef VSHUF4I_W : LSX2RI8_VVI<0x73980000>;
115606c3fb27SDimitry Andricdef VSHUF4I_D : LSX2RI8_VVVI<0x739c0000>;
115706c3fb27SDimitry Andric
115806c3fb27SDimitry Andricdef VPERMI_W : LSX2RI8_VVVI<0x73e40000>;
115906c3fb27SDimitry Andric
116006c3fb27SDimitry Andricdef VEXTRINS_D : LSX2RI8_VVVI<0x73800000>;
116106c3fb27SDimitry Andricdef VEXTRINS_W : LSX2RI8_VVVI<0x73840000>;
116206c3fb27SDimitry Andricdef VEXTRINS_H : LSX2RI8_VVVI<0x73880000>;
116306c3fb27SDimitry Andricdef VEXTRINS_B : LSX2RI8_VVVI<0x738c0000>;
116406c3fb27SDimitry Andric} // mayLoad = 0, mayStore = 0
116506c3fb27SDimitry Andric
116606c3fb27SDimitry Andriclet mayLoad = 1, mayStore = 0 in {
116706c3fb27SDimitry Andricdef VLD : LSX2RI12_Load<0x2c000000>;
116806c3fb27SDimitry Andricdef VLDX : LSX3R_Load<0x38400000>;
116906c3fb27SDimitry Andric
117006c3fb27SDimitry Andricdef VLDREPL_B : LSX2RI12_Load<0x30800000>;
117106c3fb27SDimitry Andricdef VLDREPL_H : LSX2RI11_Load<0x30400000>;
117206c3fb27SDimitry Andricdef VLDREPL_W : LSX2RI10_Load<0x30200000>;
117306c3fb27SDimitry Andricdef VLDREPL_D : LSX2RI9_Load<0x30100000>;
117406c3fb27SDimitry Andric} // mayLoad = 1, mayStore = 0
117506c3fb27SDimitry Andric
117606c3fb27SDimitry Andriclet mayLoad = 0, mayStore = 1 in {
117706c3fb27SDimitry Andricdef VST : LSX2RI12_Store<0x2c400000>;
117806c3fb27SDimitry Andricdef VSTX : LSX3R_Store<0x38440000>;
117906c3fb27SDimitry Andric
118006c3fb27SDimitry Andricdef VSTELM_B : LSX2RI8I4_VRII<0x31800000>;
118106c3fb27SDimitry Andricdef VSTELM_H : LSX2RI8I3_VRII<0x31400000, simm8_lsl1>;
118206c3fb27SDimitry Andricdef VSTELM_W : LSX2RI8I2_VRII<0x31200000, simm8_lsl2>;
118306c3fb27SDimitry Andricdef VSTELM_D : LSX2RI8I1_VRII<0x31100000, simm8_lsl3>;
118406c3fb27SDimitry Andric} // mayLoad = 0, mayStore = 1
118506c3fb27SDimitry Andric
118606c3fb27SDimitry Andric} // hasSideEffects = 0, Predicates = [HasExtLSX]
118706c3fb27SDimitry Andric
118806c3fb27SDimitry Andric/// Pseudo-instructions
118906c3fb27SDimitry Andric
119006c3fb27SDimitry Andriclet Predicates = [HasExtLSX] in {
119106c3fb27SDimitry Andric
119206c3fb27SDimitry Andriclet hasSideEffects = 0, mayLoad = 0, mayStore = 0, isCodeGenOnly = 0,
119306c3fb27SDimitry Andric    isAsmParserOnly = 1 in {
119406c3fb27SDimitry Andricdef PseudoVREPLI_B : Pseudo<(outs LSX128:$vd), (ins simm10:$imm), [],
119506c3fb27SDimitry Andric                            "vrepli.b", "$vd, $imm">;
119606c3fb27SDimitry Andricdef PseudoVREPLI_H : Pseudo<(outs LSX128:$vd), (ins simm10:$imm), [],
119706c3fb27SDimitry Andric                            "vrepli.h", "$vd, $imm">;
119806c3fb27SDimitry Andricdef PseudoVREPLI_W : Pseudo<(outs LSX128:$vd), (ins simm10:$imm), [],
119906c3fb27SDimitry Andric                            "vrepli.w", "$vd, $imm">;
120006c3fb27SDimitry Andricdef PseudoVREPLI_D : Pseudo<(outs LSX128:$vd), (ins simm10:$imm), [],
120106c3fb27SDimitry Andric                            "vrepli.d", "$vd, $imm">;
120206c3fb27SDimitry Andric}
120306c3fb27SDimitry Andric
12045f757f3fSDimitry Andricdef PseudoVBNZ_B : VecCond<loongarch_vall_nonzero, v16i8>;
12055f757f3fSDimitry Andricdef PseudoVBNZ_H : VecCond<loongarch_vall_nonzero, v8i16>;
12065f757f3fSDimitry Andricdef PseudoVBNZ_W : VecCond<loongarch_vall_nonzero, v4i32>;
12075f757f3fSDimitry Andricdef PseudoVBNZ_D : VecCond<loongarch_vall_nonzero, v2i64>;
12085f757f3fSDimitry Andricdef PseudoVBNZ : VecCond<loongarch_vany_nonzero, v16i8>;
12095f757f3fSDimitry Andric
12105f757f3fSDimitry Andricdef PseudoVBZ_B : VecCond<loongarch_vall_zero, v16i8>;
12115f757f3fSDimitry Andricdef PseudoVBZ_H : VecCond<loongarch_vall_zero, v8i16>;
12125f757f3fSDimitry Andricdef PseudoVBZ_W : VecCond<loongarch_vall_zero, v4i32>;
12135f757f3fSDimitry Andricdef PseudoVBZ_D : VecCond<loongarch_vall_zero, v2i64>;
12145f757f3fSDimitry Andricdef PseudoVBZ : VecCond<loongarch_vany_zero, v16i8>;
12155f757f3fSDimitry Andric
12165f757f3fSDimitry Andric} // Predicates = [HasExtLSX]
12175f757f3fSDimitry Andric
12185f757f3fSDimitry Andricmulticlass PatVr<SDPatternOperator OpNode, string Inst> {
12195f757f3fSDimitry Andric  def : Pat<(v16i8 (OpNode (v16i8 LSX128:$vj))),
12205f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_B") LSX128:$vj)>;
12215f757f3fSDimitry Andric  def : Pat<(v8i16 (OpNode (v8i16 LSX128:$vj))),
12225f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_H") LSX128:$vj)>;
12235f757f3fSDimitry Andric  def : Pat<(v4i32 (OpNode (v4i32 LSX128:$vj))),
12245f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_W") LSX128:$vj)>;
12255f757f3fSDimitry Andric  def : Pat<(v2i64 (OpNode (v2i64 LSX128:$vj))),
12265f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_D") LSX128:$vj)>;
12275f757f3fSDimitry Andric}
12285f757f3fSDimitry Andric
12295f757f3fSDimitry Andricmulticlass PatVrF<SDPatternOperator OpNode, string Inst> {
12305f757f3fSDimitry Andric  def : Pat<(v4f32 (OpNode (v4f32 LSX128:$vj))),
12315f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_S") LSX128:$vj)>;
12325f757f3fSDimitry Andric  def : Pat<(v2f64 (OpNode (v2f64 LSX128:$vj))),
12335f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_D") LSX128:$vj)>;
12345f757f3fSDimitry Andric}
12355f757f3fSDimitry Andric
12365f757f3fSDimitry Andricmulticlass PatVrVr<SDPatternOperator OpNode, string Inst> {
12375f757f3fSDimitry Andric  def : Pat<(OpNode (v16i8 LSX128:$vj), (v16i8 LSX128:$vk)),
12385f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_B") LSX128:$vj, LSX128:$vk)>;
12395f757f3fSDimitry Andric  def : Pat<(OpNode (v8i16 LSX128:$vj), (v8i16 LSX128:$vk)),
12405f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_H") LSX128:$vj, LSX128:$vk)>;
12415f757f3fSDimitry Andric  def : Pat<(OpNode (v4i32 LSX128:$vj), (v4i32 LSX128:$vk)),
12425f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_W") LSX128:$vj, LSX128:$vk)>;
12435f757f3fSDimitry Andric  def : Pat<(OpNode (v2i64 LSX128:$vj), (v2i64 LSX128:$vk)),
12445f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_D") LSX128:$vj, LSX128:$vk)>;
12455f757f3fSDimitry Andric}
12465f757f3fSDimitry Andric
12475f757f3fSDimitry Andricmulticlass PatVrVrF<SDPatternOperator OpNode, string Inst> {
12485f757f3fSDimitry Andric  def : Pat<(OpNode (v4f32 LSX128:$vj), (v4f32 LSX128:$vk)),
12495f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_S") LSX128:$vj, LSX128:$vk)>;
12505f757f3fSDimitry Andric  def : Pat<(OpNode (v2f64 LSX128:$vj), (v2f64 LSX128:$vk)),
12515f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_D") LSX128:$vj, LSX128:$vk)>;
12525f757f3fSDimitry Andric}
12535f757f3fSDimitry Andric
12545f757f3fSDimitry Andricmulticlass PatVrVrU<SDPatternOperator OpNode, string Inst> {
12555f757f3fSDimitry Andric  def : Pat<(OpNode (v16i8 LSX128:$vj), (v16i8 LSX128:$vk)),
12565f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_BU") LSX128:$vj, LSX128:$vk)>;
12575f757f3fSDimitry Andric  def : Pat<(OpNode (v8i16 LSX128:$vj), (v8i16 LSX128:$vk)),
12585f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_HU") LSX128:$vj, LSX128:$vk)>;
12595f757f3fSDimitry Andric  def : Pat<(OpNode (v4i32 LSX128:$vj), (v4i32 LSX128:$vk)),
12605f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_WU") LSX128:$vj, LSX128:$vk)>;
12615f757f3fSDimitry Andric  def : Pat<(OpNode (v2i64 LSX128:$vj), (v2i64 LSX128:$vk)),
12625f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_DU") LSX128:$vj, LSX128:$vk)>;
12635f757f3fSDimitry Andric}
12645f757f3fSDimitry Andric
12655f757f3fSDimitry Andricmulticlass PatVrSimm5<SDPatternOperator OpNode, string Inst> {
12665f757f3fSDimitry Andric  def : Pat<(OpNode (v16i8 LSX128:$vj), (v16i8 (SplatPat_simm5 simm5:$imm))),
12675f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_B") LSX128:$vj, simm5:$imm)>;
12685f757f3fSDimitry Andric  def : Pat<(OpNode (v8i16 LSX128:$vj), (v8i16 (SplatPat_simm5 simm5:$imm))),
12695f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_H") LSX128:$vj, simm5:$imm)>;
12705f757f3fSDimitry Andric  def : Pat<(OpNode (v4i32 LSX128:$vj), (v4i32 (SplatPat_simm5 simm5:$imm))),
12715f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_W") LSX128:$vj, simm5:$imm)>;
12725f757f3fSDimitry Andric  def : Pat<(OpNode (v2i64 LSX128:$vj), (v2i64 (SplatPat_simm5 simm5:$imm))),
12735f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_D") LSX128:$vj, simm5:$imm)>;
12745f757f3fSDimitry Andric}
12755f757f3fSDimitry Andric
12765f757f3fSDimitry Andricmulticlass PatVrUimm5<SDPatternOperator OpNode, string Inst> {
12775f757f3fSDimitry Andric  def : Pat<(OpNode (v16i8 LSX128:$vj), (v16i8 (SplatPat_uimm5 uimm5:$imm))),
12785f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_BU") LSX128:$vj, uimm5:$imm)>;
12795f757f3fSDimitry Andric  def : Pat<(OpNode (v8i16 LSX128:$vj), (v8i16 (SplatPat_uimm5 uimm5:$imm))),
12805f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_HU") LSX128:$vj, uimm5:$imm)>;
12815f757f3fSDimitry Andric  def : Pat<(OpNode (v4i32 LSX128:$vj), (v4i32 (SplatPat_uimm5 uimm5:$imm))),
12825f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_WU") LSX128:$vj, uimm5:$imm)>;
12835f757f3fSDimitry Andric  def : Pat<(OpNode (v2i64 LSX128:$vj), (v2i64 (SplatPat_uimm5 uimm5:$imm))),
12845f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_DU") LSX128:$vj, uimm5:$imm)>;
12855f757f3fSDimitry Andric}
12865f757f3fSDimitry Andric
12875f757f3fSDimitry Andricmulticlass PatVrVrVr<SDPatternOperator OpNode, string Inst> {
12885f757f3fSDimitry Andric  def : Pat<(OpNode (v16i8 LSX128:$vd), (v16i8 LSX128:$vj), (v16i8 LSX128:$vk)),
12895f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_B") LSX128:$vd, LSX128:$vj, LSX128:$vk)>;
12905f757f3fSDimitry Andric  def : Pat<(OpNode (v8i16 LSX128:$vd), (v8i16 LSX128:$vj), (v8i16 LSX128:$vk)),
12915f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_H") LSX128:$vd, LSX128:$vj, LSX128:$vk)>;
12925f757f3fSDimitry Andric  def : Pat<(OpNode (v4i32 LSX128:$vd), (v4i32 LSX128:$vj), (v4i32 LSX128:$vk)),
12935f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_W") LSX128:$vd, LSX128:$vj, LSX128:$vk)>;
12945f757f3fSDimitry Andric  def : Pat<(OpNode (v2i64 LSX128:$vd), (v2i64 LSX128:$vj), (v2i64 LSX128:$vk)),
12955f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_D") LSX128:$vd, LSX128:$vj, LSX128:$vk)>;
12965f757f3fSDimitry Andric}
12975f757f3fSDimitry Andric
12985f757f3fSDimitry Andricmulticlass PatShiftVrVr<SDPatternOperator OpNode, string Inst> {
12995f757f3fSDimitry Andric  def : Pat<(OpNode (v16i8 LSX128:$vj), (and vsplati8_imm_eq_7,
13005f757f3fSDimitry Andric                                             (v16i8 LSX128:$vk))),
13015f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_B") LSX128:$vj, LSX128:$vk)>;
13025f757f3fSDimitry Andric  def : Pat<(OpNode (v8i16 LSX128:$vj), (and vsplati16_imm_eq_15,
13035f757f3fSDimitry Andric                                             (v8i16 LSX128:$vk))),
13045f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_H") LSX128:$vj, LSX128:$vk)>;
13055f757f3fSDimitry Andric  def : Pat<(OpNode (v4i32 LSX128:$vj), (and vsplati32_imm_eq_31,
13065f757f3fSDimitry Andric                                             (v4i32 LSX128:$vk))),
13075f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_W") LSX128:$vj, LSX128:$vk)>;
13085f757f3fSDimitry Andric  def : Pat<(OpNode (v2i64 LSX128:$vj), (and vsplati64_imm_eq_63,
13095f757f3fSDimitry Andric                                             (v2i64 LSX128:$vk))),
13105f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_D") LSX128:$vj, LSX128:$vk)>;
13115f757f3fSDimitry Andric}
13125f757f3fSDimitry Andric
13135f757f3fSDimitry Andricmulticlass PatShiftVrUimm<SDPatternOperator OpNode, string Inst> {
13145f757f3fSDimitry Andric  def : Pat<(OpNode (v16i8 LSX128:$vj), (v16i8 (SplatPat_uimm3 uimm3:$imm))),
13155f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_B") LSX128:$vj, uimm3:$imm)>;
13165f757f3fSDimitry Andric  def : Pat<(OpNode (v8i16 LSX128:$vj), (v8i16 (SplatPat_uimm4 uimm4:$imm))),
13175f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_H") LSX128:$vj, uimm4:$imm)>;
13185f757f3fSDimitry Andric  def : Pat<(OpNode (v4i32 LSX128:$vj), (v4i32 (SplatPat_uimm5 uimm5:$imm))),
13195f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_W") LSX128:$vj, uimm5:$imm)>;
13205f757f3fSDimitry Andric  def : Pat<(OpNode (v2i64 LSX128:$vj), (v2i64 (SplatPat_uimm6 uimm6:$imm))),
13215f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_D") LSX128:$vj, uimm6:$imm)>;
13225f757f3fSDimitry Andric}
13235f757f3fSDimitry Andric
13245f757f3fSDimitry Andricmulticlass PatCCVrSimm5<CondCode CC, string Inst> {
13255f757f3fSDimitry Andric  def : Pat<(v16i8 (setcc (v16i8 LSX128:$vj),
13265f757f3fSDimitry Andric                          (v16i8 (SplatPat_simm5 simm5:$imm)), CC)),
13275f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_B") LSX128:$vj, simm5:$imm)>;
13285f757f3fSDimitry Andric  def : Pat<(v8i16 (setcc (v8i16 LSX128:$vj),
13295f757f3fSDimitry Andric                          (v8i16 (SplatPat_simm5 simm5:$imm)), CC)),
13305f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_H") LSX128:$vj, simm5:$imm)>;
13315f757f3fSDimitry Andric  def : Pat<(v4i32 (setcc (v4i32 LSX128:$vj),
13325f757f3fSDimitry Andric                          (v4i32 (SplatPat_simm5 simm5:$imm)), CC)),
13335f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_W") LSX128:$vj, simm5:$imm)>;
13345f757f3fSDimitry Andric  def : Pat<(v2i64 (setcc (v2i64 LSX128:$vj),
13355f757f3fSDimitry Andric                          (v2i64 (SplatPat_simm5 simm5:$imm)), CC)),
13365f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_D") LSX128:$vj, simm5:$imm)>;
13375f757f3fSDimitry Andric}
13385f757f3fSDimitry Andric
13395f757f3fSDimitry Andricmulticlass PatCCVrUimm5<CondCode CC, string Inst> {
13405f757f3fSDimitry Andric  def : Pat<(v16i8 (setcc (v16i8 LSX128:$vj),
13415f757f3fSDimitry Andric                          (v16i8 (SplatPat_uimm5 uimm5:$imm)), CC)),
13425f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_BU") LSX128:$vj, uimm5:$imm)>;
13435f757f3fSDimitry Andric  def : Pat<(v8i16 (setcc (v8i16 LSX128:$vj),
13445f757f3fSDimitry Andric                          (v8i16 (SplatPat_uimm5 uimm5:$imm)), CC)),
13455f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_HU") LSX128:$vj, uimm5:$imm)>;
13465f757f3fSDimitry Andric  def : Pat<(v4i32 (setcc (v4i32 LSX128:$vj),
13475f757f3fSDimitry Andric                          (v4i32 (SplatPat_uimm5 uimm5:$imm)), CC)),
13485f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_WU") LSX128:$vj, uimm5:$imm)>;
13495f757f3fSDimitry Andric  def : Pat<(v2i64 (setcc (v2i64 LSX128:$vj),
13505f757f3fSDimitry Andric                          (v2i64 (SplatPat_uimm5 uimm5:$imm)), CC)),
13515f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_DU") LSX128:$vj, uimm5:$imm)>;
13525f757f3fSDimitry Andric}
13535f757f3fSDimitry Andric
13545f757f3fSDimitry Andricmulticlass PatCCVrVr<CondCode CC, string Inst> {
13555f757f3fSDimitry Andric  def : Pat<(v16i8 (setcc (v16i8 LSX128:$vj), (v16i8 LSX128:$vk), CC)),
13565f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_B") LSX128:$vj, LSX128:$vk)>;
13575f757f3fSDimitry Andric  def : Pat<(v8i16 (setcc (v8i16 LSX128:$vj), (v8i16 LSX128:$vk), CC)),
13585f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_H") LSX128:$vj, LSX128:$vk)>;
13595f757f3fSDimitry Andric  def : Pat<(v4i32 (setcc (v4i32 LSX128:$vj), (v4i32 LSX128:$vk), CC)),
13605f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_W") LSX128:$vj, LSX128:$vk)>;
13615f757f3fSDimitry Andric  def : Pat<(v2i64 (setcc (v2i64 LSX128:$vj), (v2i64 LSX128:$vk), CC)),
13625f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_D") LSX128:$vj, LSX128:$vk)>;
13635f757f3fSDimitry Andric}
13645f757f3fSDimitry Andric
13655f757f3fSDimitry Andricmulticlass PatCCVrVrU<CondCode CC, string Inst> {
13665f757f3fSDimitry Andric  def : Pat<(v16i8 (setcc (v16i8 LSX128:$vj), (v16i8 LSX128:$vk), CC)),
13675f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_BU") LSX128:$vj, LSX128:$vk)>;
13685f757f3fSDimitry Andric  def : Pat<(v8i16 (setcc (v8i16 LSX128:$vj), (v8i16 LSX128:$vk), CC)),
13695f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_HU") LSX128:$vj, LSX128:$vk)>;
13705f757f3fSDimitry Andric  def : Pat<(v4i32 (setcc (v4i32 LSX128:$vj), (v4i32 LSX128:$vk), CC)),
13715f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_WU") LSX128:$vj, LSX128:$vk)>;
13725f757f3fSDimitry Andric  def : Pat<(v2i64 (setcc (v2i64 LSX128:$vj), (v2i64 LSX128:$vk), CC)),
13735f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_DU") LSX128:$vj, LSX128:$vk)>;
13745f757f3fSDimitry Andric}
13755f757f3fSDimitry Andric
13765f757f3fSDimitry Andricmulticlass PatCCVrVrF<CondCode CC, string Inst> {
13775f757f3fSDimitry Andric  def : Pat<(v4i32 (setcc (v4f32 LSX128:$vj), (v4f32 LSX128:$vk), CC)),
13785f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_S") LSX128:$vj, LSX128:$vk)>;
13795f757f3fSDimitry Andric  def : Pat<(v2i64 (setcc (v2f64 LSX128:$vj), (v2f64 LSX128:$vk), CC)),
13805f757f3fSDimitry Andric            (!cast<LAInst>(Inst#"_D") LSX128:$vj, LSX128:$vk)>;
13815f757f3fSDimitry Andric}
13825f757f3fSDimitry Andric
13835f757f3fSDimitry Andriclet Predicates = [HasExtLSX] in {
13845f757f3fSDimitry Andric
13855f757f3fSDimitry Andric// VADD_{B/H/W/D}
13865f757f3fSDimitry Andricdefm : PatVrVr<add, "VADD">;
13875f757f3fSDimitry Andric// VSUB_{B/H/W/D}
13885f757f3fSDimitry Andricdefm : PatVrVr<sub, "VSUB">;
13895f757f3fSDimitry Andric
13905f757f3fSDimitry Andric// VADDI_{B/H/W/D}U
13915f757f3fSDimitry Andricdefm : PatVrUimm5<add, "VADDI">;
13925f757f3fSDimitry Andric// VSUBI_{B/H/W/D}U
13935f757f3fSDimitry Andricdefm : PatVrUimm5<sub, "VSUBI">;
13945f757f3fSDimitry Andric
13955f757f3fSDimitry Andric// VNEG_{B/H/W/D}
13965f757f3fSDimitry Andricdef : Pat<(sub immAllZerosV, (v16i8 LSX128:$vj)), (VNEG_B LSX128:$vj)>;
13975f757f3fSDimitry Andricdef : Pat<(sub immAllZerosV, (v8i16 LSX128:$vj)), (VNEG_H LSX128:$vj)>;
13985f757f3fSDimitry Andricdef : Pat<(sub immAllZerosV, (v4i32 LSX128:$vj)), (VNEG_W LSX128:$vj)>;
13995f757f3fSDimitry Andricdef : Pat<(sub immAllZerosV, (v2i64 LSX128:$vj)), (VNEG_D LSX128:$vj)>;
14005f757f3fSDimitry Andric
14015f757f3fSDimitry Andric// VMAX[I]_{B/H/W/D}[U]
14025f757f3fSDimitry Andricdefm : PatVrVr<smax, "VMAX">;
14035f757f3fSDimitry Andricdefm : PatVrVrU<umax, "VMAX">;
14045f757f3fSDimitry Andricdefm : PatVrSimm5<smax, "VMAXI">;
14055f757f3fSDimitry Andricdefm : PatVrUimm5<umax, "VMAXI">;
14065f757f3fSDimitry Andric
14075f757f3fSDimitry Andric// VMIN[I]_{B/H/W/D}[U]
14085f757f3fSDimitry Andricdefm : PatVrVr<smin, "VMIN">;
14095f757f3fSDimitry Andricdefm : PatVrVrU<umin, "VMIN">;
14105f757f3fSDimitry Andricdefm : PatVrSimm5<smin, "VMINI">;
14115f757f3fSDimitry Andricdefm : PatVrUimm5<umin, "VMINI">;
14125f757f3fSDimitry Andric
14135f757f3fSDimitry Andric// VMUL_{B/H/W/D}
14145f757f3fSDimitry Andricdefm : PatVrVr<mul, "VMUL">;
14155f757f3fSDimitry Andric
14165f757f3fSDimitry Andric// VMUH_{B/H/W/D}[U]
14175f757f3fSDimitry Andricdefm : PatVrVr<mulhs, "VMUH">;
14185f757f3fSDimitry Andricdefm : PatVrVrU<mulhu, "VMUH">;
14195f757f3fSDimitry Andric
14205f757f3fSDimitry Andric// VMADD_{B/H/W/D}
14215f757f3fSDimitry Andricdefm : PatVrVrVr<muladd, "VMADD">;
14225f757f3fSDimitry Andric// VMSUB_{B/H/W/D}
14235f757f3fSDimitry Andricdefm : PatVrVrVr<mulsub, "VMSUB">;
14245f757f3fSDimitry Andric
14255f757f3fSDimitry Andric// VDIV_{B/H/W/D}[U]
14265f757f3fSDimitry Andricdefm : PatVrVr<sdiv, "VDIV">;
14275f757f3fSDimitry Andricdefm : PatVrVrU<udiv, "VDIV">;
14285f757f3fSDimitry Andric
14295f757f3fSDimitry Andric// VMOD_{B/H/W/D}[U]
14305f757f3fSDimitry Andricdefm : PatVrVr<srem, "VMOD">;
14315f757f3fSDimitry Andricdefm : PatVrVrU<urem, "VMOD">;
14325f757f3fSDimitry Andric
14335f757f3fSDimitry Andric// VAND_V
14345f757f3fSDimitry Andricforeach vt = [v16i8, v8i16, v4i32, v2i64] in
14355f757f3fSDimitry Andricdef : Pat<(and (vt LSX128:$vj), (vt LSX128:$vk)),
14365f757f3fSDimitry Andric          (VAND_V LSX128:$vj, LSX128:$vk)>;
14375f757f3fSDimitry Andric// VOR_V
14385f757f3fSDimitry Andricforeach vt = [v16i8, v8i16, v4i32, v2i64] in
14395f757f3fSDimitry Andricdef : Pat<(or (vt LSX128:$vj), (vt LSX128:$vk)),
14405f757f3fSDimitry Andric          (VOR_V LSX128:$vj, LSX128:$vk)>;
14415f757f3fSDimitry Andric// VXOR_V
14425f757f3fSDimitry Andricforeach vt = [v16i8, v8i16, v4i32, v2i64] in
14435f757f3fSDimitry Andricdef : Pat<(xor (vt LSX128:$vj), (vt LSX128:$vk)),
14445f757f3fSDimitry Andric          (VXOR_V LSX128:$vj, LSX128:$vk)>;
14455f757f3fSDimitry Andric// VNOR_V
14465f757f3fSDimitry Andricforeach vt = [v16i8, v8i16, v4i32, v2i64] in
14475f757f3fSDimitry Andricdef : Pat<(vnot (or (vt LSX128:$vj), (vt LSX128:$vk))),
14485f757f3fSDimitry Andric          (VNOR_V LSX128:$vj, LSX128:$vk)>;
14495f757f3fSDimitry Andric
14505f757f3fSDimitry Andric// VANDI_B
14515f757f3fSDimitry Andricdef : Pat<(and (v16i8 LSX128:$vj), (v16i8 (SplatPat_uimm8 uimm8:$imm))),
14525f757f3fSDimitry Andric          (VANDI_B LSX128:$vj, uimm8:$imm)>;
14535f757f3fSDimitry Andric// VORI_B
14545f757f3fSDimitry Andricdef : Pat<(or (v16i8 LSX128:$vj), (v16i8 (SplatPat_uimm8 uimm8:$imm))),
14555f757f3fSDimitry Andric          (VORI_B LSX128:$vj, uimm8:$imm)>;
14565f757f3fSDimitry Andric
14575f757f3fSDimitry Andric// VXORI_B
14585f757f3fSDimitry Andricdef : Pat<(xor (v16i8 LSX128:$vj), (v16i8 (SplatPat_uimm8 uimm8:$imm))),
14595f757f3fSDimitry Andric          (VXORI_B LSX128:$vj, uimm8:$imm)>;
14605f757f3fSDimitry Andric
14615f757f3fSDimitry Andric// VSLL[I]_{B/H/W/D}
14625f757f3fSDimitry Andricdefm : PatVrVr<shl, "VSLL">;
14635f757f3fSDimitry Andricdefm : PatShiftVrVr<shl, "VSLL">;
14645f757f3fSDimitry Andricdefm : PatShiftVrUimm<shl, "VSLLI">;
14655f757f3fSDimitry Andric
14665f757f3fSDimitry Andric// VSRL[I]_{B/H/W/D}
14675f757f3fSDimitry Andricdefm : PatVrVr<srl, "VSRL">;
14685f757f3fSDimitry Andricdefm : PatShiftVrVr<srl, "VSRL">;
14695f757f3fSDimitry Andricdefm : PatShiftVrUimm<srl, "VSRLI">;
14705f757f3fSDimitry Andric
14715f757f3fSDimitry Andric// VSRA[I]_{B/H/W/D}
14725f757f3fSDimitry Andricdefm : PatVrVr<sra, "VSRA">;
14735f757f3fSDimitry Andricdefm : PatShiftVrVr<sra, "VSRA">;
14745f757f3fSDimitry Andricdefm : PatShiftVrUimm<sra, "VSRAI">;
14755f757f3fSDimitry Andric
14765f757f3fSDimitry Andric// VCLZ_{B/H/W/D}
14775f757f3fSDimitry Andricdefm : PatVr<ctlz, "VCLZ">;
14785f757f3fSDimitry Andric
14795f757f3fSDimitry Andric// VPCNT_{B/H/W/D}
14805f757f3fSDimitry Andricdefm : PatVr<ctpop, "VPCNT">;
14815f757f3fSDimitry Andric
14825f757f3fSDimitry Andric// VBITCLR_{B/H/W/D}
14835f757f3fSDimitry Andricdef : Pat<(and v16i8:$vj, (vnot (shl vsplat_imm_eq_1, v16i8:$vk))),
14845f757f3fSDimitry Andric          (v16i8 (VBITCLR_B v16i8:$vj, v16i8:$vk))>;
14855f757f3fSDimitry Andricdef : Pat<(and v8i16:$vj, (vnot (shl vsplat_imm_eq_1, v8i16:$vk))),
14865f757f3fSDimitry Andric          (v8i16 (VBITCLR_H v8i16:$vj, v8i16:$vk))>;
14875f757f3fSDimitry Andricdef : Pat<(and v4i32:$vj, (vnot (shl vsplat_imm_eq_1, v4i32:$vk))),
14885f757f3fSDimitry Andric          (v4i32 (VBITCLR_W v4i32:$vj, v4i32:$vk))>;
14895f757f3fSDimitry Andricdef : Pat<(and v2i64:$vj, (vnot (shl vsplat_imm_eq_1, v2i64:$vk))),
14905f757f3fSDimitry Andric          (v2i64 (VBITCLR_D v2i64:$vj, v2i64:$vk))>;
14915f757f3fSDimitry Andricdef : Pat<(and v16i8:$vj, (vnot (shl vsplat_imm_eq_1,
14925f757f3fSDimitry Andric                                     (vsplati8imm7 v16i8:$vk)))),
14935f757f3fSDimitry Andric          (v16i8 (VBITCLR_B v16i8:$vj, v16i8:$vk))>;
14945f757f3fSDimitry Andricdef : Pat<(and v8i16:$vj, (vnot (shl vsplat_imm_eq_1,
14955f757f3fSDimitry Andric                                     (vsplati16imm15 v8i16:$vk)))),
14965f757f3fSDimitry Andric          (v8i16 (VBITCLR_H v8i16:$vj, v8i16:$vk))>;
14975f757f3fSDimitry Andricdef : Pat<(and v4i32:$vj, (vnot (shl vsplat_imm_eq_1,
14985f757f3fSDimitry Andric                                     (vsplati32imm31 v4i32:$vk)))),
14995f757f3fSDimitry Andric          (v4i32 (VBITCLR_W v4i32:$vj, v4i32:$vk))>;
15005f757f3fSDimitry Andricdef : Pat<(and v2i64:$vj, (vnot (shl vsplat_imm_eq_1,
15015f757f3fSDimitry Andric                                     (vsplati64imm63 v2i64:$vk)))),
15025f757f3fSDimitry Andric          (v2i64 (VBITCLR_D v2i64:$vj, v2i64:$vk))>;
15035f757f3fSDimitry Andric
15045f757f3fSDimitry Andric// VBITCLRI_{B/H/W/D}
15055f757f3fSDimitry Andricdef : Pat<(and (v16i8 LSX128:$vj), (v16i8 (vsplat_uimm_inv_pow2 uimm3:$imm))),
15065f757f3fSDimitry Andric          (VBITCLRI_B LSX128:$vj, uimm3:$imm)>;
15075f757f3fSDimitry Andricdef : Pat<(and (v8i16 LSX128:$vj), (v8i16 (vsplat_uimm_inv_pow2 uimm4:$imm))),
15085f757f3fSDimitry Andric          (VBITCLRI_H LSX128:$vj, uimm4:$imm)>;
15095f757f3fSDimitry Andricdef : Pat<(and (v4i32 LSX128:$vj), (v4i32 (vsplat_uimm_inv_pow2 uimm5:$imm))),
15105f757f3fSDimitry Andric          (VBITCLRI_W LSX128:$vj, uimm5:$imm)>;
15115f757f3fSDimitry Andricdef : Pat<(and (v2i64 LSX128:$vj), (v2i64 (vsplat_uimm_inv_pow2 uimm6:$imm))),
15125f757f3fSDimitry Andric          (VBITCLRI_D LSX128:$vj, uimm6:$imm)>;
15135f757f3fSDimitry Andric
15145f757f3fSDimitry Andric// VBITSET_{B/H/W/D}
15155f757f3fSDimitry Andricdef : Pat<(or v16i8:$vj, (shl vsplat_imm_eq_1, v16i8:$vk)),
15165f757f3fSDimitry Andric          (v16i8 (VBITSET_B v16i8:$vj, v16i8:$vk))>;
15175f757f3fSDimitry Andricdef : Pat<(or v8i16:$vj, (shl vsplat_imm_eq_1, v8i16:$vk)),
15185f757f3fSDimitry Andric          (v8i16 (VBITSET_H v8i16:$vj, v8i16:$vk))>;
15195f757f3fSDimitry Andricdef : Pat<(or v4i32:$vj, (shl vsplat_imm_eq_1, v4i32:$vk)),
15205f757f3fSDimitry Andric          (v4i32 (VBITSET_W v4i32:$vj, v4i32:$vk))>;
15215f757f3fSDimitry Andricdef : Pat<(or v2i64:$vj, (shl vsplat_imm_eq_1, v2i64:$vk)),
15225f757f3fSDimitry Andric          (v2i64 (VBITSET_D v2i64:$vj, v2i64:$vk))>;
15235f757f3fSDimitry Andricdef : Pat<(or v16i8:$vj, (shl vsplat_imm_eq_1, (vsplati8imm7 v16i8:$vk))),
15245f757f3fSDimitry Andric          (v16i8 (VBITSET_B v16i8:$vj, v16i8:$vk))>;
15255f757f3fSDimitry Andricdef : Pat<(or v8i16:$vj, (shl vsplat_imm_eq_1, (vsplati16imm15 v8i16:$vk))),
15265f757f3fSDimitry Andric          (v8i16 (VBITSET_H v8i16:$vj, v8i16:$vk))>;
15275f757f3fSDimitry Andricdef : Pat<(or v4i32:$vj, (shl vsplat_imm_eq_1, (vsplati32imm31 v4i32:$vk))),
15285f757f3fSDimitry Andric          (v4i32 (VBITSET_W v4i32:$vj, v4i32:$vk))>;
15295f757f3fSDimitry Andricdef : Pat<(or v2i64:$vj, (shl vsplat_imm_eq_1, (vsplati64imm63 v2i64:$vk))),
15305f757f3fSDimitry Andric          (v2i64 (VBITSET_D v2i64:$vj, v2i64:$vk))>;
15315f757f3fSDimitry Andric
15325f757f3fSDimitry Andric// VBITSETI_{B/H/W/D}
15335f757f3fSDimitry Andricdef : Pat<(or (v16i8 LSX128:$vj), (v16i8 (vsplat_uimm_pow2 uimm3:$imm))),
15345f757f3fSDimitry Andric          (VBITSETI_B LSX128:$vj, uimm3:$imm)>;
15355f757f3fSDimitry Andricdef : Pat<(or (v8i16 LSX128:$vj), (v8i16 (vsplat_uimm_pow2 uimm4:$imm))),
15365f757f3fSDimitry Andric          (VBITSETI_H LSX128:$vj, uimm4:$imm)>;
15375f757f3fSDimitry Andricdef : Pat<(or (v4i32 LSX128:$vj), (v4i32 (vsplat_uimm_pow2 uimm5:$imm))),
15385f757f3fSDimitry Andric          (VBITSETI_W LSX128:$vj, uimm5:$imm)>;
15395f757f3fSDimitry Andricdef : Pat<(or (v2i64 LSX128:$vj), (v2i64 (vsplat_uimm_pow2 uimm6:$imm))),
15405f757f3fSDimitry Andric          (VBITSETI_D LSX128:$vj, uimm6:$imm)>;
15415f757f3fSDimitry Andric
15425f757f3fSDimitry Andric// VBITREV_{B/H/W/D}
15435f757f3fSDimitry Andricdef : Pat<(xor v16i8:$vj, (shl vsplat_imm_eq_1, v16i8:$vk)),
15445f757f3fSDimitry Andric          (v16i8 (VBITREV_B v16i8:$vj, v16i8:$vk))>;
15455f757f3fSDimitry Andricdef : Pat<(xor v8i16:$vj, (shl vsplat_imm_eq_1, v8i16:$vk)),
15465f757f3fSDimitry Andric          (v8i16 (VBITREV_H v8i16:$vj, v8i16:$vk))>;
15475f757f3fSDimitry Andricdef : Pat<(xor v4i32:$vj, (shl vsplat_imm_eq_1, v4i32:$vk)),
15485f757f3fSDimitry Andric          (v4i32 (VBITREV_W v4i32:$vj, v4i32:$vk))>;
15495f757f3fSDimitry Andricdef : Pat<(xor v2i64:$vj, (shl vsplat_imm_eq_1, v2i64:$vk)),
15505f757f3fSDimitry Andric          (v2i64 (VBITREV_D v2i64:$vj, v2i64:$vk))>;
15515f757f3fSDimitry Andricdef : Pat<(xor v16i8:$vj, (shl vsplat_imm_eq_1, (vsplati8imm7 v16i8:$vk))),
15525f757f3fSDimitry Andric          (v16i8 (VBITREV_B v16i8:$vj, v16i8:$vk))>;
15535f757f3fSDimitry Andricdef : Pat<(xor v8i16:$vj, (shl vsplat_imm_eq_1, (vsplati16imm15 v8i16:$vk))),
15545f757f3fSDimitry Andric          (v8i16 (VBITREV_H v8i16:$vj, v8i16:$vk))>;
15555f757f3fSDimitry Andricdef : Pat<(xor v4i32:$vj, (shl vsplat_imm_eq_1, (vsplati32imm31 v4i32:$vk))),
15565f757f3fSDimitry Andric          (v4i32 (VBITREV_W v4i32:$vj, v4i32:$vk))>;
15575f757f3fSDimitry Andricdef : Pat<(xor v2i64:$vj, (shl vsplat_imm_eq_1, (vsplati64imm63 v2i64:$vk))),
15585f757f3fSDimitry Andric          (v2i64 (VBITREV_D v2i64:$vj, v2i64:$vk))>;
15595f757f3fSDimitry Andric
15605f757f3fSDimitry Andric// VBITREVI_{B/H/W/D}
15615f757f3fSDimitry Andricdef : Pat<(xor (v16i8 LSX128:$vj), (v16i8 (vsplat_uimm_pow2 uimm3:$imm))),
15625f757f3fSDimitry Andric          (VBITREVI_B LSX128:$vj, uimm3:$imm)>;
15635f757f3fSDimitry Andricdef : Pat<(xor (v8i16 LSX128:$vj), (v8i16 (vsplat_uimm_pow2 uimm4:$imm))),
15645f757f3fSDimitry Andric          (VBITREVI_H LSX128:$vj, uimm4:$imm)>;
15655f757f3fSDimitry Andricdef : Pat<(xor (v4i32 LSX128:$vj), (v4i32 (vsplat_uimm_pow2 uimm5:$imm))),
15665f757f3fSDimitry Andric          (VBITREVI_W LSX128:$vj, uimm5:$imm)>;
15675f757f3fSDimitry Andricdef : Pat<(xor (v2i64 LSX128:$vj), (v2i64 (vsplat_uimm_pow2 uimm6:$imm))),
15685f757f3fSDimitry Andric          (VBITREVI_D LSX128:$vj, uimm6:$imm)>;
15695f757f3fSDimitry Andric
15705f757f3fSDimitry Andric// VFADD_{S/D}
15715f757f3fSDimitry Andricdefm : PatVrVrF<fadd, "VFADD">;
15725f757f3fSDimitry Andric
15735f757f3fSDimitry Andric// VFSUB_{S/D}
15745f757f3fSDimitry Andricdefm : PatVrVrF<fsub, "VFSUB">;
15755f757f3fSDimitry Andric
15765f757f3fSDimitry Andric// VFMUL_{S/D}
15775f757f3fSDimitry Andricdefm : PatVrVrF<fmul, "VFMUL">;
15785f757f3fSDimitry Andric
15795f757f3fSDimitry Andric// VFDIV_{S/D}
15805f757f3fSDimitry Andricdefm : PatVrVrF<fdiv, "VFDIV">;
15815f757f3fSDimitry Andric
15825f757f3fSDimitry Andric// VFMADD_{S/D}
15835f757f3fSDimitry Andricdef : Pat<(fma v4f32:$vj, v4f32:$vk, v4f32:$va),
15845f757f3fSDimitry Andric          (VFMADD_S v4f32:$vj, v4f32:$vk, v4f32:$va)>;
15855f757f3fSDimitry Andricdef : Pat<(fma v2f64:$vj, v2f64:$vk, v2f64:$va),
15865f757f3fSDimitry Andric          (VFMADD_D v2f64:$vj, v2f64:$vk, v2f64:$va)>;
15875f757f3fSDimitry Andric
15885f757f3fSDimitry Andric// VFMSUB_{S/D}
15895f757f3fSDimitry Andricdef : Pat<(fma v4f32:$vj, v4f32:$vk, (fneg v4f32:$va)),
15905f757f3fSDimitry Andric          (VFMSUB_S v4f32:$vj, v4f32:$vk, v4f32:$va)>;
15915f757f3fSDimitry Andricdef : Pat<(fma v2f64:$vj, v2f64:$vk, (fneg v2f64:$va)),
15925f757f3fSDimitry Andric          (VFMSUB_D v2f64:$vj, v2f64:$vk, v2f64:$va)>;
15935f757f3fSDimitry Andric
15945f757f3fSDimitry Andric// VFNMADD_{S/D}
15955f757f3fSDimitry Andricdef : Pat<(fneg (fma v4f32:$vj, v4f32:$vk, v4f32:$va)),
15965f757f3fSDimitry Andric          (VFNMADD_S v4f32:$vj, v4f32:$vk, v4f32:$va)>;
15975f757f3fSDimitry Andricdef : Pat<(fneg (fma v2f64:$vj, v2f64:$vk, v2f64:$va)),
15985f757f3fSDimitry Andric          (VFNMADD_D v2f64:$vj, v2f64:$vk, v2f64:$va)>;
15995f757f3fSDimitry Andricdef : Pat<(fma_nsz (fneg v4f32:$vj), v4f32:$vk, (fneg v4f32:$va)),
16005f757f3fSDimitry Andric          (VFNMADD_S v4f32:$vj, v4f32:$vk, v4f32:$va)>;
16015f757f3fSDimitry Andricdef : Pat<(fma_nsz (fneg v2f64:$vj), v2f64:$vk, (fneg v2f64:$va)),
16025f757f3fSDimitry Andric          (VFNMADD_D v2f64:$vj, v2f64:$vk, v2f64:$va)>;
16035f757f3fSDimitry Andric
16045f757f3fSDimitry Andric// VFNMSUB_{S/D}
16055f757f3fSDimitry Andricdef : Pat<(fneg (fma v4f32:$vj, v4f32:$vk, (fneg v4f32:$va))),
16065f757f3fSDimitry Andric          (VFNMSUB_S v4f32:$vj, v4f32:$vk, v4f32:$va)>;
16075f757f3fSDimitry Andricdef : Pat<(fneg (fma v2f64:$vj, v2f64:$vk, (fneg v2f64:$va))),
16085f757f3fSDimitry Andric          (VFNMSUB_D v2f64:$vj, v2f64:$vk, v2f64:$va)>;
16095f757f3fSDimitry Andricdef : Pat<(fma_nsz (fneg v4f32:$vj), v4f32:$vk, v4f32:$va),
16105f757f3fSDimitry Andric          (VFNMSUB_S v4f32:$vj, v4f32:$vk, v4f32:$va)>;
16115f757f3fSDimitry Andricdef : Pat<(fma_nsz (fneg v2f64:$vj), v2f64:$vk, v2f64:$va),
16125f757f3fSDimitry Andric          (VFNMSUB_D v2f64:$vj, v2f64:$vk, v2f64:$va)>;
16135f757f3fSDimitry Andric
16145f757f3fSDimitry Andric// VFSQRT_{S/D}
16155f757f3fSDimitry Andricdefm : PatVrF<fsqrt, "VFSQRT">;
16165f757f3fSDimitry Andric
16175f757f3fSDimitry Andric// VFRECIP_{S/D}
16185f757f3fSDimitry Andricdef : Pat<(fdiv vsplatf32_fpimm_eq_1, v4f32:$vj),
16195f757f3fSDimitry Andric          (VFRECIP_S v4f32:$vj)>;
16205f757f3fSDimitry Andricdef : Pat<(fdiv vsplatf64_fpimm_eq_1, v2f64:$vj),
16215f757f3fSDimitry Andric          (VFRECIP_D v2f64:$vj)>;
16225f757f3fSDimitry Andric
16235f757f3fSDimitry Andric// VFRSQRT_{S/D}
16245f757f3fSDimitry Andricdef : Pat<(fdiv vsplatf32_fpimm_eq_1, (fsqrt v4f32:$vj)),
16255f757f3fSDimitry Andric          (VFRSQRT_S v4f32:$vj)>;
16265f757f3fSDimitry Andricdef : Pat<(fdiv vsplatf64_fpimm_eq_1, (fsqrt v2f64:$vj)),
16275f757f3fSDimitry Andric          (VFRSQRT_D v2f64:$vj)>;
16285f757f3fSDimitry Andric
16295f757f3fSDimitry Andric// VSEQ[I]_{B/H/W/D}
16305f757f3fSDimitry Andricdefm : PatCCVrSimm5<SETEQ, "VSEQI">;
16315f757f3fSDimitry Andricdefm : PatCCVrVr<SETEQ, "VSEQ">;
16325f757f3fSDimitry Andric
16335f757f3fSDimitry Andric// VSLE[I]_{B/H/W/D}[U]
16345f757f3fSDimitry Andricdefm : PatCCVrSimm5<SETLE, "VSLEI">;
16355f757f3fSDimitry Andricdefm : PatCCVrUimm5<SETULE, "VSLEI">;
16365f757f3fSDimitry Andricdefm : PatCCVrVr<SETLE, "VSLE">;
16375f757f3fSDimitry Andricdefm : PatCCVrVrU<SETULE, "VSLE">;
16385f757f3fSDimitry Andric
16395f757f3fSDimitry Andric// VSLT[I]_{B/H/W/D}[U]
16405f757f3fSDimitry Andricdefm : PatCCVrSimm5<SETLT, "VSLTI">;
16415f757f3fSDimitry Andricdefm : PatCCVrUimm5<SETULT, "VSLTI">;
16425f757f3fSDimitry Andricdefm : PatCCVrVr<SETLT, "VSLT">;
16435f757f3fSDimitry Andricdefm : PatCCVrVrU<SETULT, "VSLT">;
16445f757f3fSDimitry Andric
16455f757f3fSDimitry Andric// VFCMP.cond.{S/D}
16465f757f3fSDimitry Andricdefm : PatCCVrVrF<SETEQ, "VFCMP_CEQ">;
16475f757f3fSDimitry Andricdefm : PatCCVrVrF<SETOEQ, "VFCMP_CEQ">;
16485f757f3fSDimitry Andricdefm : PatCCVrVrF<SETUEQ, "VFCMP_CUEQ">;
16495f757f3fSDimitry Andric
16505f757f3fSDimitry Andricdefm : PatCCVrVrF<SETLE, "VFCMP_CLE">;
16515f757f3fSDimitry Andricdefm : PatCCVrVrF<SETOLE, "VFCMP_CLE">;
16525f757f3fSDimitry Andricdefm : PatCCVrVrF<SETULE, "VFCMP_CULE">;
16535f757f3fSDimitry Andric
16545f757f3fSDimitry Andricdefm : PatCCVrVrF<SETLT, "VFCMP_CLT">;
16555f757f3fSDimitry Andricdefm : PatCCVrVrF<SETOLT, "VFCMP_CLT">;
16565f757f3fSDimitry Andricdefm : PatCCVrVrF<SETULT, "VFCMP_CULT">;
16575f757f3fSDimitry Andric
16585f757f3fSDimitry Andricdefm : PatCCVrVrF<SETNE, "VFCMP_CNE">;
16595f757f3fSDimitry Andricdefm : PatCCVrVrF<SETONE, "VFCMP_CNE">;
16605f757f3fSDimitry Andricdefm : PatCCVrVrF<SETUNE, "VFCMP_CUNE">;
16615f757f3fSDimitry Andric
16625f757f3fSDimitry Andricdefm : PatCCVrVrF<SETO, "VFCMP_COR">;
16635f757f3fSDimitry Andricdefm : PatCCVrVrF<SETUO, "VFCMP_CUN">;
16645f757f3fSDimitry Andric
16655f757f3fSDimitry Andric// VINSGR2VR_{B/H/W/D}
16665f757f3fSDimitry Andricdef : Pat<(vector_insert v16i8:$vd, GRLenVT:$rj, uimm4:$imm),
16675f757f3fSDimitry Andric          (VINSGR2VR_B v16i8:$vd, GRLenVT:$rj, uimm4:$imm)>;
16685f757f3fSDimitry Andricdef : Pat<(vector_insert v8i16:$vd, GRLenVT:$rj, uimm3:$imm),
16695f757f3fSDimitry Andric          (VINSGR2VR_H v8i16:$vd, GRLenVT:$rj, uimm3:$imm)>;
16705f757f3fSDimitry Andricdef : Pat<(vector_insert v4i32:$vd, GRLenVT:$rj, uimm2:$imm),
16715f757f3fSDimitry Andric          (VINSGR2VR_W v4i32:$vd, GRLenVT:$rj, uimm2:$imm)>;
16725f757f3fSDimitry Andricdef : Pat<(vector_insert v2i64:$vd, GRLenVT:$rj, uimm1:$imm),
16735f757f3fSDimitry Andric          (VINSGR2VR_D v2i64:$vd, GRLenVT:$rj, uimm1:$imm)>;
16745f757f3fSDimitry Andric
16755f757f3fSDimitry Andricdef : Pat<(vector_insert v4f32:$vd, FPR32:$fj, uimm2:$imm),
16765f757f3fSDimitry Andric          (VINSGR2VR_W $vd, (COPY_TO_REGCLASS FPR32:$fj, GPR), uimm2:$imm)>;
16775f757f3fSDimitry Andricdef : Pat<(vector_insert v2f64:$vd, FPR64:$fj, uimm1:$imm),
16785f757f3fSDimitry Andric          (VINSGR2VR_D $vd, (COPY_TO_REGCLASS FPR64:$fj, GPR), uimm1:$imm)>;
16795f757f3fSDimitry Andric
16805f757f3fSDimitry Andric// VPICKVE2GR_{B/H/W}[U]
16815f757f3fSDimitry Andricdef : Pat<(loongarch_vpick_sext_elt v16i8:$vd, uimm4:$imm, i8),
16825f757f3fSDimitry Andric          (VPICKVE2GR_B v16i8:$vd, uimm4:$imm)>;
16835f757f3fSDimitry Andricdef : Pat<(loongarch_vpick_sext_elt v8i16:$vd, uimm3:$imm, i16),
16845f757f3fSDimitry Andric          (VPICKVE2GR_H v8i16:$vd, uimm3:$imm)>;
16855f757f3fSDimitry Andricdef : Pat<(loongarch_vpick_sext_elt v4i32:$vd, uimm2:$imm, i32),
16865f757f3fSDimitry Andric          (VPICKVE2GR_W v4i32:$vd, uimm2:$imm)>;
16875f757f3fSDimitry Andric
16885f757f3fSDimitry Andricdef : Pat<(loongarch_vpick_zext_elt v16i8:$vd, uimm4:$imm, i8),
16895f757f3fSDimitry Andric          (VPICKVE2GR_BU v16i8:$vd, uimm4:$imm)>;
16905f757f3fSDimitry Andricdef : Pat<(loongarch_vpick_zext_elt v8i16:$vd, uimm3:$imm, i16),
16915f757f3fSDimitry Andric          (VPICKVE2GR_HU v8i16:$vd, uimm3:$imm)>;
16925f757f3fSDimitry Andricdef : Pat<(loongarch_vpick_zext_elt v4i32:$vd, uimm2:$imm, i32),
16935f757f3fSDimitry Andric          (VPICKVE2GR_WU v4i32:$vd, uimm2:$imm)>;
16945f757f3fSDimitry Andric
16955f757f3fSDimitry Andric// VREPLGR2VR_{B/H/W/D}
16965f757f3fSDimitry Andricdef : Pat<(lsxsplati8 GPR:$rj), (VREPLGR2VR_B GPR:$rj)>;
16975f757f3fSDimitry Andricdef : Pat<(lsxsplati16 GPR:$rj), (VREPLGR2VR_H GPR:$rj)>;
16985f757f3fSDimitry Andricdef : Pat<(lsxsplati32 GPR:$rj), (VREPLGR2VR_W GPR:$rj)>;
16995f757f3fSDimitry Andricdef : Pat<(lsxsplati64 GPR:$rj), (VREPLGR2VR_D GPR:$rj)>;
17005f757f3fSDimitry Andric
17015f757f3fSDimitry Andric// VREPLVE_{B/H/W/D}
17025f757f3fSDimitry Andricdef : Pat<(loongarch_vreplve v16i8:$vj, GRLenVT:$rk),
17035f757f3fSDimitry Andric          (VREPLVE_B v16i8:$vj, GRLenVT:$rk)>;
17045f757f3fSDimitry Andricdef : Pat<(loongarch_vreplve v8i16:$vj, GRLenVT:$rk),
17055f757f3fSDimitry Andric          (VREPLVE_H v8i16:$vj, GRLenVT:$rk)>;
17065f757f3fSDimitry Andricdef : Pat<(loongarch_vreplve v4i32:$vj, GRLenVT:$rk),
17075f757f3fSDimitry Andric          (VREPLVE_W v4i32:$vj, GRLenVT:$rk)>;
17085f757f3fSDimitry Andricdef : Pat<(loongarch_vreplve v2i64:$vj, GRLenVT:$rk),
17095f757f3fSDimitry Andric          (VREPLVE_D v2i64:$vj, GRLenVT:$rk)>;
17105f757f3fSDimitry Andric
1711*0fca6ea1SDimitry Andric// VSHUF_{B/H/W/D}
1712*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vshuf v16i8:$va, v16i8:$vj, v16i8:$vk),
1713*0fca6ea1SDimitry Andric          (VSHUF_B v16i8:$vj, v16i8:$vk, v16i8:$va)>;
1714*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vshuf v8i16:$vd, v8i16:$vj, v8i16:$vk),
1715*0fca6ea1SDimitry Andric          (VSHUF_H v8i16:$vd, v8i16:$vj, v8i16:$vk)>;
1716*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vshuf v4i32:$vd, v4i32:$vj, v4i32:$vk),
1717*0fca6ea1SDimitry Andric          (VSHUF_W v4i32:$vd, v4i32:$vj, v4i32:$vk)>;
1718*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vshuf v2i64:$vd, v2i64:$vj, v2i64:$vk),
1719*0fca6ea1SDimitry Andric          (VSHUF_D v2i64:$vd, v2i64:$vj, v2i64:$vk)>;
1720*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vshuf v4i32:$vd, v4f32:$vj, v4f32:$vk),
1721*0fca6ea1SDimitry Andric          (VSHUF_W v4i32:$vd, v4f32:$vj, v4f32:$vk)>;
1722*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vshuf v2i64:$vd, v2f64:$vj, v2f64:$vk),
1723*0fca6ea1SDimitry Andric          (VSHUF_D v2i64:$vd, v2f64:$vj, v2f64:$vk)>;
1724*0fca6ea1SDimitry Andric
1725*0fca6ea1SDimitry Andric// VPICKEV_{B/H/W/D}
1726*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vpickev v16i8:$vj, v16i8:$vk),
1727*0fca6ea1SDimitry Andric          (VPICKEV_B v16i8:$vj, v16i8:$vk)>;
1728*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vpickev v8i16:$vj, v8i16:$vk),
1729*0fca6ea1SDimitry Andric          (VPICKEV_H v8i16:$vj, v8i16:$vk)>;
1730*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vpickev v4i32:$vj, v4i32:$vk),
1731*0fca6ea1SDimitry Andric          (VPICKEV_W v4i32:$vj, v4i32:$vk)>;
1732*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vpickev v2i64:$vj, v2i64:$vk),
1733*0fca6ea1SDimitry Andric          (VPICKEV_D v2i64:$vj, v2i64:$vk)>;
1734*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vpickev v4f32:$vj, v4f32:$vk),
1735*0fca6ea1SDimitry Andric          (VPICKEV_W v4f32:$vj, v4f32:$vk)>;
1736*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vpickev v2f64:$vj, v2f64:$vk),
1737*0fca6ea1SDimitry Andric          (VPICKEV_D v2f64:$vj, v2f64:$vk)>;
1738*0fca6ea1SDimitry Andric
1739*0fca6ea1SDimitry Andric// VPICKOD_{B/H/W/D}
1740*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vpickod v16i8:$vj, v16i8:$vk),
1741*0fca6ea1SDimitry Andric          (VPICKOD_B v16i8:$vj, v16i8:$vk)>;
1742*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vpickod v8i16:$vj, v8i16:$vk),
1743*0fca6ea1SDimitry Andric          (VPICKOD_H v8i16:$vj, v8i16:$vk)>;
1744*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vpickod v4i32:$vj, v4i32:$vk),
1745*0fca6ea1SDimitry Andric          (VPICKOD_W v4i32:$vj, v4i32:$vk)>;
1746*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vpickod v2i64:$vj, v2i64:$vk),
1747*0fca6ea1SDimitry Andric          (VPICKOD_D v2i64:$vj, v2i64:$vk)>;
1748*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vpickod v4f32:$vj, v4f32:$vk),
1749*0fca6ea1SDimitry Andric          (VPICKOD_W v4f32:$vj, v4f32:$vk)>;
1750*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vpickod v2f64:$vj, v2f64:$vk),
1751*0fca6ea1SDimitry Andric          (VPICKOD_D v2f64:$vj, v2f64:$vk)>;
1752*0fca6ea1SDimitry Andric
1753*0fca6ea1SDimitry Andric// VPACKEV_{B/H/W/D}
1754*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vpackev v16i8:$vj, v16i8:$vk),
1755*0fca6ea1SDimitry Andric          (VPACKEV_B v16i8:$vj, v16i8:$vk)>;
1756*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vpackev v8i16:$vj, v8i16:$vk),
1757*0fca6ea1SDimitry Andric          (VPACKEV_H v8i16:$vj, v8i16:$vk)>;
1758*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vpackev v4i32:$vj, v4i32:$vk),
1759*0fca6ea1SDimitry Andric          (VPACKEV_W v4i32:$vj, v4i32:$vk)>;
1760*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vpackev v2i64:$vj, v2i64:$vk),
1761*0fca6ea1SDimitry Andric          (VPACKEV_D v2i64:$vj, v2i64:$vk)>;
1762*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vpackev v4f32:$vj, v4f32:$vk),
1763*0fca6ea1SDimitry Andric          (VPACKEV_W v4f32:$vj, v4f32:$vk)>;
1764*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vpackev v2f64:$vj, v2f64:$vk),
1765*0fca6ea1SDimitry Andric          (VPACKEV_D v2f64:$vj, v2f64:$vk)>;
1766*0fca6ea1SDimitry Andric
1767*0fca6ea1SDimitry Andric// VPACKOD_{B/H/W/D}
1768*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vpackod v16i8:$vj, v16i8:$vk),
1769*0fca6ea1SDimitry Andric          (VPACKOD_B v16i8:$vj, v16i8:$vk)>;
1770*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vpackod v8i16:$vj, v8i16:$vk),
1771*0fca6ea1SDimitry Andric          (VPACKOD_H v8i16:$vj, v8i16:$vk)>;
1772*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vpackod v4i32:$vj, v4i32:$vk),
1773*0fca6ea1SDimitry Andric          (VPACKOD_W v4i32:$vj, v4i32:$vk)>;
1774*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vpackod v2i64:$vj, v2i64:$vk),
1775*0fca6ea1SDimitry Andric          (VPACKOD_D v2i64:$vj, v2i64:$vk)>;
1776*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vpackod v4f32:$vj, v4f32:$vk),
1777*0fca6ea1SDimitry Andric          (VPACKOD_W v4f32:$vj, v4f32:$vk)>;
1778*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vpackod v2f64:$vj, v2f64:$vk),
1779*0fca6ea1SDimitry Andric          (VPACKOD_D v2f64:$vj, v2f64:$vk)>;
1780*0fca6ea1SDimitry Andric
1781*0fca6ea1SDimitry Andric// VILVL_{B/H/W/D}
1782*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vilvl v16i8:$vj, v16i8:$vk),
1783*0fca6ea1SDimitry Andric          (VILVL_B v16i8:$vj, v16i8:$vk)>;
1784*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vilvl v8i16:$vj, v8i16:$vk),
1785*0fca6ea1SDimitry Andric          (VILVL_H v8i16:$vj, v8i16:$vk)>;
1786*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vilvl v4i32:$vj, v4i32:$vk),
1787*0fca6ea1SDimitry Andric          (VILVL_W v4i32:$vj, v4i32:$vk)>;
1788*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vilvl v2i64:$vj, v2i64:$vk),
1789*0fca6ea1SDimitry Andric          (VILVL_D v2i64:$vj, v2i64:$vk)>;
1790*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vilvl v4f32:$vj, v4f32:$vk),
1791*0fca6ea1SDimitry Andric          (VILVL_W v4f32:$vj, v4f32:$vk)>;
1792*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vilvl v2f64:$vj, v2f64:$vk),
1793*0fca6ea1SDimitry Andric          (VILVL_D v2f64:$vj, v2f64:$vk)>;
1794*0fca6ea1SDimitry Andric
1795*0fca6ea1SDimitry Andric// VILVH_{B/H/W/D}
1796*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vilvh v16i8:$vj, v16i8:$vk),
1797*0fca6ea1SDimitry Andric          (VILVH_B v16i8:$vj, v16i8:$vk)>;
1798*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vilvh v8i16:$vj, v8i16:$vk),
1799*0fca6ea1SDimitry Andric          (VILVH_H v8i16:$vj, v8i16:$vk)>;
1800*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vilvh v4i32:$vj, v4i32:$vk),
1801*0fca6ea1SDimitry Andric          (VILVH_W v4i32:$vj, v4i32:$vk)>;
1802*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vilvh v2i64:$vj, v2i64:$vk),
1803*0fca6ea1SDimitry Andric          (VILVH_D v2i64:$vj, v2i64:$vk)>;
1804*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vilvh v4f32:$vj, v4f32:$vk),
1805*0fca6ea1SDimitry Andric          (VILVH_W v4f32:$vj, v4f32:$vk)>;
1806*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vilvh v2f64:$vj, v2f64:$vk),
1807*0fca6ea1SDimitry Andric          (VILVH_D v2f64:$vj, v2f64:$vk)>;
1808*0fca6ea1SDimitry Andric
1809*0fca6ea1SDimitry Andric// VSHUF4I_{B/H/W}
1810*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vshuf4i v16i8:$vj, immZExt8:$ui8),
1811*0fca6ea1SDimitry Andric          (VSHUF4I_B v16i8:$vj, immZExt8:$ui8)>;
1812*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vshuf4i v8i16:$vj, immZExt8:$ui8),
1813*0fca6ea1SDimitry Andric        (VSHUF4I_H v8i16:$vj, immZExt8:$ui8)>;
1814*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vshuf4i v4i32:$vj, immZExt8:$ui8),
1815*0fca6ea1SDimitry Andric        (VSHUF4I_W v4i32:$vj, immZExt8:$ui8)>;
1816*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vshuf4i v4f32:$vj, immZExt8:$ui8),
1817*0fca6ea1SDimitry Andric        (VSHUF4I_W v4f32:$vj, immZExt8:$ui8)>;
1818*0fca6ea1SDimitry Andric
1819*0fca6ea1SDimitry Andric// VREPLVEI_{B/H/W/D}
1820*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vreplvei v16i8:$vj, immZExt4:$ui4),
1821*0fca6ea1SDimitry Andric          (VREPLVEI_B v16i8:$vj, immZExt4:$ui4)>;
1822*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vreplvei v8i16:$vj, immZExt3:$ui3),
1823*0fca6ea1SDimitry Andric        (VREPLVEI_H v8i16:$vj, immZExt3:$ui3)>;
1824*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vreplvei v4i32:$vj, immZExt2:$ui2),
1825*0fca6ea1SDimitry Andric        (VREPLVEI_W v4i32:$vj, immZExt2:$ui2)>;
1826*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vreplvei v2i64:$vj, immZExt1:$ui1),
1827*0fca6ea1SDimitry Andric        (VREPLVEI_D v2i64:$vj, immZExt1:$ui1)>;
1828*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vreplvei v4f32:$vj, immZExt2:$ui2),
1829*0fca6ea1SDimitry Andric        (VREPLVEI_W v4f32:$vj, immZExt2:$ui2)>;
1830*0fca6ea1SDimitry Andricdef : Pat<(loongarch_vreplvei v2f64:$vj, immZExt1:$ui1),
1831*0fca6ea1SDimitry Andric        (VREPLVEI_D v2f64:$vj, immZExt1:$ui1)>;
1832*0fca6ea1SDimitry Andric
18335f757f3fSDimitry Andric// VREPLVEI_{W/D}
18345f757f3fSDimitry Andricdef : Pat<(lsxsplatf32 FPR32:$fj),
18355f757f3fSDimitry Andric          (VREPLVEI_W (SUBREG_TO_REG (i64 0), FPR32:$fj, sub_32), 0)>;
18365f757f3fSDimitry Andricdef : Pat<(lsxsplatf64 FPR64:$fj),
18375f757f3fSDimitry Andric          (VREPLVEI_D (SUBREG_TO_REG (i64 0), FPR64:$fj, sub_64), 0)>;
18385f757f3fSDimitry Andric
18395f757f3fSDimitry Andric// Loads/Stores
18405f757f3fSDimitry Andricforeach vt = [v16i8, v8i16, v4i32, v2i64, v4f32, v2f64] in {
18415f757f3fSDimitry Andric  defm : LdPat<load, VLD, vt>;
18425f757f3fSDimitry Andric  def  : RegRegLdPat<load, VLDX, vt>;
18435f757f3fSDimitry Andric  defm : StPat<store, VST, LSX128, vt>;
18445f757f3fSDimitry Andric  def  : RegRegStPat<store, VSTX, LSX128, vt>;
18455f757f3fSDimitry Andric}
18465f757f3fSDimitry Andric
18475f757f3fSDimitry Andric// Vector extraction with constant index.
18485f757f3fSDimitry Andricdef : Pat<(i64 (vector_extract v16i8:$vj, uimm4:$imm)),
18495f757f3fSDimitry Andric          (VPICKVE2GR_B v16i8:$vj, uimm4:$imm)>;
18505f757f3fSDimitry Andricdef : Pat<(i64 (vector_extract v8i16:$vj, uimm3:$imm)),
18515f757f3fSDimitry Andric          (VPICKVE2GR_H v8i16:$vj, uimm3:$imm)>;
18525f757f3fSDimitry Andricdef : Pat<(i64 (vector_extract v4i32:$vj, uimm2:$imm)),
18535f757f3fSDimitry Andric          (VPICKVE2GR_W v4i32:$vj, uimm2:$imm)>;
18545f757f3fSDimitry Andricdef : Pat<(i64 (vector_extract v2i64:$vj, uimm1:$imm)),
18555f757f3fSDimitry Andric          (VPICKVE2GR_D v2i64:$vj, uimm1:$imm)>;
18565f757f3fSDimitry Andricdef : Pat<(f32 (vector_extract v4f32:$vj, uimm2:$imm)),
18575f757f3fSDimitry Andric          (f32 (EXTRACT_SUBREG (VREPLVEI_W v4f32:$vj, uimm2:$imm), sub_32))>;
18585f757f3fSDimitry Andricdef : Pat<(f64 (vector_extract v2f64:$vj, uimm1:$imm)),
18595f757f3fSDimitry Andric          (f64 (EXTRACT_SUBREG (VREPLVEI_D v2f64:$vj, uimm1:$imm), sub_64))>;
18605f757f3fSDimitry Andric
18615f757f3fSDimitry Andric// Vector extraction with variable index.
18625f757f3fSDimitry Andricdef : Pat<(i64 (vector_extract v16i8:$vj, i64:$rk)),
18635f757f3fSDimitry Andric          (SRAI_W (COPY_TO_REGCLASS (f32 (EXTRACT_SUBREG (VREPLVE_B v16i8:$vj,
18645f757f3fSDimitry Andric                                                                    i64:$rk),
18655f757f3fSDimitry Andric                                                         sub_32)),
18665f757f3fSDimitry Andric                                    GPR), (i64 24))>;
18675f757f3fSDimitry Andricdef : Pat<(i64 (vector_extract v8i16:$vj, i64:$rk)),
18685f757f3fSDimitry Andric          (SRAI_W (COPY_TO_REGCLASS (f32 (EXTRACT_SUBREG (VREPLVE_H v8i16:$vj,
18695f757f3fSDimitry Andric                                                                    i64:$rk),
18705f757f3fSDimitry Andric                                                         sub_32)),
18715f757f3fSDimitry Andric                                    GPR), (i64 16))>;
18725f757f3fSDimitry Andricdef : Pat<(i64 (vector_extract v4i32:$vj, i64:$rk)),
18735f757f3fSDimitry Andric          (COPY_TO_REGCLASS (f32 (EXTRACT_SUBREG (VREPLVE_W v4i32:$vj, i64:$rk),
18745f757f3fSDimitry Andric                                                 sub_32)),
18755f757f3fSDimitry Andric                            GPR)>;
18765f757f3fSDimitry Andricdef : Pat<(i64 (vector_extract v2i64:$vj, i64:$rk)),
18775f757f3fSDimitry Andric          (COPY_TO_REGCLASS (f64 (EXTRACT_SUBREG (VREPLVE_D v2i64:$vj, i64:$rk),
18785f757f3fSDimitry Andric                                                 sub_64)),
18795f757f3fSDimitry Andric                            GPR)>;
18805f757f3fSDimitry Andricdef : Pat<(f32 (vector_extract v4f32:$vj, i64:$rk)),
18815f757f3fSDimitry Andric          (f32 (EXTRACT_SUBREG (VREPLVE_W v4f32:$vj, i64:$rk), sub_32))>;
18825f757f3fSDimitry Andricdef : Pat<(f64 (vector_extract v2f64:$vj, i64:$rk)),
18835f757f3fSDimitry Andric          (f64 (EXTRACT_SUBREG (VREPLVE_D v2f64:$vj, i64:$rk), sub_64))>;
18845f757f3fSDimitry Andric
18855f757f3fSDimitry Andric// vselect
1886647cbc5dSDimitry Andricdef : Pat<(v16i8 (vselect LSX128:$vd, (v16i8 (SplatPat_uimm8 uimm8:$imm)),
1887647cbc5dSDimitry Andric                          LSX128:$vj)),
18885f757f3fSDimitry Andric          (VBITSELI_B LSX128:$vd, LSX128:$vj, uimm8:$imm)>;
18895f757f3fSDimitry Andricforeach vt = [v16i8, v8i16, v4i32, v2i64, v4f32, v2f64] in
18905f757f3fSDimitry Andric  def  : Pat<(vt (vselect LSX128:$va, LSX128:$vk, LSX128:$vj)),
18915f757f3fSDimitry Andric             (VBITSEL_V LSX128:$vj, LSX128:$vk, LSX128:$va)>;
18925f757f3fSDimitry Andric
18935f757f3fSDimitry Andric// fneg
18945f757f3fSDimitry Andricdef : Pat<(fneg (v4f32 LSX128:$vj)), (VBITREVI_W LSX128:$vj, 31)>;
18955f757f3fSDimitry Andricdef : Pat<(fneg (v2f64 LSX128:$vj)), (VBITREVI_D LSX128:$vj, 63)>;
18965f757f3fSDimitry Andric
18977a6dacacSDimitry Andric// VFFINT_{S_W/D_L}
18987a6dacacSDimitry Andricdef : Pat<(v4f32 (sint_to_fp v4i32:$vj)), (VFFINT_S_W v4i32:$vj)>;
18997a6dacacSDimitry Andricdef : Pat<(v2f64 (sint_to_fp v2i64:$vj)), (VFFINT_D_L v2i64:$vj)>;
19007a6dacacSDimitry Andric
19017a6dacacSDimitry Andric// VFFINT_{S_WU/D_LU}
19027a6dacacSDimitry Andricdef : Pat<(v4f32 (uint_to_fp v4i32:$vj)), (VFFINT_S_WU v4i32:$vj)>;
19037a6dacacSDimitry Andricdef : Pat<(v2f64 (uint_to_fp v2i64:$vj)), (VFFINT_D_LU v2i64:$vj)>;
19047a6dacacSDimitry Andric
19057a6dacacSDimitry Andric// VFTINTRZ_{W_S/L_D}
19067a6dacacSDimitry Andricdef : Pat<(v4i32 (fp_to_sint v4f32:$vj)), (VFTINTRZ_W_S v4f32:$vj)>;
19077a6dacacSDimitry Andricdef : Pat<(v2i64 (fp_to_sint v2f64:$vj)), (VFTINTRZ_L_D v2f64:$vj)>;
19087a6dacacSDimitry Andric
19097a6dacacSDimitry Andric// VFTINTRZ_{W_SU/L_DU}
19107a6dacacSDimitry Andricdef : Pat<(v4i32 (fp_to_uint v4f32:$vj)), (VFTINTRZ_WU_S v4f32:$vj)>;
19117a6dacacSDimitry Andricdef : Pat<(v2i64 (fp_to_uint v2f64:$vj)), (VFTINTRZ_LU_D v2f64:$vj)>;
19127a6dacacSDimitry Andric
19135f757f3fSDimitry Andric} // Predicates = [HasExtLSX]
19145f757f3fSDimitry Andric
19155f757f3fSDimitry Andric/// Intrinsic pattern
19165f757f3fSDimitry Andric
19175f757f3fSDimitry Andricclass deriveLSXIntrinsic<string Inst> {
19185f757f3fSDimitry Andric  Intrinsic ret = !cast<Intrinsic>(!tolower("int_loongarch_lsx_"#Inst));
19195f757f3fSDimitry Andric}
19205f757f3fSDimitry Andric
19215f757f3fSDimitry Andriclet Predicates = [HasExtLSX] in {
19225f757f3fSDimitry Andric
19235f757f3fSDimitry Andric// vty: v16i8/v8i16/v4i32/v2i64
19245f757f3fSDimitry Andric// Pat<(Intrinsic vty:$vj, vty:$vk),
19255f757f3fSDimitry Andric//     (LAInst vty:$vj, vty:$vk)>;
19265f757f3fSDimitry Andricforeach Inst = ["VSADD_B", "VSADD_BU", "VSSUB_B", "VSSUB_BU",
19275f757f3fSDimitry Andric                "VHADDW_H_B", "VHADDW_HU_BU", "VHSUBW_H_B", "VHSUBW_HU_BU",
19285f757f3fSDimitry Andric                "VADDWEV_H_B", "VADDWOD_H_B", "VSUBWEV_H_B", "VSUBWOD_H_B",
19295f757f3fSDimitry Andric                "VADDWEV_H_BU", "VADDWOD_H_BU", "VSUBWEV_H_BU", "VSUBWOD_H_BU",
19305f757f3fSDimitry Andric                "VADDWEV_H_BU_B", "VADDWOD_H_BU_B",
19315f757f3fSDimitry Andric                "VAVG_B", "VAVG_BU", "VAVGR_B", "VAVGR_BU",
19325f757f3fSDimitry Andric                "VABSD_B", "VABSD_BU", "VADDA_B", "VMUH_B", "VMUH_BU",
19335f757f3fSDimitry Andric                "VMULWEV_H_B", "VMULWOD_H_B", "VMULWEV_H_BU", "VMULWOD_H_BU",
19345f757f3fSDimitry Andric                "VMULWEV_H_BU_B", "VMULWOD_H_BU_B", "VSIGNCOV_B",
19355f757f3fSDimitry Andric                "VANDN_V", "VORN_V", "VROTR_B", "VSRLR_B", "VSRAR_B",
19365f757f3fSDimitry Andric                "VSEQ_B", "VSLE_B", "VSLE_BU", "VSLT_B", "VSLT_BU",
19375f757f3fSDimitry Andric                "VPACKEV_B", "VPACKOD_B", "VPICKEV_B", "VPICKOD_B",
19385f757f3fSDimitry Andric                "VILVL_B", "VILVH_B"] in
19395f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret
19405f757f3fSDimitry Andric               (v16i8 LSX128:$vj), (v16i8 LSX128:$vk)),
19415f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vj, LSX128:$vk)>;
19425f757f3fSDimitry Andricforeach Inst = ["VSADD_H", "VSADD_HU", "VSSUB_H", "VSSUB_HU",
19435f757f3fSDimitry Andric                "VHADDW_W_H", "VHADDW_WU_HU", "VHSUBW_W_H", "VHSUBW_WU_HU",
19445f757f3fSDimitry Andric                "VADDWEV_W_H", "VADDWOD_W_H", "VSUBWEV_W_H", "VSUBWOD_W_H",
19455f757f3fSDimitry Andric                "VADDWEV_W_HU", "VADDWOD_W_HU", "VSUBWEV_W_HU", "VSUBWOD_W_HU",
19465f757f3fSDimitry Andric                "VADDWEV_W_HU_H", "VADDWOD_W_HU_H",
19475f757f3fSDimitry Andric                "VAVG_H", "VAVG_HU", "VAVGR_H", "VAVGR_HU",
19485f757f3fSDimitry Andric                "VABSD_H", "VABSD_HU", "VADDA_H", "VMUH_H", "VMUH_HU",
19495f757f3fSDimitry Andric                "VMULWEV_W_H", "VMULWOD_W_H", "VMULWEV_W_HU", "VMULWOD_W_HU",
19505f757f3fSDimitry Andric                "VMULWEV_W_HU_H", "VMULWOD_W_HU_H", "VSIGNCOV_H", "VROTR_H",
19515f757f3fSDimitry Andric                "VSRLR_H", "VSRAR_H", "VSRLN_B_H", "VSRAN_B_H", "VSRLRN_B_H",
19525f757f3fSDimitry Andric                "VSRARN_B_H", "VSSRLN_B_H", "VSSRAN_B_H", "VSSRLN_BU_H",
19535f757f3fSDimitry Andric                "VSSRAN_BU_H", "VSSRLRN_B_H", "VSSRARN_B_H", "VSSRLRN_BU_H",
19545f757f3fSDimitry Andric                "VSSRARN_BU_H",
19555f757f3fSDimitry Andric                "VSEQ_H", "VSLE_H", "VSLE_HU", "VSLT_H", "VSLT_HU",
19565f757f3fSDimitry Andric                "VPACKEV_H", "VPACKOD_H", "VPICKEV_H", "VPICKOD_H",
19575f757f3fSDimitry Andric                "VILVL_H", "VILVH_H"] in
19585f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret
19595f757f3fSDimitry Andric               (v8i16 LSX128:$vj), (v8i16 LSX128:$vk)),
19605f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vj, LSX128:$vk)>;
19615f757f3fSDimitry Andricforeach Inst = ["VSADD_W", "VSADD_WU", "VSSUB_W", "VSSUB_WU",
19625f757f3fSDimitry Andric                "VHADDW_D_W", "VHADDW_DU_WU", "VHSUBW_D_W", "VHSUBW_DU_WU",
19635f757f3fSDimitry Andric                "VADDWEV_D_W", "VADDWOD_D_W", "VSUBWEV_D_W", "VSUBWOD_D_W",
19645f757f3fSDimitry Andric                "VADDWEV_D_WU", "VADDWOD_D_WU", "VSUBWEV_D_WU", "VSUBWOD_D_WU",
19655f757f3fSDimitry Andric                "VADDWEV_D_WU_W", "VADDWOD_D_WU_W",
19665f757f3fSDimitry Andric                "VAVG_W", "VAVG_WU", "VAVGR_W", "VAVGR_WU",
19675f757f3fSDimitry Andric                "VABSD_W", "VABSD_WU", "VADDA_W", "VMUH_W", "VMUH_WU",
19685f757f3fSDimitry Andric                "VMULWEV_D_W", "VMULWOD_D_W", "VMULWEV_D_WU", "VMULWOD_D_WU",
19695f757f3fSDimitry Andric                "VMULWEV_D_WU_W", "VMULWOD_D_WU_W", "VSIGNCOV_W", "VROTR_W",
19705f757f3fSDimitry Andric                "VSRLR_W", "VSRAR_W", "VSRLN_H_W", "VSRAN_H_W", "VSRLRN_H_W",
19715f757f3fSDimitry Andric                "VSRARN_H_W", "VSSRLN_H_W", "VSSRAN_H_W", "VSSRLN_HU_W",
19725f757f3fSDimitry Andric                "VSSRAN_HU_W", "VSSRLRN_H_W", "VSSRARN_H_W", "VSSRLRN_HU_W",
19735f757f3fSDimitry Andric                "VSSRARN_HU_W",
19745f757f3fSDimitry Andric                "VSEQ_W", "VSLE_W", "VSLE_WU", "VSLT_W", "VSLT_WU",
19755f757f3fSDimitry Andric                "VPACKEV_W", "VPACKOD_W", "VPICKEV_W", "VPICKOD_W",
19765f757f3fSDimitry Andric                "VILVL_W", "VILVH_W"] in
19775f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret
19785f757f3fSDimitry Andric               (v4i32 LSX128:$vj), (v4i32 LSX128:$vk)),
19795f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vj, LSX128:$vk)>;
19805f757f3fSDimitry Andricforeach Inst = ["VADD_Q", "VSUB_Q",
19815f757f3fSDimitry Andric                "VSADD_D", "VSADD_DU", "VSSUB_D", "VSSUB_DU",
19825f757f3fSDimitry Andric                "VHADDW_Q_D", "VHADDW_QU_DU", "VHSUBW_Q_D", "VHSUBW_QU_DU",
19835f757f3fSDimitry Andric                "VADDWEV_Q_D", "VADDWOD_Q_D", "VSUBWEV_Q_D", "VSUBWOD_Q_D",
19845f757f3fSDimitry Andric                "VADDWEV_Q_DU", "VADDWOD_Q_DU", "VSUBWEV_Q_DU", "VSUBWOD_Q_DU",
19855f757f3fSDimitry Andric                "VADDWEV_Q_DU_D", "VADDWOD_Q_DU_D",
19865f757f3fSDimitry Andric                "VAVG_D", "VAVG_DU", "VAVGR_D", "VAVGR_DU",
19875f757f3fSDimitry Andric                "VABSD_D", "VABSD_DU", "VADDA_D", "VMUH_D", "VMUH_DU",
19885f757f3fSDimitry Andric                "VMULWEV_Q_D", "VMULWOD_Q_D", "VMULWEV_Q_DU", "VMULWOD_Q_DU",
19895f757f3fSDimitry Andric                "VMULWEV_Q_DU_D", "VMULWOD_Q_DU_D", "VSIGNCOV_D", "VROTR_D",
19905f757f3fSDimitry Andric                "VSRLR_D", "VSRAR_D", "VSRLN_W_D", "VSRAN_W_D", "VSRLRN_W_D",
19915f757f3fSDimitry Andric                "VSRARN_W_D", "VSSRLN_W_D", "VSSRAN_W_D", "VSSRLN_WU_D",
19925f757f3fSDimitry Andric                "VSSRAN_WU_D", "VSSRLRN_W_D", "VSSRARN_W_D", "VSSRLRN_WU_D",
19935f757f3fSDimitry Andric                "VSSRARN_WU_D", "VFFINT_S_L",
19945f757f3fSDimitry Andric                "VSEQ_D", "VSLE_D", "VSLE_DU", "VSLT_D", "VSLT_DU",
19955f757f3fSDimitry Andric                "VPACKEV_D", "VPACKOD_D", "VPICKEV_D", "VPICKOD_D",
19965f757f3fSDimitry Andric                "VILVL_D", "VILVH_D"] in
19975f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret
19985f757f3fSDimitry Andric               (v2i64 LSX128:$vj), (v2i64 LSX128:$vk)),
19995f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vj, LSX128:$vk)>;
20005f757f3fSDimitry Andric
20015f757f3fSDimitry Andric// vty: v16i8/v8i16/v4i32/v2i64
20025f757f3fSDimitry Andric// Pat<(Intrinsic vty:$vd, vty:$vj, vty:$vk),
20035f757f3fSDimitry Andric//     (LAInst vty:$vd, vty:$vj, vty:$vk)>;
20045f757f3fSDimitry Andricforeach Inst = ["VMADDWEV_H_B", "VMADDWOD_H_B", "VMADDWEV_H_BU",
20055f757f3fSDimitry Andric                "VMADDWOD_H_BU", "VMADDWEV_H_BU_B", "VMADDWOD_H_BU_B"] in
20065f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret
20075f757f3fSDimitry Andric               (v8i16 LSX128:$vd), (v16i8 LSX128:$vj), (v16i8 LSX128:$vk)),
20085f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vd, LSX128:$vj, LSX128:$vk)>;
20095f757f3fSDimitry Andricforeach Inst = ["VMADDWEV_W_H", "VMADDWOD_W_H", "VMADDWEV_W_HU",
20105f757f3fSDimitry Andric                "VMADDWOD_W_HU", "VMADDWEV_W_HU_H", "VMADDWOD_W_HU_H"] in
20115f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret
20125f757f3fSDimitry Andric               (v4i32 LSX128:$vd), (v8i16 LSX128:$vj), (v8i16 LSX128:$vk)),
20135f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vd, LSX128:$vj, LSX128:$vk)>;
20145f757f3fSDimitry Andricforeach Inst = ["VMADDWEV_D_W", "VMADDWOD_D_W", "VMADDWEV_D_WU",
20155f757f3fSDimitry Andric                "VMADDWOD_D_WU", "VMADDWEV_D_WU_W", "VMADDWOD_D_WU_W"] in
20165f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret
20175f757f3fSDimitry Andric               (v2i64 LSX128:$vd), (v4i32 LSX128:$vj), (v4i32 LSX128:$vk)),
20185f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vd, LSX128:$vj, LSX128:$vk)>;
20195f757f3fSDimitry Andricforeach Inst = ["VMADDWEV_Q_D", "VMADDWOD_Q_D", "VMADDWEV_Q_DU",
20205f757f3fSDimitry Andric                "VMADDWOD_Q_DU", "VMADDWEV_Q_DU_D", "VMADDWOD_Q_DU_D"] in
20215f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret
20225f757f3fSDimitry Andric               (v2i64 LSX128:$vd), (v2i64 LSX128:$vj), (v2i64 LSX128:$vk)),
20235f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vd, LSX128:$vj, LSX128:$vk)>;
20245f757f3fSDimitry Andric
20255f757f3fSDimitry Andric// vty: v16i8/v8i16/v4i32/v2i64
20265f757f3fSDimitry Andric// Pat<(Intrinsic vty:$vj),
20275f757f3fSDimitry Andric//     (LAInst vty:$vj)>;
20285f757f3fSDimitry Andricforeach Inst = ["VEXTH_H_B", "VEXTH_HU_BU",
20295f757f3fSDimitry Andric                "VMSKLTZ_B", "VMSKGEZ_B", "VMSKNZ_B",
20305f757f3fSDimitry Andric                "VCLO_B"] in
20315f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret (v16i8 LSX128:$vj)),
20325f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vj)>;
20335f757f3fSDimitry Andricforeach Inst = ["VEXTH_W_H", "VEXTH_WU_HU", "VMSKLTZ_H",
20345f757f3fSDimitry Andric                "VCLO_H", "VFCVTL_S_H", "VFCVTH_S_H"] in
20355f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret (v8i16 LSX128:$vj)),
20365f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vj)>;
20375f757f3fSDimitry Andricforeach Inst = ["VEXTH_D_W", "VEXTH_DU_WU", "VMSKLTZ_W",
20385f757f3fSDimitry Andric                "VCLO_W", "VFFINT_S_W", "VFFINT_S_WU",
20395f757f3fSDimitry Andric                "VFFINTL_D_W", "VFFINTH_D_W"] in
20405f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret (v4i32 LSX128:$vj)),
20415f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vj)>;
20425f757f3fSDimitry Andricforeach Inst = ["VEXTH_Q_D", "VEXTH_QU_DU", "VMSKLTZ_D",
20435f757f3fSDimitry Andric                "VEXTL_Q_D", "VEXTL_QU_DU",
20445f757f3fSDimitry Andric                "VCLO_D", "VFFINT_D_L", "VFFINT_D_LU"] in
20455f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret (v2i64 LSX128:$vj)),
20465f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vj)>;
20475f757f3fSDimitry Andric
20485f757f3fSDimitry Andric// Pat<(Intrinsic timm:$imm)
20495f757f3fSDimitry Andric//     (LAInst timm:$imm)>;
20505f757f3fSDimitry Andricdef : Pat<(int_loongarch_lsx_vldi timm:$imm),
20515f757f3fSDimitry Andric          (VLDI (to_valid_timm timm:$imm))>;
20525f757f3fSDimitry Andricforeach Inst = ["VREPLI_B", "VREPLI_H", "VREPLI_W", "VREPLI_D"] in
20535f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret timm:$imm),
20545f757f3fSDimitry Andric            (!cast<LAInst>("Pseudo"#Inst) (to_valid_timm timm:$imm))>;
20555f757f3fSDimitry Andric
20565f757f3fSDimitry Andric// vty: v16i8/v8i16/v4i32/v2i64
20575f757f3fSDimitry Andric// Pat<(Intrinsic vty:$vj, timm:$imm)
20585f757f3fSDimitry Andric//     (LAInst vty:$vj, timm:$imm)>;
20595f757f3fSDimitry Andricforeach Inst = ["VSAT_B", "VSAT_BU", "VNORI_B", "VROTRI_B", "VSLLWIL_H_B",
20605f757f3fSDimitry Andric                "VSLLWIL_HU_BU", "VSRLRI_B", "VSRARI_B",
20615f757f3fSDimitry Andric                "VSEQI_B", "VSLEI_B", "VSLEI_BU", "VSLTI_B", "VSLTI_BU",
20625f757f3fSDimitry Andric                "VREPLVEI_B", "VBSLL_V", "VBSRL_V", "VSHUF4I_B"] in
20635f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret (v16i8 LSX128:$vj), timm:$imm),
20645f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vj, (to_valid_timm timm:$imm))>;
20655f757f3fSDimitry Andricforeach Inst = ["VSAT_H", "VSAT_HU", "VROTRI_H", "VSLLWIL_W_H",
20665f757f3fSDimitry Andric                "VSLLWIL_WU_HU", "VSRLRI_H", "VSRARI_H",
20675f757f3fSDimitry Andric                "VSEQI_H", "VSLEI_H", "VSLEI_HU", "VSLTI_H", "VSLTI_HU",
20685f757f3fSDimitry Andric                "VREPLVEI_H", "VSHUF4I_H"] in
20695f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret (v8i16 LSX128:$vj), timm:$imm),
20705f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vj, (to_valid_timm timm:$imm))>;
20715f757f3fSDimitry Andricforeach Inst = ["VSAT_W", "VSAT_WU", "VROTRI_W", "VSLLWIL_D_W",
20725f757f3fSDimitry Andric                "VSLLWIL_DU_WU", "VSRLRI_W", "VSRARI_W",
20735f757f3fSDimitry Andric                "VSEQI_W", "VSLEI_W", "VSLEI_WU", "VSLTI_W", "VSLTI_WU",
20745f757f3fSDimitry Andric                "VREPLVEI_W", "VSHUF4I_W"] in
20755f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret (v4i32 LSX128:$vj), timm:$imm),
20765f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vj, (to_valid_timm timm:$imm))>;
20775f757f3fSDimitry Andricforeach Inst = ["VSAT_D", "VSAT_DU", "VROTRI_D", "VSRLRI_D", "VSRARI_D",
20785f757f3fSDimitry Andric                "VSEQI_D", "VSLEI_D", "VSLEI_DU", "VSLTI_D", "VSLTI_DU",
20795f757f3fSDimitry Andric                "VPICKVE2GR_D", "VPICKVE2GR_DU",
20805f757f3fSDimitry Andric                "VREPLVEI_D"] in
20815f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret (v2i64 LSX128:$vj), timm:$imm),
20825f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vj, (to_valid_timm timm:$imm))>;
20835f757f3fSDimitry Andric
20845f757f3fSDimitry Andric// vty: v16i8/v8i16/v4i32/v2i64
20855f757f3fSDimitry Andric// Pat<(Intrinsic vty:$vd, vty:$vj, timm:$imm)
20865f757f3fSDimitry Andric//     (LAInst vty:$vd, vty:$vj, timm:$imm)>;
20875f757f3fSDimitry Andricforeach Inst = ["VSRLNI_B_H", "VSRANI_B_H", "VSRLRNI_B_H", "VSRARNI_B_H",
20885f757f3fSDimitry Andric                "VSSRLNI_B_H", "VSSRANI_B_H", "VSSRLNI_BU_H", "VSSRANI_BU_H",
20895f757f3fSDimitry Andric                "VSSRLRNI_B_H", "VSSRARNI_B_H", "VSSRLRNI_BU_H", "VSSRARNI_BU_H",
20905f757f3fSDimitry Andric                "VFRSTPI_B", "VBITSELI_B", "VEXTRINS_B"] in
20915f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret
20925f757f3fSDimitry Andric               (v16i8 LSX128:$vd), (v16i8 LSX128:$vj), timm:$imm),
20935f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vd, LSX128:$vj,
20945f757f3fSDimitry Andric               (to_valid_timm timm:$imm))>;
20955f757f3fSDimitry Andricforeach Inst = ["VSRLNI_H_W", "VSRANI_H_W", "VSRLRNI_H_W", "VSRARNI_H_W",
20965f757f3fSDimitry Andric                "VSSRLNI_H_W", "VSSRANI_H_W", "VSSRLNI_HU_W", "VSSRANI_HU_W",
20975f757f3fSDimitry Andric                "VSSRLRNI_H_W", "VSSRARNI_H_W", "VSSRLRNI_HU_W", "VSSRARNI_HU_W",
20985f757f3fSDimitry Andric                "VFRSTPI_H", "VEXTRINS_H"] in
20995f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret
21005f757f3fSDimitry Andric               (v8i16 LSX128:$vd), (v8i16 LSX128:$vj), timm:$imm),
21015f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vd, LSX128:$vj,
21025f757f3fSDimitry Andric               (to_valid_timm timm:$imm))>;
21035f757f3fSDimitry Andricforeach Inst = ["VSRLNI_W_D", "VSRANI_W_D", "VSRLRNI_W_D", "VSRARNI_W_D",
21045f757f3fSDimitry Andric                "VSSRLNI_W_D", "VSSRANI_W_D", "VSSRLNI_WU_D", "VSSRANI_WU_D",
21055f757f3fSDimitry Andric                "VSSRLRNI_W_D", "VSSRARNI_W_D", "VSSRLRNI_WU_D", "VSSRARNI_WU_D",
21065f757f3fSDimitry Andric                "VPERMI_W", "VEXTRINS_W"] in
21075f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret
21085f757f3fSDimitry Andric               (v4i32 LSX128:$vd), (v4i32 LSX128:$vj), timm:$imm),
21095f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vd, LSX128:$vj,
21105f757f3fSDimitry Andric               (to_valid_timm timm:$imm))>;
21115f757f3fSDimitry Andricforeach Inst = ["VSRLNI_D_Q", "VSRANI_D_Q", "VSRLRNI_D_Q", "VSRARNI_D_Q",
21125f757f3fSDimitry Andric                "VSSRLNI_D_Q", "VSSRANI_D_Q", "VSSRLNI_DU_Q", "VSSRANI_DU_Q",
21135f757f3fSDimitry Andric                "VSSRLRNI_D_Q", "VSSRARNI_D_Q", "VSSRLRNI_DU_Q", "VSSRARNI_DU_Q",
21145f757f3fSDimitry Andric                "VSHUF4I_D", "VEXTRINS_D"] in
21155f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret
21165f757f3fSDimitry Andric               (v2i64 LSX128:$vd), (v2i64 LSX128:$vj), timm:$imm),
21175f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vd, LSX128:$vj,
21185f757f3fSDimitry Andric               (to_valid_timm timm:$imm))>;
21195f757f3fSDimitry Andric
21205f757f3fSDimitry Andric// vty: v16i8/v8i16/v4i32/v2i64
21215f757f3fSDimitry Andric// Pat<(Intrinsic vty:$vd, vty:$vj, vty:$vk),
21225f757f3fSDimitry Andric//     (LAInst vty:$vd, vty:$vj, vty:$vk)>;
21235f757f3fSDimitry Andricforeach Inst = ["VFRSTP_B", "VBITSEL_V", "VSHUF_B"] in
21245f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret
21255f757f3fSDimitry Andric               (v16i8 LSX128:$vd), (v16i8 LSX128:$vj), (v16i8 LSX128:$vk)),
21265f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vd, LSX128:$vj, LSX128:$vk)>;
21275f757f3fSDimitry Andricforeach Inst = ["VFRSTP_H", "VSHUF_H"] in
21285f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret
21295f757f3fSDimitry Andric               (v8i16 LSX128:$vd), (v8i16 LSX128:$vj), (v8i16 LSX128:$vk)),
21305f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vd, LSX128:$vj, LSX128:$vk)>;
21315f757f3fSDimitry Andricdef : Pat<(int_loongarch_lsx_vshuf_w (v4i32 LSX128:$vd), (v4i32 LSX128:$vj),
21325f757f3fSDimitry Andric                                     (v4i32 LSX128:$vk)),
21335f757f3fSDimitry Andric          (VSHUF_W LSX128:$vd, LSX128:$vj, LSX128:$vk)>;
21345f757f3fSDimitry Andricdef : Pat<(int_loongarch_lsx_vshuf_d (v2i64 LSX128:$vd), (v2i64 LSX128:$vj),
21355f757f3fSDimitry Andric                                     (v2i64 LSX128:$vk)),
21365f757f3fSDimitry Andric          (VSHUF_D LSX128:$vd, LSX128:$vj, LSX128:$vk)>;
21375f757f3fSDimitry Andric
21385f757f3fSDimitry Andric// vty: v4f32/v2f64
21395f757f3fSDimitry Andric// Pat<(Intrinsic vty:$vj, vty:$vk, vty:$va),
21405f757f3fSDimitry Andric//     (LAInst vty:$vj, vty:$vk, vty:$va)>;
21415f757f3fSDimitry Andricforeach Inst = ["VFMSUB_S", "VFNMADD_S", "VFNMSUB_S"] in
21425f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret
21435f757f3fSDimitry Andric               (v4f32 LSX128:$vj), (v4f32 LSX128:$vk), (v4f32 LSX128:$va)),
21445f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vj, LSX128:$vk, LSX128:$va)>;
21455f757f3fSDimitry Andricforeach Inst = ["VFMSUB_D", "VFNMADD_D", "VFNMSUB_D"] in
21465f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret
21475f757f3fSDimitry Andric               (v2f64 LSX128:$vj), (v2f64 LSX128:$vk), (v2f64 LSX128:$va)),
21485f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vj, LSX128:$vk, LSX128:$va)>;
21495f757f3fSDimitry Andric
21505f757f3fSDimitry Andric// vty: v4f32/v2f64
21515f757f3fSDimitry Andric// Pat<(Intrinsic vty:$vj, vty:$vk),
21525f757f3fSDimitry Andric//     (LAInst vty:$vj, vty:$vk)>;
21535f757f3fSDimitry Andricforeach Inst = ["VFMAX_S", "VFMIN_S", "VFMAXA_S", "VFMINA_S", "VFCVT_H_S",
21545f757f3fSDimitry Andric                "VFCMP_CAF_S", "VFCMP_CUN_S", "VFCMP_CEQ_S", "VFCMP_CUEQ_S",
21555f757f3fSDimitry Andric                "VFCMP_CLT_S", "VFCMP_CULT_S", "VFCMP_CLE_S", "VFCMP_CULE_S",
21565f757f3fSDimitry Andric                "VFCMP_CNE_S", "VFCMP_COR_S", "VFCMP_CUNE_S",
21575f757f3fSDimitry Andric                "VFCMP_SAF_S", "VFCMP_SUN_S", "VFCMP_SEQ_S", "VFCMP_SUEQ_S",
21585f757f3fSDimitry Andric                "VFCMP_SLT_S", "VFCMP_SULT_S", "VFCMP_SLE_S", "VFCMP_SULE_S",
21595f757f3fSDimitry Andric                "VFCMP_SNE_S", "VFCMP_SOR_S", "VFCMP_SUNE_S"] in
21605f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret
21615f757f3fSDimitry Andric               (v4f32 LSX128:$vj), (v4f32 LSX128:$vk)),
21625f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vj, LSX128:$vk)>;
21635f757f3fSDimitry Andricforeach Inst = ["VFMAX_D", "VFMIN_D", "VFMAXA_D", "VFMINA_D", "VFCVT_S_D",
21645f757f3fSDimitry Andric                "VFTINTRNE_W_D", "VFTINTRZ_W_D", "VFTINTRP_W_D", "VFTINTRM_W_D",
21655f757f3fSDimitry Andric                "VFTINT_W_D",
21665f757f3fSDimitry Andric                "VFCMP_CAF_D", "VFCMP_CUN_D", "VFCMP_CEQ_D", "VFCMP_CUEQ_D",
21675f757f3fSDimitry Andric                "VFCMP_CLT_D", "VFCMP_CULT_D", "VFCMP_CLE_D", "VFCMP_CULE_D",
21685f757f3fSDimitry Andric                "VFCMP_CNE_D", "VFCMP_COR_D", "VFCMP_CUNE_D",
21695f757f3fSDimitry Andric                "VFCMP_SAF_D", "VFCMP_SUN_D", "VFCMP_SEQ_D", "VFCMP_SUEQ_D",
21705f757f3fSDimitry Andric                "VFCMP_SLT_D", "VFCMP_SULT_D", "VFCMP_SLE_D", "VFCMP_SULE_D",
21715f757f3fSDimitry Andric                "VFCMP_SNE_D", "VFCMP_SOR_D", "VFCMP_SUNE_D"] in
21725f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret
21735f757f3fSDimitry Andric               (v2f64 LSX128:$vj), (v2f64 LSX128:$vk)),
21745f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vj, LSX128:$vk)>;
21755f757f3fSDimitry Andric
21765f757f3fSDimitry Andric// vty: v4f32/v2f64
21775f757f3fSDimitry Andric// Pat<(Intrinsic vty:$vj),
21785f757f3fSDimitry Andric//     (LAInst vty:$vj)>;
21795f757f3fSDimitry Andricforeach Inst = ["VFLOGB_S", "VFCLASS_S", "VFSQRT_S", "VFRECIP_S", "VFRSQRT_S",
21805f757f3fSDimitry Andric                "VFRINT_S", "VFCVTL_D_S", "VFCVTH_D_S",
21815f757f3fSDimitry Andric                "VFRINTRNE_S", "VFRINTRZ_S", "VFRINTRP_S", "VFRINTRM_S",
21825f757f3fSDimitry Andric                "VFTINTRNE_W_S", "VFTINTRZ_W_S", "VFTINTRP_W_S", "VFTINTRM_W_S",
21835f757f3fSDimitry Andric                "VFTINT_W_S", "VFTINTRZ_WU_S", "VFTINT_WU_S",
21845f757f3fSDimitry Andric                "VFTINTRNEL_L_S", "VFTINTRNEH_L_S", "VFTINTRZL_L_S",
21855f757f3fSDimitry Andric                "VFTINTRZH_L_S", "VFTINTRPL_L_S", "VFTINTRPH_L_S",
21865f757f3fSDimitry Andric                "VFTINTRML_L_S", "VFTINTRMH_L_S", "VFTINTL_L_S",
21875f757f3fSDimitry Andric                "VFTINTH_L_S"] in
21885f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret (v4f32 LSX128:$vj)),
21895f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vj)>;
21905f757f3fSDimitry Andricforeach Inst = ["VFLOGB_D", "VFCLASS_D", "VFSQRT_D", "VFRECIP_D", "VFRSQRT_D",
21915f757f3fSDimitry Andric                "VFRINT_D",
21925f757f3fSDimitry Andric                "VFRINTRNE_D", "VFRINTRZ_D", "VFRINTRP_D", "VFRINTRM_D",
21935f757f3fSDimitry Andric                "VFTINTRNE_L_D", "VFTINTRZ_L_D", "VFTINTRP_L_D", "VFTINTRM_L_D",
21945f757f3fSDimitry Andric                "VFTINT_L_D", "VFTINTRZ_LU_D", "VFTINT_LU_D"] in
21955f757f3fSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret (v2f64 LSX128:$vj)),
21965f757f3fSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vj)>;
21975f757f3fSDimitry Andric
21987a6dacacSDimitry Andric// 128-Bit vector FP approximate reciprocal operation
21997a6dacacSDimitry Andriclet Predicates = [HasFrecipe] in {
22007a6dacacSDimitry Andricforeach Inst = ["VFRECIPE_S", "VFRSQRTE_S"] in
22017a6dacacSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret (v4f32 LSX128:$vj)),
22027a6dacacSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vj)>;
22037a6dacacSDimitry Andricforeach Inst = ["VFRECIPE_D", "VFRSQRTE_D"] in
22047a6dacacSDimitry Andric  def : Pat<(deriveLSXIntrinsic<Inst>.ret (v2f64 LSX128:$vj)),
22057a6dacacSDimitry Andric            (!cast<LAInst>(Inst) LSX128:$vj)>;
22067a6dacacSDimitry Andric}
22077a6dacacSDimitry Andric
22085f757f3fSDimitry Andric// load
22095f757f3fSDimitry Andricdef : Pat<(int_loongarch_lsx_vld GPR:$rj, timm:$imm),
22105f757f3fSDimitry Andric          (VLD GPR:$rj, (to_valid_timm timm:$imm))>;
22115f757f3fSDimitry Andricdef : Pat<(int_loongarch_lsx_vldx GPR:$rj, GPR:$rk),
22125f757f3fSDimitry Andric          (VLDX GPR:$rj, GPR:$rk)>;
22135f757f3fSDimitry Andric
22145f757f3fSDimitry Andricdef : Pat<(int_loongarch_lsx_vldrepl_b GPR:$rj, timm:$imm),
22155f757f3fSDimitry Andric          (VLDREPL_B GPR:$rj, (to_valid_timm timm:$imm))>;
22165f757f3fSDimitry Andricdef : Pat<(int_loongarch_lsx_vldrepl_h GPR:$rj, timm:$imm),
22175f757f3fSDimitry Andric          (VLDREPL_H GPR:$rj, (to_valid_timm timm:$imm))>;
22185f757f3fSDimitry Andricdef : Pat<(int_loongarch_lsx_vldrepl_w GPR:$rj, timm:$imm),
22195f757f3fSDimitry Andric          (VLDREPL_W GPR:$rj, (to_valid_timm timm:$imm))>;
22205f757f3fSDimitry Andricdef : Pat<(int_loongarch_lsx_vldrepl_d GPR:$rj, timm:$imm),
22215f757f3fSDimitry Andric          (VLDREPL_D GPR:$rj, (to_valid_timm timm:$imm))>;
22225f757f3fSDimitry Andric
22235f757f3fSDimitry Andric// store
22245f757f3fSDimitry Andricdef : Pat<(int_loongarch_lsx_vst LSX128:$vd, GPR:$rj, timm:$imm),
22255f757f3fSDimitry Andric          (VST LSX128:$vd, GPR:$rj, (to_valid_timm timm:$imm))>;
22265f757f3fSDimitry Andricdef : Pat<(int_loongarch_lsx_vstx LSX128:$vd, GPR:$rj, GPR:$rk),
22275f757f3fSDimitry Andric          (VSTX LSX128:$vd, GPR:$rj, GPR:$rk)>;
22285f757f3fSDimitry Andric
22295f757f3fSDimitry Andricdef : Pat<(int_loongarch_lsx_vstelm_b v16i8:$vd, GPR:$rj, timm:$imm, timm:$idx),
22305f757f3fSDimitry Andric          (VSTELM_B v16i8:$vd, GPR:$rj, (to_valid_timm timm:$imm),
22315f757f3fSDimitry Andric                    (to_valid_timm timm:$idx))>;
22325f757f3fSDimitry Andricdef : Pat<(int_loongarch_lsx_vstelm_h v8i16:$vd, GPR:$rj, timm:$imm, timm:$idx),
22335f757f3fSDimitry Andric          (VSTELM_H v8i16:$vd, GPR:$rj, (to_valid_timm timm:$imm),
22345f757f3fSDimitry Andric                    (to_valid_timm timm:$idx))>;
22355f757f3fSDimitry Andricdef : Pat<(int_loongarch_lsx_vstelm_w v4i32:$vd, GPR:$rj, timm:$imm, timm:$idx),
22365f757f3fSDimitry Andric          (VSTELM_W v4i32:$vd, GPR:$rj, (to_valid_timm timm:$imm),
22375f757f3fSDimitry Andric                    (to_valid_timm timm:$idx))>;
22385f757f3fSDimitry Andricdef : Pat<(int_loongarch_lsx_vstelm_d v2i64:$vd, GPR:$rj, timm:$imm, timm:$idx),
22395f757f3fSDimitry Andric          (VSTELM_D v2i64:$vd, GPR:$rj, (to_valid_timm timm:$imm),
22405f757f3fSDimitry Andric                    (to_valid_timm timm:$idx))>;
22415f757f3fSDimitry Andric
224206c3fb27SDimitry Andric} // Predicates = [HasExtLSX]
2243