xref: /freebsd/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
106c3fb27SDimitry Andric//===-- RISCVInstrInfoXsf.td - SiFive custom 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 vendor extensions defined by SiFive.
1006c3fb27SDimitry Andric//
1106c3fb27SDimitry Andric//===----------------------------------------------------------------------===//
1206c3fb27SDimitry Andric
1306c3fb27SDimitry Andric//===----------------------------------------------------------------------===//
1406c3fb27SDimitry Andric// XSFVCP extension instructions.
1506c3fb27SDimitry Andric//===----------------------------------------------------------------------===//
1606c3fb27SDimitry Andric
1706c3fb27SDimitry Andricdef VCIXVS2    : RISCVVConstraint<VS2Constraint.Value>;
1806c3fb27SDimitry Andricdef VCIXVS2VS1 : RISCVVConstraint<!or(VS2Constraint.Value,
1906c3fb27SDimitry Andric                                      VS1Constraint.Value)>;
2006c3fb27SDimitry Andric
2106c3fb27SDimitry Andricclass VCIXType<bits<4> val> {
2206c3fb27SDimitry Andric  bits<4> Val = val;
2306c3fb27SDimitry Andric}
2406c3fb27SDimitry Andric
2506c3fb27SDimitry Andricdef VCIX_X   : VCIXType<0b0000>;
2606c3fb27SDimitry Andricdef VCIX_XV  : VCIXType<0b0010>;
2706c3fb27SDimitry Andricdef VCIX_XVV : VCIXType<0b1010>;
2806c3fb27SDimitry Andricdef VCIX_XVW : VCIXType<0b1111>;
2906c3fb27SDimitry Andric
305f757f3fSDimitry Andric// The payload and tsimm5 operands are all marked as ImmArg in the IR
3106c3fb27SDimitry Andric// intrinsic and will be target constant, so use TImmLeaf rather than ImmLeaf.
325f757f3fSDimitry Andricclass PayloadOp<int bitsNum> : RISCVOp, TImmLeaf<XLenVT, "return isUInt<" # bitsNum # ">(Imm);"> {
335f757f3fSDimitry Andric  let ParserMatchClass = UImmAsmOperand<bitsNum>;
345f757f3fSDimitry Andric  let DecoderMethod = "decodeUImmOperand<"# bitsNum # ">";
355f757f3fSDimitry Andric  let OperandType = "OPERAND_UIMM" # bitsNum;
3606c3fb27SDimitry Andric}
3706c3fb27SDimitry Andric
385f757f3fSDimitry Andricdef payload1 : PayloadOp<1>;
395f757f3fSDimitry Andricdef payload2 : PayloadOp<2>;
405f757f3fSDimitry Andricdef payload5 : PayloadOp<5>;
4106c3fb27SDimitry Andric
425f757f3fSDimitry Andricdef tsimm5 : Operand<XLenVT>, TImmLeaf<XLenVT, [{return isInt<5>(Imm);}]> {
4306c3fb27SDimitry Andric  let ParserMatchClass = SImmAsmOperand<5>;
4406c3fb27SDimitry Andric  let EncoderMethod = "getImmOpValue";
4506c3fb27SDimitry Andric  let DecoderMethod = "decodeSImmOperand<5>";
4606c3fb27SDimitry Andric  let MCOperandPredicate = [{
4706c3fb27SDimitry Andric    int64_t Imm;
4806c3fb27SDimitry Andric    if (MCOp.evaluateAsConstantImm(Imm))
4906c3fb27SDimitry Andric      return isInt<5>(Imm);
5006c3fb27SDimitry Andric    return MCOp.isBareSymbolRef();
5106c3fb27SDimitry Andric  }];
5206c3fb27SDimitry Andric}
5306c3fb27SDimitry Andric
5406c3fb27SDimitry Andricclass SwapVCIXIns<dag funct6, dag rd, dag rs2, dag rs1, bit swap> {
5506c3fb27SDimitry Andric  dag Ins = !con(funct6, !if(swap, rs2, rd), !if(swap, rd, rs2), rs1);
5606c3fb27SDimitry Andric}
5706c3fb27SDimitry Andric
5806c3fb27SDimitry Andricclass RVInstVCCustom2<bits<4> funct6_hi4, bits<3> funct3, dag outs, dag ins,
5906c3fb27SDimitry Andric                      string opcodestr, string argstr>
6006c3fb27SDimitry Andric    : RVInst<outs, ins, opcodestr, argstr, [], InstFormatR> {
6106c3fb27SDimitry Andric  bits<5> rs2;
6206c3fb27SDimitry Andric  bits<5> rs1;
6306c3fb27SDimitry Andric  bits<5> rd;
6406c3fb27SDimitry Andric  bits<2> funct6_lo2;
6506c3fb27SDimitry Andric  bit vm;
6606c3fb27SDimitry Andric
6706c3fb27SDimitry Andric  let Inst{31-28} = funct6_hi4;
6806c3fb27SDimitry Andric  let Inst{27-26} = funct6_lo2;
6906c3fb27SDimitry Andric  let Inst{25} = vm;
7006c3fb27SDimitry Andric  let Inst{24-20} = rs2;
7106c3fb27SDimitry Andric  let Inst{19-15} = rs1;
7206c3fb27SDimitry Andric  let Inst{14-12} = funct3;
7306c3fb27SDimitry Andric  let Inst{11-7} = rd;
7406c3fb27SDimitry Andric  let Inst{6-0} = OPC_CUSTOM_2.Value;
7506c3fb27SDimitry Andric
7606c3fb27SDimitry Andric  let Uses = [VTYPE, VL];
7706c3fb27SDimitry Andric  let RVVConstraint = NoConstraint;
7806c3fb27SDimitry Andric}
7906c3fb27SDimitry Andric
8006c3fb27SDimitry Andricclass RVInstVCFCustom2<bits<4> funct6_hi4, bits<3> funct3, dag outs, dag ins,
8106c3fb27SDimitry Andric                       string opcodestr, string argstr>
8206c3fb27SDimitry Andric    : RVInst<outs, ins, opcodestr, argstr, [], InstFormatR> {
8306c3fb27SDimitry Andric  bits<5> rs2;
8406c3fb27SDimitry Andric  bits<5> rs1;
8506c3fb27SDimitry Andric  bits<5> rd;
8606c3fb27SDimitry Andric  bit funct6_lo1;
8706c3fb27SDimitry Andric  bit vm;
8806c3fb27SDimitry Andric
8906c3fb27SDimitry Andric  let Inst{31-28} = funct6_hi4;
9006c3fb27SDimitry Andric  let Inst{27} = 1;
9106c3fb27SDimitry Andric  let Inst{26} = funct6_lo1;
9206c3fb27SDimitry Andric  let Inst{25} = vm;
9306c3fb27SDimitry Andric  let Inst{24-20} = rs2;
9406c3fb27SDimitry Andric  let Inst{19-15} = rs1;
9506c3fb27SDimitry Andric  let Inst{14-12} = funct3;
9606c3fb27SDimitry Andric  let Inst{11-7} = rd;
9706c3fb27SDimitry Andric  let Inst{6-0} = OPC_CUSTOM_2.Value;
9806c3fb27SDimitry Andric
9906c3fb27SDimitry Andric  let Uses = [VTYPE, VL];
10006c3fb27SDimitry Andric  let RVVConstraint = NoConstraint;
10106c3fb27SDimitry Andric}
10206c3fb27SDimitry Andric
10306c3fb27SDimitry Andricclass VCIXInfo<string suffix, VCIXType type, DAGOperand TyRd,
10406c3fb27SDimitry Andric               DAGOperand TyRs2, DAGOperand TyRs1, bit HaveOutputDst> {
10506c3fb27SDimitry Andric  string OpcodeStr = !if(HaveOutputDst, "sf.vc.v." # suffix,
10606c3fb27SDimitry Andric                                        "sf.vc." # suffix);
10706c3fb27SDimitry Andric  bits<4> Funct6_hi4 = type.Val;
10806c3fb27SDimitry Andric  bits<3> Funct3 = !cond(!eq(TyRs1, VR):    0b000,
10906c3fb27SDimitry Andric                         !eq(TyRs1, GPR):   0b100,
11006c3fb27SDimitry Andric                         !eq(TyRs1, FPR32): 0b101,
11106c3fb27SDimitry Andric                         !eq(TyRs1, simm5): 0b011);
11206c3fb27SDimitry Andric  dag Outs = !if(!not(HaveOutputDst), (outs),
11306c3fb27SDimitry Andric                 !if(!or(!eq(type, VCIX_XVV), !eq(type, VCIX_XVW)),
11406c3fb27SDimitry Andric                     (outs TyRd:$rd_wb), (outs TyRd:$rd)));
11506c3fb27SDimitry Andric  dag Ins = SwapVCIXIns<!if(!ne(TyRs1, FPR32), (ins uimm2:$funct6_lo2),
11606c3fb27SDimitry Andric                                               (ins uimm1:$funct6_lo1)),
11706c3fb27SDimitry Andric                        !if(!and(HaveOutputDst, !or(!eq(type, VCIX_X),
11806c3fb27SDimitry Andric                                                    !eq(type, VCIX_XV))),
11906c3fb27SDimitry Andric                            (ins), (ins TyRd:$rd)),
12006c3fb27SDimitry Andric                        (ins TyRs2:$rs2),
12106c3fb27SDimitry Andric                        (ins TyRs1:$rs1),
12206c3fb27SDimitry Andric                        !if(!eq(type, VCIX_X), 1, 0)>.Ins;
12306c3fb27SDimitry Andric  string Prototype = !if(!eq(type, VCIX_X), "$funct6_lo2, $rs2, $rd, $rs1",
12406c3fb27SDimitry Andric                         !if(!ne(TyRs1, FPR32), "$funct6_lo2, $rd, $rs2, $rs1",
12506c3fb27SDimitry Andric                                                "$funct6_lo1, $rd, $rs2, $rs1"));
12606c3fb27SDimitry Andric  string Constraints = !if(!not(HaveOutputDst), "",
12706c3fb27SDimitry Andric                           !if(!or(!eq(type, VCIX_XVV),
12806c3fb27SDimitry Andric                                   !eq(type, VCIX_XVW)), "$rd = $rd_wb", ""));
12906c3fb27SDimitry Andric  RISCVVConstraint RVVConstraint = !if(!or(!not(HaveOutputDst),
13006c3fb27SDimitry Andric                                           !ne(type, VCIX_XVW)), NoConstraint,
13106c3fb27SDimitry Andric                                       !if(!eq(TyRs1, VR), VCIXVS2VS1, VCIXVS2));
13206c3fb27SDimitry Andric}
13306c3fb27SDimitry Andric
13406c3fb27SDimitry Andricclass CustomSiFiveVCIX<VCIXInfo info>
13506c3fb27SDimitry Andric  : RVInstVCCustom2<info.Funct6_hi4, info.Funct3, info.Outs,
13606c3fb27SDimitry Andric                    info.Ins, info.OpcodeStr, info.Prototype> {
13706c3fb27SDimitry Andric  let Constraints = info.Constraints;
13806c3fb27SDimitry Andric  let RVVConstraint = info.RVVConstraint;
13906c3fb27SDimitry Andric}
14006c3fb27SDimitry Andric
14106c3fb27SDimitry Andricclass CustomSiFiveVCIF<VCIXInfo info>
14206c3fb27SDimitry Andric  : RVInstVCFCustom2<info.Funct6_hi4, info.Funct3, info.Outs,
14306c3fb27SDimitry Andric                     info.Ins, info.OpcodeStr, info.Prototype> {
14406c3fb27SDimitry Andric  let Constraints = info.Constraints;
14506c3fb27SDimitry Andric  let RVVConstraint = info.RVVConstraint;
14606c3fb27SDimitry Andric}
14706c3fb27SDimitry Andric
14806c3fb27SDimitry Andricmulticlass CustomSiFiveVCIXorVCIF<string suffix, VCIXType type,
14906c3fb27SDimitry Andric                                  DAGOperand TyRd, DAGOperand TyRs2,
15006c3fb27SDimitry Andric                                  DAGOperand TyRs1, bit HaveOutputDst> {
15106c3fb27SDimitry Andric  defvar info = VCIXInfo<suffix, type, TyRd, TyRs2, TyRs1, HaveOutputDst>;
15206c3fb27SDimitry Andric  if !eq(TyRs1, FPR32) then {
15306c3fb27SDimitry Andric    def NAME : CustomSiFiveVCIF<info>;
15406c3fb27SDimitry Andric  } else {
15506c3fb27SDimitry Andric    def NAME : CustomSiFiveVCIX<info>;
15606c3fb27SDimitry Andric  }
15706c3fb27SDimitry Andric}
15806c3fb27SDimitry Andric
15906c3fb27SDimitry Andricmulticlass CustomSiFiveVCIX<string suffix, VCIXType type,
16006c3fb27SDimitry Andric                            DAGOperand InTyRd, DAGOperand InTyRs2,
16106c3fb27SDimitry Andric                            DAGOperand InTyRs1> {
16206c3fb27SDimitry Andric  let vm = 1 in
16306c3fb27SDimitry Andric  defm VC_ # NAME   : CustomSiFiveVCIXorVCIF<suffix, type, InTyRd, InTyRs2,
16406c3fb27SDimitry Andric                                             InTyRs1, 0>;
16506c3fb27SDimitry Andric  let vm = 0 in
16606c3fb27SDimitry Andric  defm VC_V_ # NAME : CustomSiFiveVCIXorVCIF<suffix, type, VR, InTyRs2,
16706c3fb27SDimitry Andric                                             InTyRs1, 1>;
16806c3fb27SDimitry Andric}
16906c3fb27SDimitry Andric
1705f757f3fSDimitry Andriclet hasSideEffects = 0, mayLoad = 0, mayStore = 0 in {
1715f757f3fSDimitry Andricclass CustomSiFiveVMACC<bits<6> funct6, RISCVVFormat opv, string opcodestr>
1725f757f3fSDimitry Andric    : RVInstVCCustom2<funct6{5-2}, opv.Value, (outs VR:$rd), (ins VR:$rs1, VR:$rs2),
1735f757f3fSDimitry Andric                      opcodestr, "$rd, $rs1, $rs2"> {
1745f757f3fSDimitry Andric  let vm = 1;
1755f757f3fSDimitry Andric  let funct6_lo2 = funct6{1-0};
1765f757f3fSDimitry Andric}
1775f757f3fSDimitry Andric}
1785f757f3fSDimitry Andric
1795f757f3fSDimitry Andricclass CustomSiFiveVFNRCLIP<bits<6> funct6, RISCVVFormat opv, string opcodestr>
1805f757f3fSDimitry Andric    : VALUVF<funct6, opv, opcodestr> {
1815f757f3fSDimitry Andric  let Inst{6-0} = OPC_CUSTOM_2.Value;
1825f757f3fSDimitry Andric}
1835f757f3fSDimitry Andric
18406c3fb27SDimitry Andriclet Predicates = [HasVendorXSfvcp], mayLoad = 0, mayStore = 0,
18506c3fb27SDimitry Andric    hasSideEffects = 1, hasNoSchedulingInfo = 1, DecoderNamespace = "XSfvcp" in {
18606c3fb27SDimitry Andric  defm X   : CustomSiFiveVCIX<"x",   VCIX_X,   uimm5, uimm5, GPR>,   Sched<[]>;
18706c3fb27SDimitry Andric  defm I   : CustomSiFiveVCIX<"i",   VCIX_X,   uimm5, uimm5, simm5>, Sched<[]>;
18806c3fb27SDimitry Andric  defm XV  : CustomSiFiveVCIX<"xv",  VCIX_XV,  uimm5, VR,    GPR>,   Sched<[]>;
18906c3fb27SDimitry Andric  defm IV  : CustomSiFiveVCIX<"iv",  VCIX_XV,  uimm5, VR,    simm5>, Sched<[]>;
19006c3fb27SDimitry Andric  defm VV  : CustomSiFiveVCIX<"vv",  VCIX_XV,  uimm5, VR,    VR>,    Sched<[]>;
19106c3fb27SDimitry Andric  defm FV  : CustomSiFiveVCIX<"fv",  VCIX_XV,  uimm5, VR,    FPR32>, Sched<[]>;
19206c3fb27SDimitry Andric  defm XVV : CustomSiFiveVCIX<"xvv", VCIX_XVV, VR,    VR,    GPR>,   Sched<[]>;
19306c3fb27SDimitry Andric  defm IVV : CustomSiFiveVCIX<"ivv", VCIX_XVV, VR,    VR,    simm5>, Sched<[]>;
19406c3fb27SDimitry Andric  defm VVV : CustomSiFiveVCIX<"vvv", VCIX_XVV, VR,    VR,    VR>,    Sched<[]>;
19506c3fb27SDimitry Andric  defm FVV : CustomSiFiveVCIX<"fvv", VCIX_XVV, VR,    VR,    FPR32>, Sched<[]>;
19606c3fb27SDimitry Andric  defm XVW : CustomSiFiveVCIX<"xvw", VCIX_XVW, VR,    VR,    GPR>,   Sched<[]>;
19706c3fb27SDimitry Andric  defm IVW : CustomSiFiveVCIX<"ivw", VCIX_XVW, VR,    VR,    simm5>, Sched<[]>;
19806c3fb27SDimitry Andric  defm VVW : CustomSiFiveVCIX<"vvw", VCIX_XVW, VR,    VR,    VR>,    Sched<[]>;
19906c3fb27SDimitry Andric  defm FVW : CustomSiFiveVCIX<"fvw", VCIX_XVW, VR,    VR,    FPR32>, Sched<[]>;
20006c3fb27SDimitry Andric}
20106c3fb27SDimitry Andric
2025f757f3fSDimitry Andriclet Predicates = [HasVendorXSfvqmaccdod], DecoderNamespace = "XSfvqmaccdod" in {
2035f757f3fSDimitry Andric  def VQMACCU_2x8x2  : CustomSiFiveVMACC<0b101100, OPMVV, "sf.vqmaccu.2x8x2">;
2045f757f3fSDimitry Andric  def VQMACC_2x8x2   : CustomSiFiveVMACC<0b101101, OPMVV, "sf.vqmacc.2x8x2">;
2055f757f3fSDimitry Andric  def VQMACCUS_2x8x2 : CustomSiFiveVMACC<0b101110, OPMVV, "sf.vqmaccus.2x8x2">;
2065f757f3fSDimitry Andric  def VQMACCSU_2x8x2 : CustomSiFiveVMACC<0b101111, OPMVV, "sf.vqmaccsu.2x8x2">;
2075f757f3fSDimitry Andric}
2085f757f3fSDimitry Andric
2095f757f3fSDimitry Andriclet Predicates = [HasVendorXSfvqmaccqoq], DecoderNamespace = "XSfvqmaccqoq" in {
2105f757f3fSDimitry Andric  def VQMACCU_4x8x4  : CustomSiFiveVMACC<0b111100, OPMVV, "sf.vqmaccu.4x8x4">;
2115f757f3fSDimitry Andric  def VQMACC_4x8x4   : CustomSiFiveVMACC<0b111101, OPMVV, "sf.vqmacc.4x8x4">;
2125f757f3fSDimitry Andric  def VQMACCUS_4x8x4 : CustomSiFiveVMACC<0b111110, OPMVV, "sf.vqmaccus.4x8x4">;
2135f757f3fSDimitry Andric  def VQMACCSU_4x8x4 : CustomSiFiveVMACC<0b111111, OPMVV, "sf.vqmaccsu.4x8x4">;
2145f757f3fSDimitry Andric}
2155f757f3fSDimitry Andric
2165f757f3fSDimitry Andriclet Predicates = [HasVendorXSfvfwmaccqqq], DecoderNamespace = "XSfvfwmaccqqq" in {
2175f757f3fSDimitry Andric  def VFWMACC_4x4x4 : CustomSiFiveVMACC<0b111100, OPFVV, "sf.vfwmacc.4x4x4">;
2185f757f3fSDimitry Andric}
2195f757f3fSDimitry Andric
2205f757f3fSDimitry Andriclet Predicates = [HasVendorXSfvfnrclipxfqf], DecoderNamespace = "XSfvfnrclipxfqf" in {
2215f757f3fSDimitry Andric  def VFNRCLIP_XU_F_QF : CustomSiFiveVFNRCLIP<0b100010, OPFVF, "sf.vfnrclip.xu.f.qf">;
2225f757f3fSDimitry Andric  def VFNRCLIP_X_F_QF : CustomSiFiveVFNRCLIP<0b100011, OPFVF, "sf.vfnrclip.x.f.qf">;
2235f757f3fSDimitry Andric}
224*0fca6ea1SDimitry Andric
225*0fca6ea1SDimitry Andricclass VPseudoVC_X<Operand OpClass, DAGOperand RS1Class> :
22606c3fb27SDimitry Andric      Pseudo<(outs),
22706c3fb27SDimitry Andric             (ins OpClass:$op1, payload5:$rs2, payload5:$rd, RS1Class:$r1,
22806c3fb27SDimitry Andric                  AVL:$vl, ixlenimm:$sew), []>,
22906c3fb27SDimitry Andric      RISCVVPseudo {
23006c3fb27SDimitry Andric  let mayLoad = 0;
23106c3fb27SDimitry Andric  let mayStore = 0;
23206c3fb27SDimitry Andric  let HasVLOp = 1;
23306c3fb27SDimitry Andric  let HasSEWOp = 1;
234*0fca6ea1SDimitry Andric  let hasSideEffects = 0;
23506c3fb27SDimitry Andric  let BaseInstr = !cast<Instruction>(PseudoToVInst<NAME>.VInst);
23606c3fb27SDimitry Andric}
23706c3fb27SDimitry Andric
238*0fca6ea1SDimitry Andricclass VPseudoVC_XV<Operand OpClass, VReg RS2Class, DAGOperand RS1Class> :
23906c3fb27SDimitry Andric      Pseudo<(outs),
24006c3fb27SDimitry Andric             (ins OpClass:$op1, payload5:$rd, RS2Class:$rs2, RS1Class:$r1,
24106c3fb27SDimitry Andric                  AVL:$vl, ixlenimm:$sew), []>,
24206c3fb27SDimitry Andric      RISCVVPseudo {
24306c3fb27SDimitry Andric  let mayLoad = 0;
24406c3fb27SDimitry Andric  let mayStore = 0;
24506c3fb27SDimitry Andric  let HasVLOp = 1;
24606c3fb27SDimitry Andric  let HasSEWOp = 1;
247*0fca6ea1SDimitry Andric  let hasSideEffects = 0;
24806c3fb27SDimitry Andric  let BaseInstr = !cast<Instruction>(PseudoToVInst<NAME>.VInst);
24906c3fb27SDimitry Andric}
25006c3fb27SDimitry Andric
25106c3fb27SDimitry Andricclass VPseudoVC_XVV<Operand OpClass, VReg RDClass, VReg RS2Class,
252*0fca6ea1SDimitry Andric                    DAGOperand RS1Class> :
25306c3fb27SDimitry Andric      Pseudo<(outs),
25406c3fb27SDimitry Andric             (ins OpClass:$op1, RDClass:$rd, RS2Class:$rs2, RS1Class:$r1,
25506c3fb27SDimitry Andric                  AVL:$vl, ixlenimm:$sew), []>,
25606c3fb27SDimitry Andric      RISCVVPseudo {
25706c3fb27SDimitry Andric  let mayLoad = 0;
25806c3fb27SDimitry Andric  let mayStore = 0;
25906c3fb27SDimitry Andric  let HasVLOp = 1;
26006c3fb27SDimitry Andric  let HasSEWOp = 1;
261*0fca6ea1SDimitry Andric  let hasSideEffects = 0;
26206c3fb27SDimitry Andric  let BaseInstr = !cast<Instruction>(PseudoToVInst<NAME>.VInst);
26306c3fb27SDimitry Andric}
26406c3fb27SDimitry Andric
265*0fca6ea1SDimitry Andricclass VPseudoVC_V_X<Operand OpClass, VReg RDClass, DAGOperand RS1Class> :
26606c3fb27SDimitry Andric      Pseudo<(outs RDClass:$rd),
26706c3fb27SDimitry Andric             (ins OpClass:$op1, payload5:$rs2, RS1Class:$r1,
26806c3fb27SDimitry Andric                  AVL:$vl, ixlenimm:$sew), []>,
26906c3fb27SDimitry Andric      RISCVVPseudo {
27006c3fb27SDimitry Andric  let mayLoad = 0;
27106c3fb27SDimitry Andric  let mayStore = 0;
27206c3fb27SDimitry Andric  let HasVLOp = 1;
27306c3fb27SDimitry Andric  let HasSEWOp = 1;
274*0fca6ea1SDimitry Andric  let hasSideEffects = 0;
27506c3fb27SDimitry Andric  let BaseInstr = !cast<Instruction>(PseudoToVInst<NAME>.VInst);
27606c3fb27SDimitry Andric}
27706c3fb27SDimitry Andric
27806c3fb27SDimitry Andricclass VPseudoVC_V_XV<Operand OpClass, VReg RDClass, VReg RS2Class,
279*0fca6ea1SDimitry Andric                     DAGOperand RS1Class> :
28006c3fb27SDimitry Andric      Pseudo<(outs RDClass:$rd),
28106c3fb27SDimitry Andric             (ins OpClass:$op1, RS2Class:$rs2, RS1Class:$r1,
28206c3fb27SDimitry Andric                  AVL:$vl, ixlenimm:$sew), []>,
28306c3fb27SDimitry Andric      RISCVVPseudo {
28406c3fb27SDimitry Andric  let mayLoad = 0;
28506c3fb27SDimitry Andric  let mayStore = 0;
28606c3fb27SDimitry Andric  let HasVLOp = 1;
28706c3fb27SDimitry Andric  let HasSEWOp = 1;
288*0fca6ea1SDimitry Andric  let hasSideEffects = 0;
28906c3fb27SDimitry Andric  let BaseInstr = !cast<Instruction>(PseudoToVInst<NAME>.VInst);
29006c3fb27SDimitry Andric}
29106c3fb27SDimitry Andric
29206c3fb27SDimitry Andricclass VPseudoVC_V_XVV<Operand OpClass, VReg RDClass, VReg RS2Class,
293*0fca6ea1SDimitry Andric                      DAGOperand RS1Class> :
29406c3fb27SDimitry Andric      Pseudo<(outs RDClass:$rd),
29506c3fb27SDimitry Andric             (ins OpClass:$op1, RDClass:$rs3, RS2Class:$rs2, RS1Class:$r1,
29606c3fb27SDimitry Andric                  AVL:$vl, ixlenimm:$sew), []>,
29706c3fb27SDimitry Andric      RISCVVPseudo {
29806c3fb27SDimitry Andric  let mayLoad = 0;
29906c3fb27SDimitry Andric  let mayStore = 0;
30006c3fb27SDimitry Andric  let HasVLOp = 1;
30106c3fb27SDimitry Andric  let HasSEWOp = 1;
302*0fca6ea1SDimitry Andric  let hasSideEffects = 0;
30306c3fb27SDimitry Andric  let BaseInstr = !cast<Instruction>(PseudoToVInst<NAME>.VInst);
30406c3fb27SDimitry Andric}
30506c3fb27SDimitry Andric
30606c3fb27SDimitry Andricmulticlass VPseudoVC_X<LMULInfo m, DAGOperand RS1Class,
30706c3fb27SDimitry Andric                       Operand OpClass = payload2> {
30806c3fb27SDimitry Andric  let VLMul = m.value in {
309*0fca6ea1SDimitry Andric    let Defs = [VCIX_STATE], Uses = [VCIX_STATE] in {
310*0fca6ea1SDimitry Andric      def "PseudoVC_" # NAME # "_SE_" # m.MX
311*0fca6ea1SDimitry Andric        : VPseudoVC_X<OpClass, RS1Class>,
312*0fca6ea1SDimitry Andric          Sched<[!cast<SchedWrite>("WriteVC_" # NAME # "_" # m.MX)]>;
313*0fca6ea1SDimitry Andric      def "PseudoVC_V_" # NAME # "_SE_" # m.MX
314*0fca6ea1SDimitry Andric        : VPseudoVC_V_X<OpClass, m.vrclass, RS1Class>,
315*0fca6ea1SDimitry Andric          Sched<[!cast<SchedWrite>("WriteVC_V_" # NAME # "_" # m.MX)]>;
316*0fca6ea1SDimitry Andric    }
317*0fca6ea1SDimitry Andric    def "PseudoVC_V_" # NAME # "_" # m.MX
318*0fca6ea1SDimitry Andric      : VPseudoVC_V_X<OpClass, m.vrclass, RS1Class>,
319*0fca6ea1SDimitry Andric        Sched<[!cast<SchedWrite>("WriteVC_V_" # NAME # "_" # m.MX)]>;
32006c3fb27SDimitry Andric  }
32106c3fb27SDimitry Andric}
32206c3fb27SDimitry Andric
32306c3fb27SDimitry Andricmulticlass VPseudoVC_XV<LMULInfo m, DAGOperand RS1Class,
32406c3fb27SDimitry Andric                        Operand OpClass = payload2> {
32506c3fb27SDimitry Andric  let VLMul = m.value in {
326*0fca6ea1SDimitry Andric    let Defs = [VCIX_STATE], Uses = [VCIX_STATE] in {
327*0fca6ea1SDimitry Andric      def "PseudoVC_" # NAME # "_SE_" # m.MX
328*0fca6ea1SDimitry Andric        : VPseudoVC_XV<OpClass, m.vrclass, RS1Class>,
329*0fca6ea1SDimitry Andric          Sched<[!cast<SchedWrite>("WriteVC_" # NAME # "_" # m.MX)]>;
330*0fca6ea1SDimitry Andric      def "PseudoVC_V_" # NAME # "_SE_" # m.MX
331*0fca6ea1SDimitry Andric        : VPseudoVC_V_XV<OpClass, m.vrclass, m.vrclass, RS1Class>,
332*0fca6ea1SDimitry Andric          Sched<[!cast<SchedWrite>("WriteVC_V_" # NAME # "_" # m.MX)]>;
333*0fca6ea1SDimitry Andric    }
334*0fca6ea1SDimitry Andric    def "PseudoVC_V_" # NAME # "_" # m.MX
335*0fca6ea1SDimitry Andric      : VPseudoVC_V_XV<OpClass, m.vrclass, m.vrclass, RS1Class>,
336*0fca6ea1SDimitry Andric        Sched<[!cast<SchedWrite>("WriteVC_V_" # NAME # "_" # m.MX)]>;
33706c3fb27SDimitry Andric  }
33806c3fb27SDimitry Andric}
33906c3fb27SDimitry Andric
34006c3fb27SDimitry Andricmulticlass VPseudoVC_XVV<LMULInfo m, DAGOperand RS1Class,
34106c3fb27SDimitry Andric                         Operand OpClass = payload2> {
34206c3fb27SDimitry Andric  let VLMul = m.value in {
343*0fca6ea1SDimitry Andric    let Defs = [VCIX_STATE], Uses = [VCIX_STATE] in {
344*0fca6ea1SDimitry Andric      def "PseudoVC_" # NAME # "_SE_" # m.MX
345*0fca6ea1SDimitry Andric        : VPseudoVC_XVV<OpClass, m.vrclass, m.vrclass, RS1Class>,
346*0fca6ea1SDimitry Andric          Sched<[!cast<SchedWrite>("WriteVC_" # NAME # "_" # m.MX)]>;
347*0fca6ea1SDimitry Andric      def "PseudoVC_V_" # NAME # "_SE_" # m.MX
348*0fca6ea1SDimitry Andric        : VPseudoVC_V_XVV<OpClass, m.vrclass, m.vrclass, RS1Class>,
349*0fca6ea1SDimitry Andric          Sched<[!cast<SchedWrite>("WriteVC_V_" # NAME # "_" # m.MX)]>;
350*0fca6ea1SDimitry Andric    }
351*0fca6ea1SDimitry Andric    def "PseudoVC_V_" # NAME # "_" # m.MX
352*0fca6ea1SDimitry Andric      : VPseudoVC_V_XVV<OpClass, m.vrclass, m.vrclass, RS1Class>,
353*0fca6ea1SDimitry Andric        Sched<[!cast<SchedWrite>("WriteVC_V_" # NAME # "_" # m.MX)]>;
35406c3fb27SDimitry Andric  }
35506c3fb27SDimitry Andric}
35606c3fb27SDimitry Andric
35706c3fb27SDimitry Andricmulticlass VPseudoVC_XVW<LMULInfo m, DAGOperand RS1Class,
35806c3fb27SDimitry Andric                         Operand OpClass = payload2> {
35906c3fb27SDimitry Andric  let VLMul = m.value in {
360*0fca6ea1SDimitry Andric    let Defs = [VCIX_STATE], Uses = [VCIX_STATE] in
361*0fca6ea1SDimitry Andric    def "PseudoVC_" # NAME # "_SE_" # m.MX
362*0fca6ea1SDimitry Andric      : VPseudoVC_XVV<OpClass, m.wvrclass, m.vrclass, RS1Class>,
363*0fca6ea1SDimitry Andric        Sched<[!cast<SchedWrite>("WriteVC_" # NAME # "_" # m.MX)]>;
36406c3fb27SDimitry Andric    let Constraints = "@earlyclobber $rd, $rd = $rs3" in {
365*0fca6ea1SDimitry Andric      let Defs = [VCIX_STATE], Uses = [VCIX_STATE] in
366*0fca6ea1SDimitry Andric      def "PseudoVC_V_" # NAME # "_SE_" # m.MX
367*0fca6ea1SDimitry Andric        : VPseudoVC_V_XVV<OpClass, m.wvrclass, m.vrclass, RS1Class>,
368*0fca6ea1SDimitry Andric          Sched<[!cast<SchedWrite>("WriteVC_V_" # NAME # "_" # m.MX)]>;
369*0fca6ea1SDimitry Andric      def "PseudoVC_V_" # NAME # "_" # m.MX
370*0fca6ea1SDimitry Andric        : VPseudoVC_V_XVV<OpClass, m.wvrclass, m.vrclass, RS1Class>,
371*0fca6ea1SDimitry Andric          Sched<[!cast<SchedWrite>("WriteVC_V_" # NAME # "_" # m.MX)]>;
37206c3fb27SDimitry Andric    }
37306c3fb27SDimitry Andric  }
37406c3fb27SDimitry Andric}
37506c3fb27SDimitry Andric
3765f757f3fSDimitry Andricmulticlass VPseudoSiFiveVMACC<string mx, VReg vd_type, VReg vs2_type,
3775f757f3fSDimitry Andric                              string Constraint = ""> {
3785f757f3fSDimitry Andric  def "Pseudo" # NAME # "_" # mx
3795f757f3fSDimitry Andric      : VPseudoTernaryNoMaskWithPolicy<vd_type, V_M1.vrclass, vs2_type, Constraint>;
3805f757f3fSDimitry Andric}
3815f757f3fSDimitry Andric
382647cbc5dSDimitry Andricmulticlass VPseudoSiFiveVQMACCDOD<string Constraint = ""> {
3835f757f3fSDimitry Andric  foreach m = MxListVF8 in
384cb14a3feSDimitry Andric    let VLMul = m.value in
3855f757f3fSDimitry Andric    defm NAME : VPseudoSiFiveVMACC<m.MX, m.vrclass, m.vrclass, Constraint>;
3865f757f3fSDimitry Andric}
3875f757f3fSDimitry Andric
388647cbc5dSDimitry Andricmulticlass VPseudoSiFiveVQMACCQOQ<string Constraint = ""> {
389647cbc5dSDimitry Andric  foreach m = [V_MF2, V_M1, V_M2, V_M4] in
390647cbc5dSDimitry Andric    let VLMul = m.value in
391647cbc5dSDimitry Andric    defm NAME : VPseudoSiFiveVMACC<m.MX, m.wvrclass, m.vrclass, Constraint>;
392647cbc5dSDimitry Andric}
393647cbc5dSDimitry Andric
3945f757f3fSDimitry Andricmulticlass VPseudoSiFiveVFWMACC<string Constraint = ""> {
395647cbc5dSDimitry Andric  foreach m = MxListVF2 in
396cb14a3feSDimitry Andric    let VLMul = m.value in
3975f757f3fSDimitry Andric    defm NAME : VPseudoSiFiveVMACC<m.MX, m.wvrclass, m.vrclass, Constraint>;
3985f757f3fSDimitry Andric}
3995f757f3fSDimitry Andric
4005f757f3fSDimitry Andricmulticlass VPseudoSiFiveVFNRCLIP<string Constraint = "@earlyclobber $rd"> {
401647cbc5dSDimitry Andric  foreach i = 0-4 in
4025f757f3fSDimitry Andric    let hasSideEffects = 0 in
403cb14a3feSDimitry Andric      defm "Pseudo" # NAME : VPseudoBinaryRoundingMode<MxListW[i].vrclass,
404cb14a3feSDimitry Andric                                                       MxListVF4[i].vrclass,
405cb14a3feSDimitry Andric                                                       FPR32, MxListW[i],
4065f757f3fSDimitry Andric                                                       Constraint, /*sew*/0,
4075f757f3fSDimitry Andric                                                       UsesVXRM=0>;
4085f757f3fSDimitry Andric}
4095f757f3fSDimitry Andric
41006c3fb27SDimitry Andriclet Predicates = [HasVendorXSfvcp] in {
41106c3fb27SDimitry Andric  foreach m = MxList in {
41206c3fb27SDimitry Andric    defm X : VPseudoVC_X<m, GPR>;
4135f757f3fSDimitry Andric    defm I : VPseudoVC_X<m, tsimm5>;
41406c3fb27SDimitry Andric    defm XV : VPseudoVC_XV<m, GPR>;
4155f757f3fSDimitry Andric    defm IV : VPseudoVC_XV<m, tsimm5>;
41606c3fb27SDimitry Andric    defm VV : VPseudoVC_XV<m, m.vrclass>;
41706c3fb27SDimitry Andric    defm XVV : VPseudoVC_XVV<m, GPR>;
4185f757f3fSDimitry Andric    defm IVV : VPseudoVC_XVV<m, tsimm5>;
41906c3fb27SDimitry Andric    defm VVV : VPseudoVC_XVV<m, m.vrclass>;
42006c3fb27SDimitry Andric  }
42106c3fb27SDimitry Andric  foreach f = FPList in {
42206c3fb27SDimitry Andric    foreach m = f.MxList in {
42306c3fb27SDimitry Andric    defm f.FX # "V" : VPseudoVC_XV<m, f.fprclass, payload1>;
42406c3fb27SDimitry Andric    defm f.FX # "VV" : VPseudoVC_XVV<m, f.fprclass, payload1>;
42506c3fb27SDimitry Andric    }
42606c3fb27SDimitry Andric  }
42706c3fb27SDimitry Andric  foreach m = MxListW in {
42806c3fb27SDimitry Andric    defm XVW : VPseudoVC_XVW<m, GPR>;
4295f757f3fSDimitry Andric    defm IVW : VPseudoVC_XVW<m, tsimm5>;
43006c3fb27SDimitry Andric    defm VVW : VPseudoVC_XVW<m, m.vrclass>;
43106c3fb27SDimitry Andric  }
43206c3fb27SDimitry Andric  foreach f = FPListW in {
43306c3fb27SDimitry Andric    foreach m = f.MxList in
43406c3fb27SDimitry Andric    defm f.FX # "VW" : VPseudoVC_XVW<m, f.fprclass, payload1>;
43506c3fb27SDimitry Andric  }
43606c3fb27SDimitry Andric}
43706c3fb27SDimitry Andric
4385f757f3fSDimitry Andriclet Predicates = [HasVendorXSfvqmaccdod] in {
439647cbc5dSDimitry Andric  defm VQMACCU_2x8x2  : VPseudoSiFiveVQMACCDOD;
440647cbc5dSDimitry Andric  defm VQMACC_2x8x2   : VPseudoSiFiveVQMACCDOD;
441647cbc5dSDimitry Andric  defm VQMACCUS_2x8x2 : VPseudoSiFiveVQMACCDOD;
442647cbc5dSDimitry Andric  defm VQMACCSU_2x8x2 : VPseudoSiFiveVQMACCDOD;
4435f757f3fSDimitry Andric}
4445f757f3fSDimitry Andric
4455f757f3fSDimitry Andriclet Predicates = [HasVendorXSfvqmaccqoq] in {
446647cbc5dSDimitry Andric  defm VQMACCU_4x8x4  : VPseudoSiFiveVQMACCQOQ;
447647cbc5dSDimitry Andric  defm VQMACC_4x8x4   : VPseudoSiFiveVQMACCQOQ;
448647cbc5dSDimitry Andric  defm VQMACCUS_4x8x4 : VPseudoSiFiveVQMACCQOQ;
449647cbc5dSDimitry Andric  defm VQMACCSU_4x8x4 : VPseudoSiFiveVQMACCQOQ;
4505f757f3fSDimitry Andric}
4515f757f3fSDimitry Andric
4525f757f3fSDimitry Andriclet Predicates = [HasVendorXSfvfwmaccqqq] in {
4535f757f3fSDimitry Andric  defm VFWMACC_4x4x4 : VPseudoSiFiveVFWMACC;
4545f757f3fSDimitry Andric}
4555f757f3fSDimitry Andric
4565f757f3fSDimitry Andriclet Predicates = [HasVendorXSfvfnrclipxfqf] in {
4575f757f3fSDimitry Andric  defm VFNRCLIP_XU_F_QF : VPseudoSiFiveVFNRCLIP;
4585f757f3fSDimitry Andric  defm VFNRCLIP_X_F_QF : VPseudoSiFiveVFNRCLIP;
4595f757f3fSDimitry Andric}
4605f757f3fSDimitry Andric
461*0fca6ea1SDimitry Andric// SDNode
462*0fca6ea1SDimitry Andricdef SDT_SF_VC_V_X : SDTypeProfile<1, 4, [SDTCisVec<0>,
463*0fca6ea1SDimitry Andric                                         SDTCisVT<1, XLenVT>,
464*0fca6ea1SDimitry Andric                                         SDTCisSameAs<1, 2>,
465*0fca6ea1SDimitry Andric                                         SDTCisSameAs<1, 3>,
466*0fca6ea1SDimitry Andric                                         SDTCisSameAs<1, 4>]>;
467*0fca6ea1SDimitry Andric
468*0fca6ea1SDimitry Andricdef SDT_SF_VC_XV : SDTypeProfile<0, 5, [SDTCisSameAs<0, 1>,
469*0fca6ea1SDimitry Andric                                        SDTCisVec<2>,
470*0fca6ea1SDimitry Andric                                        SDTCisSameAs<0, 4>,
471*0fca6ea1SDimitry Andric                                        SDTCisVT<0, XLenVT>]>;
472*0fca6ea1SDimitry Andric
473*0fca6ea1SDimitry Andricdef SDT_SF_VC_V_XV : SDTypeProfile<1, 4, [SDTCisVec<0>,
474*0fca6ea1SDimitry Andric                                          SDTCisVT<1, XLenVT>,
475*0fca6ea1SDimitry Andric                                          SDTCisSameAs<0, 2>,
476*0fca6ea1SDimitry Andric                                          SDTCisSameAs<1, 4>]>;
477*0fca6ea1SDimitry Andric
478*0fca6ea1SDimitry Andricdef SDT_SF_VC_XVV : SDTypeProfile<0, 5, [SDTCisVT<0, XLenVT>,
479*0fca6ea1SDimitry Andric                                         SDTCisVec<1>,
480*0fca6ea1SDimitry Andric                                         SDTCisSameAs<1, 2>,
481*0fca6ea1SDimitry Andric                                         SDTCisSameAs<0, 4>]>;
482*0fca6ea1SDimitry Andric
483*0fca6ea1SDimitry Andricdef SDT_SF_VC_V_XVV : SDTypeProfile<1, 5, [SDTCisVec<0>,
484*0fca6ea1SDimitry Andric                                           SDTCisVT<1, XLenVT>,
485*0fca6ea1SDimitry Andric                                           SDTCisSameAs<0, 2>,
486*0fca6ea1SDimitry Andric                                           SDTCisSameAs<0, 3>,
487*0fca6ea1SDimitry Andric                                           SDTCisSameAs<1, 5>]>;
488*0fca6ea1SDimitry Andric
489*0fca6ea1SDimitry Andricdef SDT_SF_VC_XVW : SDTypeProfile<0, 5, [SDTCisVT<0, XLenVT>,
490*0fca6ea1SDimitry Andric                                         SDTCisVec<1>, SDTCisVec<2>,
491*0fca6ea1SDimitry Andric                                         SDTCisSameAs<0, 4>]>;
492*0fca6ea1SDimitry Andric
493*0fca6ea1SDimitry Andricdef SDT_SF_VC_V_XVW : SDTypeProfile<1, 5, [SDTCisVec<0>,
494*0fca6ea1SDimitry Andric                                           SDTCisVT<1, XLenVT>,
495*0fca6ea1SDimitry Andric                                           SDTCisSameAs<0, 2>,
496*0fca6ea1SDimitry Andric                                           SDTCisVec<3>,
497*0fca6ea1SDimitry Andric                                           SDTCisSameAs<1, 5>]>;
498*0fca6ea1SDimitry Andric
499*0fca6ea1SDimitry Andricdef sf_vc_v_x_se : SDNode<"RISCVISD::SF_VC_V_X_SE", SDT_SF_VC_V_X, [SDNPHasChain]>;
500*0fca6ea1SDimitry Andricdef sf_vc_v_i_se : SDNode<"RISCVISD::SF_VC_V_I_SE", SDT_SF_VC_V_X, [SDNPHasChain]>;
501*0fca6ea1SDimitry Andricdef sf_vc_vv_se : SDNode<"RISCVISD::SF_VC_VV_SE", SDT_SF_VC_XV, [SDNPHasChain]>;
502*0fca6ea1SDimitry Andricdef sf_vc_xv_se : SDNode<"RISCVISD::SF_VC_XV_SE", SDT_SF_VC_XV, [SDNPHasChain]>;
503*0fca6ea1SDimitry Andricdef sf_vc_iv_se : SDNode<"RISCVISD::SF_VC_IV_SE", SDT_SF_VC_XV, [SDNPHasChain]>;
504*0fca6ea1SDimitry Andricdef sf_vc_fv_se : SDNode<"RISCVISD::SF_VC_FV_SE", SDT_SF_VC_XV, [SDNPHasChain]>;
505*0fca6ea1SDimitry Andricdef sf_vc_v_vv_se : SDNode<"RISCVISD::SF_VC_V_VV_SE", SDT_SF_VC_V_XV, [SDNPHasChain]>;
506*0fca6ea1SDimitry Andricdef sf_vc_v_xv_se : SDNode<"RISCVISD::SF_VC_V_XV_SE", SDT_SF_VC_V_XV, [SDNPHasChain]>;
507*0fca6ea1SDimitry Andricdef sf_vc_v_iv_se : SDNode<"RISCVISD::SF_VC_V_IV_SE", SDT_SF_VC_V_XV, [SDNPHasChain]>;
508*0fca6ea1SDimitry Andricdef sf_vc_v_fv_se : SDNode<"RISCVISD::SF_VC_V_FV_SE", SDT_SF_VC_V_XV, [SDNPHasChain]>;
509*0fca6ea1SDimitry Andricdef sf_vc_vvv_se : SDNode<"RISCVISD::SF_VC_VVV_SE", SDT_SF_VC_XVV, [SDNPHasChain]>;
510*0fca6ea1SDimitry Andricdef sf_vc_xvv_se : SDNode<"RISCVISD::SF_VC_XVV_SE", SDT_SF_VC_XVV, [SDNPHasChain]>;
511*0fca6ea1SDimitry Andricdef sf_vc_ivv_se : SDNode<"RISCVISD::SF_VC_IVV_SE", SDT_SF_VC_XVV, [SDNPHasChain]>;
512*0fca6ea1SDimitry Andricdef sf_vc_fvv_se : SDNode<"RISCVISD::SF_VC_FVV_SE", SDT_SF_VC_XVV, [SDNPHasChain]>;
513*0fca6ea1SDimitry Andricdef sf_vc_v_vvv_se : SDNode<"RISCVISD::SF_VC_V_VVV_SE", SDT_SF_VC_V_XVV, [SDNPHasChain]>;
514*0fca6ea1SDimitry Andricdef sf_vc_v_xvv_se : SDNode<"RISCVISD::SF_VC_V_XVV_SE", SDT_SF_VC_V_XVV, [SDNPHasChain]>;
515*0fca6ea1SDimitry Andricdef sf_vc_v_ivv_se : SDNode<"RISCVISD::SF_VC_V_IVV_SE", SDT_SF_VC_V_XVV, [SDNPHasChain]>;
516*0fca6ea1SDimitry Andricdef sf_vc_v_fvv_se : SDNode<"RISCVISD::SF_VC_V_FVV_SE", SDT_SF_VC_V_XVV, [SDNPHasChain]>;
517*0fca6ea1SDimitry Andricdef sf_vc_vvw_se : SDNode<"RISCVISD::SF_VC_VVW_SE", SDT_SF_VC_XVW, [SDNPHasChain]>;
518*0fca6ea1SDimitry Andricdef sf_vc_xvw_se : SDNode<"RISCVISD::SF_VC_XVW_SE", SDT_SF_VC_XVW, [SDNPHasChain]>;
519*0fca6ea1SDimitry Andricdef sf_vc_ivw_se : SDNode<"RISCVISD::SF_VC_IVW_SE", SDT_SF_VC_XVW, [SDNPHasChain]>;
520*0fca6ea1SDimitry Andricdef sf_vc_fvw_se : SDNode<"RISCVISD::SF_VC_FVW_SE", SDT_SF_VC_XVW, [SDNPHasChain]>;
521*0fca6ea1SDimitry Andricdef sf_vc_v_vvw_se : SDNode<"RISCVISD::SF_VC_V_VVW_SE", SDT_SF_VC_V_XVW, [SDNPHasChain]>;
522*0fca6ea1SDimitry Andricdef sf_vc_v_xvw_se : SDNode<"RISCVISD::SF_VC_V_XVW_SE", SDT_SF_VC_V_XVW, [SDNPHasChain]>;
523*0fca6ea1SDimitry Andricdef sf_vc_v_ivw_se : SDNode<"RISCVISD::SF_VC_V_IVW_SE", SDT_SF_VC_V_XVW, [SDNPHasChain]>;
524*0fca6ea1SDimitry Andricdef sf_vc_v_fvw_se : SDNode<"RISCVISD::SF_VC_V_FVW_SE", SDT_SF_VC_V_XVW, [SDNPHasChain]>;
525*0fca6ea1SDimitry Andric
526*0fca6ea1SDimitry Andricclass VPatVC_OP4_ISD<SDPatternOperator op,
527*0fca6ea1SDimitry Andric                     string inst,
528*0fca6ea1SDimitry Andric                     ValueType op2_type,
529*0fca6ea1SDimitry Andric                     ValueType op3_type,
530*0fca6ea1SDimitry Andric                     ValueType op4_type,
531*0fca6ea1SDimitry Andric                     int sew,
532*0fca6ea1SDimitry Andric                     DAGOperand op2_kind,
533*0fca6ea1SDimitry Andric                     DAGOperand op3_kind,
534*0fca6ea1SDimitry Andric                     DAGOperand op4_kind,
535*0fca6ea1SDimitry Andric                     Operand op1_kind = payload2> :
536*0fca6ea1SDimitry Andric  Pat<(op
537*0fca6ea1SDimitry Andric       (XLenVT   op1_kind:$op1),
538*0fca6ea1SDimitry Andric       (op2_type op2_kind:$op2),
539*0fca6ea1SDimitry Andric       (op3_type op3_kind:$op3),
540*0fca6ea1SDimitry Andric       (op4_type op4_kind:$op4),
541*0fca6ea1SDimitry Andric       VLOpFrag),
542*0fca6ea1SDimitry Andric      (!cast<Instruction>(inst)
543*0fca6ea1SDimitry Andric       (XLenVT   op1_kind:$op1),
544*0fca6ea1SDimitry Andric       (op2_type op2_kind:$op2),
545*0fca6ea1SDimitry Andric       (op3_type op3_kind:$op3),
546*0fca6ea1SDimitry Andric       (op4_type op4_kind:$op4),
547*0fca6ea1SDimitry Andric       GPR:$vl, sew)>;
548*0fca6ea1SDimitry Andric
549*0fca6ea1SDimitry Andricclass VPatVC_V_OP4_ISD<SDPatternOperator op,
550*0fca6ea1SDimitry Andric                       string inst,
551*0fca6ea1SDimitry Andric                       ValueType result_type,
552*0fca6ea1SDimitry Andric                       ValueType op2_type,
553*0fca6ea1SDimitry Andric                       ValueType op3_type,
554*0fca6ea1SDimitry Andric                       ValueType op4_type,
555*0fca6ea1SDimitry Andric                       int sew,
556*0fca6ea1SDimitry Andric                       DAGOperand op2_kind,
557*0fca6ea1SDimitry Andric                       DAGOperand op3_kind,
558*0fca6ea1SDimitry Andric                       DAGOperand op4_kind,
559*0fca6ea1SDimitry Andric                       Operand op1_kind = payload2> :
560*0fca6ea1SDimitry Andric  Pat<(result_type (op
561*0fca6ea1SDimitry Andric                    (XLenVT   op1_kind:$op1),
562*0fca6ea1SDimitry Andric                    (op2_type op2_kind:$op2),
563*0fca6ea1SDimitry Andric                    (op3_type op3_kind:$op3),
564*0fca6ea1SDimitry Andric                    (op4_type op4_kind:$op4),
565*0fca6ea1SDimitry Andric                    VLOpFrag)),
566*0fca6ea1SDimitry Andric                   (!cast<Instruction>(inst)
567*0fca6ea1SDimitry Andric                    (XLenVT   op1_kind:$op1),
568*0fca6ea1SDimitry Andric                    (op2_type op2_kind:$op2),
569*0fca6ea1SDimitry Andric                    (op3_type op3_kind:$op3),
570*0fca6ea1SDimitry Andric                    (op4_type op4_kind:$op4),
571*0fca6ea1SDimitry Andric                    GPR:$vl, sew)>;
572*0fca6ea1SDimitry Andric
573*0fca6ea1SDimitry Andric
574*0fca6ea1SDimitry Andricclass VPatVC_V_OP3_ISD<SDPatternOperator op,
575*0fca6ea1SDimitry Andric                       string inst,
576*0fca6ea1SDimitry Andric                       ValueType result_type,
577*0fca6ea1SDimitry Andric                       ValueType op2_type,
578*0fca6ea1SDimitry Andric                       ValueType op3_type,
579*0fca6ea1SDimitry Andric                       int sew,
580*0fca6ea1SDimitry Andric                       DAGOperand op2_kind,
581*0fca6ea1SDimitry Andric                       DAGOperand op3_kind,
582*0fca6ea1SDimitry Andric                       Operand op1_kind = payload2> :
583*0fca6ea1SDimitry Andric  Pat<(result_type (op
584*0fca6ea1SDimitry Andric                    (XLenVT   op1_kind:$op1),
585*0fca6ea1SDimitry Andric                    (op2_type op2_kind:$op2),
586*0fca6ea1SDimitry Andric                    (op3_type op3_kind:$op3),
587*0fca6ea1SDimitry Andric                    VLOpFrag)),
588*0fca6ea1SDimitry Andric                   (!cast<Instruction>(inst)
589*0fca6ea1SDimitry Andric                    (XLenVT   op1_kind:$op1),
590*0fca6ea1SDimitry Andric                    (op2_type op2_kind:$op2),
591*0fca6ea1SDimitry Andric                    (op3_type op3_kind:$op3),
592*0fca6ea1SDimitry Andric                    GPR:$vl, sew)>;
593*0fca6ea1SDimitry Andric
59406c3fb27SDimitry Andricclass VPatVC_OP4<string intrinsic_name,
59506c3fb27SDimitry Andric                 string inst,
59606c3fb27SDimitry Andric                 ValueType op2_type,
59706c3fb27SDimitry Andric                 ValueType op3_type,
59806c3fb27SDimitry Andric                 ValueType op4_type,
59906c3fb27SDimitry Andric                 int sew,
60006c3fb27SDimitry Andric                 DAGOperand op2_kind,
60106c3fb27SDimitry Andric                 DAGOperand op3_kind,
60206c3fb27SDimitry Andric                 DAGOperand op4_kind,
60306c3fb27SDimitry Andric                 Operand op1_kind = payload2> :
60406c3fb27SDimitry Andric  Pat<(!cast<Intrinsic>(intrinsic_name)
60506c3fb27SDimitry Andric       (XLenVT   op1_kind:$op1),
60606c3fb27SDimitry Andric       (op2_type op2_kind:$op2),
60706c3fb27SDimitry Andric       (op3_type op3_kind:$op3),
60806c3fb27SDimitry Andric       (op4_type op4_kind:$op4),
60906c3fb27SDimitry Andric       VLOpFrag),
61006c3fb27SDimitry Andric      (!cast<Instruction>(inst)
61106c3fb27SDimitry Andric       (XLenVT   op1_kind:$op1),
61206c3fb27SDimitry Andric       (op2_type op2_kind:$op2),
61306c3fb27SDimitry Andric       (op3_type op3_kind:$op3),
61406c3fb27SDimitry Andric       (op4_type op4_kind:$op4),
61506c3fb27SDimitry Andric       GPR:$vl, sew)>;
61606c3fb27SDimitry Andric
61706c3fb27SDimitry Andricclass VPatVC_V_OP4<string intrinsic_name,
61806c3fb27SDimitry Andric                   string inst,
61906c3fb27SDimitry Andric                   ValueType result_type,
62006c3fb27SDimitry Andric                   ValueType op2_type,
62106c3fb27SDimitry Andric                   ValueType op3_type,
62206c3fb27SDimitry Andric                   ValueType op4_type,
62306c3fb27SDimitry Andric                   int sew,
62406c3fb27SDimitry Andric                   DAGOperand op2_kind,
62506c3fb27SDimitry Andric                   DAGOperand op3_kind,
62606c3fb27SDimitry Andric                   DAGOperand op4_kind,
62706c3fb27SDimitry Andric                   Operand op1_kind = payload2> :
62806c3fb27SDimitry Andric  Pat<(result_type (!cast<Intrinsic>(intrinsic_name)
62906c3fb27SDimitry Andric                    (XLenVT   op1_kind:$op1),
63006c3fb27SDimitry Andric                    (op2_type op2_kind:$op2),
63106c3fb27SDimitry Andric                    (op3_type op3_kind:$op3),
63206c3fb27SDimitry Andric                    (op4_type op4_kind:$op4),
63306c3fb27SDimitry Andric                    VLOpFrag)),
63406c3fb27SDimitry Andric                   (!cast<Instruction>(inst)
63506c3fb27SDimitry Andric                    (XLenVT   op1_kind:$op1),
63606c3fb27SDimitry Andric                    (op2_type op2_kind:$op2),
63706c3fb27SDimitry Andric                    (op3_type op3_kind:$op3),
63806c3fb27SDimitry Andric                    (op4_type op4_kind:$op4),
63906c3fb27SDimitry Andric                    GPR:$vl, sew)>;
64006c3fb27SDimitry Andric
64106c3fb27SDimitry Andricclass VPatVC_V_OP3<string intrinsic_name,
64206c3fb27SDimitry Andric                   string inst,
64306c3fb27SDimitry Andric                   ValueType result_type,
64406c3fb27SDimitry Andric                   ValueType op2_type,
64506c3fb27SDimitry Andric                   ValueType op3_type,
64606c3fb27SDimitry Andric                   int sew,
64706c3fb27SDimitry Andric                   DAGOperand op2_kind,
64806c3fb27SDimitry Andric                   DAGOperand op3_kind,
64906c3fb27SDimitry Andric                   Operand op1_kind = payload2> :
65006c3fb27SDimitry Andric  Pat<(result_type (!cast<Intrinsic>(intrinsic_name)
65106c3fb27SDimitry Andric                    (XLenVT   op1_kind:$op1),
65206c3fb27SDimitry Andric                    (op2_type op2_kind:$op2),
65306c3fb27SDimitry Andric                    (op3_type op3_kind:$op3),
65406c3fb27SDimitry Andric                    VLOpFrag)),
65506c3fb27SDimitry Andric                   (!cast<Instruction>(inst)
65606c3fb27SDimitry Andric                    (XLenVT   op1_kind:$op1),
65706c3fb27SDimitry Andric                    (op2_type op2_kind:$op2),
65806c3fb27SDimitry Andric                    (op3_type op3_kind:$op3),
65906c3fb27SDimitry Andric                    GPR:$vl, sew)>;
66006c3fb27SDimitry Andric
66106c3fb27SDimitry Andricmulticlass VPatVC_X<string intrinsic_suffix, string instruction_suffix,
66206c3fb27SDimitry Andric                    VTypeInfo vti, ValueType type, DAGOperand kind> {
663*0fca6ea1SDimitry Andric  def : VPatVC_V_OP3_ISD<!cast<SDPatternOperator>("sf_vc_v_" # intrinsic_suffix # "_se"),
66406c3fb27SDimitry Andric                         "PseudoVC_V_" # instruction_suffix # "_SE_" # vti.LMul.MX,
66506c3fb27SDimitry Andric                         vti.Vector, XLenVT, type, vti.Log2SEW,
66606c3fb27SDimitry Andric                         payload5, kind>;
66706c3fb27SDimitry Andric  def : VPatVC_V_OP3<"int_riscv_sf_vc_v_" # intrinsic_suffix,
66806c3fb27SDimitry Andric                     "PseudoVC_V_" # instruction_suffix # "_" # vti.LMul.MX,
66906c3fb27SDimitry Andric                     vti.Vector, XLenVT, type, vti.Log2SEW,
67006c3fb27SDimitry Andric                     payload5, kind>;
67106c3fb27SDimitry Andric}
67206c3fb27SDimitry Andric
67306c3fb27SDimitry Andricmulticlass VPatVC_XV<string intrinsic_suffix, string instruction_suffix,
67406c3fb27SDimitry Andric                     VTypeInfo vti, ValueType type, DAGOperand kind,
67506c3fb27SDimitry Andric                     Operand op1_kind = payload2> {
676*0fca6ea1SDimitry Andric  def : VPatVC_OP4_ISD<!cast<SDPatternOperator>("sf_vc_" # intrinsic_suffix # "_se"),
67706c3fb27SDimitry Andric                   "PseudoVC_" # instruction_suffix # "_SE_" # vti.LMul.MX,
67806c3fb27SDimitry Andric                   XLenVT, vti.Vector, type, vti.Log2SEW,
67906c3fb27SDimitry Andric                   payload5, vti.RegClass, kind, op1_kind>;
680*0fca6ea1SDimitry Andric  def : VPatVC_V_OP3_ISD<!cast<SDPatternOperator>("sf_vc_v_" # intrinsic_suffix # "_se"),
68106c3fb27SDimitry Andric                         "PseudoVC_V_" # instruction_suffix # "_SE_" # vti.LMul.MX,
68206c3fb27SDimitry Andric                         vti.Vector, vti.Vector, type, vti.Log2SEW,
68306c3fb27SDimitry Andric                         vti.RegClass, kind, op1_kind>;
68406c3fb27SDimitry Andric  def : VPatVC_V_OP3<"int_riscv_sf_vc_v_" # intrinsic_suffix,
68506c3fb27SDimitry Andric                     "PseudoVC_V_" # instruction_suffix # "_" # vti.LMul.MX,
68606c3fb27SDimitry Andric                     vti.Vector, vti.Vector, type, vti.Log2SEW,
68706c3fb27SDimitry Andric                     vti.RegClass, kind, op1_kind>;
68806c3fb27SDimitry Andric}
68906c3fb27SDimitry Andric
69006c3fb27SDimitry Andricmulticlass VPatVC_XVV<string intrinsic_suffix, string instruction_suffix,
69106c3fb27SDimitry Andric                      VTypeInfo wti, VTypeInfo vti, ValueType type, DAGOperand kind,
69206c3fb27SDimitry Andric                      Operand op1_kind = payload2> {
693*0fca6ea1SDimitry Andric  def : VPatVC_OP4_ISD<!cast<SDPatternOperator>("sf_vc_" # intrinsic_suffix # "_se"),
69406c3fb27SDimitry Andric                   "PseudoVC_" # instruction_suffix # "_SE_" # vti.LMul.MX,
69506c3fb27SDimitry Andric                   wti.Vector, vti.Vector, type, vti.Log2SEW,
69606c3fb27SDimitry Andric                   wti.RegClass, vti.RegClass, kind, op1_kind>;
697*0fca6ea1SDimitry Andric  def : VPatVC_V_OP4_ISD<!cast<SDPatternOperator>("sf_vc_v_" # intrinsic_suffix # "_se"),
69806c3fb27SDimitry Andric                     "PseudoVC_V_" # instruction_suffix # "_SE_" # vti.LMul.MX,
69906c3fb27SDimitry Andric                     wti.Vector, wti.Vector, vti.Vector, type, vti.Log2SEW,
70006c3fb27SDimitry Andric                     wti.RegClass, vti.RegClass, kind, op1_kind>;
70106c3fb27SDimitry Andric  def : VPatVC_V_OP4<"int_riscv_sf_vc_v_" # intrinsic_suffix,
70206c3fb27SDimitry Andric                     "PseudoVC_V_" # instruction_suffix # "_" # vti.LMul.MX,
70306c3fb27SDimitry Andric                     wti.Vector, wti.Vector, vti.Vector, type, vti.Log2SEW,
70406c3fb27SDimitry Andric                     wti.RegClass, vti.RegClass, kind, op1_kind>;
70506c3fb27SDimitry Andric}
70606c3fb27SDimitry Andric
7075f757f3fSDimitry Andricclass GetFTypeInfo<int Sew> {
7085f757f3fSDimitry Andric  ValueType Scalar = !cond(!eq(Sew, 16) : f16,
7095f757f3fSDimitry Andric                           !eq(Sew, 32) : f32,
7105f757f3fSDimitry Andric                           !eq(Sew, 64) : f64);
7115f757f3fSDimitry Andric  RegisterClass ScalarRegClass = !cond(!eq(Sew, 16) : FPR16,
7125f757f3fSDimitry Andric                                       !eq(Sew, 32) : FPR32,
7135f757f3fSDimitry Andric                                       !eq(Sew, 64) : FPR64);
7145f757f3fSDimitry Andric
7155f757f3fSDimitry Andric  string ScalarSuffix = !cond(!eq(Scalar, f16) : "FPR16",
7165f757f3fSDimitry Andric                              !eq(Scalar, f32) : "FPR32",
7175f757f3fSDimitry Andric                              !eq(Scalar, f64) : "FPR64");
7185f757f3fSDimitry Andric}
7195f757f3fSDimitry Andric
7205f757f3fSDimitry Andricmulticlass VPatVMACC<string intrinsic, string instruction, string kind,
7215f757f3fSDimitry Andric                     list<VTypeInfoToWide> info_pairs, ValueType vec_m1> {
7225f757f3fSDimitry Andric  foreach pair = info_pairs in {
7235f757f3fSDimitry Andric    defvar VdInfo = pair.Wti;
7245f757f3fSDimitry Andric    defvar Vs2Info = pair.Vti;
7255f757f3fSDimitry Andric    let Predicates = [HasVInstructions] in
7265f757f3fSDimitry Andric    def : VPatTernaryNoMaskWithPolicy<"int_riscv_sf_" # intrinsic,
7275f757f3fSDimitry Andric                                      "Pseudo" # instruction, kind, VdInfo.Vector,
7285f757f3fSDimitry Andric                                      vec_m1, Vs2Info.Vector,
7295f757f3fSDimitry Andric                                      Vs2Info.Log2SEW, Vs2Info.LMul,
7305f757f3fSDimitry Andric                                      VdInfo.RegClass, VR, Vs2Info.RegClass>;
7315f757f3fSDimitry Andric  }
7325f757f3fSDimitry Andric}
7335f757f3fSDimitry Andric
734647cbc5dSDimitry Andricdefset list<VTypeInfoToWide> VQMACCDODInfoPairs = {
7355f757f3fSDimitry Andric  def : VTypeInfoToWide<VI8M1, VI32M1>;
7365f757f3fSDimitry Andric  def : VTypeInfoToWide<VI8M2, VI32M2>;
7375f757f3fSDimitry Andric  def : VTypeInfoToWide<VI8M4, VI32M4>;
7385f757f3fSDimitry Andric  def : VTypeInfoToWide<VI8M8, VI32M8>;
7395f757f3fSDimitry Andric}
7405f757f3fSDimitry Andric
741647cbc5dSDimitry Andricdefset list<VTypeInfoToWide> VQMACCQOQInfoPairs = {
742647cbc5dSDimitry Andric  def : VTypeInfoToWide<VI8MF2, VI32M1>;
743647cbc5dSDimitry Andric  def : VTypeInfoToWide<VI8M1, VI32M2>;
744647cbc5dSDimitry Andric  def : VTypeInfoToWide<VI8M2, VI32M4>;
745647cbc5dSDimitry Andric  def : VTypeInfoToWide<VI8M4, VI32M8>;
746647cbc5dSDimitry Andric}
7475f757f3fSDimitry Andric
748647cbc5dSDimitry Andricmulticlass VPatVQMACCDOD<string intrinsic, string instruction, string kind>
749647cbc5dSDimitry Andric    : VPatVMACC<intrinsic, instruction, kind, VQMACCDODInfoPairs, vint8m1_t>;
750647cbc5dSDimitry Andric
751647cbc5dSDimitry Andricmulticlass VPatVQMACCQOQ<string intrinsic, string instruction, string kind>
752647cbc5dSDimitry Andric    : VPatVMACC<intrinsic, instruction, kind, VQMACCQOQInfoPairs, vint8m1_t>;
7535f757f3fSDimitry Andric
7545f757f3fSDimitry Andricmulticlass VPatVFWMACC<string intrinsic, string instruction, string kind>
7555f757f3fSDimitry Andric    : VPatVMACC<intrinsic, instruction, kind, AllWidenableBFloatToFloatVectors,
7565f757f3fSDimitry Andric                vbfloat16m1_t>;
7575f757f3fSDimitry Andric
7585f757f3fSDimitry Andricdefset list<VTypeInfoToWide> VFNRCLIPInfoPairs = {
7595f757f3fSDimitry Andric  def : VTypeInfoToWide<VI8MF8, VF32MF2>;
7605f757f3fSDimitry Andric  def : VTypeInfoToWide<VI8MF4, VF32M1>;
7615f757f3fSDimitry Andric  def : VTypeInfoToWide<VI8MF2, VF32M2>;
7625f757f3fSDimitry Andric  def : VTypeInfoToWide<VI8M1,  VF32M4>;
7635f757f3fSDimitry Andric  def : VTypeInfoToWide<VI8M2,  VF32M8>;
7645f757f3fSDimitry Andric}
7655f757f3fSDimitry Andric
7665f757f3fSDimitry Andricmulticlass VPatVFNRCLIP<string intrinsic, string instruction> {
7675f757f3fSDimitry Andric  foreach pair = VFNRCLIPInfoPairs in {
7685f757f3fSDimitry Andric    defvar Vti = pair.Vti;
7695f757f3fSDimitry Andric    defvar Wti = pair.Wti;
7705f757f3fSDimitry Andric    defm : VPatBinaryRoundingMode<"int_riscv_sf_" # intrinsic,
771cb14a3feSDimitry Andric                                  "Pseudo" # instruction # "_" # Vti.LMul.MX,
7725f757f3fSDimitry Andric                                  Vti.Vector, Wti.Vector, Wti.Scalar, Vti.Mask,
7735f757f3fSDimitry Andric                                  Vti.Log2SEW, Vti.RegClass,
7745f757f3fSDimitry Andric                                  Wti.RegClass, Wti.ScalarRegClass>;
7755f757f3fSDimitry Andric  }
7765f757f3fSDimitry Andric}
7775f757f3fSDimitry Andric
77806c3fb27SDimitry Andriclet Predicates = [HasVendorXSfvcp] in {
77906c3fb27SDimitry Andric  foreach vti = AllIntegerVectors in {
7805f757f3fSDimitry Andric    defm : VPatVC_X<"x", "X", vti, XLenVT, GPR>;
7815f757f3fSDimitry Andric    defm : VPatVC_X<"i", "I", vti, XLenVT, tsimm5>;
7825f757f3fSDimitry Andric    defm : VPatVC_XV<"xv", "XV", vti, XLenVT, GPR>;
7835f757f3fSDimitry Andric    defm : VPatVC_XV<"iv", "IV", vti, XLenVT, tsimm5>;
78406c3fb27SDimitry Andric    defm : VPatVC_XV<"vv", "VV", vti, vti.Vector, vti.RegClass>;
7855f757f3fSDimitry Andric    defm : VPatVC_XVV<"xvv", "XVV", vti, vti, XLenVT, GPR>;
7865f757f3fSDimitry Andric    defm : VPatVC_XVV<"ivv", "IVV", vti, vti, XLenVT, tsimm5>;
78706c3fb27SDimitry Andric    defm : VPatVC_XVV<"vvv", "VVV", vti, vti, vti.Vector, vti.RegClass>;
7885f757f3fSDimitry Andric
7895f757f3fSDimitry Andric    if !ne(vti.SEW, 8) then {
7905f757f3fSDimitry Andric      defvar finfo = GetFTypeInfo<vti.SEW>;
7915f757f3fSDimitry Andric      defm : VPatVC_XV<"fv", finfo.ScalarSuffix # "V", vti, finfo.Scalar,
7925f757f3fSDimitry Andric                       finfo.ScalarRegClass, payload1>;
7935f757f3fSDimitry Andric      defm : VPatVC_XVV<"fvv", finfo.ScalarSuffix # "VV", vti, vti, finfo.Scalar,
7945f757f3fSDimitry Andric                        finfo.ScalarRegClass, payload1>;
79506c3fb27SDimitry Andric    }
79606c3fb27SDimitry Andric  }
79706c3fb27SDimitry Andric  foreach VtiToWti = AllWidenableIntVectors in {
79806c3fb27SDimitry Andric    defvar vti = VtiToWti.Vti;
79906c3fb27SDimitry Andric    defvar wti = VtiToWti.Wti;
8005f757f3fSDimitry Andric    defvar iinfo = GetIntVTypeInfo<vti>.Vti;
8015f757f3fSDimitry Andric    defm : VPatVC_XVV<"xvw", "XVW", wti, vti, iinfo.Scalar, iinfo.ScalarRegClass>;
8025f757f3fSDimitry Andric    defm : VPatVC_XVV<"ivw", "IVW", wti, vti, XLenVT, tsimm5>;
80306c3fb27SDimitry Andric    defm : VPatVC_XVV<"vvw", "VVW", wti, vti, vti.Vector, vti.RegClass>;
8045f757f3fSDimitry Andric
8055f757f3fSDimitry Andric    if !ne(vti.SEW, 8) then {
8065f757f3fSDimitry Andric      defvar finfo = GetFTypeInfo<vti.SEW>;
8075f757f3fSDimitry Andric      defm : VPatVC_XVV<"fvw", finfo.ScalarSuffix # "VW", wti, vti, finfo.Scalar,
8085f757f3fSDimitry Andric                        finfo.ScalarRegClass, payload1>;
80906c3fb27SDimitry Andric    }
81006c3fb27SDimitry Andric  }
81106c3fb27SDimitry Andric}
81206c3fb27SDimitry Andric
8135f757f3fSDimitry Andriclet Predicates = [HasVendorXSfvqmaccdod] in {
814647cbc5dSDimitry Andric  defm : VPatVQMACCDOD<"vqmaccu_2x8x2", "VQMACCU", "2x8x2">;
815647cbc5dSDimitry Andric  defm : VPatVQMACCDOD<"vqmacc_2x8x2", "VQMACC", "2x8x2">;
816647cbc5dSDimitry Andric  defm : VPatVQMACCDOD<"vqmaccus_2x8x2", "VQMACCUS", "2x8x2">;
817647cbc5dSDimitry Andric  defm : VPatVQMACCDOD<"vqmaccsu_2x8x2", "VQMACCSU", "2x8x2">;
8185f757f3fSDimitry Andric}
8195f757f3fSDimitry Andric
8205f757f3fSDimitry Andriclet Predicates = [HasVendorXSfvqmaccqoq] in {
821647cbc5dSDimitry Andric  defm : VPatVQMACCQOQ<"vqmaccu_4x8x4", "VQMACCU", "4x8x4">;
822647cbc5dSDimitry Andric  defm : VPatVQMACCQOQ<"vqmacc_4x8x4", "VQMACC", "4x8x4">;
823647cbc5dSDimitry Andric  defm : VPatVQMACCQOQ<"vqmaccus_4x8x4", "VQMACCUS", "4x8x4">;
824647cbc5dSDimitry Andric  defm : VPatVQMACCQOQ<"vqmaccsu_4x8x4", "VQMACCSU", "4x8x4">;
8255f757f3fSDimitry Andric}
8265f757f3fSDimitry Andric
8275f757f3fSDimitry Andriclet Predicates = [HasVendorXSfvfwmaccqqq] in {
8285f757f3fSDimitry Andric  defm : VPatVFWMACC<"vfwmacc_4x4x4", "VFWMACC", "4x4x4">;
8295f757f3fSDimitry Andric}
8305f757f3fSDimitry Andric
8315f757f3fSDimitry Andriclet Predicates = [HasVendorXSfvfnrclipxfqf] in {
8325f757f3fSDimitry Andric  defm : VPatVFNRCLIP<"vfnrclip_xu_f_qf", "VFNRCLIP_XU_F_QF">;
8335f757f3fSDimitry Andric  defm : VPatVFNRCLIP<"vfnrclip_x_f_qf", "VFNRCLIP_X_F_QF">;
8345f757f3fSDimitry Andric}
835*0fca6ea1SDimitry Andric
836*0fca6ea1SDimitry Andriclet Predicates = [HasVendorXSiFivecdiscarddlone] in {
837*0fca6ea1SDimitry Andric  let hasNoSchedulingInfo = 1, hasSideEffects = 1, mayLoad = 0, mayStore = 0,
838*0fca6ea1SDimitry Andric      DecoderNamespace = "XSiFivecdiscarddlone" in
839*0fca6ea1SDimitry Andric  def SF_CDISCARD_D_L1
840*0fca6ea1SDimitry Andric      : RVInstIUnary<0b111111000010, 0b000, OPC_SYSTEM, (outs), (ins GPR:$rs1),
841*0fca6ea1SDimitry Andric                     "sf.cdiscard.d.l1", "$rs1">, Sched<[]> {
842*0fca6ea1SDimitry Andric    let rd = 0;
843*0fca6ea1SDimitry Andric  }
844*0fca6ea1SDimitry Andric  def : InstAlias<"sf.cdiscard.d.l1", (SF_CDISCARD_D_L1 X0)>;
845*0fca6ea1SDimitry Andric} // Predicates = [HasVendorXSifivecdiscarddlone]
846*0fca6ea1SDimitry Andric
847*0fca6ea1SDimitry Andriclet Predicates = [HasVendorXSiFivecflushdlone] in {
848*0fca6ea1SDimitry Andric  let hasNoSchedulingInfo = 1, hasSideEffects = 1, mayLoad = 0, mayStore = 0,
849*0fca6ea1SDimitry Andric      DecoderNamespace = "XSiFivecflushdlone" in
850*0fca6ea1SDimitry Andric  def SF_CFLUSH_D_L1
851*0fca6ea1SDimitry Andric      : RVInstIUnary<0b111111000000, 0b000, OPC_SYSTEM, (outs), (ins GPR:$rs1),
852*0fca6ea1SDimitry Andric                     "sf.cflush.d.l1", "$rs1">, Sched<[]> {
853*0fca6ea1SDimitry Andric    let rd = 0;
854*0fca6ea1SDimitry Andric  }
855*0fca6ea1SDimitry Andric  def : InstAlias<"sf.cflush.d.l1", (SF_CFLUSH_D_L1 X0)>;
856*0fca6ea1SDimitry Andric} // Predicates = [HasVendorXSifivecflushdlone]
857*0fca6ea1SDimitry Andric
858*0fca6ea1SDimitry Andriclet Predicates = [HasVendorXSfcease] in {
859*0fca6ea1SDimitry Andric  let hasNoSchedulingInfo = 1, hasSideEffects = 1, mayLoad = 0, mayStore = 0,
860*0fca6ea1SDimitry Andric      DecoderNamespace = "XSfcease" in
861*0fca6ea1SDimitry Andric  def SF_CEASE : RVInstIUnary<0b001100000101, 0b000, OPC_SYSTEM, (outs), (ins),
862*0fca6ea1SDimitry Andric                              "sf.cease", "">, Sched<[]> {
863*0fca6ea1SDimitry Andric    let rs1 = 0b00000;
864*0fca6ea1SDimitry Andric    let rd = 0b00000;
865*0fca6ea1SDimitry Andric}
866*0fca6ea1SDimitry Andric}
867