1e8d8bef9SDimitry Andric//===-- RISCVInstrInfoVPseudos.td - RISC-V 'V' Pseudos -----*- tablegen -*-===// 2e8d8bef9SDimitry Andric// 3e8d8bef9SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4e8d8bef9SDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 5e8d8bef9SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6e8d8bef9SDimitry Andric// 7e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 8e8d8bef9SDimitry Andric/// 9e8d8bef9SDimitry Andric/// This file contains the required infrastructure to support code generation 1081ad6265SDimitry Andric/// for the standard 'V' (Vector) extension, version 1.0. 11e8d8bef9SDimitry Andric/// 12e8d8bef9SDimitry Andric/// This file is included from RISCVInstrInfoV.td 13e8d8bef9SDimitry Andric/// 1406c3fb27SDimitry Andric/// Overview of our vector instruction pseudos. Many of the instructions 1506c3fb27SDimitry Andric/// have behavior which depends on the value of VTYPE. Several core aspects of 1606c3fb27SDimitry Andric/// the compiler - e.g. register allocation - depend on fields in this 1706c3fb27SDimitry Andric/// configuration register. The details of which fields matter differ by the 1806c3fb27SDimitry Andric/// specific instruction, but the common dimensions are: 1906c3fb27SDimitry Andric/// 2006c3fb27SDimitry Andric/// LMUL/EMUL - Most instructions can write to differently sized register groups 2106c3fb27SDimitry Andric/// depending on LMUL. 2206c3fb27SDimitry Andric/// 2306c3fb27SDimitry Andric/// Masked vs Unmasked - Many instructions which allow a mask disallow register 2406c3fb27SDimitry Andric/// overlap. As a result, masked vs unmasked require different register 2506c3fb27SDimitry Andric/// allocation constraints. 2606c3fb27SDimitry Andric/// 2706c3fb27SDimitry Andric/// Policy - For each of mask and tail policy, there are three options: 2806c3fb27SDimitry Andric/// * "Undisturbed" - As defined in the specification, required to preserve the 2906c3fb27SDimitry Andric/// exact bit pattern of inactive lanes. 3006c3fb27SDimitry Andric/// * "Agnostic" - As defined in the specification, required to either preserve 3106c3fb27SDimitry Andric/// the exact bit pattern of inactive lanes, or produce the bit pattern -1 for 3206c3fb27SDimitry Andric/// those lanes. Note that each lane can make this choice independently. 3306c3fb27SDimitry Andric/// Instructions which produce masks (and only those instructions) also have the 3406c3fb27SDimitry Andric/// option of producing a result as-if VL had been VLMAX. 3506c3fb27SDimitry Andric/// * "Undefined" - The bit pattern of the inactive lanes is unspecified, and 3606c3fb27SDimitry Andric/// can be changed without impacting the semantics of the program. Note that 3706c3fb27SDimitry Andric/// this concept does not exist in the specification, and requires source 3806c3fb27SDimitry Andric/// knowledge to be preserved. 3906c3fb27SDimitry Andric/// 4006c3fb27SDimitry Andric/// SEW - Some instructions have semantics which depend on SEW. This is 4106c3fb27SDimitry Andric/// relatively rare, and mostly impacts scheduling and cost estimation. 4206c3fb27SDimitry Andric/// 4306c3fb27SDimitry Andric/// We have two techniques we use to represent the impact of these fields: 4406c3fb27SDimitry Andric/// * For fields which don't impact register classes, we largely use 4506c3fb27SDimitry Andric/// dummy operands on the pseudo instructions which convey information 4606c3fb27SDimitry Andric/// about the value of VTYPE. 4706c3fb27SDimitry Andric/// * For fields which do impact register classes (and a few bits of 4806c3fb27SDimitry Andric/// legacy - see policy discussion below), we define a family of pseudo 4906c3fb27SDimitry Andric/// instructions for each actual instruction. Said differently, we encode 5006c3fb27SDimitry Andric/// each of the preceding fields which are relevant for a given instruction 5106c3fb27SDimitry Andric/// in the opcode space. 5206c3fb27SDimitry Andric/// 5306c3fb27SDimitry Andric/// Currently, the policy is represented via the following instrinsic families: 5406c3fb27SDimitry Andric/// * _MASK - Can represent all three policy states for both tail and mask. If 555f757f3fSDimitry Andric/// passthrough is IMPLICIT_DEF (or NoReg), then represents "undefined". 565f757f3fSDimitry Andric/// Otherwise, policy operand and tablegen flags drive the interpretation. 575f757f3fSDimitry Andric/// (If policy operand is not present - there are a couple, though we're 585f757f3fSDimitry Andric/// rapidly removing them - a non-undefined policy defaults to "tail 595f757f3fSDimitry Andric/// agnostic", and "mask undisturbed". Since this is the only variant with 605f757f3fSDimitry Andric/// a mask, all other variants are "mask undefined". 6106c3fb27SDimitry Andric/// * Unsuffixed w/ both passthrough and policy operand. Can represent all 625f757f3fSDimitry Andric/// three policy states. If passthrough is IMPLICIT_DEF (or NoReg), then 635f757f3fSDimitry Andric/// represents "undefined". Otherwise, policy operand and tablegen flags 645f757f3fSDimitry Andric/// drive the interpretation. 6506c3fb27SDimitry Andric/// * Unsuffixed w/o passthrough or policy operand -- Does not have a 6606c3fb27SDimitry Andric/// passthrough operand, and thus represents the "undefined" state. Note 6706c3fb27SDimitry Andric/// that terminology in code frequently refers to these as "TA" which is 6806c3fb27SDimitry Andric/// confusing. We're in the process of migrating away from this 6906c3fb27SDimitry Andric/// representation. 7006c3fb27SDimitry Andric/// 71e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 72e8d8bef9SDimitry Andric 73e8d8bef9SDimitry Andricdef riscv_vmv_x_s : SDNode<"RISCVISD::VMV_X_S", 74e8d8bef9SDimitry Andric SDTypeProfile<1, 1, [SDTCisInt<0>, SDTCisVec<1>, 75e8d8bef9SDimitry Andric SDTCisInt<1>]>>; 76e8d8bef9SDimitry Andricdef riscv_read_vlenb : SDNode<"RISCVISD::READ_VLENB", 77e8d8bef9SDimitry Andric SDTypeProfile<1, 0, [SDTCisVT<0, XLenVT>]>>; 78e8d8bef9SDimitry Andric 795f757f3fSDimitry Andric// Operand that is allowed to be a register other than X0, a 5 bit unsigned 805f757f3fSDimitry Andric// immediate, or -1. -1 means VLMAX. This allows us to pick between VSETIVLI and 815f757f3fSDimitry Andric// VSETVLI opcodes using the same pseudo instructions. 82349cc55cSDimitry Andricdef AVL : RegisterOperand<GPRNoX0> { 83fe6060f1SDimitry Andric let OperandNamespace = "RISCVOp"; 84fe6060f1SDimitry Andric let OperandType = "OPERAND_AVL"; 85fe6060f1SDimitry Andric} 86e8d8bef9SDimitry Andric 87e8d8bef9SDimitry Andric// X0 has special meaning for vsetvl/vsetvli. 88e8d8bef9SDimitry Andric// rd | rs1 | AVL value | Effect on vl 89e8d8bef9SDimitry Andric//-------------------------------------------------------------- 90e8d8bef9SDimitry Andric// !X0 | X0 | VLMAX | Set vl to VLMAX 91e8d8bef9SDimitry Andric// X0 | X0 | Value in vl | Keep current vl, just change vtype. 92d409305fSDimitry Andricdef VLOp : ComplexPattern<XLenVT, 1, "selectVLOp">; 93e8d8bef9SDimitry Andric 94e8d8bef9SDimitry Andricdef DecImm : SDNodeXForm<imm, [{ 95e8d8bef9SDimitry Andric return CurDAG->getTargetConstant(N->getSExtValue() - 1, SDLoc(N), 96e8d8bef9SDimitry Andric N->getValueType(0)); 97e8d8bef9SDimitry Andric}]>; 98e8d8bef9SDimitry Andric 99349cc55cSDimitry Andricdefvar TAIL_AGNOSTIC = 1; 10006c3fb27SDimitry Andricdefvar TU_MU = 0; 101bdd1243dSDimitry Andricdefvar TA_MA = 3; 102349cc55cSDimitry Andric 103e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 104e8d8bef9SDimitry Andric// Utilities. 105e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 106e8d8bef9SDimitry Andric 10781ad6265SDimitry Andricclass PseudoToVInst<string PseudoInst> { 10806c3fb27SDimitry Andric defvar AffixSubsts = [["Pseudo", ""], 10906c3fb27SDimitry Andric ["_E64", ""], 11006c3fb27SDimitry Andric ["_E32", ""], 11106c3fb27SDimitry Andric ["_E16", ""], 11206c3fb27SDimitry Andric ["_E8", ""], 1135f757f3fSDimitry Andric ["FPR64", "F"], 1145f757f3fSDimitry Andric ["FPR32", "F"], 1155f757f3fSDimitry Andric ["FPR16", "F"], 11606c3fb27SDimitry Andric ["_TIED", ""], 11706c3fb27SDimitry Andric ["_MASK", ""], 11806c3fb27SDimitry Andric ["_B64", ""], 11906c3fb27SDimitry Andric ["_B32", ""], 12006c3fb27SDimitry Andric ["_B16", ""], 12106c3fb27SDimitry Andric ["_B8", ""], 12206c3fb27SDimitry Andric ["_B4", ""], 12306c3fb27SDimitry Andric ["_B2", ""], 12406c3fb27SDimitry Andric ["_B1", ""], 12506c3fb27SDimitry Andric ["_MF8", ""], 12606c3fb27SDimitry Andric ["_MF4", ""], 12706c3fb27SDimitry Andric ["_MF2", ""], 12806c3fb27SDimitry Andric ["_M1", ""], 12906c3fb27SDimitry Andric ["_M2", ""], 13006c3fb27SDimitry Andric ["_M4", ""], 13106c3fb27SDimitry Andric ["_M8", ""], 1325f757f3fSDimitry Andric ["_SE", ""], 1335f757f3fSDimitry Andric ["_RM", ""] 13406c3fb27SDimitry Andric ]; 13506c3fb27SDimitry Andric string VInst = !foldl(PseudoInst, AffixSubsts, Acc, AffixSubst, 13606c3fb27SDimitry Andric !subst(AffixSubst[0], AffixSubst[1], Acc)); 13781ad6265SDimitry Andric} 13881ad6265SDimitry Andric 139e8d8bef9SDimitry Andric// This class describes information associated to the LMUL. 140fe6060f1SDimitry Andricclass LMULInfo<int lmul, int oct, VReg regclass, VReg wregclass, 141e8d8bef9SDimitry Andric VReg f2regclass, VReg f4regclass, VReg f8regclass, string mx> { 142e8d8bef9SDimitry Andric bits<3> value = lmul; // This is encoded as the vlmul field of vtype. 143e8d8bef9SDimitry Andric VReg vrclass = regclass; 144e8d8bef9SDimitry Andric VReg wvrclass = wregclass; 145e8d8bef9SDimitry Andric VReg f8vrclass = f8regclass; 146e8d8bef9SDimitry Andric VReg f4vrclass = f4regclass; 147e8d8bef9SDimitry Andric VReg f2vrclass = f2regclass; 148e8d8bef9SDimitry Andric string MX = mx; 149fe6060f1SDimitry Andric int octuple = oct; 150e8d8bef9SDimitry Andric} 151e8d8bef9SDimitry Andric 152e8d8bef9SDimitry Andric// Associate LMUL with tablegen records of register classes. 153fe6060f1SDimitry Andricdef V_M1 : LMULInfo<0b000, 8, VR, VRM2, VR, VR, VR, "M1">; 154fe6060f1SDimitry Andricdef V_M2 : LMULInfo<0b001, 16, VRM2, VRM4, VR, VR, VR, "M2">; 155fe6060f1SDimitry Andricdef V_M4 : LMULInfo<0b010, 32, VRM4, VRM8, VRM2, VR, VR, "M4">; 156fe6060f1SDimitry Andricdef V_M8 : LMULInfo<0b011, 64, VRM8,/*NoVReg*/VR, VRM4, VRM2, VR, "M8">; 157e8d8bef9SDimitry Andric 158fe6060f1SDimitry Andricdef V_MF8 : LMULInfo<0b101, 1, VR, VR,/*NoVReg*/VR,/*NoVReg*/VR,/*NoVReg*/VR, "MF8">; 159fe6060f1SDimitry Andricdef V_MF4 : LMULInfo<0b110, 2, VR, VR, VR,/*NoVReg*/VR,/*NoVReg*/VR, "MF4">; 160fe6060f1SDimitry Andricdef V_MF2 : LMULInfo<0b111, 4, VR, VR, VR, VR,/*NoVReg*/VR, "MF2">; 161e8d8bef9SDimitry Andric 162e8d8bef9SDimitry Andric// Used to iterate over all possible LMULs. 16304eeddc0SDimitry Andricdefvar MxList = [V_MF8, V_MF4, V_MF2, V_M1, V_M2, V_M4, V_M8]; 16404eeddc0SDimitry Andric// For floating point which don't need MF8. 16504eeddc0SDimitry Andricdefvar MxListF = [V_MF4, V_MF2, V_M1, V_M2, V_M4, V_M8]; 16604eeddc0SDimitry Andric 167fe6060f1SDimitry Andric// Used for widening and narrowing instructions as it doesn't contain M8. 16804eeddc0SDimitry Andricdefvar MxListW = [V_MF8, V_MF4, V_MF2, V_M1, V_M2, V_M4]; 16906c3fb27SDimitry Andric// Used for widening reductions. It can contain M8 because wider operands are 17006c3fb27SDimitry Andric// scalar operands. 17106c3fb27SDimitry Andricdefvar MxListWRed = MxList; 17204eeddc0SDimitry Andric// For floating point which don't need MF8. 17304eeddc0SDimitry Andricdefvar MxListFW = [V_MF4, V_MF2, V_M1, V_M2, V_M4]; 17406c3fb27SDimitry Andric// For widening floating-point Reduction as it doesn't contain MF8. It can 17506c3fb27SDimitry Andric// contain M8 because wider operands are scalar operands. 17606c3fb27SDimitry Andricdefvar MxListFWRed = [V_MF4, V_MF2, V_M1, V_M2, V_M4, V_M8]; 17704eeddc0SDimitry Andric 178fe6060f1SDimitry Andric// Use for zext/sext.vf2 17904eeddc0SDimitry Andricdefvar MxListVF2 = [V_MF4, V_MF2, V_M1, V_M2, V_M4, V_M8]; 18004eeddc0SDimitry Andric 1815f757f3fSDimitry Andric// Use for zext/sext.vf4 and vector crypto instructions 18204eeddc0SDimitry Andricdefvar MxListVF4 = [V_MF2, V_M1, V_M2, V_M4, V_M8]; 18304eeddc0SDimitry Andric 184fe6060f1SDimitry Andric// Use for zext/sext.vf8 18504eeddc0SDimitry Andricdefvar MxListVF8 = [V_M1, V_M2, V_M4, V_M8]; 186e8d8bef9SDimitry Andric 187e8d8bef9SDimitry Andricclass MxSet<int eew> { 188e8d8bef9SDimitry Andric list<LMULInfo> m = !cond(!eq(eew, 8) : [V_MF8, V_MF4, V_MF2, V_M1, V_M2, V_M4, V_M8], 189e8d8bef9SDimitry Andric !eq(eew, 16) : [V_MF4, V_MF2, V_M1, V_M2, V_M4, V_M8], 190e8d8bef9SDimitry Andric !eq(eew, 32) : [V_MF2, V_M1, V_M2, V_M4, V_M8], 191e8d8bef9SDimitry Andric !eq(eew, 64) : [V_M1, V_M2, V_M4, V_M8]); 192e8d8bef9SDimitry Andric} 193e8d8bef9SDimitry Andric 19406c3fb27SDimitry Andricclass FPR_Info<int sew> { 19506c3fb27SDimitry Andric RegisterClass fprclass = !cast<RegisterClass>("FPR" # sew); 1965f757f3fSDimitry Andric string FX = "FPR" # sew; 19706c3fb27SDimitry Andric int SEW = sew; 19806c3fb27SDimitry Andric list<LMULInfo> MxList = MxSet<sew>.m; 19906c3fb27SDimitry Andric list<LMULInfo> MxListFW = !if(!eq(sew, 64), [], !listremove(MxList, [V_M8])); 20004eeddc0SDimitry Andric} 20104eeddc0SDimitry Andric 20206c3fb27SDimitry Andricdef SCALAR_F16 : FPR_Info<16>; 20306c3fb27SDimitry Andricdef SCALAR_F32 : FPR_Info<32>; 20406c3fb27SDimitry Andricdef SCALAR_F64 : FPR_Info<64>; 20504eeddc0SDimitry Andric 2065f757f3fSDimitry Andric// BF16 uses the same register class as F16. 2075f757f3fSDimitry Andricdef SCALAR_BF16 : FPR_Info<16>; 2085f757f3fSDimitry Andric 20904eeddc0SDimitry Andricdefvar FPList = [SCALAR_F16, SCALAR_F32, SCALAR_F64]; 21004eeddc0SDimitry Andric 21104eeddc0SDimitry Andric// Used for widening instructions. It excludes F64. 21204eeddc0SDimitry Andricdefvar FPListW = [SCALAR_F16, SCALAR_F32]; 21304eeddc0SDimitry Andric 2145f757f3fSDimitry Andric// Used for widening bf16 instructions. 2155f757f3fSDimitry Andricdefvar BFPListW = [SCALAR_BF16]; 2165f757f3fSDimitry Andric 217e8d8bef9SDimitry Andricclass NFSet<LMULInfo m> { 2185f757f3fSDimitry Andric defvar lmul = !shl(1, m.value); 2195f757f3fSDimitry Andric list<int> L = NFList<lmul>.L; 220e8d8bef9SDimitry Andric} 221e8d8bef9SDimitry Andric 222e8d8bef9SDimitry Andricclass octuple_to_str<int octuple> { 22306c3fb27SDimitry Andric string ret = !cond(!eq(octuple, 1): "MF8", 22406c3fb27SDimitry Andric !eq(octuple, 2): "MF4", 22506c3fb27SDimitry Andric !eq(octuple, 4): "MF2", 22606c3fb27SDimitry Andric !eq(octuple, 8): "M1", 22706c3fb27SDimitry Andric !eq(octuple, 16): "M2", 22806c3fb27SDimitry Andric !eq(octuple, 32): "M4", 22906c3fb27SDimitry Andric !eq(octuple, 64): "M8"); 230e8d8bef9SDimitry Andric} 231e8d8bef9SDimitry Andric 232fe6060f1SDimitry Andricdef VLOpFrag : PatFrag<(ops), (XLenVT (VLOp (XLenVT AVL:$vl)))>; 233fe6060f1SDimitry Andric 234e8d8bef9SDimitry Andric// Output pattern for X0 used to represent VLMAX in the pseudo instructions. 235349cc55cSDimitry Andric// We can't use X0 register becuase the AVL operands use GPRNoX0. 236349cc55cSDimitry Andric// This must be kept in sync with RISCV::VLMaxSentinel. 237349cc55cSDimitry Andricdef VLMax : OutPatFrag<(ops), (XLenVT -1)>; 238e8d8bef9SDimitry Andric 2395f757f3fSDimitry Andricdef SelectFPImm : ComplexPattern<fAny, 1, "selectFPImm", [], [], 1>; 2405f757f3fSDimitry Andric 241e8d8bef9SDimitry Andric// List of EEW. 242e8d8bef9SDimitry Andricdefvar EEWList = [8, 16, 32, 64]; 243e8d8bef9SDimitry Andric 244e8d8bef9SDimitry Andricclass SegRegClass<LMULInfo m, int nf> { 245e8d8bef9SDimitry Andric VReg RC = !cast<VReg>("VRN" # nf # !cond(!eq(m.value, V_MF8.value): V_M1.MX, 246e8d8bef9SDimitry Andric !eq(m.value, V_MF4.value): V_M1.MX, 247e8d8bef9SDimitry Andric !eq(m.value, V_MF2.value): V_M1.MX, 248e8d8bef9SDimitry Andric true: m.MX)); 249e8d8bef9SDimitry Andric} 250e8d8bef9SDimitry Andric 251e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 252e8d8bef9SDimitry Andric// Vector register and vector group type information. 253e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 254e8d8bef9SDimitry Andric 255647cbc5dSDimitry Andricclass VTypeInfo<ValueType Vec, ValueType Mas, int Sew, LMULInfo M, 25606c3fb27SDimitry Andric ValueType Scal = XLenVT, RegisterClass ScalarReg = GPR> { 257e8d8bef9SDimitry Andric ValueType Vector = Vec; 258e8d8bef9SDimitry Andric ValueType Mask = Mas; 259e8d8bef9SDimitry Andric int SEW = Sew; 26006c3fb27SDimitry Andric int Log2SEW = !logtwo(Sew); 261647cbc5dSDimitry Andric VReg RegClass = M.vrclass; 262e8d8bef9SDimitry Andric LMULInfo LMul = M; 263e8d8bef9SDimitry Andric ValueType Scalar = Scal; 264e8d8bef9SDimitry Andric RegisterClass ScalarRegClass = ScalarReg; 265e8d8bef9SDimitry Andric // The pattern fragment which produces the AVL operand, representing the 266e8d8bef9SDimitry Andric // "natural" vector length for this type. For scalable vectors this is VLMax. 267e8d8bef9SDimitry Andric OutPatFrag AVL = VLMax; 268e8d8bef9SDimitry Andric 269e8d8bef9SDimitry Andric string ScalarSuffix = !cond(!eq(Scal, XLenVT) : "X", 2705f757f3fSDimitry Andric !eq(Scal, f16) : "FPR16", 2715f757f3fSDimitry Andric !eq(Scal, bf16) : "FPR16", 2725f757f3fSDimitry Andric !eq(Scal, f32) : "FPR32", 2735f757f3fSDimitry Andric !eq(Scal, f64) : "FPR64"); 274e8d8bef9SDimitry Andric} 275e8d8bef9SDimitry Andric 276e8d8bef9SDimitry Andricclass GroupVTypeInfo<ValueType Vec, ValueType VecM1, ValueType Mas, int Sew, 277647cbc5dSDimitry Andric LMULInfo M, ValueType Scal = XLenVT, 278e8d8bef9SDimitry Andric RegisterClass ScalarReg = GPR> 279647cbc5dSDimitry Andric : VTypeInfo<Vec, Mas, Sew, M, Scal, ScalarReg> { 280e8d8bef9SDimitry Andric ValueType VectorM1 = VecM1; 281e8d8bef9SDimitry Andric} 282e8d8bef9SDimitry Andric 283e8d8bef9SDimitry Andricdefset list<VTypeInfo> AllVectors = { 284e8d8bef9SDimitry Andric defset list<VTypeInfo> AllIntegerVectors = { 285e8d8bef9SDimitry Andric defset list<VTypeInfo> NoGroupIntegerVectors = { 286fe6060f1SDimitry Andric defset list<VTypeInfo> FractionalGroupIntegerVectors = { 287647cbc5dSDimitry Andric def VI8MF8: VTypeInfo<vint8mf8_t, vbool64_t, 8, V_MF8>; 288647cbc5dSDimitry Andric def VI8MF4: VTypeInfo<vint8mf4_t, vbool32_t, 8, V_MF4>; 289647cbc5dSDimitry Andric def VI8MF2: VTypeInfo<vint8mf2_t, vbool16_t, 8, V_MF2>; 290647cbc5dSDimitry Andric def VI16MF4: VTypeInfo<vint16mf4_t, vbool64_t, 16, V_MF4>; 291647cbc5dSDimitry Andric def VI16MF2: VTypeInfo<vint16mf2_t, vbool32_t, 16, V_MF2>; 292647cbc5dSDimitry Andric def VI32MF2: VTypeInfo<vint32mf2_t, vbool64_t, 32, V_MF2>; 293fe6060f1SDimitry Andric } 294647cbc5dSDimitry Andric def VI8M1: VTypeInfo<vint8m1_t, vbool8_t, 8, V_M1>; 295647cbc5dSDimitry Andric def VI16M1: VTypeInfo<vint16m1_t, vbool16_t, 16, V_M1>; 296647cbc5dSDimitry Andric def VI32M1: VTypeInfo<vint32m1_t, vbool32_t, 32, V_M1>; 297647cbc5dSDimitry Andric def VI64M1: VTypeInfo<vint64m1_t, vbool64_t, 64, V_M1>; 298e8d8bef9SDimitry Andric } 299e8d8bef9SDimitry Andric defset list<GroupVTypeInfo> GroupIntegerVectors = { 300647cbc5dSDimitry Andric def VI8M2: GroupVTypeInfo<vint8m2_t, vint8m1_t, vbool4_t, 8, V_M2>; 301647cbc5dSDimitry Andric def VI8M4: GroupVTypeInfo<vint8m4_t, vint8m1_t, vbool2_t, 8, V_M4>; 302647cbc5dSDimitry Andric def VI8M8: GroupVTypeInfo<vint8m8_t, vint8m1_t, vbool1_t, 8, V_M8>; 303e8d8bef9SDimitry Andric 304647cbc5dSDimitry Andric def VI16M2: GroupVTypeInfo<vint16m2_t, vint16m1_t, vbool8_t, 16, V_M2>; 305647cbc5dSDimitry Andric def VI16M4: GroupVTypeInfo<vint16m4_t, vint16m1_t, vbool4_t, 16, V_M4>; 306647cbc5dSDimitry Andric def VI16M8: GroupVTypeInfo<vint16m8_t, vint16m1_t, vbool2_t, 16, V_M8>; 307e8d8bef9SDimitry Andric 308647cbc5dSDimitry Andric def VI32M2: GroupVTypeInfo<vint32m2_t, vint32m1_t, vbool16_t, 32, V_M2>; 309647cbc5dSDimitry Andric def VI32M4: GroupVTypeInfo<vint32m4_t, vint32m1_t, vbool8_t, 32, V_M4>; 310647cbc5dSDimitry Andric def VI32M8: GroupVTypeInfo<vint32m8_t, vint32m1_t, vbool4_t, 32, V_M8>; 311e8d8bef9SDimitry Andric 312647cbc5dSDimitry Andric def VI64M2: GroupVTypeInfo<vint64m2_t, vint64m1_t, vbool32_t, 64, V_M2>; 313647cbc5dSDimitry Andric def VI64M4: GroupVTypeInfo<vint64m4_t, vint64m1_t, vbool16_t, 64, V_M4>; 314647cbc5dSDimitry Andric def VI64M8: GroupVTypeInfo<vint64m8_t, vint64m1_t, vbool8_t, 64, V_M8>; 315e8d8bef9SDimitry Andric } 316e8d8bef9SDimitry Andric } 317e8d8bef9SDimitry Andric 318e8d8bef9SDimitry Andric defset list<VTypeInfo> AllFloatVectors = { 319e8d8bef9SDimitry Andric defset list<VTypeInfo> NoGroupFloatVectors = { 320fe6060f1SDimitry Andric defset list<VTypeInfo> FractionalGroupFloatVectors = { 321647cbc5dSDimitry Andric def VF16MF4: VTypeInfo<vfloat16mf4_t, vbool64_t, 16, V_MF4, f16, FPR16>; 322647cbc5dSDimitry Andric def VF16MF2: VTypeInfo<vfloat16mf2_t, vbool32_t, 16, V_MF2, f16, FPR16>; 323647cbc5dSDimitry Andric def VF32MF2: VTypeInfo<vfloat32mf2_t, vbool64_t, 32, V_MF2, f32, FPR32>; 324fe6060f1SDimitry Andric } 325647cbc5dSDimitry Andric def VF16M1: VTypeInfo<vfloat16m1_t, vbool16_t, 16, V_M1, f16, FPR16>; 326647cbc5dSDimitry Andric def VF32M1: VTypeInfo<vfloat32m1_t, vbool32_t, 32, V_M1, f32, FPR32>; 327647cbc5dSDimitry Andric def VF64M1: VTypeInfo<vfloat64m1_t, vbool64_t, 64, V_M1, f64, FPR64>; 328e8d8bef9SDimitry Andric } 329e8d8bef9SDimitry Andric 330e8d8bef9SDimitry Andric defset list<GroupVTypeInfo> GroupFloatVectors = { 331e8d8bef9SDimitry Andric def VF16M2: GroupVTypeInfo<vfloat16m2_t, vfloat16m1_t, vbool8_t, 16, 332647cbc5dSDimitry Andric V_M2, f16, FPR16>; 333e8d8bef9SDimitry Andric def VF16M4: GroupVTypeInfo<vfloat16m4_t, vfloat16m1_t, vbool4_t, 16, 334647cbc5dSDimitry Andric V_M4, f16, FPR16>; 335e8d8bef9SDimitry Andric def VF16M8: GroupVTypeInfo<vfloat16m8_t, vfloat16m1_t, vbool2_t, 16, 336647cbc5dSDimitry Andric V_M8, f16, FPR16>; 337e8d8bef9SDimitry Andric 338e8d8bef9SDimitry Andric def VF32M2: GroupVTypeInfo<vfloat32m2_t, vfloat32m1_t, vbool16_t, 32, 339647cbc5dSDimitry Andric V_M2, f32, FPR32>; 340e8d8bef9SDimitry Andric def VF32M4: GroupVTypeInfo<vfloat32m4_t, vfloat32m1_t, vbool8_t, 32, 341647cbc5dSDimitry Andric V_M4, f32, FPR32>; 342e8d8bef9SDimitry Andric def VF32M8: GroupVTypeInfo<vfloat32m8_t, vfloat32m1_t, vbool4_t, 32, 343647cbc5dSDimitry Andric V_M8, f32, FPR32>; 344e8d8bef9SDimitry Andric 345e8d8bef9SDimitry Andric def VF64M2: GroupVTypeInfo<vfloat64m2_t, vfloat64m1_t, vbool32_t, 64, 346647cbc5dSDimitry Andric V_M2, f64, FPR64>; 347e8d8bef9SDimitry Andric def VF64M4: GroupVTypeInfo<vfloat64m4_t, vfloat64m1_t, vbool16_t, 64, 348647cbc5dSDimitry Andric V_M4, f64, FPR64>; 349e8d8bef9SDimitry Andric def VF64M8: GroupVTypeInfo<vfloat64m8_t, vfloat64m1_t, vbool8_t, 64, 350647cbc5dSDimitry Andric V_M8, f64, FPR64>; 351e8d8bef9SDimitry Andric } 352e8d8bef9SDimitry Andric } 353e8d8bef9SDimitry Andric 3545f757f3fSDimitry Andric defset list<VTypeInfo> AllBFloatVectors = { 3555f757f3fSDimitry Andric defset list<VTypeInfo> NoGroupBFloatVectors = { 3565f757f3fSDimitry Andric defset list<VTypeInfo> FractionalGroupBFloatVectors = { 357647cbc5dSDimitry Andric def VBF16MF4: VTypeInfo<vbfloat16mf4_t, vbool64_t, 16, V_MF4, bf16, FPR16>; 358647cbc5dSDimitry Andric def VBF16MF2: VTypeInfo<vbfloat16mf2_t, vbool32_t, 16, V_MF2, bf16, FPR16>; 3595f757f3fSDimitry Andric } 360647cbc5dSDimitry Andric def VBF16M1: VTypeInfo<vbfloat16m1_t, vbool16_t, 16, V_M1, bf16, FPR16>; 3615f757f3fSDimitry Andric } 3625f757f3fSDimitry Andric 3635f757f3fSDimitry Andric defset list<GroupVTypeInfo> GroupBFloatVectors = { 3645f757f3fSDimitry Andric def VBF16M2: GroupVTypeInfo<vbfloat16m2_t, vbfloat16m1_t, vbool8_t, 16, 365647cbc5dSDimitry Andric V_M2, bf16, FPR16>; 3665f757f3fSDimitry Andric def VBF16M4: GroupVTypeInfo<vbfloat16m4_t, vbfloat16m1_t, vbool4_t, 16, 367647cbc5dSDimitry Andric V_M4, bf16, FPR16>; 3685f757f3fSDimitry Andric def VBF16M8: GroupVTypeInfo<vbfloat16m8_t, vbfloat16m1_t, vbool2_t, 16, 369647cbc5dSDimitry Andric V_M8, bf16, FPR16>; 3705f757f3fSDimitry Andric } 3715f757f3fSDimitry Andric } 372*0fca6ea1SDimitry Andric} 3735f757f3fSDimitry Andric 374e8d8bef9SDimitry Andric// This functor is used to obtain the int vector type that has the same SEW and 375e8d8bef9SDimitry Andric// multiplier as the input parameter type 37606c3fb27SDimitry Andricclass GetIntVTypeInfo<VTypeInfo vti> { 377e8d8bef9SDimitry Andric // Equivalent integer vector type. Eg. 378e8d8bef9SDimitry Andric // VI8M1 → VI8M1 (identity) 379e8d8bef9SDimitry Andric // VF64M4 → VI64M4 380*0fca6ea1SDimitry Andric VTypeInfo Vti = !cast<VTypeInfo>(!subst("VBF", "VI", 381*0fca6ea1SDimitry Andric !subst("VF", "VI", 382*0fca6ea1SDimitry Andric !cast<string>(vti)))); 383e8d8bef9SDimitry Andric} 384e8d8bef9SDimitry Andric 385e8d8bef9SDimitry Andricclass MTypeInfo<ValueType Mas, LMULInfo M, string Bx> { 386e8d8bef9SDimitry Andric ValueType Mask = Mas; 387e8d8bef9SDimitry Andric // {SEW, VLMul} values set a valid VType to deal with this mask type. 388fe6060f1SDimitry Andric // we assume SEW=1 and set corresponding LMUL. vsetvli insertion will 389fe6060f1SDimitry Andric // look for SEW=1 to optimize based on surrounding instructions. 390fe6060f1SDimitry Andric int SEW = 1; 391fe6060f1SDimitry Andric int Log2SEW = 0; 392e8d8bef9SDimitry Andric LMULInfo LMul = M; 393e8d8bef9SDimitry Andric string BX = Bx; // Appendix of mask operations. 394e8d8bef9SDimitry Andric // The pattern fragment which produces the AVL operand, representing the 395e8d8bef9SDimitry Andric // "natural" vector length for this mask type. For scalable masks this is 396e8d8bef9SDimitry Andric // VLMax. 397e8d8bef9SDimitry Andric OutPatFrag AVL = VLMax; 398e8d8bef9SDimitry Andric} 399e8d8bef9SDimitry Andric 400e8d8bef9SDimitry Andricdefset list<MTypeInfo> AllMasks = { 401e8d8bef9SDimitry Andric // vbool<n>_t, <n> = SEW/LMUL, we assume SEW=8 and corresponding LMUL. 402e8d8bef9SDimitry Andric def : MTypeInfo<vbool64_t, V_MF8, "B1">; 403e8d8bef9SDimitry Andric def : MTypeInfo<vbool32_t, V_MF4, "B2">; 404e8d8bef9SDimitry Andric def : MTypeInfo<vbool16_t, V_MF2, "B4">; 405e8d8bef9SDimitry Andric def : MTypeInfo<vbool8_t, V_M1, "B8">; 406e8d8bef9SDimitry Andric def : MTypeInfo<vbool4_t, V_M2, "B16">; 407e8d8bef9SDimitry Andric def : MTypeInfo<vbool2_t, V_M4, "B32">; 408e8d8bef9SDimitry Andric def : MTypeInfo<vbool1_t, V_M8, "B64">; 409e8d8bef9SDimitry Andric} 410e8d8bef9SDimitry Andric 41106c3fb27SDimitry Andricclass VTypeInfoToWide<VTypeInfo vti, VTypeInfo wti> { 412e8d8bef9SDimitry Andric VTypeInfo Vti = vti; 413e8d8bef9SDimitry Andric VTypeInfo Wti = wti; 414e8d8bef9SDimitry Andric} 415e8d8bef9SDimitry Andric 41606c3fb27SDimitry Andricclass VTypeInfoToFraction<VTypeInfo vti, VTypeInfo fti> { 417e8d8bef9SDimitry Andric VTypeInfo Vti = vti; 418e8d8bef9SDimitry Andric VTypeInfo Fti = fti; 419e8d8bef9SDimitry Andric} 420e8d8bef9SDimitry Andric 421e8d8bef9SDimitry Andricdefset list<VTypeInfoToWide> AllWidenableIntVectors = { 422e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI8MF8, VI16MF4>; 423e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI8MF4, VI16MF2>; 424e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI8MF2, VI16M1>; 425e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI8M1, VI16M2>; 426e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI8M2, VI16M4>; 427e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI8M4, VI16M8>; 428e8d8bef9SDimitry Andric 429e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI16MF4, VI32MF2>; 430e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI16MF2, VI32M1>; 431e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI16M1, VI32M2>; 432e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI16M2, VI32M4>; 433e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI16M4, VI32M8>; 434e8d8bef9SDimitry Andric 435e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI32MF2, VI64M1>; 436e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI32M1, VI64M2>; 437e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI32M2, VI64M4>; 438e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI32M4, VI64M8>; 439e8d8bef9SDimitry Andric} 440e8d8bef9SDimitry Andric 441e8d8bef9SDimitry Andricdefset list<VTypeInfoToWide> AllWidenableFloatVectors = { 442e8d8bef9SDimitry Andric def : VTypeInfoToWide<VF16MF4, VF32MF2>; 443e8d8bef9SDimitry Andric def : VTypeInfoToWide<VF16MF2, VF32M1>; 444e8d8bef9SDimitry Andric def : VTypeInfoToWide<VF16M1, VF32M2>; 445e8d8bef9SDimitry Andric def : VTypeInfoToWide<VF16M2, VF32M4>; 446e8d8bef9SDimitry Andric def : VTypeInfoToWide<VF16M4, VF32M8>; 447e8d8bef9SDimitry Andric 448e8d8bef9SDimitry Andric def : VTypeInfoToWide<VF32MF2, VF64M1>; 449e8d8bef9SDimitry Andric def : VTypeInfoToWide<VF32M1, VF64M2>; 450e8d8bef9SDimitry Andric def : VTypeInfoToWide<VF32M2, VF64M4>; 451e8d8bef9SDimitry Andric def : VTypeInfoToWide<VF32M4, VF64M8>; 452e8d8bef9SDimitry Andric} 453e8d8bef9SDimitry Andric 454e8d8bef9SDimitry Andricdefset list<VTypeInfoToFraction> AllFractionableVF2IntVectors = { 455e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI16MF4, VI8MF8>; 456e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI16MF2, VI8MF4>; 457e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI16M1, VI8MF2>; 458e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI16M2, VI8M1>; 459e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI16M4, VI8M2>; 460e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI16M8, VI8M4>; 461e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI32MF2, VI16MF4>; 462e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI32M1, VI16MF2>; 463e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI32M2, VI16M1>; 464e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI32M4, VI16M2>; 465e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI32M8, VI16M4>; 466e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI64M1, VI32MF2>; 467e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI64M2, VI32M1>; 468e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI64M4, VI32M2>; 469e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI64M8, VI32M4>; 470e8d8bef9SDimitry Andric} 471e8d8bef9SDimitry Andric 472e8d8bef9SDimitry Andricdefset list<VTypeInfoToFraction> AllFractionableVF4IntVectors = { 473e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI32MF2, VI8MF8>; 474e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI32M1, VI8MF4>; 475e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI32M2, VI8MF2>; 476e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI32M4, VI8M1>; 477e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI32M8, VI8M2>; 478e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI64M1, VI16MF4>; 479e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI64M2, VI16MF2>; 480e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI64M4, VI16M1>; 481e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI64M8, VI16M2>; 482e8d8bef9SDimitry Andric} 483e8d8bef9SDimitry Andric 484e8d8bef9SDimitry Andricdefset list<VTypeInfoToFraction> AllFractionableVF8IntVectors = { 485e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI64M1, VI8MF8>; 486e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI64M2, VI8MF4>; 487e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI64M4, VI8MF2>; 488e8d8bef9SDimitry Andric def : VTypeInfoToFraction<VI64M8, VI8M1>; 489e8d8bef9SDimitry Andric} 490e8d8bef9SDimitry Andric 491e8d8bef9SDimitry Andricdefset list<VTypeInfoToWide> AllWidenableIntToFloatVectors = { 492e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI8MF8, VF16MF4>; 493e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI8MF4, VF16MF2>; 494e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI8MF2, VF16M1>; 495e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI8M1, VF16M2>; 496e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI8M2, VF16M4>; 497e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI8M4, VF16M8>; 498e8d8bef9SDimitry Andric 499e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI16MF4, VF32MF2>; 500e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI16MF2, VF32M1>; 501e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI16M1, VF32M2>; 502e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI16M2, VF32M4>; 503e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI16M4, VF32M8>; 504e8d8bef9SDimitry Andric 505e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI32MF2, VF64M1>; 506e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI32M1, VF64M2>; 507e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI32M2, VF64M4>; 508e8d8bef9SDimitry Andric def : VTypeInfoToWide<VI32M4, VF64M8>; 509e8d8bef9SDimitry Andric} 510e8d8bef9SDimitry Andric 5115f757f3fSDimitry Andricdefset list<VTypeInfoToWide> AllWidenableBFloatToFloatVectors = { 5125f757f3fSDimitry Andric def : VTypeInfoToWide<VBF16MF4, VF32MF2>; 5135f757f3fSDimitry Andric def : VTypeInfoToWide<VBF16MF2, VF32M1>; 5145f757f3fSDimitry Andric def : VTypeInfoToWide<VBF16M1, VF32M2>; 5155f757f3fSDimitry Andric def : VTypeInfoToWide<VBF16M2, VF32M4>; 5165f757f3fSDimitry Andric def : VTypeInfoToWide<VBF16M4, VF32M8>; 5175f757f3fSDimitry Andric} 5185f757f3fSDimitry Andric 519e8d8bef9SDimitry Andric// This class holds the record of the RISCVVPseudoTable below. 520e8d8bef9SDimitry Andric// This represents the information we need in codegen for each pseudo. 521e8d8bef9SDimitry Andric// The definition should be consistent with `struct PseudoInfo` in 52206c3fb27SDimitry Andric// RISCVInstrInfo.h. 523e8d8bef9SDimitry Andricclass RISCVVPseudo { 524e8d8bef9SDimitry Andric Pseudo Pseudo = !cast<Pseudo>(NAME); // Used as a key. 52581ad6265SDimitry Andric Instruction BaseInstr = !cast<Instruction>(PseudoToVInst<NAME>.VInst); 52606c3fb27SDimitry Andric // SEW = 0 is used to denote that the Pseudo is not SEW specific (or unknown). 52706c3fb27SDimitry Andric bits<8> SEW = 0; 5285f757f3fSDimitry Andric bit NeedBeInPseudoTable = 1; 529e8d8bef9SDimitry Andric} 530e8d8bef9SDimitry Andric 531e8d8bef9SDimitry Andric// The actual table. 532e8d8bef9SDimitry Andricdef RISCVVPseudosTable : GenericTable { 533e8d8bef9SDimitry Andric let FilterClass = "RISCVVPseudo"; 5345f757f3fSDimitry Andric let FilterClassField = "NeedBeInPseudoTable"; 535e8d8bef9SDimitry Andric let CppTypeName = "PseudoInfo"; 536e8d8bef9SDimitry Andric let Fields = [ "Pseudo", "BaseInstr" ]; 537e8d8bef9SDimitry Andric let PrimaryKey = [ "Pseudo" ]; 538e8d8bef9SDimitry Andric let PrimaryKeyName = "getPseudoInfo"; 539fe6060f1SDimitry Andric let PrimaryKeyEarlyOut = true; 540e8d8bef9SDimitry Andric} 541e8d8bef9SDimitry Andric 542bdd1243dSDimitry Andricdef RISCVVInversePseudosTable : GenericTable { 543bdd1243dSDimitry Andric let FilterClass = "RISCVVPseudo"; 544bdd1243dSDimitry Andric let CppTypeName = "PseudoInfo"; 54506c3fb27SDimitry Andric let Fields = [ "Pseudo", "BaseInstr", "VLMul", "SEW"]; 54606c3fb27SDimitry Andric let PrimaryKey = [ "BaseInstr", "VLMul", "SEW"]; 547bdd1243dSDimitry Andric let PrimaryKeyName = "getBaseInfo"; 548bdd1243dSDimitry Andric let PrimaryKeyEarlyOut = true; 549bdd1243dSDimitry Andric} 550bdd1243dSDimitry Andric 551e8d8bef9SDimitry Andricdef RISCVVIntrinsicsTable : GenericTable { 552e8d8bef9SDimitry Andric let FilterClass = "RISCVVIntrinsic"; 553e8d8bef9SDimitry Andric let CppTypeName = "RISCVVIntrinsicInfo"; 55481ad6265SDimitry Andric let Fields = ["IntrinsicID", "ScalarOperand", "VLOperand"]; 555e8d8bef9SDimitry Andric let PrimaryKey = ["IntrinsicID"]; 556e8d8bef9SDimitry Andric let PrimaryKeyName = "getRISCVVIntrinsicInfo"; 557e8d8bef9SDimitry Andric} 558e8d8bef9SDimitry Andric 55906c3fb27SDimitry Andric// Describes the relation of a masked pseudo to the unmasked variants. 56006c3fb27SDimitry Andric// Note that all masked variants (in this table) have exactly one 56106c3fb27SDimitry Andric// unmasked variant. For all but compares, both the masked and 56206c3fb27SDimitry Andric// unmasked variant have a passthru and policy operand. For compares, 56306c3fb27SDimitry Andric// neither has a policy op, and only the masked version has a passthru. 564*0fca6ea1SDimitry Andricclass RISCVMaskedPseudo<bits<4> MaskIdx, bit ActiveAffectsRes=false> { 56581ad6265SDimitry Andric Pseudo MaskedPseudo = !cast<Pseudo>(NAME); 56681ad6265SDimitry Andric Pseudo UnmaskedPseudo = !cast<Pseudo>(!subst("_MASK", "", NAME)); 56781ad6265SDimitry Andric bits<4> MaskOpIdx = MaskIdx; 568*0fca6ea1SDimitry Andric bit ActiveElementsAffectResult = ActiveAffectsRes; 56981ad6265SDimitry Andric} 57081ad6265SDimitry Andric 57181ad6265SDimitry Andricdef RISCVMaskedPseudosTable : GenericTable { 57281ad6265SDimitry Andric let FilterClass = "RISCVMaskedPseudo"; 57381ad6265SDimitry Andric let CppTypeName = "RISCVMaskedPseudoInfo"; 574*0fca6ea1SDimitry Andric let Fields = ["MaskedPseudo", "UnmaskedPseudo", "MaskOpIdx", "ActiveElementsAffectResult"]; 57581ad6265SDimitry Andric let PrimaryKey = ["MaskedPseudo"]; 57681ad6265SDimitry Andric let PrimaryKeyName = "getMaskedPseudoInfo"; 57781ad6265SDimitry Andric} 57881ad6265SDimitry Andric 57906c3fb27SDimitry Andricclass RISCVVLE<bit M, bit Str, bit F, bits<3> S, bits<3> L> { 580fe6060f1SDimitry Andric bits<1> Masked = M; 581fe6060f1SDimitry Andric bits<1> Strided = Str; 582fe6060f1SDimitry Andric bits<1> FF = F; 583fe6060f1SDimitry Andric bits<3> Log2SEW = S; 584fe6060f1SDimitry Andric bits<3> LMUL = L; 585fe6060f1SDimitry Andric Pseudo Pseudo = !cast<Pseudo>(NAME); 586fe6060f1SDimitry Andric} 587fe6060f1SDimitry Andric 58806c3fb27SDimitry Andricdef lookupMaskedIntrinsicByUnmasked : SearchIndex { 589bdd1243dSDimitry Andric let Table = RISCVMaskedPseudosTable; 590bdd1243dSDimitry Andric let Key = ["UnmaskedPseudo"]; 591bdd1243dSDimitry Andric} 592bdd1243dSDimitry Andric 593fe6060f1SDimitry Andricdef RISCVVLETable : GenericTable { 594fe6060f1SDimitry Andric let FilterClass = "RISCVVLE"; 595fe6060f1SDimitry Andric let CppTypeName = "VLEPseudo"; 59606c3fb27SDimitry Andric let Fields = ["Masked", "Strided", "FF", "Log2SEW", "LMUL", "Pseudo"]; 59706c3fb27SDimitry Andric let PrimaryKey = ["Masked", "Strided", "FF", "Log2SEW", "LMUL"]; 598fe6060f1SDimitry Andric let PrimaryKeyName = "getVLEPseudo"; 599fe6060f1SDimitry Andric} 600fe6060f1SDimitry Andric 601fe6060f1SDimitry Andricclass RISCVVSE<bit M, bit Str, bits<3> S, bits<3> L> { 602fe6060f1SDimitry Andric bits<1> Masked = M; 603fe6060f1SDimitry Andric bits<1> Strided = Str; 604fe6060f1SDimitry Andric bits<3> Log2SEW = S; 605fe6060f1SDimitry Andric bits<3> LMUL = L; 606fe6060f1SDimitry Andric Pseudo Pseudo = !cast<Pseudo>(NAME); 607fe6060f1SDimitry Andric} 608fe6060f1SDimitry Andric 609fe6060f1SDimitry Andricdef RISCVVSETable : GenericTable { 610fe6060f1SDimitry Andric let FilterClass = "RISCVVSE"; 611fe6060f1SDimitry Andric let CppTypeName = "VSEPseudo"; 612fe6060f1SDimitry Andric let Fields = ["Masked", "Strided", "Log2SEW", "LMUL", "Pseudo"]; 613fe6060f1SDimitry Andric let PrimaryKey = ["Masked", "Strided", "Log2SEW", "LMUL"]; 614fe6060f1SDimitry Andric let PrimaryKeyName = "getVSEPseudo"; 615fe6060f1SDimitry Andric} 616fe6060f1SDimitry Andric 61706c3fb27SDimitry Andricclass RISCVVLX_VSX<bit M, bit O, bits<3> S, bits<3> L, bits<3> IL> { 618fe6060f1SDimitry Andric bits<1> Masked = M; 619fe6060f1SDimitry Andric bits<1> Ordered = O; 620fe6060f1SDimitry Andric bits<3> Log2SEW = S; 621e8d8bef9SDimitry Andric bits<3> LMUL = L; 622e8d8bef9SDimitry Andric bits<3> IndexLMUL = IL; 623e8d8bef9SDimitry Andric Pseudo Pseudo = !cast<Pseudo>(NAME); 624e8d8bef9SDimitry Andric} 625e8d8bef9SDimitry Andric 62606c3fb27SDimitry Andricclass RISCVVLX<bit M, bit O, bits<3> S, bits<3> L, bits<3> IL> : 62706c3fb27SDimitry Andric RISCVVLX_VSX<M, O, S, L, IL>; 628fe6060f1SDimitry Andricclass RISCVVSX<bit M, bit O, bits<3> S, bits<3> L, bits<3> IL> : 62906c3fb27SDimitry Andric RISCVVLX_VSX<M, O, S, L, IL>; 630fe6060f1SDimitry Andric 631fe6060f1SDimitry Andricclass RISCVVLX_VSXTable : GenericTable { 632fe6060f1SDimitry Andric let CppTypeName = "VLX_VSXPseudo"; 63306c3fb27SDimitry Andric let Fields = ["Masked", "Ordered", "Log2SEW", "LMUL", "IndexLMUL", "Pseudo"]; 63406c3fb27SDimitry Andric let PrimaryKey = ["Masked", "Ordered", "Log2SEW", "LMUL", "IndexLMUL"]; 635fe6060f1SDimitry Andric} 636fe6060f1SDimitry Andric 637fe6060f1SDimitry Andricdef RISCVVLXTable : RISCVVLX_VSXTable { 638fe6060f1SDimitry Andric let FilterClass = "RISCVVLX"; 639fe6060f1SDimitry Andric let PrimaryKeyName = "getVLXPseudo"; 640fe6060f1SDimitry Andric} 641fe6060f1SDimitry Andric 642fe6060f1SDimitry Andricdef RISCVVSXTable : RISCVVLX_VSXTable { 643fe6060f1SDimitry Andric let FilterClass = "RISCVVSX"; 644fe6060f1SDimitry Andric let PrimaryKeyName = "getVSXPseudo"; 645fe6060f1SDimitry Andric} 646fe6060f1SDimitry Andric 64706c3fb27SDimitry Andricclass RISCVVLSEG<bits<4> N, bit M, bit Str, bit F, bits<3> S, bits<3> L> { 648fe6060f1SDimitry Andric bits<4> NF = N; 649fe6060f1SDimitry Andric bits<1> Masked = M; 650fe6060f1SDimitry Andric bits<1> Strided = Str; 651fe6060f1SDimitry Andric bits<1> FF = F; 652fe6060f1SDimitry Andric bits<3> Log2SEW = S; 653fe6060f1SDimitry Andric bits<3> LMUL = L; 654fe6060f1SDimitry Andric Pseudo Pseudo = !cast<Pseudo>(NAME); 655fe6060f1SDimitry Andric} 656fe6060f1SDimitry Andric 657fe6060f1SDimitry Andricdef RISCVVLSEGTable : GenericTable { 658fe6060f1SDimitry Andric let FilterClass = "RISCVVLSEG"; 659fe6060f1SDimitry Andric let CppTypeName = "VLSEGPseudo"; 66006c3fb27SDimitry Andric let Fields = ["NF", "Masked", "Strided", "FF", "Log2SEW", "LMUL", "Pseudo"]; 66106c3fb27SDimitry Andric let PrimaryKey = ["NF", "Masked", "Strided", "FF", "Log2SEW", "LMUL"]; 662fe6060f1SDimitry Andric let PrimaryKeyName = "getVLSEGPseudo"; 663fe6060f1SDimitry Andric} 664fe6060f1SDimitry Andric 66506c3fb27SDimitry Andricclass RISCVVLXSEG<bits<4> N, bit M, bit O, bits<3> S, bits<3> L, bits<3> IL> { 666fe6060f1SDimitry Andric bits<4> NF = N; 667fe6060f1SDimitry Andric bits<1> Masked = M; 668fe6060f1SDimitry Andric bits<1> Ordered = O; 669fe6060f1SDimitry Andric bits<3> Log2SEW = S; 670fe6060f1SDimitry Andric bits<3> LMUL = L; 671fe6060f1SDimitry Andric bits<3> IndexLMUL = IL; 672fe6060f1SDimitry Andric Pseudo Pseudo = !cast<Pseudo>(NAME); 673fe6060f1SDimitry Andric} 674fe6060f1SDimitry Andric 675fe6060f1SDimitry Andricdef RISCVVLXSEGTable : GenericTable { 676fe6060f1SDimitry Andric let FilterClass = "RISCVVLXSEG"; 677fe6060f1SDimitry Andric let CppTypeName = "VLXSEGPseudo"; 67806c3fb27SDimitry Andric let Fields = ["NF", "Masked", "Ordered", "Log2SEW", "LMUL", "IndexLMUL", "Pseudo"]; 67906c3fb27SDimitry Andric let PrimaryKey = ["NF", "Masked", "Ordered", "Log2SEW", "LMUL", "IndexLMUL"]; 680fe6060f1SDimitry Andric let PrimaryKeyName = "getVLXSEGPseudo"; 681fe6060f1SDimitry Andric} 682fe6060f1SDimitry Andric 683fe6060f1SDimitry Andricclass RISCVVSSEG<bits<4> N, bit M, bit Str, bits<3> S, bits<3> L> { 684fe6060f1SDimitry Andric bits<4> NF = N; 685fe6060f1SDimitry Andric bits<1> Masked = M; 686fe6060f1SDimitry Andric bits<1> Strided = Str; 687fe6060f1SDimitry Andric bits<3> Log2SEW = S; 688fe6060f1SDimitry Andric bits<3> LMUL = L; 689fe6060f1SDimitry Andric Pseudo Pseudo = !cast<Pseudo>(NAME); 690fe6060f1SDimitry Andric} 691fe6060f1SDimitry Andric 692fe6060f1SDimitry Andricdef RISCVVSSEGTable : GenericTable { 693fe6060f1SDimitry Andric let FilterClass = "RISCVVSSEG"; 694fe6060f1SDimitry Andric let CppTypeName = "VSSEGPseudo"; 695fe6060f1SDimitry Andric let Fields = ["NF", "Masked", "Strided", "Log2SEW", "LMUL", "Pseudo"]; 696fe6060f1SDimitry Andric let PrimaryKey = ["NF", "Masked", "Strided", "Log2SEW", "LMUL"]; 697fe6060f1SDimitry Andric let PrimaryKeyName = "getVSSEGPseudo"; 698fe6060f1SDimitry Andric} 699fe6060f1SDimitry Andric 700fe6060f1SDimitry Andricclass RISCVVSXSEG<bits<4> N, bit M, bit O, bits<3> S, bits<3> L, bits<3> IL> { 701fe6060f1SDimitry Andric bits<4> NF = N; 702fe6060f1SDimitry Andric bits<1> Masked = M; 703fe6060f1SDimitry Andric bits<1> Ordered = O; 704fe6060f1SDimitry Andric bits<3> Log2SEW = S; 705fe6060f1SDimitry Andric bits<3> LMUL = L; 706fe6060f1SDimitry Andric bits<3> IndexLMUL = IL; 707fe6060f1SDimitry Andric Pseudo Pseudo = !cast<Pseudo>(NAME); 708fe6060f1SDimitry Andric} 709fe6060f1SDimitry Andric 710fe6060f1SDimitry Andricdef RISCVVSXSEGTable : GenericTable { 711fe6060f1SDimitry Andric let FilterClass = "RISCVVSXSEG"; 712fe6060f1SDimitry Andric let CppTypeName = "VSXSEGPseudo"; 713fe6060f1SDimitry Andric let Fields = ["NF", "Masked", "Ordered", "Log2SEW", "LMUL", "IndexLMUL", "Pseudo"]; 714fe6060f1SDimitry Andric let PrimaryKey = ["NF", "Masked", "Ordered", "Log2SEW", "LMUL", "IndexLMUL"]; 715fe6060f1SDimitry Andric let PrimaryKeyName = "getVSXSEGPseudo"; 716e8d8bef9SDimitry Andric} 717e8d8bef9SDimitry Andric 718e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 719e8d8bef9SDimitry Andric// Helpers to define the different pseudo instructions. 720e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 721e8d8bef9SDimitry Andric 722e8d8bef9SDimitry Andric// The destination vector register group for a masked vector instruction cannot 723e8d8bef9SDimitry Andric// overlap the source mask register (v0), unless the destination vector register 724e8d8bef9SDimitry Andric// is being written with a mask value (e.g., comparisons) or the scalar result 725e8d8bef9SDimitry Andric// of a reduction. 726e8d8bef9SDimitry Andricclass GetVRegNoV0<VReg VRegClass> { 727e8d8bef9SDimitry Andric VReg R = !cond(!eq(VRegClass, VR) : VRNoV0, 728e8d8bef9SDimitry Andric !eq(VRegClass, VRM2) : VRM2NoV0, 729e8d8bef9SDimitry Andric !eq(VRegClass, VRM4) : VRM4NoV0, 730e8d8bef9SDimitry Andric !eq(VRegClass, VRM8) : VRM8NoV0, 731fe6060f1SDimitry Andric !eq(VRegClass, VRN2M1) : VRN2M1NoV0, 732fe6060f1SDimitry Andric !eq(VRegClass, VRN2M2) : VRN2M2NoV0, 733fe6060f1SDimitry Andric !eq(VRegClass, VRN2M4) : VRN2M4NoV0, 734fe6060f1SDimitry Andric !eq(VRegClass, VRN3M1) : VRN3M1NoV0, 735fe6060f1SDimitry Andric !eq(VRegClass, VRN3M2) : VRN3M2NoV0, 736fe6060f1SDimitry Andric !eq(VRegClass, VRN4M1) : VRN4M1NoV0, 737fe6060f1SDimitry Andric !eq(VRegClass, VRN4M2) : VRN4M2NoV0, 738fe6060f1SDimitry Andric !eq(VRegClass, VRN5M1) : VRN5M1NoV0, 739fe6060f1SDimitry Andric !eq(VRegClass, VRN6M1) : VRN6M1NoV0, 740fe6060f1SDimitry Andric !eq(VRegClass, VRN7M1) : VRN7M1NoV0, 741fe6060f1SDimitry Andric !eq(VRegClass, VRN8M1) : VRN8M1NoV0, 742fe6060f1SDimitry Andric true : VRegClass); 743e8d8bef9SDimitry Andric} 744e8d8bef9SDimitry Andric 74506c3fb27SDimitry Andricclass VPseudo<Instruction instr, LMULInfo m, dag outs, dag ins, int sew = 0> : 746e8d8bef9SDimitry Andric Pseudo<outs, ins, []>, RISCVVPseudo { 747e8d8bef9SDimitry Andric let BaseInstr = instr; 748e8d8bef9SDimitry Andric let VLMul = m.value; 74906c3fb27SDimitry Andric let SEW = sew; 750e8d8bef9SDimitry Andric} 751e8d8bef9SDimitry Andric 75206c3fb27SDimitry Andricclass GetVTypePredicates<VTypeInfo vti> { 75306c3fb27SDimitry Andric list<Predicate> Predicates = !cond(!eq(vti.Scalar, f16) : [HasVInstructionsF16], 7545f757f3fSDimitry Andric !eq(vti.Scalar, bf16) : [HasVInstructionsBF16], 75506c3fb27SDimitry Andric !eq(vti.Scalar, f32) : [HasVInstructionsAnyF], 75606c3fb27SDimitry Andric !eq(vti.Scalar, f64) : [HasVInstructionsF64], 75706c3fb27SDimitry Andric !eq(vti.SEW, 64) : [HasVInstructionsI64], 75806c3fb27SDimitry Andric true : [HasVInstructions]); 75906c3fb27SDimitry Andric} 76006c3fb27SDimitry Andric 7615f757f3fSDimitry Andricclass VPseudoUSLoadNoMask<VReg RetClass, 7625f757f3fSDimitry Andric int EEW> : 763e8d8bef9SDimitry Andric Pseudo<(outs RetClass:$rd), 76406c3fb27SDimitry Andric (ins RetClass:$dest, GPRMem:$rs1, AVL:$vl, ixlenimm:$sew, 76506c3fb27SDimitry Andric ixlenimm:$policy), []>, 766fe6060f1SDimitry Andric RISCVVPseudo, 76706c3fb27SDimitry Andric RISCVVLE</*Masked*/0, /*Strided*/0, /*FF*/0, !logtwo(EEW), VLMul> { 768e8d8bef9SDimitry Andric let mayLoad = 1; 769e8d8bef9SDimitry Andric let mayStore = 0; 770e8d8bef9SDimitry Andric let hasSideEffects = 0; 771e8d8bef9SDimitry Andric let HasVLOp = 1; 772e8d8bef9SDimitry Andric let HasSEWOp = 1; 77306c3fb27SDimitry Andric let HasVecPolicyOp = 1; 77404eeddc0SDimitry Andric let Constraints = "$rd = $dest"; 77504eeddc0SDimitry Andric} 77604eeddc0SDimitry Andric 7775f757f3fSDimitry Andricclass VPseudoUSLoadMask<VReg RetClass, 7785f757f3fSDimitry Andric int EEW> : 779e8d8bef9SDimitry Andric Pseudo<(outs GetVRegNoV0<RetClass>.R:$rd), 780e8d8bef9SDimitry Andric (ins GetVRegNoV0<RetClass>.R:$merge, 781bdd1243dSDimitry Andric GPRMem:$rs1, 782349cc55cSDimitry Andric VMaskOp:$vm, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, 783fe6060f1SDimitry Andric RISCVVPseudo, 78406c3fb27SDimitry Andric RISCVVLE</*Masked*/1, /*Strided*/0, /*FF*/0, !logtwo(EEW), VLMul> { 785e8d8bef9SDimitry Andric let mayLoad = 1; 786e8d8bef9SDimitry Andric let mayStore = 0; 787e8d8bef9SDimitry Andric let hasSideEffects = 0; 788e8d8bef9SDimitry Andric let Constraints = "$rd = $merge"; 789e8d8bef9SDimitry Andric let HasVLOp = 1; 790e8d8bef9SDimitry Andric let HasSEWOp = 1; 791349cc55cSDimitry Andric let HasVecPolicyOp = 1; 79281ad6265SDimitry Andric let UsesMaskPolicy = 1; 79381ad6265SDimitry Andric} 79481ad6265SDimitry Andric 7955f757f3fSDimitry Andricclass VPseudoUSLoadFFNoMask<VReg RetClass, 7965f757f3fSDimitry Andric int EEW> : 79781ad6265SDimitry Andric Pseudo<(outs RetClass:$rd, GPR:$vl), 79806c3fb27SDimitry Andric (ins RetClass:$dest, GPRMem:$rs1, AVL:$avl, 79906c3fb27SDimitry Andric ixlenimm:$sew, ixlenimm:$policy), []>, 80081ad6265SDimitry Andric RISCVVPseudo, 80106c3fb27SDimitry Andric RISCVVLE</*Masked*/0, /*Strided*/0, /*FF*/1, !logtwo(EEW), VLMul> { 80281ad6265SDimitry Andric let mayLoad = 1; 80381ad6265SDimitry Andric let mayStore = 0; 80481ad6265SDimitry Andric let hasSideEffects = 0; 80581ad6265SDimitry Andric let HasVLOp = 1; 80681ad6265SDimitry Andric let HasSEWOp = 1; 80706c3fb27SDimitry Andric let HasVecPolicyOp = 1; 80881ad6265SDimitry Andric let Constraints = "$rd = $dest"; 80981ad6265SDimitry Andric} 81081ad6265SDimitry Andric 8115f757f3fSDimitry Andricclass VPseudoUSLoadFFMask<VReg RetClass, 8125f757f3fSDimitry Andric int EEW> : 81381ad6265SDimitry Andric Pseudo<(outs GetVRegNoV0<RetClass>.R:$rd, GPR:$vl), 81481ad6265SDimitry Andric (ins GetVRegNoV0<RetClass>.R:$merge, 815bdd1243dSDimitry Andric GPRMem:$rs1, 81681ad6265SDimitry Andric VMaskOp:$vm, AVL:$avl, ixlenimm:$sew, ixlenimm:$policy), []>, 81781ad6265SDimitry Andric RISCVVPseudo, 81806c3fb27SDimitry Andric RISCVVLE</*Masked*/1, /*Strided*/0, /*FF*/1, !logtwo(EEW), VLMul> { 81981ad6265SDimitry Andric let mayLoad = 1; 82081ad6265SDimitry Andric let mayStore = 0; 82181ad6265SDimitry Andric let hasSideEffects = 0; 82281ad6265SDimitry Andric let Constraints = "$rd = $merge"; 82381ad6265SDimitry Andric let HasVLOp = 1; 82481ad6265SDimitry Andric let HasSEWOp = 1; 82581ad6265SDimitry Andric let HasVecPolicyOp = 1; 82681ad6265SDimitry Andric let UsesMaskPolicy = 1; 827e8d8bef9SDimitry Andric} 828e8d8bef9SDimitry Andric 8295f757f3fSDimitry Andricclass VPseudoSLoadNoMask<VReg RetClass, 8305f757f3fSDimitry Andric int EEW> : 831e8d8bef9SDimitry Andric Pseudo<(outs RetClass:$rd), 83206c3fb27SDimitry Andric (ins RetClass:$dest, GPRMem:$rs1, GPR:$rs2, AVL:$vl, 83306c3fb27SDimitry Andric ixlenimm:$sew, ixlenimm:$policy), []>, 834fe6060f1SDimitry Andric RISCVVPseudo, 83506c3fb27SDimitry Andric RISCVVLE</*Masked*/0, /*Strided*/1, /*FF*/0, !logtwo(EEW), VLMul> { 836e8d8bef9SDimitry Andric let mayLoad = 1; 837e8d8bef9SDimitry Andric let mayStore = 0; 838e8d8bef9SDimitry Andric let hasSideEffects = 0; 839e8d8bef9SDimitry Andric let HasVLOp = 1; 840e8d8bef9SDimitry Andric let HasSEWOp = 1; 84106c3fb27SDimitry Andric let HasVecPolicyOp = 1; 84204eeddc0SDimitry Andric let Constraints = "$rd = $dest"; 84304eeddc0SDimitry Andric} 84404eeddc0SDimitry Andric 8455f757f3fSDimitry Andricclass VPseudoSLoadMask<VReg RetClass, 8465f757f3fSDimitry Andric int EEW> : 847e8d8bef9SDimitry Andric Pseudo<(outs GetVRegNoV0<RetClass>.R:$rd), 848e8d8bef9SDimitry Andric (ins GetVRegNoV0<RetClass>.R:$merge, 849bdd1243dSDimitry Andric GPRMem:$rs1, GPR:$rs2, 850349cc55cSDimitry Andric VMaskOp:$vm, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, 851fe6060f1SDimitry Andric RISCVVPseudo, 85206c3fb27SDimitry Andric RISCVVLE</*Masked*/1, /*Strided*/1, /*FF*/0, !logtwo(EEW), VLMul> { 853e8d8bef9SDimitry Andric let mayLoad = 1; 854e8d8bef9SDimitry Andric let mayStore = 0; 855e8d8bef9SDimitry Andric let hasSideEffects = 0; 856e8d8bef9SDimitry Andric let Constraints = "$rd = $merge"; 857e8d8bef9SDimitry Andric let HasVLOp = 1; 858e8d8bef9SDimitry Andric let HasSEWOp = 1; 859349cc55cSDimitry Andric let HasVecPolicyOp = 1; 86081ad6265SDimitry Andric let UsesMaskPolicy = 1; 861e8d8bef9SDimitry Andric} 862e8d8bef9SDimitry Andric 8635f757f3fSDimitry Andricclass VPseudoILoadNoMask<VReg RetClass, 8645f757f3fSDimitry Andric VReg IdxClass, 8655f757f3fSDimitry Andric int EEW, 8665f757f3fSDimitry Andric bits<3> LMUL, 8675f757f3fSDimitry Andric bit Ordered, 8685f757f3fSDimitry Andric bit EarlyClobber, 8695f757f3fSDimitry Andric int TargetConstraintType = 1> : 870e8d8bef9SDimitry Andric Pseudo<(outs RetClass:$rd), 871bdd1243dSDimitry Andric (ins RetClass:$dest, GPRMem:$rs1, IdxClass:$rs2, AVL:$vl, 87206c3fb27SDimitry Andric ixlenimm:$sew, ixlenimm:$policy), []>, 87304eeddc0SDimitry Andric RISCVVPseudo, 87406c3fb27SDimitry Andric RISCVVLX</*Masked*/0, Ordered, !logtwo(EEW), VLMul, LMUL> { 87504eeddc0SDimitry Andric let mayLoad = 1; 87604eeddc0SDimitry Andric let mayStore = 0; 87704eeddc0SDimitry Andric let hasSideEffects = 0; 87804eeddc0SDimitry Andric let HasVLOp = 1; 87904eeddc0SDimitry Andric let HasSEWOp = 1; 88006c3fb27SDimitry Andric let HasVecPolicyOp = 1; 88104eeddc0SDimitry Andric let Constraints = !if(!eq(EarlyClobber, 1), "@earlyclobber $rd, $rd = $dest", "$rd = $dest"); 8825f757f3fSDimitry Andric let TargetOverlapConstraintType = TargetConstraintType; 88304eeddc0SDimitry Andric} 88404eeddc0SDimitry Andric 8855f757f3fSDimitry Andricclass VPseudoILoadMask<VReg RetClass, 8865f757f3fSDimitry Andric VReg IdxClass, 8875f757f3fSDimitry Andric int EEW, 8885f757f3fSDimitry Andric bits<3> LMUL, 8895f757f3fSDimitry Andric bit Ordered, 8905f757f3fSDimitry Andric bit EarlyClobber, 8915f757f3fSDimitry Andric int TargetConstraintType = 1> : 892e8d8bef9SDimitry Andric Pseudo<(outs GetVRegNoV0<RetClass>.R:$rd), 893e8d8bef9SDimitry Andric (ins GetVRegNoV0<RetClass>.R:$merge, 894bdd1243dSDimitry Andric GPRMem:$rs1, IdxClass:$rs2, 895349cc55cSDimitry Andric VMaskOp:$vm, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, 896fe6060f1SDimitry Andric RISCVVPseudo, 89706c3fb27SDimitry Andric RISCVVLX</*Masked*/1, Ordered, !logtwo(EEW), VLMul, LMUL> { 898e8d8bef9SDimitry Andric let mayLoad = 1; 899e8d8bef9SDimitry Andric let mayStore = 0; 900e8d8bef9SDimitry Andric let hasSideEffects = 0; 901fe6060f1SDimitry Andric let Constraints = !if(!eq(EarlyClobber, 1), "@earlyclobber $rd, $rd = $merge", "$rd = $merge"); 9025f757f3fSDimitry Andric let TargetOverlapConstraintType = TargetConstraintType; 903e8d8bef9SDimitry Andric let HasVLOp = 1; 904e8d8bef9SDimitry Andric let HasSEWOp = 1; 905349cc55cSDimitry Andric let HasVecPolicyOp = 1; 90681ad6265SDimitry Andric let UsesMaskPolicy = 1; 907e8d8bef9SDimitry Andric} 908e8d8bef9SDimitry Andric 9095f757f3fSDimitry Andricclass VPseudoUSStoreNoMask<VReg StClass, 9105f757f3fSDimitry Andric int EEW> : 911e8d8bef9SDimitry Andric Pseudo<(outs), 912bdd1243dSDimitry Andric (ins StClass:$rd, GPRMem:$rs1, AVL:$vl, ixlenimm:$sew), []>, 913fe6060f1SDimitry Andric RISCVVPseudo, 91406c3fb27SDimitry Andric RISCVVSE</*Masked*/0, /*Strided*/0, !logtwo(EEW), VLMul> { 915e8d8bef9SDimitry Andric let mayLoad = 0; 916e8d8bef9SDimitry Andric let mayStore = 1; 917e8d8bef9SDimitry Andric let hasSideEffects = 0; 918e8d8bef9SDimitry Andric let HasVLOp = 1; 919e8d8bef9SDimitry Andric let HasSEWOp = 1; 920e8d8bef9SDimitry Andric} 921e8d8bef9SDimitry Andric 9225f757f3fSDimitry Andricclass VPseudoUSStoreMask<VReg StClass, 9235f757f3fSDimitry Andric int EEW> : 924e8d8bef9SDimitry Andric Pseudo<(outs), 9255f757f3fSDimitry Andric (ins StClass:$rd, GPRMem:$rs1, 9265f757f3fSDimitry Andric VMaskOp:$vm, AVL:$vl, ixlenimm:$sew), []>, 927fe6060f1SDimitry Andric RISCVVPseudo, 92806c3fb27SDimitry Andric RISCVVSE</*Masked*/1, /*Strided*/0, !logtwo(EEW), VLMul> { 929e8d8bef9SDimitry Andric let mayLoad = 0; 930e8d8bef9SDimitry Andric let mayStore = 1; 931e8d8bef9SDimitry Andric let hasSideEffects = 0; 932e8d8bef9SDimitry Andric let HasVLOp = 1; 933e8d8bef9SDimitry Andric let HasSEWOp = 1; 934e8d8bef9SDimitry Andric} 935e8d8bef9SDimitry Andric 9365f757f3fSDimitry Andricclass VPseudoSStoreNoMask<VReg StClass, 9375f757f3fSDimitry Andric int EEW> : 938e8d8bef9SDimitry Andric Pseudo<(outs), 9395f757f3fSDimitry Andric (ins StClass:$rd, GPRMem:$rs1, GPR:$rs2, 9405f757f3fSDimitry Andric AVL:$vl, ixlenimm:$sew), []>, 941fe6060f1SDimitry Andric RISCVVPseudo, 94206c3fb27SDimitry Andric RISCVVSE</*Masked*/0, /*Strided*/1, !logtwo(EEW), VLMul> { 943e8d8bef9SDimitry Andric let mayLoad = 0; 944e8d8bef9SDimitry Andric let mayStore = 1; 945e8d8bef9SDimitry Andric let hasSideEffects = 0; 946e8d8bef9SDimitry Andric let HasVLOp = 1; 947e8d8bef9SDimitry Andric let HasSEWOp = 1; 948e8d8bef9SDimitry Andric} 949e8d8bef9SDimitry Andric 9505f757f3fSDimitry Andricclass VPseudoSStoreMask<VReg StClass, 9515f757f3fSDimitry Andric int EEW> : 952e8d8bef9SDimitry Andric Pseudo<(outs), 9535f757f3fSDimitry Andric (ins StClass:$rd, GPRMem:$rs1, GPR:$rs2, 9545f757f3fSDimitry Andric VMaskOp:$vm, AVL:$vl, ixlenimm:$sew), []>, 955fe6060f1SDimitry Andric RISCVVPseudo, 95606c3fb27SDimitry Andric RISCVVSE</*Masked*/1, /*Strided*/1, !logtwo(EEW), VLMul> { 957e8d8bef9SDimitry Andric let mayLoad = 0; 958e8d8bef9SDimitry Andric let mayStore = 1; 959e8d8bef9SDimitry Andric let hasSideEffects = 0; 960e8d8bef9SDimitry Andric let HasVLOp = 1; 961e8d8bef9SDimitry Andric let HasSEWOp = 1; 962e8d8bef9SDimitry Andric} 963e8d8bef9SDimitry Andric 964e8d8bef9SDimitry Andricclass VPseudoNullaryNoMask<VReg RegClass> : 965e8d8bef9SDimitry Andric Pseudo<(outs RegClass:$rd), 9665f757f3fSDimitry Andric (ins RegClass:$merge, 9675f757f3fSDimitry Andric AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, 9685f757f3fSDimitry Andric RISCVVPseudo { 96981ad6265SDimitry Andric let mayLoad = 0; 97081ad6265SDimitry Andric let mayStore = 0; 97181ad6265SDimitry Andric let hasSideEffects = 0; 97281ad6265SDimitry Andric let Constraints = "$rd = $merge"; 97381ad6265SDimitry Andric let HasVLOp = 1; 97481ad6265SDimitry Andric let HasSEWOp = 1; 97506c3fb27SDimitry Andric let HasVecPolicyOp = 1; 976e8d8bef9SDimitry Andric} 977e8d8bef9SDimitry Andric 978e8d8bef9SDimitry Andricclass VPseudoNullaryMask<VReg RegClass> : 979e8d8bef9SDimitry Andric Pseudo<(outs GetVRegNoV0<RegClass>.R:$rd), 9805f757f3fSDimitry Andric (ins GetVRegNoV0<RegClass>.R:$merge, 9815f757f3fSDimitry Andric VMaskOp:$vm, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, 9825f757f3fSDimitry Andric RISCVVPseudo { 983e8d8bef9SDimitry Andric let mayLoad = 0; 984e8d8bef9SDimitry Andric let mayStore = 0; 985e8d8bef9SDimitry Andric let hasSideEffects = 0; 986e8d8bef9SDimitry Andric let Constraints ="$rd = $merge"; 987e8d8bef9SDimitry Andric let HasVLOp = 1; 988e8d8bef9SDimitry Andric let HasSEWOp = 1; 98981ad6265SDimitry Andric let UsesMaskPolicy = 1; 99081ad6265SDimitry Andric let HasVecPolicyOp = 1; 991e8d8bef9SDimitry Andric} 992e8d8bef9SDimitry Andric 993e8d8bef9SDimitry Andric// Nullary for pseudo instructions. They are expanded in 994e8d8bef9SDimitry Andric// RISCVExpandPseudoInsts pass. 9955f757f3fSDimitry Andricclass VPseudoNullaryPseudoM<string BaseInst> : 9965f757f3fSDimitry Andric Pseudo<(outs VR:$rd), (ins AVL:$vl, ixlenimm:$sew), []>, 997e8d8bef9SDimitry Andric RISCVVPseudo { 998e8d8bef9SDimitry Andric let mayLoad = 0; 999e8d8bef9SDimitry Andric let mayStore = 0; 1000e8d8bef9SDimitry Andric let hasSideEffects = 0; 1001e8d8bef9SDimitry Andric let HasVLOp = 1; 1002e8d8bef9SDimitry Andric let HasSEWOp = 1; 1003e8d8bef9SDimitry Andric // BaseInstr is not used in RISCVExpandPseudoInsts pass. 1004e8d8bef9SDimitry Andric // Just fill a corresponding real v-inst to pass tablegen check. 1005e8d8bef9SDimitry Andric let BaseInstr = !cast<Instruction>(BaseInst); 10065f757f3fSDimitry Andric // We exclude them from RISCVVPseudoTable. 10075f757f3fSDimitry Andric let NeedBeInPseudoTable = 0; 1008e8d8bef9SDimitry Andric} 1009e8d8bef9SDimitry Andric 10105f757f3fSDimitry Andricclass VPseudoUnaryNoMask<DAGOperand RetClass, 10115f757f3fSDimitry Andric DAGOperand OpClass, 10125f757f3fSDimitry Andric string Constraint = "", 10135f757f3fSDimitry Andric int TargetConstraintType = 1> : 1014e8d8bef9SDimitry Andric Pseudo<(outs RetClass:$rd), 10155f757f3fSDimitry Andric (ins RetClass:$merge, OpClass:$rs2, 10165f757f3fSDimitry Andric AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, 1017e8d8bef9SDimitry Andric RISCVVPseudo { 1018e8d8bef9SDimitry Andric let mayLoad = 0; 1019e8d8bef9SDimitry Andric let mayStore = 0; 1020e8d8bef9SDimitry Andric let hasSideEffects = 0; 102106c3fb27SDimitry Andric let Constraints = !interleave([Constraint, "$rd = $merge"], ","); 10225f757f3fSDimitry Andric let TargetOverlapConstraintType = TargetConstraintType; 1023e8d8bef9SDimitry Andric let HasVLOp = 1; 1024e8d8bef9SDimitry Andric let HasSEWOp = 1; 102506c3fb27SDimitry Andric let HasVecPolicyOp = 1; 102681ad6265SDimitry Andric} 102781ad6265SDimitry Andric 1028*0fca6ea1SDimitry Andricclass VPseudoUnaryNoMaskNoPolicy<DAGOperand RetClass, 1029*0fca6ea1SDimitry Andric DAGOperand OpClass, 1030*0fca6ea1SDimitry Andric string Constraint = "", 1031*0fca6ea1SDimitry Andric int TargetConstraintType = 1> : 1032*0fca6ea1SDimitry Andric Pseudo<(outs RetClass:$rd), 1033*0fca6ea1SDimitry Andric (ins OpClass:$rs2, AVL:$vl, ixlenimm:$sew), []>, 1034*0fca6ea1SDimitry Andric RISCVVPseudo { 1035*0fca6ea1SDimitry Andric let mayLoad = 0; 1036*0fca6ea1SDimitry Andric let mayStore = 0; 1037*0fca6ea1SDimitry Andric let hasSideEffects = 0; 1038*0fca6ea1SDimitry Andric let Constraints = Constraint; 1039*0fca6ea1SDimitry Andric let TargetOverlapConstraintType = TargetConstraintType; 1040*0fca6ea1SDimitry Andric let HasVLOp = 1; 1041*0fca6ea1SDimitry Andric let HasSEWOp = 1; 1042*0fca6ea1SDimitry Andric} 1043*0fca6ea1SDimitry Andric 10445f757f3fSDimitry Andricclass VPseudoUnaryNoMaskRoundingMode<DAGOperand RetClass, 10455f757f3fSDimitry Andric DAGOperand OpClass, 10465f757f3fSDimitry Andric string Constraint = "", 10475f757f3fSDimitry Andric int TargetConstraintType = 1> : 104881ad6265SDimitry Andric Pseudo<(outs RetClass:$rd), 10495f757f3fSDimitry Andric (ins RetClass:$merge, OpClass:$rs2, ixlenimm:$rm, 10505f757f3fSDimitry Andric AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, 105181ad6265SDimitry Andric RISCVVPseudo { 105281ad6265SDimitry Andric let mayLoad = 0; 105381ad6265SDimitry Andric let mayStore = 0; 105481ad6265SDimitry Andric let hasSideEffects = 0; 105506c3fb27SDimitry Andric let Constraints = !interleave([Constraint, "$rd = $merge"], ","); 10565f757f3fSDimitry Andric let TargetOverlapConstraintType = TargetConstraintType; 105781ad6265SDimitry Andric let HasVLOp = 1; 105881ad6265SDimitry Andric let HasSEWOp = 1; 105906c3fb27SDimitry Andric let HasVecPolicyOp = 1; 106006c3fb27SDimitry Andric let HasRoundModeOp = 1; 106106c3fb27SDimitry Andric let UsesVXRM = 0; 1062e8d8bef9SDimitry Andric} 1063e8d8bef9SDimitry Andric 10645f757f3fSDimitry Andricclass VPseudoUnaryMask<VReg RetClass, 10655f757f3fSDimitry Andric VReg OpClass, 10665f757f3fSDimitry Andric string Constraint = "", 10675f757f3fSDimitry Andric int TargetConstraintType = 1> : 1068e8d8bef9SDimitry Andric Pseudo<(outs GetVRegNoV0<RetClass>.R:$rd), 1069e8d8bef9SDimitry Andric (ins GetVRegNoV0<RetClass>.R:$merge, OpClass:$rs2, 1070349cc55cSDimitry Andric VMaskOp:$vm, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, 1071349cc55cSDimitry Andric RISCVVPseudo { 1072349cc55cSDimitry Andric let mayLoad = 0; 1073349cc55cSDimitry Andric let mayStore = 0; 1074349cc55cSDimitry Andric let hasSideEffects = 0; 107506c3fb27SDimitry Andric let Constraints = !interleave([Constraint, "$rd = $merge"], ","); 10765f757f3fSDimitry Andric let TargetOverlapConstraintType = TargetConstraintType; 1077349cc55cSDimitry Andric let HasVLOp = 1; 1078349cc55cSDimitry Andric let HasSEWOp = 1; 1079349cc55cSDimitry Andric let HasVecPolicyOp = 1; 108081ad6265SDimitry Andric let UsesMaskPolicy = 1; 1081349cc55cSDimitry Andric} 1082349cc55cSDimitry Andric 10835f757f3fSDimitry Andricclass VPseudoUnaryMaskRoundingMode<VReg RetClass, 10845f757f3fSDimitry Andric VReg OpClass, 1085647cbc5dSDimitry Andric string Constraint = "", 1086647cbc5dSDimitry Andric int TargetConstraintType = 1> : 108706c3fb27SDimitry Andric Pseudo<(outs GetVRegNoV0<RetClass>.R:$rd), 108806c3fb27SDimitry Andric (ins GetVRegNoV0<RetClass>.R:$merge, OpClass:$rs2, 108906c3fb27SDimitry Andric VMaskOp:$vm, ixlenimm:$rm, 109006c3fb27SDimitry Andric AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, 109106c3fb27SDimitry Andric RISCVVPseudo { 109206c3fb27SDimitry Andric let mayLoad = 0; 109306c3fb27SDimitry Andric let mayStore = 0; 109406c3fb27SDimitry Andric let hasSideEffects = 0; 109506c3fb27SDimitry Andric let Constraints = !interleave([Constraint, "$rd = $merge"], ","); 1096647cbc5dSDimitry Andric let TargetOverlapConstraintType = TargetConstraintType; 109706c3fb27SDimitry Andric let HasVLOp = 1; 109806c3fb27SDimitry Andric let HasSEWOp = 1; 109906c3fb27SDimitry Andric let HasVecPolicyOp = 1; 110006c3fb27SDimitry Andric let UsesMaskPolicy = 1; 110106c3fb27SDimitry Andric let HasRoundModeOp = 1; 110206c3fb27SDimitry Andric let UsesVXRM = 0; 110306c3fb27SDimitry Andric} 110406c3fb27SDimitry Andric 11055f757f3fSDimitry Andricclass VPseudoUnaryMask_NoExcept<VReg RetClass, 11065f757f3fSDimitry Andric VReg OpClass, 11075f757f3fSDimitry Andric string Constraint = ""> : 1108bdd1243dSDimitry Andric Pseudo<(outs GetVRegNoV0<RetClass>.R:$rd), 1109bdd1243dSDimitry Andric (ins GetVRegNoV0<RetClass>.R:$merge, OpClass:$rs2, 11105f757f3fSDimitry Andric VMaskOp:$vm, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []> { 1111bdd1243dSDimitry Andric let mayLoad = 0; 1112bdd1243dSDimitry Andric let mayStore = 0; 1113bdd1243dSDimitry Andric let hasSideEffects = 0; 111406c3fb27SDimitry Andric let Constraints = !interleave([Constraint, "$rd = $merge"], ","); 1115bdd1243dSDimitry Andric let HasVLOp = 1; 1116bdd1243dSDimitry Andric let HasSEWOp = 1; 1117bdd1243dSDimitry Andric let HasVecPolicyOp = 1; 1118bdd1243dSDimitry Andric let UsesMaskPolicy = 1; 1119bdd1243dSDimitry Andric let usesCustomInserter = 1; 1120bdd1243dSDimitry Andric} 1121bdd1243dSDimitry Andric 11225f757f3fSDimitry Andricclass VPseudoUnaryNoMask_FRM<VReg RetClass, 11235f757f3fSDimitry Andric VReg OpClass, 1124647cbc5dSDimitry Andric string Constraint = "", 1125647cbc5dSDimitry Andric int TargetConstraintType = 1> : 11265f757f3fSDimitry Andric Pseudo<(outs RetClass:$rd), 11275f757f3fSDimitry Andric (ins RetClass:$merge, OpClass:$rs2, ixlenimm:$frm, 11285f757f3fSDimitry Andric AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, 11295f757f3fSDimitry Andric RISCVVPseudo { 11305f757f3fSDimitry Andric let mayLoad = 0; 11315f757f3fSDimitry Andric let mayStore = 0; 11325f757f3fSDimitry Andric let hasSideEffects = 0; 11335f757f3fSDimitry Andric let Constraints = !interleave([Constraint, "$rd = $merge"], ","); 1134647cbc5dSDimitry Andric let TargetOverlapConstraintType = TargetConstraintType; 11355f757f3fSDimitry Andric let HasVLOp = 1; 11365f757f3fSDimitry Andric let HasSEWOp = 1; 11375f757f3fSDimitry Andric let HasVecPolicyOp = 1; 11385f757f3fSDimitry Andric let HasRoundModeOp = 1; 11395f757f3fSDimitry Andric} 11405f757f3fSDimitry Andric 11415f757f3fSDimitry Andricclass VPseudoUnaryMask_FRM<VReg RetClass, 11425f757f3fSDimitry Andric VReg OpClass, 1143647cbc5dSDimitry Andric string Constraint = "", 1144647cbc5dSDimitry Andric int TargetConstraintType = 1> : 11455f757f3fSDimitry Andric Pseudo<(outs GetVRegNoV0<RetClass>.R:$rd), 11465f757f3fSDimitry Andric (ins GetVRegNoV0<RetClass>.R:$merge, OpClass:$rs2, 11475f757f3fSDimitry Andric VMaskOp:$vm, ixlenimm:$frm, 11485f757f3fSDimitry Andric AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, 11495f757f3fSDimitry Andric RISCVVPseudo { 11505f757f3fSDimitry Andric let mayLoad = 0; 11515f757f3fSDimitry Andric let mayStore = 0; 11525f757f3fSDimitry Andric let hasSideEffects = 0; 11535f757f3fSDimitry Andric let Constraints = !interleave([Constraint, "$rd = $merge"], ","); 1154647cbc5dSDimitry Andric let TargetOverlapConstraintType = TargetConstraintType; 11555f757f3fSDimitry Andric let HasVLOp = 1; 11565f757f3fSDimitry Andric let HasSEWOp = 1; 11575f757f3fSDimitry Andric let HasVecPolicyOp = 1; 11585f757f3fSDimitry Andric let UsesMaskPolicy = 1; 11595f757f3fSDimitry Andric let HasRoundModeOp = 1; 11605f757f3fSDimitry Andric} 11615f757f3fSDimitry Andric 116206c3fb27SDimitry Andricclass VPseudoUnaryNoMaskGPROut : 116306c3fb27SDimitry Andric Pseudo<(outs GPR:$rd), 116406c3fb27SDimitry Andric (ins VR:$rs2, AVL:$vl, ixlenimm:$sew), []>, 116506c3fb27SDimitry Andric RISCVVPseudo { 116606c3fb27SDimitry Andric let mayLoad = 0; 116706c3fb27SDimitry Andric let mayStore = 0; 116806c3fb27SDimitry Andric let hasSideEffects = 0; 116906c3fb27SDimitry Andric let HasVLOp = 1; 117006c3fb27SDimitry Andric let HasSEWOp = 1; 117106c3fb27SDimitry Andric} 117206c3fb27SDimitry Andric 117306c3fb27SDimitry Andricclass VPseudoUnaryMaskGPROut : 1174e8d8bef9SDimitry Andric Pseudo<(outs GPR:$rd), 1175fe6060f1SDimitry Andric (ins VR:$rs1, VMaskOp:$vm, AVL:$vl, ixlenimm:$sew), []>, 1176e8d8bef9SDimitry Andric RISCVVPseudo { 1177e8d8bef9SDimitry Andric let mayLoad = 0; 1178e8d8bef9SDimitry Andric let mayStore = 0; 1179e8d8bef9SDimitry Andric let hasSideEffects = 0; 1180e8d8bef9SDimitry Andric let HasVLOp = 1; 1181e8d8bef9SDimitry Andric let HasSEWOp = 1; 1182e8d8bef9SDimitry Andric} 1183e8d8bef9SDimitry Andric 1184e8d8bef9SDimitry Andric// Mask can be V0~V31 1185e8d8bef9SDimitry Andricclass VPseudoUnaryAnyMask<VReg RetClass, 1186e8d8bef9SDimitry Andric VReg Op1Class> : 1187e8d8bef9SDimitry Andric Pseudo<(outs RetClass:$rd), 11885f757f3fSDimitry Andric (ins RetClass:$merge, Op1Class:$rs2, 11895f757f3fSDimitry Andric VR:$vm, AVL:$vl, ixlenimm:$sew), []>, 1190e8d8bef9SDimitry Andric RISCVVPseudo { 1191e8d8bef9SDimitry Andric let mayLoad = 0; 1192e8d8bef9SDimitry Andric let mayStore = 0; 1193e8d8bef9SDimitry Andric let hasSideEffects = 0; 1194e8d8bef9SDimitry Andric let Constraints = "@earlyclobber $rd, $rd = $merge"; 1195e8d8bef9SDimitry Andric let HasVLOp = 1; 1196e8d8bef9SDimitry Andric let HasSEWOp = 1; 1197e8d8bef9SDimitry Andric} 1198e8d8bef9SDimitry Andric 1199e8d8bef9SDimitry Andricclass VPseudoBinaryNoMask<VReg RetClass, 1200e8d8bef9SDimitry Andric VReg Op1Class, 1201e8d8bef9SDimitry Andric DAGOperand Op2Class, 12025f757f3fSDimitry Andric string Constraint, 12035f757f3fSDimitry Andric int TargetConstraintType = 1> : 1204e8d8bef9SDimitry Andric Pseudo<(outs RetClass:$rd), 1205fe6060f1SDimitry Andric (ins Op1Class:$rs2, Op2Class:$rs1, AVL:$vl, ixlenimm:$sew), []>, 1206e8d8bef9SDimitry Andric RISCVVPseudo { 1207e8d8bef9SDimitry Andric let mayLoad = 0; 1208e8d8bef9SDimitry Andric let mayStore = 0; 1209e8d8bef9SDimitry Andric let hasSideEffects = 0; 1210e8d8bef9SDimitry Andric let Constraints = Constraint; 12115f757f3fSDimitry Andric let TargetOverlapConstraintType = TargetConstraintType; 1212e8d8bef9SDimitry Andric let HasVLOp = 1; 1213e8d8bef9SDimitry Andric let HasSEWOp = 1; 121481ad6265SDimitry Andric} 121581ad6265SDimitry Andric 1216*0fca6ea1SDimitry Andricclass VPseudoBinaryNoMaskPolicy<VReg RetClass, 121781ad6265SDimitry Andric VReg Op1Class, 121881ad6265SDimitry Andric DAGOperand Op2Class, 12195f757f3fSDimitry Andric string Constraint, 12205f757f3fSDimitry Andric int TargetConstraintType = 1> : 122181ad6265SDimitry Andric Pseudo<(outs RetClass:$rd), 122206c3fb27SDimitry Andric (ins RetClass:$merge, Op1Class:$rs2, Op2Class:$rs1, AVL:$vl, 122306c3fb27SDimitry Andric ixlenimm:$sew, ixlenimm:$policy), []>, 122481ad6265SDimitry Andric RISCVVPseudo { 122581ad6265SDimitry Andric let mayLoad = 0; 122681ad6265SDimitry Andric let mayStore = 0; 122781ad6265SDimitry Andric let hasSideEffects = 0; 122806c3fb27SDimitry Andric let Constraints = !interleave([Constraint, "$rd = $merge"], ","); 12295f757f3fSDimitry Andric let TargetOverlapConstraintType = TargetConstraintType; 123081ad6265SDimitry Andric let HasVLOp = 1; 123181ad6265SDimitry Andric let HasSEWOp = 1; 123206c3fb27SDimitry Andric let HasVecPolicyOp = 1; 123306c3fb27SDimitry Andric} 123406c3fb27SDimitry Andric 123506c3fb27SDimitry Andricclass VPseudoBinaryNoMaskRoundingMode<VReg RetClass, 123606c3fb27SDimitry Andric VReg Op1Class, 123706c3fb27SDimitry Andric DAGOperand Op2Class, 123806c3fb27SDimitry Andric string Constraint, 12395f757f3fSDimitry Andric int UsesVXRM_ = 1, 12405f757f3fSDimitry Andric int TargetConstraintType = 1> : 124106c3fb27SDimitry Andric Pseudo<(outs RetClass:$rd), 124206c3fb27SDimitry Andric (ins RetClass:$merge, Op1Class:$rs2, Op2Class:$rs1, ixlenimm:$rm, 124306c3fb27SDimitry Andric AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, 124406c3fb27SDimitry Andric RISCVVPseudo { 124506c3fb27SDimitry Andric let mayLoad = 0; 124606c3fb27SDimitry Andric let mayStore = 0; 124706c3fb27SDimitry Andric let Constraints = !interleave([Constraint, "$rd = $merge"], ","); 12485f757f3fSDimitry Andric let TargetOverlapConstraintType = TargetConstraintType; 124906c3fb27SDimitry Andric let HasVLOp = 1; 125006c3fb27SDimitry Andric let HasSEWOp = 1; 125106c3fb27SDimitry Andric let HasVecPolicyOp = 1; 125206c3fb27SDimitry Andric let HasRoundModeOp = 1; 125306c3fb27SDimitry Andric let UsesVXRM = UsesVXRM_; 125406c3fb27SDimitry Andric} 125506c3fb27SDimitry Andric 125606c3fb27SDimitry Andricclass VPseudoBinaryMaskPolicyRoundingMode<VReg RetClass, 125706c3fb27SDimitry Andric RegisterClass Op1Class, 125806c3fb27SDimitry Andric DAGOperand Op2Class, 125906c3fb27SDimitry Andric string Constraint, 12605f757f3fSDimitry Andric int UsesVXRM_, 12615f757f3fSDimitry Andric int TargetConstraintType = 1> : 126206c3fb27SDimitry Andric Pseudo<(outs GetVRegNoV0<RetClass>.R:$rd), 126306c3fb27SDimitry Andric (ins GetVRegNoV0<RetClass>.R:$merge, 126406c3fb27SDimitry Andric Op1Class:$rs2, Op2Class:$rs1, 126506c3fb27SDimitry Andric VMaskOp:$vm, ixlenimm:$rm, AVL:$vl, 126606c3fb27SDimitry Andric ixlenimm:$sew, ixlenimm:$policy), []>, 126706c3fb27SDimitry Andric RISCVVPseudo { 126806c3fb27SDimitry Andric let mayLoad = 0; 126906c3fb27SDimitry Andric let mayStore = 0; 127006c3fb27SDimitry Andric let Constraints = !interleave([Constraint, "$rd = $merge"], ","); 12715f757f3fSDimitry Andric let TargetOverlapConstraintType = TargetConstraintType; 127206c3fb27SDimitry Andric let HasVLOp = 1; 127306c3fb27SDimitry Andric let HasSEWOp = 1; 127406c3fb27SDimitry Andric let HasVecPolicyOp = 1; 127506c3fb27SDimitry Andric let UsesMaskPolicy = 1; 127606c3fb27SDimitry Andric let HasRoundModeOp = 1; 127706c3fb27SDimitry Andric let UsesVXRM = UsesVXRM_; 1278e8d8bef9SDimitry Andric} 1279e8d8bef9SDimitry Andric 128004eeddc0SDimitry Andric// Special version of VPseudoBinaryNoMask where we pretend the first source is 128104eeddc0SDimitry Andric// tied to the destination. 128204eeddc0SDimitry Andric// This allows maskedoff and rs2 to be the same register. 1283fe6060f1SDimitry Andricclass VPseudoTiedBinaryNoMask<VReg RetClass, 1284fe6060f1SDimitry Andric DAGOperand Op2Class, 12855f757f3fSDimitry Andric string Constraint, 12865f757f3fSDimitry Andric int TargetConstraintType = 1> : 1287fe6060f1SDimitry Andric Pseudo<(outs RetClass:$rd), 128881ad6265SDimitry Andric (ins RetClass:$rs2, Op2Class:$rs1, AVL:$vl, ixlenimm:$sew, 128981ad6265SDimitry Andric ixlenimm:$policy), []>, 1290e8d8bef9SDimitry Andric RISCVVPseudo { 1291e8d8bef9SDimitry Andric let mayLoad = 0; 1292fe6060f1SDimitry Andric let mayStore = 0; 1293fe6060f1SDimitry Andric let hasSideEffects = 0; 129406c3fb27SDimitry Andric let Constraints = !interleave([Constraint, "$rd = $rs2"], ","); 12955f757f3fSDimitry Andric let TargetOverlapConstraintType = TargetConstraintType; 1296fe6060f1SDimitry Andric let HasVLOp = 1; 1297fe6060f1SDimitry Andric let HasSEWOp = 1; 129881ad6265SDimitry Andric let HasVecPolicyOp = 1; 1299fe6060f1SDimitry Andric let isConvertibleToThreeAddress = 1; 130006c3fb27SDimitry Andric let IsTiedPseudo = 1; 130106c3fb27SDimitry Andric} 130206c3fb27SDimitry Andric 130306c3fb27SDimitry Andricclass VPseudoTiedBinaryNoMaskRoundingMode<VReg RetClass, 130406c3fb27SDimitry Andric DAGOperand Op2Class, 13055f757f3fSDimitry Andric string Constraint, 13065f757f3fSDimitry Andric int TargetConstraintType = 1> : 130706c3fb27SDimitry Andric Pseudo<(outs RetClass:$rd), 130806c3fb27SDimitry Andric (ins RetClass:$rs2, Op2Class:$rs1, 130906c3fb27SDimitry Andric ixlenimm:$rm, 131006c3fb27SDimitry Andric AVL:$vl, ixlenimm:$sew, 131106c3fb27SDimitry Andric ixlenimm:$policy), []>, 131206c3fb27SDimitry Andric RISCVVPseudo { 131306c3fb27SDimitry Andric let mayLoad = 0; 131406c3fb27SDimitry Andric let mayStore = 0; 131506c3fb27SDimitry Andric let hasSideEffects = 0; 131606c3fb27SDimitry Andric let Constraints = !interleave([Constraint, "$rd = $rs2"], ","); 13175f757f3fSDimitry Andric let TargetOverlapConstraintType = TargetConstraintType; 131806c3fb27SDimitry Andric let HasVLOp = 1; 131906c3fb27SDimitry Andric let HasSEWOp = 1; 132006c3fb27SDimitry Andric let HasVecPolicyOp = 1; 132106c3fb27SDimitry Andric let isConvertibleToThreeAddress = 1; 132206c3fb27SDimitry Andric let IsTiedPseudo = 1; 132306c3fb27SDimitry Andric let HasRoundModeOp = 1; 132406c3fb27SDimitry Andric let UsesVXRM = 0; 1325fe6060f1SDimitry Andric} 1326fe6060f1SDimitry Andric 1327fe6060f1SDimitry Andricclass VPseudoIStoreNoMask<VReg StClass, VReg IdxClass, int EEW, bits<3> LMUL, 1328fe6060f1SDimitry Andric bit Ordered>: 1329fe6060f1SDimitry Andric Pseudo<(outs), 13305f757f3fSDimitry Andric (ins StClass:$rd, GPRMem:$rs1, IdxClass:$rs2, AVL:$vl, 13315f757f3fSDimitry Andric ixlenimm:$sew),[]>, 1332fe6060f1SDimitry Andric RISCVVPseudo, 133306c3fb27SDimitry Andric RISCVVSX</*Masked*/0, Ordered, !logtwo(EEW), VLMul, LMUL> { 1334fe6060f1SDimitry Andric let mayLoad = 0; 1335e8d8bef9SDimitry Andric let mayStore = 1; 1336e8d8bef9SDimitry Andric let hasSideEffects = 0; 1337e8d8bef9SDimitry Andric let HasVLOp = 1; 1338e8d8bef9SDimitry Andric let HasSEWOp = 1; 1339e8d8bef9SDimitry Andric} 1340e8d8bef9SDimitry Andric 1341fe6060f1SDimitry Andricclass VPseudoIStoreMask<VReg StClass, VReg IdxClass, int EEW, bits<3> LMUL, 1342fe6060f1SDimitry Andric bit Ordered>: 1343e8d8bef9SDimitry Andric Pseudo<(outs), 13445f757f3fSDimitry Andric (ins StClass:$rd, GPRMem:$rs1, IdxClass:$rs2, 13455f757f3fSDimitry Andric VMaskOp:$vm, AVL:$vl, ixlenimm:$sew),[]>, 1346fe6060f1SDimitry Andric RISCVVPseudo, 134706c3fb27SDimitry Andric RISCVVSX</*Masked*/1, Ordered, !logtwo(EEW), VLMul, LMUL> { 1348e8d8bef9SDimitry Andric let mayLoad = 0; 1349e8d8bef9SDimitry Andric let mayStore = 1; 1350e8d8bef9SDimitry Andric let hasSideEffects = 0; 1351e8d8bef9SDimitry Andric let HasVLOp = 1; 1352e8d8bef9SDimitry Andric let HasSEWOp = 1; 1353e8d8bef9SDimitry Andric} 1354e8d8bef9SDimitry Andric 135581ad6265SDimitry Andricclass VPseudoBinaryMaskPolicy<VReg RetClass, 1356349cc55cSDimitry Andric RegisterClass Op1Class, 1357349cc55cSDimitry Andric DAGOperand Op2Class, 13585f757f3fSDimitry Andric string Constraint, 13595f757f3fSDimitry Andric int TargetConstraintType = 1> : 1360349cc55cSDimitry Andric Pseudo<(outs GetVRegNoV0<RetClass>.R:$rd), 1361349cc55cSDimitry Andric (ins GetVRegNoV0<RetClass>.R:$merge, 1362349cc55cSDimitry Andric Op1Class:$rs2, Op2Class:$rs1, 1363349cc55cSDimitry Andric VMaskOp:$vm, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, 1364349cc55cSDimitry Andric RISCVVPseudo { 1365349cc55cSDimitry Andric let mayLoad = 0; 1366349cc55cSDimitry Andric let mayStore = 0; 1367349cc55cSDimitry Andric let hasSideEffects = 0; 136806c3fb27SDimitry Andric let Constraints = !interleave([Constraint, "$rd = $merge"], ","); 13695f757f3fSDimitry Andric let TargetOverlapConstraintType = TargetConstraintType; 1370349cc55cSDimitry Andric let HasVLOp = 1; 1371349cc55cSDimitry Andric let HasSEWOp = 1; 1372349cc55cSDimitry Andric let HasVecPolicyOp = 1; 137381ad6265SDimitry Andric let UsesMaskPolicy = 1; 1374349cc55cSDimitry Andric} 1375349cc55cSDimitry Andric 137606c3fb27SDimitry Andricclass VPseudoTernaryMaskPolicy<VReg RetClass, 137706c3fb27SDimitry Andric RegisterClass Op1Class, 1378*0fca6ea1SDimitry Andric DAGOperand Op2Class> : 137906c3fb27SDimitry Andric Pseudo<(outs GetVRegNoV0<RetClass>.R:$rd), 138006c3fb27SDimitry Andric (ins GetVRegNoV0<RetClass>.R:$merge, 138106c3fb27SDimitry Andric Op1Class:$rs2, Op2Class:$rs1, 138206c3fb27SDimitry Andric VMaskOp:$vm, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, 138306c3fb27SDimitry Andric RISCVVPseudo { 138406c3fb27SDimitry Andric let mayLoad = 0; 138506c3fb27SDimitry Andric let mayStore = 0; 138606c3fb27SDimitry Andric let hasSideEffects = 0; 1387*0fca6ea1SDimitry Andric let Constraints = "$rd = $merge"; 138806c3fb27SDimitry Andric let HasVLOp = 1; 138906c3fb27SDimitry Andric let HasSEWOp = 1; 139006c3fb27SDimitry Andric let HasVecPolicyOp = 1; 139106c3fb27SDimitry Andric} 139206c3fb27SDimitry Andric 139306c3fb27SDimitry Andricclass VPseudoTernaryMaskPolicyRoundingMode<VReg RetClass, 139406c3fb27SDimitry Andric RegisterClass Op1Class, 1395*0fca6ea1SDimitry Andric DAGOperand Op2Class> : 139606c3fb27SDimitry Andric Pseudo<(outs GetVRegNoV0<RetClass>.R:$rd), 139706c3fb27SDimitry Andric (ins GetVRegNoV0<RetClass>.R:$merge, 139806c3fb27SDimitry Andric Op1Class:$rs2, Op2Class:$rs1, 139906c3fb27SDimitry Andric VMaskOp:$vm, 140006c3fb27SDimitry Andric ixlenimm:$rm, 140106c3fb27SDimitry Andric AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, 140206c3fb27SDimitry Andric RISCVVPseudo { 140306c3fb27SDimitry Andric let mayLoad = 0; 140406c3fb27SDimitry Andric let mayStore = 0; 140506c3fb27SDimitry Andric let hasSideEffects = 0; 1406*0fca6ea1SDimitry Andric let Constraints = "$rd = $merge"; 140706c3fb27SDimitry Andric let HasVLOp = 1; 140806c3fb27SDimitry Andric let HasSEWOp = 1; 140906c3fb27SDimitry Andric let HasVecPolicyOp = 1; 141006c3fb27SDimitry Andric let HasRoundModeOp = 1; 141106c3fb27SDimitry Andric let UsesVXRM = 0; 141206c3fb27SDimitry Andric} 141306c3fb27SDimitry Andric 1414*0fca6ea1SDimitry Andric// Like VPseudoBinaryMaskPolicy, but output can be V0 and there is no policy. 1415fe6060f1SDimitry Andricclass VPseudoBinaryMOutMask<VReg RetClass, 1416fe6060f1SDimitry Andric RegisterClass Op1Class, 1417fe6060f1SDimitry Andric DAGOperand Op2Class, 14185f757f3fSDimitry Andric string Constraint, 14195f757f3fSDimitry Andric int TargetConstraintType = 1> : 1420fe6060f1SDimitry Andric Pseudo<(outs RetClass:$rd), 1421fe6060f1SDimitry Andric (ins RetClass:$merge, 1422fe6060f1SDimitry Andric Op1Class:$rs2, Op2Class:$rs1, 1423fe6060f1SDimitry Andric VMaskOp:$vm, AVL:$vl, ixlenimm:$sew), []>, 1424fe6060f1SDimitry Andric RISCVVPseudo { 1425fe6060f1SDimitry Andric let mayLoad = 0; 1426fe6060f1SDimitry Andric let mayStore = 0; 1427fe6060f1SDimitry Andric let hasSideEffects = 0; 142806c3fb27SDimitry Andric let Constraints = !interleave([Constraint, "$rd = $merge"], ","); 14295f757f3fSDimitry Andric let TargetOverlapConstraintType = TargetConstraintType; 1430fe6060f1SDimitry Andric let HasVLOp = 1; 1431fe6060f1SDimitry Andric let HasSEWOp = 1; 143281ad6265SDimitry Andric let UsesMaskPolicy = 1; 1433fe6060f1SDimitry Andric} 1434fe6060f1SDimitry Andric 1435*0fca6ea1SDimitry Andric// Special version of VPseudoBinaryMaskPolicy where we pretend the first source 1436*0fca6ea1SDimitry Andric// is tied to the destination so we can workaround the earlyclobber constraint. 1437fe6060f1SDimitry Andric// This allows maskedoff and rs2 to be the same register. 1438fe6060f1SDimitry Andricclass VPseudoTiedBinaryMask<VReg RetClass, 1439fe6060f1SDimitry Andric DAGOperand Op2Class, 14405f757f3fSDimitry Andric string Constraint, 14415f757f3fSDimitry Andric int TargetConstraintType = 1> : 1442fe6060f1SDimitry Andric Pseudo<(outs GetVRegNoV0<RetClass>.R:$rd), 1443fe6060f1SDimitry Andric (ins GetVRegNoV0<RetClass>.R:$merge, 1444fe6060f1SDimitry Andric Op2Class:$rs1, 1445349cc55cSDimitry Andric VMaskOp:$vm, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, 1446fe6060f1SDimitry Andric RISCVVPseudo { 1447fe6060f1SDimitry Andric let mayLoad = 0; 1448fe6060f1SDimitry Andric let mayStore = 0; 1449fe6060f1SDimitry Andric let hasSideEffects = 0; 145006c3fb27SDimitry Andric let Constraints = !interleave([Constraint, "$rd = $merge"], ","); 14515f757f3fSDimitry Andric let TargetOverlapConstraintType = TargetConstraintType; 1452fe6060f1SDimitry Andric let HasVLOp = 1; 1453fe6060f1SDimitry Andric let HasSEWOp = 1; 1454349cc55cSDimitry Andric let HasVecPolicyOp = 1; 145581ad6265SDimitry Andric let UsesMaskPolicy = 1; 145606c3fb27SDimitry Andric let IsTiedPseudo = 1; 145706c3fb27SDimitry Andric} 145806c3fb27SDimitry Andric 145906c3fb27SDimitry Andricclass VPseudoTiedBinaryMaskRoundingMode<VReg RetClass, 146006c3fb27SDimitry Andric DAGOperand Op2Class, 14615f757f3fSDimitry Andric string Constraint, 14625f757f3fSDimitry Andric int TargetConstraintType = 1> : 146306c3fb27SDimitry Andric Pseudo<(outs GetVRegNoV0<RetClass>.R:$rd), 146406c3fb27SDimitry Andric (ins GetVRegNoV0<RetClass>.R:$merge, 146506c3fb27SDimitry Andric Op2Class:$rs1, 146606c3fb27SDimitry Andric VMaskOp:$vm, 146706c3fb27SDimitry Andric ixlenimm:$rm, 146806c3fb27SDimitry Andric AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, 146906c3fb27SDimitry Andric RISCVVPseudo { 147006c3fb27SDimitry Andric let mayLoad = 0; 147106c3fb27SDimitry Andric let mayStore = 0; 147206c3fb27SDimitry Andric let hasSideEffects = 0; 147306c3fb27SDimitry Andric let Constraints = !interleave([Constraint, "$rd = $merge"], ","); 14745f757f3fSDimitry Andric let TargetOverlapConstraintType = TargetConstraintType; 147506c3fb27SDimitry Andric let HasVLOp = 1; 147606c3fb27SDimitry Andric let HasSEWOp = 1; 147706c3fb27SDimitry Andric let HasVecPolicyOp = 1; 147806c3fb27SDimitry Andric let UsesMaskPolicy = 1; 147906c3fb27SDimitry Andric let IsTiedPseudo = 1; 148006c3fb27SDimitry Andric let HasRoundModeOp = 1; 148106c3fb27SDimitry Andric let UsesVXRM = 0; 1482fe6060f1SDimitry Andric} 1483fe6060f1SDimitry Andric 1484*0fca6ea1SDimitry Andricclass VPseudoBinaryCarry<VReg RetClass, 1485e8d8bef9SDimitry Andric VReg Op1Class, 1486e8d8bef9SDimitry Andric DAGOperand Op2Class, 1487e8d8bef9SDimitry Andric LMULInfo MInfo, 1488e8d8bef9SDimitry Andric bit CarryIn, 14895f757f3fSDimitry Andric string Constraint, 14905f757f3fSDimitry Andric int TargetConstraintType = 1> : 1491e8d8bef9SDimitry Andric Pseudo<(outs RetClass:$rd), 1492e8d8bef9SDimitry Andric !if(CarryIn, 14935f757f3fSDimitry Andric (ins Op1Class:$rs2, Op2Class:$rs1, 14945f757f3fSDimitry Andric VMV0:$carry, AVL:$vl, ixlenimm:$sew), 14955f757f3fSDimitry Andric (ins Op1Class:$rs2, Op2Class:$rs1, 14965f757f3fSDimitry Andric AVL:$vl, ixlenimm:$sew)), []>, 1497e8d8bef9SDimitry Andric RISCVVPseudo { 1498e8d8bef9SDimitry Andric let mayLoad = 0; 1499e8d8bef9SDimitry Andric let mayStore = 0; 1500e8d8bef9SDimitry Andric let hasSideEffects = 0; 1501e8d8bef9SDimitry Andric let Constraints = Constraint; 15025f757f3fSDimitry Andric let TargetOverlapConstraintType = TargetConstraintType; 1503e8d8bef9SDimitry Andric let HasVLOp = 1; 1504e8d8bef9SDimitry Andric let HasSEWOp = 1; 1505e8d8bef9SDimitry Andric let VLMul = MInfo.value; 1506e8d8bef9SDimitry Andric} 1507e8d8bef9SDimitry Andric 150804eeddc0SDimitry Andricclass VPseudoTiedBinaryCarryIn<VReg RetClass, 150904eeddc0SDimitry Andric VReg Op1Class, 151004eeddc0SDimitry Andric DAGOperand Op2Class, 151104eeddc0SDimitry Andric LMULInfo MInfo, 1512647cbc5dSDimitry Andric int TargetConstraintType = 1> : 151304eeddc0SDimitry Andric Pseudo<(outs RetClass:$rd), 15145f757f3fSDimitry Andric (ins RetClass:$merge, Op1Class:$rs2, Op2Class:$rs1, 1515*0fca6ea1SDimitry Andric VMV0:$carry, AVL:$vl, ixlenimm:$sew), []>, 151604eeddc0SDimitry Andric RISCVVPseudo { 151704eeddc0SDimitry Andric let mayLoad = 0; 151804eeddc0SDimitry Andric let mayStore = 0; 151904eeddc0SDimitry Andric let hasSideEffects = 0; 1520*0fca6ea1SDimitry Andric let Constraints = "$rd = $merge"; 1521647cbc5dSDimitry Andric let TargetOverlapConstraintType = TargetConstraintType; 152204eeddc0SDimitry Andric let HasVLOp = 1; 152304eeddc0SDimitry Andric let HasSEWOp = 1; 152404eeddc0SDimitry Andric let HasVecPolicyOp = 0; 152504eeddc0SDimitry Andric let VLMul = MInfo.value; 152604eeddc0SDimitry Andric} 152704eeddc0SDimitry Andric 1528e8d8bef9SDimitry Andricclass VPseudoTernaryNoMask<VReg RetClass, 1529fe6060f1SDimitry Andric RegisterClass Op1Class, 1530e8d8bef9SDimitry Andric DAGOperand Op2Class, 1531e8d8bef9SDimitry Andric string Constraint> : 1532e8d8bef9SDimitry Andric Pseudo<(outs RetClass:$rd), 1533e8d8bef9SDimitry Andric (ins RetClass:$rs3, Op1Class:$rs1, Op2Class:$rs2, 15345f757f3fSDimitry Andric AVL:$vl, ixlenimm:$sew), []>, 1535e8d8bef9SDimitry Andric RISCVVPseudo { 1536e8d8bef9SDimitry Andric let mayLoad = 0; 1537e8d8bef9SDimitry Andric let mayStore = 0; 1538e8d8bef9SDimitry Andric let hasSideEffects = 0; 153906c3fb27SDimitry Andric let Constraints = !interleave([Constraint, "$rd = $rs3"], ","); 1540e8d8bef9SDimitry Andric let HasVLOp = 1; 1541e8d8bef9SDimitry Andric let HasSEWOp = 1; 1542e8d8bef9SDimitry Andric} 1543e8d8bef9SDimitry Andric 1544349cc55cSDimitry Andricclass VPseudoTernaryNoMaskWithPolicy<VReg RetClass, 1545349cc55cSDimitry Andric RegisterClass Op1Class, 1546349cc55cSDimitry Andric DAGOperand Op2Class, 1547*0fca6ea1SDimitry Andric string Constraint = "", 15485f757f3fSDimitry Andric int TargetConstraintType = 1> : 1549349cc55cSDimitry Andric Pseudo<(outs RetClass:$rd), 1550349cc55cSDimitry Andric (ins RetClass:$rs3, Op1Class:$rs1, Op2Class:$rs2, 15515f757f3fSDimitry Andric AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, 1552349cc55cSDimitry Andric RISCVVPseudo { 1553349cc55cSDimitry Andric let mayLoad = 0; 1554349cc55cSDimitry Andric let mayStore = 0; 1555349cc55cSDimitry Andric let hasSideEffects = 0; 155606c3fb27SDimitry Andric let Constraints = !interleave([Constraint, "$rd = $rs3"], ","); 15575f757f3fSDimitry Andric let TargetOverlapConstraintType = TargetConstraintType; 1558349cc55cSDimitry Andric let HasVecPolicyOp = 1; 1559349cc55cSDimitry Andric let HasVLOp = 1; 1560349cc55cSDimitry Andric let HasSEWOp = 1; 156106c3fb27SDimitry Andric} 156206c3fb27SDimitry Andric 156306c3fb27SDimitry Andricclass VPseudoTernaryNoMaskWithPolicyRoundingMode<VReg RetClass, 156406c3fb27SDimitry Andric RegisterClass Op1Class, 156506c3fb27SDimitry Andric DAGOperand Op2Class, 1566*0fca6ea1SDimitry Andric string Constraint = "", 15675f757f3fSDimitry Andric int TargetConstraintType = 1> : 156806c3fb27SDimitry Andric Pseudo<(outs RetClass:$rd), 156906c3fb27SDimitry Andric (ins RetClass:$rs3, Op1Class:$rs1, Op2Class:$rs2, 15705f757f3fSDimitry Andric ixlenimm:$rm, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, 157106c3fb27SDimitry Andric RISCVVPseudo { 157206c3fb27SDimitry Andric let mayLoad = 0; 157306c3fb27SDimitry Andric let mayStore = 0; 157406c3fb27SDimitry Andric let hasSideEffects = 0; 157506c3fb27SDimitry Andric let Constraints = !interleave([Constraint, "$rd = $rs3"], ","); 15765f757f3fSDimitry Andric let TargetOverlapConstraintType = TargetConstraintType; 157706c3fb27SDimitry Andric let HasVecPolicyOp = 1; 157806c3fb27SDimitry Andric let HasVLOp = 1; 157906c3fb27SDimitry Andric let HasSEWOp = 1; 158006c3fb27SDimitry Andric let HasRoundModeOp = 1; 158106c3fb27SDimitry Andric let UsesVXRM = 0; 1582349cc55cSDimitry Andric} 1583349cc55cSDimitry Andric 15845f757f3fSDimitry Andricclass VPseudoUSSegLoadNoMask<VReg RetClass, 15855f757f3fSDimitry Andric int EEW, 15865f757f3fSDimitry Andric bits<4> NF> : 1587e8d8bef9SDimitry Andric Pseudo<(outs RetClass:$rd), 158806c3fb27SDimitry Andric (ins RetClass:$dest, GPRMem:$rs1, AVL:$vl, 158906c3fb27SDimitry Andric ixlenimm:$sew, ixlenimm:$policy), []>, 1590e8d8bef9SDimitry Andric RISCVVPseudo, 159106c3fb27SDimitry Andric RISCVVLSEG<NF, /*Masked*/0, /*Strided*/0, /*FF*/0, !logtwo(EEW), VLMul> { 1592e8d8bef9SDimitry Andric let mayLoad = 1; 1593e8d8bef9SDimitry Andric let mayStore = 0; 1594e8d8bef9SDimitry Andric let hasSideEffects = 0; 1595e8d8bef9SDimitry Andric let HasVLOp = 1; 1596e8d8bef9SDimitry Andric let HasSEWOp = 1; 159706c3fb27SDimitry Andric let HasVecPolicyOp = 1; 159881ad6265SDimitry Andric let Constraints = "$rd = $dest"; 159981ad6265SDimitry Andric} 160081ad6265SDimitry Andric 16015f757f3fSDimitry Andricclass VPseudoUSSegLoadMask<VReg RetClass, 16025f757f3fSDimitry Andric int EEW, 16035f757f3fSDimitry Andric bits<4> NF> : 1604e8d8bef9SDimitry Andric Pseudo<(outs GetVRegNoV0<RetClass>.R:$rd), 1605bdd1243dSDimitry Andric (ins GetVRegNoV0<RetClass>.R:$merge, GPRMem:$rs1, 1606349cc55cSDimitry Andric VMaskOp:$vm, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy), []>, 1607e8d8bef9SDimitry Andric RISCVVPseudo, 160806c3fb27SDimitry Andric RISCVVLSEG<NF, /*Masked*/1, /*Strided*/0, /*FF*/0, !logtwo(EEW), VLMul> { 1609e8d8bef9SDimitry Andric let mayLoad = 1; 1610e8d8bef9SDimitry Andric let mayStore = 0; 1611e8d8bef9SDimitry Andric let hasSideEffects = 0; 1612e8d8bef9SDimitry Andric let Constraints = "$rd = $merge"; 1613e8d8bef9SDimitry Andric let HasVLOp = 1; 1614e8d8bef9SDimitry Andric let HasSEWOp = 1; 1615349cc55cSDimitry Andric let HasVecPolicyOp = 1; 161681ad6265SDimitry Andric let UsesMaskPolicy = 1; 161781ad6265SDimitry Andric} 161881ad6265SDimitry Andric 16195f757f3fSDimitry Andricclass VPseudoUSSegLoadFFNoMask<VReg RetClass, 16205f757f3fSDimitry Andric int EEW, 16215f757f3fSDimitry Andric bits<4> NF> : 162281ad6265SDimitry Andric Pseudo<(outs RetClass:$rd, GPR:$vl), 162306c3fb27SDimitry Andric (ins RetClass:$dest, GPRMem:$rs1, AVL:$avl, 162406c3fb27SDimitry Andric ixlenimm:$sew, ixlenimm:$policy), []>, 162581ad6265SDimitry Andric RISCVVPseudo, 162606c3fb27SDimitry Andric RISCVVLSEG<NF, /*Masked*/0, /*Strided*/0, /*FF*/1, !logtwo(EEW), VLMul> { 162781ad6265SDimitry Andric let mayLoad = 1; 162881ad6265SDimitry Andric let mayStore = 0; 162981ad6265SDimitry Andric let hasSideEffects = 0; 163081ad6265SDimitry Andric let HasVLOp = 1; 163181ad6265SDimitry Andric let HasSEWOp = 1; 163206c3fb27SDimitry Andric let HasVecPolicyOp = 1; 163381ad6265SDimitry Andric let Constraints = "$rd = $dest"; 163481ad6265SDimitry Andric} 163581ad6265SDimitry Andric 16365f757f3fSDimitry Andricclass VPseudoUSSegLoadFFMask<VReg RetClass, 16375f757f3fSDimitry Andric int EEW, 16385f757f3fSDimitry Andric bits<4> NF> : 163981ad6265SDimitry Andric Pseudo<(outs GetVRegNoV0<RetClass>.R:$rd, GPR:$vl), 1640bdd1243dSDimitry Andric (ins GetVRegNoV0<RetClass>.R:$merge, GPRMem:$rs1, 164181ad6265SDimitry Andric VMaskOp:$vm, AVL:$avl, ixlenimm:$sew, ixlenimm:$policy), []>, 164281ad6265SDimitry Andric RISCVVPseudo, 164306c3fb27SDimitry Andric RISCVVLSEG<NF, /*Masked*/1, /*Strided*/0, /*FF*/1, !logtwo(EEW), VLMul> { 164481ad6265SDimitry Andric let mayLoad = 1; 164581ad6265SDimitry Andric let mayStore = 0; 164681ad6265SDimitry Andric let hasSideEffects = 0; 164781ad6265SDimitry Andric let Constraints = "$rd = $merge"; 164881ad6265SDimitry Andric let HasVLOp = 1; 164981ad6265SDimitry Andric let HasSEWOp = 1; 165081ad6265SDimitry Andric let HasVecPolicyOp = 1; 165181ad6265SDimitry Andric let UsesMaskPolicy = 1; 1652e8d8bef9SDimitry Andric} 1653e8d8bef9SDimitry Andric 16545f757f3fSDimitry Andricclass VPseudoSSegLoadNoMask<VReg RetClass, 16555f757f3fSDimitry Andric int EEW, 16565f757f3fSDimitry Andric bits<4> NF> : 1657e8d8bef9SDimitry Andric Pseudo<(outs RetClass:$rd), 165806c3fb27SDimitry Andric (ins RetClass:$merge, GPRMem:$rs1, GPR:$offset, AVL:$vl, 165906c3fb27SDimitry Andric ixlenimm:$sew, ixlenimm:$policy), []>, 1660e8d8bef9SDimitry Andric RISCVVPseudo, 166106c3fb27SDimitry Andric RISCVVLSEG<NF, /*Masked*/0, /*Strided*/1, /*FF*/0, !logtwo(EEW), VLMul> { 1662fe6060f1SDimitry Andric let mayLoad = 1; 1663e8d8bef9SDimitry Andric let mayStore = 0; 1664e8d8bef9SDimitry Andric let hasSideEffects = 0; 1665e8d8bef9SDimitry Andric let HasVLOp = 1; 1666e8d8bef9SDimitry Andric let HasSEWOp = 1; 166706c3fb27SDimitry Andric let HasVecPolicyOp = 1; 166881ad6265SDimitry Andric let Constraints = "$rd = $merge"; 1669e8d8bef9SDimitry Andric} 1670e8d8bef9SDimitry Andric 16715f757f3fSDimitry Andricclass VPseudoSSegLoadMask<VReg RetClass, 16725f757f3fSDimitry Andric int EEW, 16735f757f3fSDimitry Andric bits<4> NF> : 1674e8d8bef9SDimitry Andric Pseudo<(outs GetVRegNoV0<RetClass>.R:$rd), 1675bdd1243dSDimitry Andric (ins GetVRegNoV0<RetClass>.R:$merge, GPRMem:$rs1, 1676349cc55cSDimitry Andric GPR:$offset, VMaskOp:$vm, AVL:$vl, ixlenimm:$sew, 1677349cc55cSDimitry Andric ixlenimm:$policy), []>, 1678e8d8bef9SDimitry Andric RISCVVPseudo, 167906c3fb27SDimitry Andric RISCVVLSEG<NF, /*Masked*/1, /*Strided*/1, /*FF*/0, !logtwo(EEW), VLMul> { 1680e8d8bef9SDimitry Andric let mayLoad = 1; 1681e8d8bef9SDimitry Andric let mayStore = 0; 1682e8d8bef9SDimitry Andric let hasSideEffects = 0; 1683e8d8bef9SDimitry Andric let Constraints = "$rd = $merge"; 1684e8d8bef9SDimitry Andric let HasVLOp = 1; 1685e8d8bef9SDimitry Andric let HasSEWOp = 1; 1686349cc55cSDimitry Andric let HasVecPolicyOp = 1; 168781ad6265SDimitry Andric let UsesMaskPolicy = 1; 1688e8d8bef9SDimitry Andric} 1689e8d8bef9SDimitry Andric 16905f757f3fSDimitry Andricclass VPseudoISegLoadNoMask<VReg RetClass, 16915f757f3fSDimitry Andric VReg IdxClass, 16925f757f3fSDimitry Andric int EEW, 16935f757f3fSDimitry Andric bits<3> LMUL, 16945f757f3fSDimitry Andric bits<4> NF, 16955f757f3fSDimitry Andric bit Ordered> : 1696e8d8bef9SDimitry Andric Pseudo<(outs RetClass:$rd), 169706c3fb27SDimitry Andric (ins RetClass:$merge, GPRMem:$rs1, IdxClass:$offset, AVL:$vl, 169806c3fb27SDimitry Andric ixlenimm:$sew, ixlenimm:$policy), []>, 1699e8d8bef9SDimitry Andric RISCVVPseudo, 170006c3fb27SDimitry Andric RISCVVLXSEG<NF, /*Masked*/0, Ordered, !logtwo(EEW), VLMul, LMUL> { 170181ad6265SDimitry Andric let mayLoad = 1; 170281ad6265SDimitry Andric let mayStore = 0; 170381ad6265SDimitry Andric let hasSideEffects = 0; 170481ad6265SDimitry Andric // For vector indexed segment loads, the destination vector register groups 170581ad6265SDimitry Andric // cannot overlap the source vector register group 170681ad6265SDimitry Andric let Constraints = "@earlyclobber $rd, $rd = $merge"; 170781ad6265SDimitry Andric let HasVLOp = 1; 170881ad6265SDimitry Andric let HasSEWOp = 1; 170906c3fb27SDimitry Andric let HasVecPolicyOp = 1; 1710e8d8bef9SDimitry Andric} 1711e8d8bef9SDimitry Andric 17125f757f3fSDimitry Andricclass VPseudoISegLoadMask<VReg RetClass, 17135f757f3fSDimitry Andric VReg IdxClass, 17145f757f3fSDimitry Andric int EEW, 17155f757f3fSDimitry Andric bits<3> LMUL, 17165f757f3fSDimitry Andric bits<4> NF, 17175f757f3fSDimitry Andric bit Ordered> : 1718e8d8bef9SDimitry Andric Pseudo<(outs GetVRegNoV0<RetClass>.R:$rd), 1719bdd1243dSDimitry Andric (ins GetVRegNoV0<RetClass>.R:$merge, GPRMem:$rs1, 1720349cc55cSDimitry Andric IdxClass:$offset, VMaskOp:$vm, AVL:$vl, ixlenimm:$sew, 1721349cc55cSDimitry Andric ixlenimm:$policy), []>, 1722e8d8bef9SDimitry Andric RISCVVPseudo, 172306c3fb27SDimitry Andric RISCVVLXSEG<NF, /*Masked*/1, Ordered, !logtwo(EEW), VLMul, LMUL> { 1724e8d8bef9SDimitry Andric let mayLoad = 1; 1725e8d8bef9SDimitry Andric let mayStore = 0; 1726e8d8bef9SDimitry Andric let hasSideEffects = 0; 1727e8d8bef9SDimitry Andric // For vector indexed segment loads, the destination vector register groups 1728e8d8bef9SDimitry Andric // cannot overlap the source vector register group 1729e8d8bef9SDimitry Andric let Constraints = "@earlyclobber $rd, $rd = $merge"; 1730e8d8bef9SDimitry Andric let HasVLOp = 1; 1731e8d8bef9SDimitry Andric let HasSEWOp = 1; 1732349cc55cSDimitry Andric let HasVecPolicyOp = 1; 173381ad6265SDimitry Andric let UsesMaskPolicy = 1; 1734e8d8bef9SDimitry Andric} 1735e8d8bef9SDimitry Andric 17365f757f3fSDimitry Andricclass VPseudoUSSegStoreNoMask<VReg ValClass, 17375f757f3fSDimitry Andric int EEW, 17385f757f3fSDimitry Andric bits<4> NF> : 1739e8d8bef9SDimitry Andric Pseudo<(outs), 1740bdd1243dSDimitry Andric (ins ValClass:$rd, GPRMem:$rs1, AVL:$vl, ixlenimm:$sew), []>, 1741e8d8bef9SDimitry Andric RISCVVPseudo, 174206c3fb27SDimitry Andric RISCVVSSEG<NF, /*Masked*/0, /*Strided*/0, !logtwo(EEW), VLMul> { 1743e8d8bef9SDimitry Andric let mayLoad = 0; 1744e8d8bef9SDimitry Andric let mayStore = 1; 1745e8d8bef9SDimitry Andric let hasSideEffects = 0; 1746e8d8bef9SDimitry Andric let HasVLOp = 1; 1747e8d8bef9SDimitry Andric let HasSEWOp = 1; 1748e8d8bef9SDimitry Andric} 1749e8d8bef9SDimitry Andric 17505f757f3fSDimitry Andricclass VPseudoUSSegStoreMask<VReg ValClass, 17515f757f3fSDimitry Andric int EEW, 17525f757f3fSDimitry Andric bits<4> NF> : 1753e8d8bef9SDimitry Andric Pseudo<(outs), 1754bdd1243dSDimitry Andric (ins ValClass:$rd, GPRMem:$rs1, 1755fe6060f1SDimitry Andric VMaskOp:$vm, AVL:$vl, ixlenimm:$sew), []>, 1756e8d8bef9SDimitry Andric RISCVVPseudo, 175706c3fb27SDimitry Andric RISCVVSSEG<NF, /*Masked*/1, /*Strided*/0, !logtwo(EEW), VLMul> { 1758e8d8bef9SDimitry Andric let mayLoad = 0; 1759e8d8bef9SDimitry Andric let mayStore = 1; 1760e8d8bef9SDimitry Andric let hasSideEffects = 0; 1761e8d8bef9SDimitry Andric let HasVLOp = 1; 1762e8d8bef9SDimitry Andric let HasSEWOp = 1; 1763e8d8bef9SDimitry Andric} 1764e8d8bef9SDimitry Andric 17655f757f3fSDimitry Andricclass VPseudoSSegStoreNoMask<VReg ValClass, 17665f757f3fSDimitry Andric int EEW, 17675f757f3fSDimitry Andric bits<4> NF> : 1768e8d8bef9SDimitry Andric Pseudo<(outs), 17695f757f3fSDimitry Andric (ins ValClass:$rd, GPRMem:$rs1, GPR:$offset, 17705f757f3fSDimitry Andric AVL:$vl, ixlenimm:$sew), []>, 1771e8d8bef9SDimitry Andric RISCVVPseudo, 177206c3fb27SDimitry Andric RISCVVSSEG<NF, /*Masked*/0, /*Strided*/1, !logtwo(EEW), VLMul> { 1773e8d8bef9SDimitry Andric let mayLoad = 0; 1774e8d8bef9SDimitry Andric let mayStore = 1; 1775e8d8bef9SDimitry Andric let hasSideEffects = 0; 1776e8d8bef9SDimitry Andric let HasVLOp = 1; 1777e8d8bef9SDimitry Andric let HasSEWOp = 1; 1778e8d8bef9SDimitry Andric} 1779e8d8bef9SDimitry Andric 17805f757f3fSDimitry Andricclass VPseudoSSegStoreMask<VReg ValClass, 17815f757f3fSDimitry Andric int EEW, 17825f757f3fSDimitry Andric bits<4> NF> : 1783e8d8bef9SDimitry Andric Pseudo<(outs), 1784bdd1243dSDimitry Andric (ins ValClass:$rd, GPRMem:$rs1, GPR: $offset, 1785fe6060f1SDimitry Andric VMaskOp:$vm, AVL:$vl, ixlenimm:$sew), []>, 1786e8d8bef9SDimitry Andric RISCVVPseudo, 178706c3fb27SDimitry Andric RISCVVSSEG<NF, /*Masked*/1, /*Strided*/1, !logtwo(EEW), VLMul> { 1788e8d8bef9SDimitry Andric let mayLoad = 0; 1789e8d8bef9SDimitry Andric let mayStore = 1; 1790e8d8bef9SDimitry Andric let hasSideEffects = 0; 1791e8d8bef9SDimitry Andric let HasVLOp = 1; 1792e8d8bef9SDimitry Andric let HasSEWOp = 1; 1793e8d8bef9SDimitry Andric} 1794e8d8bef9SDimitry Andric 17955f757f3fSDimitry Andricclass VPseudoISegStoreNoMask<VReg ValClass, 17965f757f3fSDimitry Andric VReg IdxClass, 17975f757f3fSDimitry Andric int EEW, 17985f757f3fSDimitry Andric bits<3> LMUL, 17995f757f3fSDimitry Andric bits<4> NF, 18005f757f3fSDimitry Andric bit Ordered> : 1801e8d8bef9SDimitry Andric Pseudo<(outs), 1802bdd1243dSDimitry Andric (ins ValClass:$rd, GPRMem:$rs1, IdxClass: $index, 1803fe6060f1SDimitry Andric AVL:$vl, ixlenimm:$sew), []>, 1804e8d8bef9SDimitry Andric RISCVVPseudo, 180506c3fb27SDimitry Andric RISCVVSXSEG<NF, /*Masked*/0, Ordered, !logtwo(EEW), VLMul, LMUL> { 1806e8d8bef9SDimitry Andric let mayLoad = 0; 1807e8d8bef9SDimitry Andric let mayStore = 1; 1808e8d8bef9SDimitry Andric let hasSideEffects = 0; 1809e8d8bef9SDimitry Andric let HasVLOp = 1; 1810e8d8bef9SDimitry Andric let HasSEWOp = 1; 1811e8d8bef9SDimitry Andric} 1812e8d8bef9SDimitry Andric 18135f757f3fSDimitry Andricclass VPseudoISegStoreMask<VReg ValClass, 18145f757f3fSDimitry Andric VReg IdxClass, 18155f757f3fSDimitry Andric int EEW, 18165f757f3fSDimitry Andric bits<3> LMUL, 18175f757f3fSDimitry Andric bits<4> NF, 18185f757f3fSDimitry Andric bit Ordered> : 1819e8d8bef9SDimitry Andric Pseudo<(outs), 1820bdd1243dSDimitry Andric (ins ValClass:$rd, GPRMem:$rs1, IdxClass: $index, 1821fe6060f1SDimitry Andric VMaskOp:$vm, AVL:$vl, ixlenimm:$sew), []>, 1822e8d8bef9SDimitry Andric RISCVVPseudo, 182306c3fb27SDimitry Andric RISCVVSXSEG<NF, /*Masked*/1, Ordered, !logtwo(EEW), VLMul, LMUL> { 1824e8d8bef9SDimitry Andric let mayLoad = 0; 1825e8d8bef9SDimitry Andric let mayStore = 1; 1826e8d8bef9SDimitry Andric let hasSideEffects = 0; 1827e8d8bef9SDimitry Andric let HasVLOp = 1; 1828e8d8bef9SDimitry Andric let HasSEWOp = 1; 1829e8d8bef9SDimitry Andric} 1830e8d8bef9SDimitry Andric 18310eae32dcSDimitry Andricmulticlass VPseudoUSLoad { 1832fe6060f1SDimitry Andric foreach eew = EEWList in { 1833fe6060f1SDimitry Andric foreach lmul = MxSet<eew>.m in { 1834e8d8bef9SDimitry Andric defvar LInfo = lmul.MX; 1835e8d8bef9SDimitry Andric defvar vreg = lmul.vrclass; 183606c3fb27SDimitry Andric let VLMul = lmul.value, SEW=eew in { 18370eae32dcSDimitry Andric def "E" # eew # "_V_" # LInfo : 183881ad6265SDimitry Andric VPseudoUSLoadNoMask<vreg, eew>, 1839bdd1243dSDimitry Andric VLESched<LInfo>; 18400eae32dcSDimitry Andric def "E" # eew # "_V_" # LInfo # "_MASK" : 184181ad6265SDimitry Andric VPseudoUSLoadMask<vreg, eew>, 184206c3fb27SDimitry Andric RISCVMaskedPseudo<MaskIdx=2>, 1843bdd1243dSDimitry Andric VLESched<LInfo>; 18440eae32dcSDimitry Andric } 18450eae32dcSDimitry Andric } 18460eae32dcSDimitry Andric } 18470eae32dcSDimitry Andric} 18480eae32dcSDimitry Andric 18490eae32dcSDimitry Andricmulticlass VPseudoFFLoad { 18500eae32dcSDimitry Andric foreach eew = EEWList in { 18510eae32dcSDimitry Andric foreach lmul = MxSet<eew>.m in { 18520eae32dcSDimitry Andric defvar LInfo = lmul.MX; 18530eae32dcSDimitry Andric defvar vreg = lmul.vrclass; 185406c3fb27SDimitry Andric let VLMul = lmul.value, SEW=eew in { 18550eae32dcSDimitry Andric def "E" # eew # "FF_V_" # LInfo: 185681ad6265SDimitry Andric VPseudoUSLoadFFNoMask<vreg, eew>, 1857bdd1243dSDimitry Andric VLFSched<LInfo>; 18580eae32dcSDimitry Andric def "E" # eew # "FF_V_" # LInfo # "_MASK": 185981ad6265SDimitry Andric VPseudoUSLoadFFMask<vreg, eew>, 186006c3fb27SDimitry Andric RISCVMaskedPseudo<MaskIdx=2>, 1861bdd1243dSDimitry Andric VLFSched<LInfo>; 1862fe6060f1SDimitry Andric } 1863e8d8bef9SDimitry Andric } 1864e8d8bef9SDimitry Andric } 1865e8d8bef9SDimitry Andric} 1866e8d8bef9SDimitry Andric 1867d409305fSDimitry Andricmulticlass VPseudoLoadMask { 1868d409305fSDimitry Andric foreach mti = AllMasks in { 1869bdd1243dSDimitry Andric defvar mx = mti.LMul.MX; 1870bdd1243dSDimitry Andric defvar WriteVLDM_MX = !cast<SchedWrite>("WriteVLDM_" # mx); 1871d409305fSDimitry Andric let VLMul = mti.LMul.value in { 187206c3fb27SDimitry Andric def "_V_" # mti.BX : VPseudoUSLoadNoMask<VR, EEW=1>, 187306c3fb27SDimitry Andric Sched<[WriteVLDM_MX, ReadVLDX]>; 1874d409305fSDimitry Andric } 1875d409305fSDimitry Andric } 1876d409305fSDimitry Andric} 1877d409305fSDimitry Andric 1878e8d8bef9SDimitry Andricmulticlass VPseudoSLoad { 1879fe6060f1SDimitry Andric foreach eew = EEWList in { 1880fe6060f1SDimitry Andric foreach lmul = MxSet<eew>.m in { 1881e8d8bef9SDimitry Andric defvar LInfo = lmul.MX; 1882e8d8bef9SDimitry Andric defvar vreg = lmul.vrclass; 188306c3fb27SDimitry Andric let VLMul = lmul.value, SEW=eew in { 18840eae32dcSDimitry Andric def "E" # eew # "_V_" # LInfo : VPseudoSLoadNoMask<vreg, eew>, 1885bdd1243dSDimitry Andric VLSSched<eew, LInfo>; 1886bdd1243dSDimitry Andric def "E" # eew # "_V_" # LInfo # "_MASK" : 1887bdd1243dSDimitry Andric VPseudoSLoadMask<vreg, eew>, 188806c3fb27SDimitry Andric RISCVMaskedPseudo<MaskIdx=3>, 1889bdd1243dSDimitry Andric VLSSched<eew, LInfo>; 1890fe6060f1SDimitry Andric } 1891e8d8bef9SDimitry Andric } 1892e8d8bef9SDimitry Andric } 1893e8d8bef9SDimitry Andric} 1894e8d8bef9SDimitry Andric 1895fe6060f1SDimitry Andricmulticlass VPseudoILoad<bit Ordered> { 189606c3fb27SDimitry Andric foreach idxEEW = EEWList in { 189706c3fb27SDimitry Andric foreach dataEEW = EEWList in { 189806c3fb27SDimitry Andric foreach dataEMUL = MxSet<dataEEW>.m in { 189906c3fb27SDimitry Andric defvar dataEMULOctuple = dataEMUL.octuple; 1900fe6060f1SDimitry Andric // Calculate emul = eew * lmul / sew 190106c3fb27SDimitry Andric defvar idxEMULOctuple = 190206c3fb27SDimitry Andric !srl(!mul(idxEEW, dataEMULOctuple), !logtwo(dataEEW)); 190306c3fb27SDimitry Andric if !and(!ge(idxEMULOctuple, 1), !le(idxEMULOctuple, 64)) then { 190406c3fb27SDimitry Andric defvar DataLInfo = dataEMUL.MX; 190506c3fb27SDimitry Andric defvar IdxLInfo = octuple_to_str<idxEMULOctuple>.ret; 190606c3fb27SDimitry Andric defvar idxEMUL = !cast<LMULInfo>("V_" # IdxLInfo); 190706c3fb27SDimitry Andric defvar Vreg = dataEMUL.vrclass; 190806c3fb27SDimitry Andric defvar IdxVreg = idxEMUL.vrclass; 190906c3fb27SDimitry Andric defvar HasConstraint = !ne(dataEEW, idxEEW); 19105f757f3fSDimitry Andric defvar TypeConstraints = 19115f757f3fSDimitry Andric !if(!eq(dataEEW, idxEEW), 1, !if(!gt(dataEEW, idxEEW), !if(!ge(idxEMULOctuple, 8), 3, 1), 2)); 191206c3fb27SDimitry Andric let VLMul = dataEMUL.value in { 191306c3fb27SDimitry Andric def "EI" # idxEEW # "_V_" # IdxLInfo # "_" # DataLInfo : 19145f757f3fSDimitry Andric VPseudoILoadNoMask<Vreg, IdxVreg, idxEEW, idxEMUL.value, Ordered, HasConstraint, TypeConstraints>, 19155f757f3fSDimitry Andric VLXSched<dataEEW, Ordered, DataLInfo, IdxLInfo>; 191606c3fb27SDimitry Andric def "EI" # idxEEW # "_V_" # IdxLInfo # "_" # DataLInfo # "_MASK" : 19175f757f3fSDimitry Andric VPseudoILoadMask<Vreg, IdxVreg, idxEEW, idxEMUL.value, Ordered, HasConstraint, TypeConstraints>, 191806c3fb27SDimitry Andric RISCVMaskedPseudo<MaskIdx=3>, 19195f757f3fSDimitry Andric VLXSched<dataEEW, Ordered, DataLInfo, IdxLInfo>; 1920fe6060f1SDimitry Andric } 1921fe6060f1SDimitry Andric } 1922fe6060f1SDimitry Andric } 1923e8d8bef9SDimitry Andric } 1924e8d8bef9SDimitry Andric } 1925e8d8bef9SDimitry Andric} 1926e8d8bef9SDimitry Andric 1927e8d8bef9SDimitry Andricmulticlass VPseudoUSStore { 1928fe6060f1SDimitry Andric foreach eew = EEWList in { 1929fe6060f1SDimitry Andric foreach lmul = MxSet<eew>.m in { 1930e8d8bef9SDimitry Andric defvar LInfo = lmul.MX; 1931e8d8bef9SDimitry Andric defvar vreg = lmul.vrclass; 193206c3fb27SDimitry Andric let VLMul = lmul.value, SEW=eew in { 19330eae32dcSDimitry Andric def "E" # eew # "_V_" # LInfo : VPseudoUSStoreNoMask<vreg, eew>, 1934bdd1243dSDimitry Andric VSESched<LInfo>; 19350eae32dcSDimitry Andric def "E" # eew # "_V_" # LInfo # "_MASK" : VPseudoUSStoreMask<vreg, eew>, 1936bdd1243dSDimitry Andric VSESched<LInfo>; 1937fe6060f1SDimitry Andric } 1938e8d8bef9SDimitry Andric } 1939e8d8bef9SDimitry Andric } 1940e8d8bef9SDimitry Andric} 1941e8d8bef9SDimitry Andric 1942d409305fSDimitry Andricmulticlass VPseudoStoreMask { 1943d409305fSDimitry Andric foreach mti = AllMasks in { 1944bdd1243dSDimitry Andric defvar mx = mti.LMul.MX; 1945bdd1243dSDimitry Andric defvar WriteVSTM_MX = !cast<SchedWrite>("WriteVSTM_" # mx); 1946d409305fSDimitry Andric let VLMul = mti.LMul.value in { 194706c3fb27SDimitry Andric def "_V_" # mti.BX : VPseudoUSStoreNoMask<VR, EEW=1>, 194806c3fb27SDimitry Andric Sched<[WriteVSTM_MX, ReadVSTX]>; 1949d409305fSDimitry Andric } 1950d409305fSDimitry Andric } 1951d409305fSDimitry Andric} 1952d409305fSDimitry Andric 1953e8d8bef9SDimitry Andricmulticlass VPseudoSStore { 1954fe6060f1SDimitry Andric foreach eew = EEWList in { 1955fe6060f1SDimitry Andric foreach lmul = MxSet<eew>.m in { 1956e8d8bef9SDimitry Andric defvar LInfo = lmul.MX; 1957e8d8bef9SDimitry Andric defvar vreg = lmul.vrclass; 195806c3fb27SDimitry Andric let VLMul = lmul.value, SEW=eew in { 19590eae32dcSDimitry Andric def "E" # eew # "_V_" # LInfo : VPseudoSStoreNoMask<vreg, eew>, 1960bdd1243dSDimitry Andric VSSSched<eew, LInfo>; 19610eae32dcSDimitry Andric def "E" # eew # "_V_" # LInfo # "_MASK" : VPseudoSStoreMask<vreg, eew>, 1962bdd1243dSDimitry Andric VSSSched<eew, LInfo>; 1963fe6060f1SDimitry Andric } 1964e8d8bef9SDimitry Andric } 1965e8d8bef9SDimitry Andric } 1966e8d8bef9SDimitry Andric} 1967e8d8bef9SDimitry Andric 1968fe6060f1SDimitry Andricmulticlass VPseudoIStore<bit Ordered> { 196906c3fb27SDimitry Andric foreach idxEEW = EEWList in { 197006c3fb27SDimitry Andric foreach dataEEW = EEWList in { 197106c3fb27SDimitry Andric foreach dataEMUL = MxSet<dataEEW>.m in { 197206c3fb27SDimitry Andric defvar dataEMULOctuple = dataEMUL.octuple; 1973fe6060f1SDimitry Andric // Calculate emul = eew * lmul / sew 197406c3fb27SDimitry Andric defvar idxEMULOctuple = 197506c3fb27SDimitry Andric !srl(!mul(idxEEW, dataEMULOctuple), !logtwo(dataEEW)); 197606c3fb27SDimitry Andric if !and(!ge(idxEMULOctuple, 1), !le(idxEMULOctuple, 64)) then { 197706c3fb27SDimitry Andric defvar DataLInfo = dataEMUL.MX; 197806c3fb27SDimitry Andric defvar IdxLInfo = octuple_to_str<idxEMULOctuple>.ret; 197906c3fb27SDimitry Andric defvar idxEMUL = !cast<LMULInfo>("V_" # IdxLInfo); 198006c3fb27SDimitry Andric defvar Vreg = dataEMUL.vrclass; 198106c3fb27SDimitry Andric defvar IdxVreg = idxEMUL.vrclass; 198206c3fb27SDimitry Andric let VLMul = dataEMUL.value in { 198306c3fb27SDimitry Andric def "EI" # idxEEW # "_V_" # IdxLInfo # "_" # DataLInfo : 198406c3fb27SDimitry Andric VPseudoIStoreNoMask<Vreg, IdxVreg, idxEEW, idxEMUL.value, Ordered>, 19855f757f3fSDimitry Andric VSXSched<dataEEW, Ordered, DataLInfo, IdxLInfo>; 198606c3fb27SDimitry Andric def "EI" # idxEEW # "_V_" # IdxLInfo # "_" # DataLInfo # "_MASK" : 198706c3fb27SDimitry Andric VPseudoIStoreMask<Vreg, IdxVreg, idxEEW, idxEMUL.value, Ordered>, 19885f757f3fSDimitry Andric VSXSched<dataEEW, Ordered, DataLInfo, IdxLInfo>; 1989fe6060f1SDimitry Andric } 1990fe6060f1SDimitry Andric } 1991fe6060f1SDimitry Andric } 1992e8d8bef9SDimitry Andric } 1993e8d8bef9SDimitry Andric } 1994e8d8bef9SDimitry Andric} 1995e8d8bef9SDimitry Andric 19960eae32dcSDimitry Andricmulticlass VPseudoVPOP_M { 199706c3fb27SDimitry Andric foreach mti = AllMasks in { 1998bdd1243dSDimitry Andric defvar mx = mti.LMul.MX; 1999e8d8bef9SDimitry Andric let VLMul = mti.LMul.value in { 200006c3fb27SDimitry Andric def "_M_" # mti.BX : VPseudoUnaryNoMaskGPROut, 20015f757f3fSDimitry Andric SchedBinary<"WriteVMPopV", "ReadVMPopV", "ReadVMPopV", mx>; 200206c3fb27SDimitry Andric def "_M_" # mti.BX # "_MASK" : VPseudoUnaryMaskGPROut, 20035f757f3fSDimitry Andric SchedBinary<"WriteVMPopV", "ReadVMPopV", "ReadVMPopV", mx>; 2004e8d8bef9SDimitry Andric } 2005e8d8bef9SDimitry Andric } 2006e8d8bef9SDimitry Andric} 2007e8d8bef9SDimitry Andric 20080eae32dcSDimitry Andricmulticlass VPseudoV1ST_M { 200906c3fb27SDimitry Andric foreach mti = AllMasks in { 2010bdd1243dSDimitry Andric defvar mx = mti.LMul.MX; 20110eae32dcSDimitry Andric let VLMul = mti.LMul.value in { 201206c3fb27SDimitry Andric def "_M_" #mti.BX : VPseudoUnaryNoMaskGPROut, 20135f757f3fSDimitry Andric SchedBinary<"WriteVMFFSV", "ReadVMFFSV", "ReadVMFFSV", mx>; 201406c3fb27SDimitry Andric def "_M_" # mti.BX # "_MASK" : VPseudoUnaryMaskGPROut, 20155f757f3fSDimitry Andric SchedBinary<"WriteVMFFSV", "ReadVMFFSV", "ReadVMFFSV", mx>; 20160eae32dcSDimitry Andric } 20170eae32dcSDimitry Andric } 20180eae32dcSDimitry Andric} 20190eae32dcSDimitry Andric 20200eae32dcSDimitry Andricmulticlass VPseudoVSFS_M { 2021e8d8bef9SDimitry Andric defvar constraint = "@earlyclobber $rd"; 202206c3fb27SDimitry Andric foreach mti = AllMasks in { 2023bdd1243dSDimitry Andric defvar mx = mti.LMul.MX; 2024e8d8bef9SDimitry Andric let VLMul = mti.LMul.value in { 2025*0fca6ea1SDimitry Andric def "_M_" # mti.BX : VPseudoUnaryNoMaskNoPolicy<VR, VR, constraint>, 20265f757f3fSDimitry Andric SchedUnary<"WriteVMSFSV", "ReadVMSFSV", mx, 20275f757f3fSDimitry Andric forceMergeOpRead=true>; 2028*0fca6ea1SDimitry Andric let ForceTailAgnostic = true in 20290eae32dcSDimitry Andric def "_M_" # mti.BX # "_MASK" : VPseudoUnaryMask<VR, VR, constraint>, 20305f757f3fSDimitry Andric SchedUnary<"WriteVMSFSV", "ReadVMSFSV", mx, 20315f757f3fSDimitry Andric forceMergeOpRead=true>; 2032e8d8bef9SDimitry Andric } 2033e8d8bef9SDimitry Andric } 2034e8d8bef9SDimitry Andric} 2035e8d8bef9SDimitry Andric 20360eae32dcSDimitry Andricmulticlass VPseudoVID_V { 203704eeddc0SDimitry Andric foreach m = MxList in { 2038bdd1243dSDimitry Andric defvar mx = m.MX; 2039e8d8bef9SDimitry Andric let VLMul = m.value in { 20405f757f3fSDimitry Andric def "_V_" # mx : VPseudoNullaryNoMask<m.vrclass>, 2041*0fca6ea1SDimitry Andric SchedNullary<"WriteVIdxV", mx, forceMergeOpRead=true>; 20425f757f3fSDimitry Andric def "_V_" # mx # "_MASK" : VPseudoNullaryMask<m.vrclass>, 204306c3fb27SDimitry Andric RISCVMaskedPseudo<MaskIdx=1>, 2044*0fca6ea1SDimitry Andric SchedNullary<"WriteVIdxV", mx, 20455f757f3fSDimitry Andric forceMergeOpRead=true>; 2046e8d8bef9SDimitry Andric } 2047e8d8bef9SDimitry Andric } 2048e8d8bef9SDimitry Andric} 2049e8d8bef9SDimitry Andric 2050e8d8bef9SDimitry Andricmulticlass VPseudoNullaryPseudoM <string BaseInst> { 2051e8d8bef9SDimitry Andric foreach mti = AllMasks in { 2052e8d8bef9SDimitry Andric let VLMul = mti.LMul.value in { 2053bdd1243dSDimitry Andric def "_M_" # mti.BX : VPseudoNullaryPseudoM<BaseInst # "_MM">, 20545f757f3fSDimitry Andric SchedBinary<"WriteVMALUV", "ReadVMALUV", "ReadVMALUV", mti.LMul.MX>; 2055e8d8bef9SDimitry Andric } 2056e8d8bef9SDimitry Andric } 2057e8d8bef9SDimitry Andric} 2058e8d8bef9SDimitry Andric 2059*0fca6ea1SDimitry Andricmulticlass VPseudoVIOTA_M { 2060e8d8bef9SDimitry Andric defvar constraint = "@earlyclobber $rd"; 206104eeddc0SDimitry Andric foreach m = MxList in { 2062bdd1243dSDimitry Andric defvar mx = m.MX; 2063e8d8bef9SDimitry Andric let VLMul = m.value in { 20645f757f3fSDimitry Andric def "_" # mx : VPseudoUnaryNoMask<m.vrclass, VR, constraint>, 2065*0fca6ea1SDimitry Andric SchedUnary<"WriteVIotaV", "ReadVIotaV", mx, 20665f757f3fSDimitry Andric forceMergeOpRead=true>; 20675f757f3fSDimitry Andric def "_" # mx # "_MASK" : VPseudoUnaryMask<m.vrclass, VR, constraint>, 2068*0fca6ea1SDimitry Andric RISCVMaskedPseudo<MaskIdx=2, ActiveAffectsRes=true>, 2069*0fca6ea1SDimitry Andric SchedUnary<"WriteVIotaV", "ReadVIotaV", mx, 20705f757f3fSDimitry Andric forceMergeOpRead=true>; 2071e8d8bef9SDimitry Andric } 2072e8d8bef9SDimitry Andric } 2073e8d8bef9SDimitry Andric} 2074e8d8bef9SDimitry Andric 20750eae32dcSDimitry Andricmulticlass VPseudoVCPR_V { 207604eeddc0SDimitry Andric foreach m = MxList in { 2077bdd1243dSDimitry Andric defvar mx = m.MX; 207806c3fb27SDimitry Andric defvar sews = SchedSEWSet<mx>.val; 2079e8d8bef9SDimitry Andric let VLMul = m.value in 208006c3fb27SDimitry Andric foreach e = sews in { 208106c3fb27SDimitry Andric defvar suffix = "_" # m.MX # "_E" # e; 208206c3fb27SDimitry Andric let SEW = e in 20835f757f3fSDimitry Andric def _VM # suffix 20845f757f3fSDimitry Andric : VPseudoUnaryAnyMask<m.vrclass, m.vrclass>, 20855f757f3fSDimitry Andric SchedBinary<"WriteVCompressV", "ReadVCompressV", "ReadVCompressV", 20865f757f3fSDimitry Andric mx, e>; 208706c3fb27SDimitry Andric } 2088e8d8bef9SDimitry Andric } 2089e8d8bef9SDimitry Andric} 2090e8d8bef9SDimitry Andric 2091e8d8bef9SDimitry Andricmulticlass VPseudoBinary<VReg RetClass, 2092e8d8bef9SDimitry Andric VReg Op1Class, 2093e8d8bef9SDimitry Andric DAGOperand Op2Class, 2094e8d8bef9SDimitry Andric LMULInfo MInfo, 209506c3fb27SDimitry Andric string Constraint = "", 20965f757f3fSDimitry Andric int sew = 0, 2097*0fca6ea1SDimitry Andric int TargetConstraintType = 1, 2098*0fca6ea1SDimitry Andric bit Commutable = 0> { 2099*0fca6ea1SDimitry Andric let VLMul = MInfo.value, SEW=sew, isCommutable = Commutable in { 21005f757f3fSDimitry Andric defvar suffix = !if(sew, "_" # MInfo.MX # "_E" # sew, "_" # MInfo.MX); 2101*0fca6ea1SDimitry Andric def suffix : VPseudoBinaryNoMaskPolicy<RetClass, Op1Class, Op2Class, 21025f757f3fSDimitry Andric Constraint, TargetConstraintType>; 21035f757f3fSDimitry Andric def suffix # "_MASK" : VPseudoBinaryMaskPolicy<RetClass, Op1Class, Op2Class, 21045f757f3fSDimitry Andric Constraint, TargetConstraintType>, 21055f757f3fSDimitry Andric RISCVMaskedPseudo<MaskIdx=3>; 21065f757f3fSDimitry Andric } 21075f757f3fSDimitry Andric} 21085f757f3fSDimitry Andric 210906c3fb27SDimitry Andricmulticlass VPseudoBinaryRoundingMode<VReg RetClass, 211006c3fb27SDimitry Andric VReg Op1Class, 211106c3fb27SDimitry Andric DAGOperand Op2Class, 211206c3fb27SDimitry Andric LMULInfo MInfo, 211306c3fb27SDimitry Andric string Constraint = "", 211406c3fb27SDimitry Andric int sew = 0, 21155f757f3fSDimitry Andric int UsesVXRM = 1, 2116*0fca6ea1SDimitry Andric int TargetConstraintType = 1, 2117*0fca6ea1SDimitry Andric bit Commutable = 0> { 2118*0fca6ea1SDimitry Andric let VLMul = MInfo.value, SEW=sew, isCommutable = Commutable in { 211906c3fb27SDimitry Andric defvar suffix = !if(sew, "_" # MInfo.MX # "_E" # sew, "_" # MInfo.MX); 212006c3fb27SDimitry Andric def suffix : VPseudoBinaryNoMaskRoundingMode<RetClass, Op1Class, Op2Class, 21215f757f3fSDimitry Andric Constraint, UsesVXRM, 21225f757f3fSDimitry Andric TargetConstraintType>; 212306c3fb27SDimitry Andric def suffix # "_MASK" : VPseudoBinaryMaskPolicyRoundingMode<RetClass, 212406c3fb27SDimitry Andric Op1Class, 212506c3fb27SDimitry Andric Op2Class, 212606c3fb27SDimitry Andric Constraint, 21275f757f3fSDimitry Andric UsesVXRM, 21285f757f3fSDimitry Andric TargetConstraintType>, 212906c3fb27SDimitry Andric RISCVMaskedPseudo<MaskIdx=3>; 213006c3fb27SDimitry Andric } 213106c3fb27SDimitry Andric} 213206c3fb27SDimitry Andric 213306c3fb27SDimitry Andric 2134fe6060f1SDimitry Andricmulticlass VPseudoBinaryM<VReg RetClass, 2135fe6060f1SDimitry Andric VReg Op1Class, 2136fe6060f1SDimitry Andric DAGOperand Op2Class, 2137fe6060f1SDimitry Andric LMULInfo MInfo, 21385f757f3fSDimitry Andric string Constraint = "", 2139*0fca6ea1SDimitry Andric int TargetConstraintType = 1, 2140*0fca6ea1SDimitry Andric bit Commutable = 0> { 2141*0fca6ea1SDimitry Andric let VLMul = MInfo.value, isCommutable = Commutable in { 2142*0fca6ea1SDimitry Andric def "_" # MInfo.MX : VPseudoBinaryNoMask<RetClass, Op1Class, Op2Class, 21435f757f3fSDimitry Andric Constraint, TargetConstraintType>; 2144fe6060f1SDimitry Andric let ForceTailAgnostic = true in 2145fe6060f1SDimitry Andric def "_" # MInfo.MX # "_MASK" : VPseudoBinaryMOutMask<RetClass, Op1Class, 21465f757f3fSDimitry Andric Op2Class, Constraint, TargetConstraintType>, 214706c3fb27SDimitry Andric RISCVMaskedPseudo<MaskIdx=3>; 2148fe6060f1SDimitry Andric } 2149fe6060f1SDimitry Andric} 2150fe6060f1SDimitry Andric 2151e8d8bef9SDimitry Andricmulticlass VPseudoBinaryEmul<VReg RetClass, 2152e8d8bef9SDimitry Andric VReg Op1Class, 2153e8d8bef9SDimitry Andric DAGOperand Op2Class, 2154e8d8bef9SDimitry Andric LMULInfo lmul, 2155e8d8bef9SDimitry Andric LMULInfo emul, 215606c3fb27SDimitry Andric string Constraint = "", 2157*0fca6ea1SDimitry Andric int sew> { 215806c3fb27SDimitry Andric let VLMul = lmul.value, SEW=sew in { 215906c3fb27SDimitry Andric defvar suffix = !if(sew, "_" # lmul.MX # "_E" # sew, "_" # lmul.MX); 2160*0fca6ea1SDimitry Andric def suffix # "_" # emul.MX : VPseudoBinaryNoMaskPolicy<RetClass, Op1Class, Op2Class, 2161e8d8bef9SDimitry Andric Constraint>; 216206c3fb27SDimitry Andric def suffix # "_" # emul.MX # "_MASK" : VPseudoBinaryMaskPolicy<RetClass, Op1Class, Op2Class, 216381ad6265SDimitry Andric Constraint>, 216406c3fb27SDimitry Andric RISCVMaskedPseudo<MaskIdx=3>; 2165e8d8bef9SDimitry Andric } 2166e8d8bef9SDimitry Andric} 2167e8d8bef9SDimitry Andric 2168fe6060f1SDimitry Andricmulticlass VPseudoTiedBinary<VReg RetClass, 2169fe6060f1SDimitry Andric DAGOperand Op2Class, 2170fe6060f1SDimitry Andric LMULInfo MInfo, 21715f757f3fSDimitry Andric string Constraint = "", 21725f757f3fSDimitry Andric int TargetConstraintType = 1> { 2173fe6060f1SDimitry Andric let VLMul = MInfo.value in { 2174fe6060f1SDimitry Andric def "_" # MInfo.MX # "_TIED": VPseudoTiedBinaryNoMask<RetClass, Op2Class, 21755f757f3fSDimitry Andric Constraint, TargetConstraintType>; 2176fe6060f1SDimitry Andric def "_" # MInfo.MX # "_MASK_TIED" : VPseudoTiedBinaryMask<RetClass, Op2Class, 2177*0fca6ea1SDimitry Andric Constraint, TargetConstraintType>, 2178*0fca6ea1SDimitry Andric RISCVMaskedPseudo<MaskIdx=2>; 2179fe6060f1SDimitry Andric } 2180fe6060f1SDimitry Andric} 2181fe6060f1SDimitry Andric 218206c3fb27SDimitry Andricmulticlass VPseudoTiedBinaryRoundingMode<VReg RetClass, 218306c3fb27SDimitry Andric DAGOperand Op2Class, 218406c3fb27SDimitry Andric LMULInfo MInfo, 21855f757f3fSDimitry Andric string Constraint = "", 2186*0fca6ea1SDimitry Andric int sew = 0, 21875f757f3fSDimitry Andric int TargetConstraintType = 1> { 2188*0fca6ea1SDimitry Andric defvar suffix = !if(sew, "_" # MInfo.MX # "_E" # sew, "_" # MInfo.MX); 218906c3fb27SDimitry Andric let VLMul = MInfo.value in { 2190*0fca6ea1SDimitry Andric def suffix # "_TIED": 21915f757f3fSDimitry Andric VPseudoTiedBinaryNoMaskRoundingMode<RetClass, Op2Class, Constraint, TargetConstraintType>; 2192*0fca6ea1SDimitry Andric def suffix # "_MASK_TIED" : 2193*0fca6ea1SDimitry Andric VPseudoTiedBinaryMaskRoundingMode<RetClass, Op2Class, Constraint, TargetConstraintType>, 2194*0fca6ea1SDimitry Andric RISCVMaskedPseudo<MaskIdx=2>; 219506c3fb27SDimitry Andric } 219606c3fb27SDimitry Andric} 219706c3fb27SDimitry Andric 219806c3fb27SDimitry Andric 2199*0fca6ea1SDimitry Andricmulticlass VPseudoBinaryV_VV<LMULInfo m, string Constraint = "", int sew = 0, bit Commutable = 0> { 2200*0fca6ea1SDimitry Andric defm _VV : VPseudoBinary<m.vrclass, m.vrclass, m.vrclass, m, Constraint, sew, Commutable=Commutable>; 220106c3fb27SDimitry Andric} 220206c3fb27SDimitry Andric 2203*0fca6ea1SDimitry Andricmulticlass VPseudoBinaryV_VV_RM<LMULInfo m, string Constraint = "", bit Commutable = 0> { 2204*0fca6ea1SDimitry Andric defm _VV : VPseudoBinaryRoundingMode<m.vrclass, m.vrclass, m.vrclass, m, Constraint, 2205*0fca6ea1SDimitry Andric Commutable=Commutable>; 220604eeddc0SDimitry Andric} 220704eeddc0SDimitry Andric 2208*0fca6ea1SDimitry Andricmulticlass VPseudoBinaryFV_VV_RM<LMULInfo m, int sew> { 220906c3fb27SDimitry Andric defm _VV : VPseudoBinaryRoundingMode<m.vrclass, m.vrclass, m.vrclass, m, 2210*0fca6ea1SDimitry Andric "", sew, UsesVXRM=0>; 2211e8d8bef9SDimitry Andric} 2212e8d8bef9SDimitry Andric 2213*0fca6ea1SDimitry Andricmulticlass VPseudoVGTR_EI16_VV { 2214*0fca6ea1SDimitry Andric defvar constraint = "@earlyclobber $rd"; 221504eeddc0SDimitry Andric foreach m = MxList in { 2216bdd1243dSDimitry Andric defvar mx = m.MX; 2217e8d8bef9SDimitry Andric foreach sew = EEWList in { 221806c3fb27SDimitry Andric defvar dataEMULOctuple = m.octuple; 2219*0fca6ea1SDimitry Andric // emul = lmul * 16 / sew 2220*0fca6ea1SDimitry Andric defvar idxEMULOctuple = !srl(!mul(dataEMULOctuple, 16), !logtwo(sew)); 222106c3fb27SDimitry Andric if !and(!ge(idxEMULOctuple, 1), !le(idxEMULOctuple, 64)) then { 222206c3fb27SDimitry Andric defvar emulMX = octuple_to_str<idxEMULOctuple>.ret; 2223e8d8bef9SDimitry Andric defvar emul = !cast<LMULInfo>("V_" # emulMX); 222406c3fb27SDimitry Andric defvar sews = SchedSEWSet<mx>.val; 222506c3fb27SDimitry Andric foreach e = sews in { 22265f757f3fSDimitry Andric defm _VV 22275f757f3fSDimitry Andric : VPseudoBinaryEmul<m.vrclass, m.vrclass, emul.vrclass, m, emul, 2228*0fca6ea1SDimitry Andric constraint, e>, 2229*0fca6ea1SDimitry Andric SchedBinary<"WriteVRGatherEI16VV", "ReadVRGatherEI16VV_data", 2230*0fca6ea1SDimitry Andric "ReadVRGatherEI16VV_index", mx, e, forceMergeOpRead=true>; 223106c3fb27SDimitry Andric } 2232e8d8bef9SDimitry Andric } 2233e8d8bef9SDimitry Andric } 2234e8d8bef9SDimitry Andric } 2235e8d8bef9SDimitry Andric} 2236e8d8bef9SDimitry Andric 223706c3fb27SDimitry Andricmulticlass VPseudoBinaryV_VX<LMULInfo m, string Constraint = "", int sew = 0> { 223806c3fb27SDimitry Andric defm "_VX" : VPseudoBinary<m.vrclass, m.vrclass, GPR, m, Constraint, sew>; 223906c3fb27SDimitry Andric} 224006c3fb27SDimitry Andric 224106c3fb27SDimitry Andricmulticlass VPseudoBinaryV_VX_RM<LMULInfo m, string Constraint = ""> { 224206c3fb27SDimitry Andric defm "_VX" : VPseudoBinaryRoundingMode<m.vrclass, m.vrclass, GPR, m, Constraint>; 2243e8d8bef9SDimitry Andric} 2244e8d8bef9SDimitry Andric 22450eae32dcSDimitry Andricmulticlass VPseudoVSLD1_VX<string Constraint = ""> { 2246bdd1243dSDimitry Andric foreach m = MxList in { 22470eae32dcSDimitry Andric defm "_VX" : VPseudoBinary<m.vrclass, m.vrclass, GPR, m, Constraint>, 22485f757f3fSDimitry Andric SchedBinary<"WriteVISlide1X", "ReadVISlideV", "ReadVISlideX", 22495f757f3fSDimitry Andric m.MX, forceMergeOpRead=true>; 2250bdd1243dSDimitry Andric } 22510eae32dcSDimitry Andric} 22520eae32dcSDimitry Andric 2253*0fca6ea1SDimitry Andricmulticlass VPseudoBinaryV_VF<LMULInfo m, FPR_Info f, int sew> { 2254e8d8bef9SDimitry Andric defm "_V" # f.FX : VPseudoBinary<m.vrclass, m.vrclass, 2255*0fca6ea1SDimitry Andric f.fprclass, m, "", sew>; 225606c3fb27SDimitry Andric} 225706c3fb27SDimitry Andric 2258*0fca6ea1SDimitry Andricmulticlass VPseudoBinaryV_VF_RM<LMULInfo m, FPR_Info f, int sew> { 225906c3fb27SDimitry Andric defm "_V" # f.FX : VPseudoBinaryRoundingMode<m.vrclass, m.vrclass, 2260*0fca6ea1SDimitry Andric f.fprclass, m, "", sew, 226106c3fb27SDimitry Andric UsesVXRM=0>; 2262e8d8bef9SDimitry Andric} 2263e8d8bef9SDimitry Andric 22640eae32dcSDimitry Andricmulticlass VPseudoVSLD1_VF<string Constraint = ""> { 2265bdd1243dSDimitry Andric foreach f = FPList in { 2266bdd1243dSDimitry Andric foreach m = f.MxList in { 22675f757f3fSDimitry Andric defm "_V" #f.FX 22685f757f3fSDimitry Andric : VPseudoBinary<m.vrclass, m.vrclass, f.fprclass, m, Constraint>, 22695f757f3fSDimitry Andric SchedBinary<"WriteVFSlide1F", "ReadVFSlideV", "ReadVFSlideF", m.MX, 22705f757f3fSDimitry Andric forceMergeOpRead=true>; 2271bdd1243dSDimitry Andric } 2272bdd1243dSDimitry Andric } 22730eae32dcSDimitry Andric} 22740eae32dcSDimitry Andric 2275*0fca6ea1SDimitry Andricmulticlass VPseudoBinaryV_VI<Operand ImmType, LMULInfo m, string Constraint = ""> { 2276e8d8bef9SDimitry Andric defm _VI : VPseudoBinary<m.vrclass, m.vrclass, ImmType, m, Constraint>; 2277e8d8bef9SDimitry Andric} 2278e8d8bef9SDimitry Andric 2279*0fca6ea1SDimitry Andricmulticlass VPseudoBinaryV_VI_RM<Operand ImmType, LMULInfo m, string Constraint = ""> { 228006c3fb27SDimitry Andric defm _VI : VPseudoBinaryRoundingMode<m.vrclass, m.vrclass, ImmType, m, Constraint>; 228106c3fb27SDimitry Andric} 228206c3fb27SDimitry Andric 22835f757f3fSDimitry Andricmulticlass VPseudoVALU_MM<bit Commutable = 0> { 2284bdd1243dSDimitry Andric foreach m = MxList in { 2285bdd1243dSDimitry Andric defvar mx = m.MX; 22865f757f3fSDimitry Andric let VLMul = m.value, isCommutable = Commutable in { 228706c3fb27SDimitry Andric def "_MM_" # mx : VPseudoBinaryNoMask<VR, VR, VR, "">, 22885f757f3fSDimitry Andric SchedBinary<"WriteVMALUV", "ReadVMALUV", "ReadVMALUV", mx>; 2289bdd1243dSDimitry Andric } 2290e8d8bef9SDimitry Andric } 2291e8d8bef9SDimitry Andric} 2292e8d8bef9SDimitry Andric 2293e8d8bef9SDimitry Andric// We use earlyclobber here due to 2294e8d8bef9SDimitry Andric// * The destination EEW is smaller than the source EEW and the overlap is 2295e8d8bef9SDimitry Andric// in the lowest-numbered part of the source register group is legal. 2296e8d8bef9SDimitry Andric// Otherwise, it is illegal. 2297e8d8bef9SDimitry Andric// * The destination EEW is greater than the source EEW, the source EMUL is 2298e8d8bef9SDimitry Andric// at least 1, and the overlap is in the highest-numbered part of the 2299e8d8bef9SDimitry Andric// destination register group is legal. Otherwise, it is illegal. 2300*0fca6ea1SDimitry Andricmulticlass VPseudoBinaryW_VV<LMULInfo m, bit Commutable = 0> { 2301e8d8bef9SDimitry Andric defm _VV : VPseudoBinary<m.wvrclass, m.vrclass, m.vrclass, m, 2302*0fca6ea1SDimitry Andric "@earlyclobber $rd", TargetConstraintType=3, 2303*0fca6ea1SDimitry Andric Commutable=Commutable>; 2304e8d8bef9SDimitry Andric} 2305e8d8bef9SDimitry Andric 2306*0fca6ea1SDimitry Andricmulticlass VPseudoBinaryW_VV_RM<LMULInfo m, int sew> { 230706c3fb27SDimitry Andric defm _VV : VPseudoBinaryRoundingMode<m.wvrclass, m.vrclass, m.vrclass, m, 2308*0fca6ea1SDimitry Andric "@earlyclobber $rd", sew, UsesVXRM=0, 23095f757f3fSDimitry Andric TargetConstraintType=3>; 231006c3fb27SDimitry Andric} 231106c3fb27SDimitry Andric 2312bdd1243dSDimitry Andricmulticlass VPseudoBinaryW_VX<LMULInfo m> { 2313e8d8bef9SDimitry Andric defm "_VX" : VPseudoBinary<m.wvrclass, m.vrclass, GPR, m, 23145f757f3fSDimitry Andric "@earlyclobber $rd", TargetConstraintType=3>; 23155f757f3fSDimitry Andric} 23165f757f3fSDimitry Andric 23175f757f3fSDimitry Andricmulticlass VPseudoBinaryW_VI<Operand ImmType, LMULInfo m> { 23185f757f3fSDimitry Andric defm "_VI" : VPseudoBinary<m.wvrclass, m.vrclass, ImmType, m, 23195f757f3fSDimitry Andric "@earlyclobber $rd", TargetConstraintType=3>; 2320e8d8bef9SDimitry Andric} 2321e8d8bef9SDimitry Andric 2322*0fca6ea1SDimitry Andricmulticlass VPseudoBinaryW_VF_RM<LMULInfo m, FPR_Info f, int sew> { 232306c3fb27SDimitry Andric defm "_V" # f.FX : VPseudoBinaryRoundingMode<m.wvrclass, m.vrclass, 232406c3fb27SDimitry Andric f.fprclass, m, 2325*0fca6ea1SDimitry Andric "@earlyclobber $rd", sew, 23265f757f3fSDimitry Andric UsesVXRM=0, 23275f757f3fSDimitry Andric TargetConstraintType=3>; 232806c3fb27SDimitry Andric} 232906c3fb27SDimitry Andric 2330bdd1243dSDimitry Andricmulticlass VPseudoBinaryW_WV<LMULInfo m> { 2331e8d8bef9SDimitry Andric defm _WV : VPseudoBinary<m.wvrclass, m.wvrclass, m.vrclass, m, 23325f757f3fSDimitry Andric "@earlyclobber $rd", TargetConstraintType=3>; 2333fe6060f1SDimitry Andric defm _WV : VPseudoTiedBinary<m.wvrclass, m.vrclass, m, 23345f757f3fSDimitry Andric "@earlyclobber $rd", TargetConstraintType=3>; 2335fe6060f1SDimitry Andric} 2336e8d8bef9SDimitry Andric 2337*0fca6ea1SDimitry Andricmulticlass VPseudoBinaryW_WV_RM<LMULInfo m, int sew> { 233806c3fb27SDimitry Andric defm _WV : VPseudoBinaryRoundingMode<m.wvrclass, m.wvrclass, m.vrclass, m, 2339*0fca6ea1SDimitry Andric "@earlyclobber $rd", sew, UsesVXRM = 0, 2340*0fca6ea1SDimitry Andric TargetConstraintType = 3>; 234106c3fb27SDimitry Andric defm _WV : VPseudoTiedBinaryRoundingMode<m.wvrclass, m.vrclass, m, 2342*0fca6ea1SDimitry Andric "@earlyclobber $rd", sew, 2343*0fca6ea1SDimitry Andric TargetConstraintType = 3>; 234406c3fb27SDimitry Andric} 234506c3fb27SDimitry Andric 2346bdd1243dSDimitry Andricmulticlass VPseudoBinaryW_WX<LMULInfo m> { 23475f757f3fSDimitry Andric defm "_WX" : VPseudoBinary<m.wvrclass, m.wvrclass, GPR, m, /*Constraint*/ "", TargetConstraintType=3>; 2348e8d8bef9SDimitry Andric} 2349e8d8bef9SDimitry Andric 2350*0fca6ea1SDimitry Andricmulticlass VPseudoBinaryW_WF_RM<LMULInfo m, FPR_Info f, int sew> { 235106c3fb27SDimitry Andric defm "_W" # f.FX : VPseudoBinaryRoundingMode<m.wvrclass, m.wvrclass, 235206c3fb27SDimitry Andric f.fprclass, m, 23535f757f3fSDimitry Andric Constraint="", 2354*0fca6ea1SDimitry Andric sew=sew, 23555f757f3fSDimitry Andric UsesVXRM=0, 23565f757f3fSDimitry Andric TargetConstraintType=3>; 235706c3fb27SDimitry Andric} 235806c3fb27SDimitry Andric 2359fe6060f1SDimitry Andric// Narrowing instructions like vnsrl/vnsra/vnclip(u) don't need @earlyclobber 2360fe6060f1SDimitry Andric// if the source and destination have an LMUL<=1. This matches this overlap 2361fe6060f1SDimitry Andric// exception from the spec. 2362fe6060f1SDimitry Andric// "The destination EEW is smaller than the source EEW and the overlap is in the 2363fe6060f1SDimitry Andric// lowest-numbered part of the source register group." 2364*0fca6ea1SDimitry Andricmulticlass VPseudoBinaryV_WV<LMULInfo m> { 2365e8d8bef9SDimitry Andric defm _WV : VPseudoBinary<m.vrclass, m.wvrclass, m.vrclass, m, 2366*0fca6ea1SDimitry Andric !if(!ge(m.octuple, 8), "@earlyclobber $rd", ""), 2367*0fca6ea1SDimitry Andric TargetConstraintType=2>; 2368e8d8bef9SDimitry Andric} 2369e8d8bef9SDimitry Andric 237006c3fb27SDimitry Andricmulticlass VPseudoBinaryV_WV_RM<LMULInfo m> { 237106c3fb27SDimitry Andric defm _WV : VPseudoBinaryRoundingMode<m.vrclass, m.wvrclass, m.vrclass, m, 237206c3fb27SDimitry Andric !if(!ge(m.octuple, 8), 2373*0fca6ea1SDimitry Andric "@earlyclobber $rd", ""), 2374*0fca6ea1SDimitry Andric TargetConstraintType=2>; 237506c3fb27SDimitry Andric} 237606c3fb27SDimitry Andric 2377*0fca6ea1SDimitry Andricmulticlass VPseudoBinaryV_WX<LMULInfo m> { 2378e8d8bef9SDimitry Andric defm _WX : VPseudoBinary<m.vrclass, m.wvrclass, GPR, m, 2379*0fca6ea1SDimitry Andric !if(!ge(m.octuple, 8), "@earlyclobber $rd", ""), 2380*0fca6ea1SDimitry Andric TargetConstraintType=2>; 2381e8d8bef9SDimitry Andric} 2382e8d8bef9SDimitry Andric 238306c3fb27SDimitry Andricmulticlass VPseudoBinaryV_WX_RM<LMULInfo m> { 238406c3fb27SDimitry Andric defm _WX : VPseudoBinaryRoundingMode<m.vrclass, m.wvrclass, GPR, m, 238506c3fb27SDimitry Andric !if(!ge(m.octuple, 8), 2386*0fca6ea1SDimitry Andric "@earlyclobber $rd", ""), 2387*0fca6ea1SDimitry Andric TargetConstraintType=2>; 238806c3fb27SDimitry Andric} 238906c3fb27SDimitry Andric 2390*0fca6ea1SDimitry Andricmulticlass VPseudoBinaryV_WI<LMULInfo m> { 2391e8d8bef9SDimitry Andric defm _WI : VPseudoBinary<m.vrclass, m.wvrclass, uimm5, m, 2392*0fca6ea1SDimitry Andric !if(!ge(m.octuple, 8), "@earlyclobber $rd", ""), 2393*0fca6ea1SDimitry Andric TargetConstraintType=2>; 2394e8d8bef9SDimitry Andric} 2395e8d8bef9SDimitry Andric 239606c3fb27SDimitry Andricmulticlass VPseudoBinaryV_WI_RM<LMULInfo m> { 239706c3fb27SDimitry Andric defm _WI : VPseudoBinaryRoundingMode<m.vrclass, m.wvrclass, uimm5, m, 239806c3fb27SDimitry Andric !if(!ge(m.octuple, 8), 2399*0fca6ea1SDimitry Andric "@earlyclobber $rd", ""), 2400*0fca6ea1SDimitry Andric TargetConstraintType=2>; 240106c3fb27SDimitry Andric} 240206c3fb27SDimitry Andric 2403e8d8bef9SDimitry Andric// For vadc and vsbc, the instruction encoding is reserved if the destination 2404e8d8bef9SDimitry Andric// vector register is v0. 2405e8d8bef9SDimitry Andric// For vadc and vsbc, CarryIn == 1 and CarryOut == 0 2406bdd1243dSDimitry Andricmulticlass VPseudoBinaryV_VM<LMULInfo m, bit CarryOut = 0, bit CarryIn = 1, 24075f757f3fSDimitry Andric string Constraint = "", 24085f757f3fSDimitry Andric bit Commutable = 0, 24095f757f3fSDimitry Andric int TargetConstraintType = 1> { 24105f757f3fSDimitry Andric let isCommutable = Commutable in 2411e8d8bef9SDimitry Andric def "_VV" # !if(CarryIn, "M", "") # "_" # m.MX : 2412*0fca6ea1SDimitry Andric VPseudoBinaryCarry<!if(CarryOut, VR, 2413e8d8bef9SDimitry Andric !if(!and(CarryIn, !not(CarryOut)), 2414e8d8bef9SDimitry Andric GetVRegNoV0<m.vrclass>.R, m.vrclass)), 24155f757f3fSDimitry Andric m.vrclass, m.vrclass, m, CarryIn, Constraint, TargetConstraintType>; 2416e8d8bef9SDimitry Andric} 2417e8d8bef9SDimitry Andric 2418*0fca6ea1SDimitry Andricmulticlass VPseudoTiedBinaryV_VM<LMULInfo m, bit Commutable = 0> { 2419*0fca6ea1SDimitry Andric let isCommutable = Commutable in 242006c3fb27SDimitry Andric def "_VVM" # "_" # m.MX: 242106c3fb27SDimitry Andric VPseudoTiedBinaryCarryIn<GetVRegNoV0<m.vrclass>.R, 2422*0fca6ea1SDimitry Andric m.vrclass, m.vrclass, m>; 242304eeddc0SDimitry Andric} 242404eeddc0SDimitry Andric 2425bdd1243dSDimitry Andricmulticlass VPseudoBinaryV_XM<LMULInfo m, bit CarryOut = 0, bit CarryIn = 1, 24265f757f3fSDimitry Andric string Constraint = "", int TargetConstraintType = 1> { 2427e8d8bef9SDimitry Andric def "_VX" # !if(CarryIn, "M", "") # "_" # m.MX : 2428*0fca6ea1SDimitry Andric VPseudoBinaryCarry<!if(CarryOut, VR, 2429e8d8bef9SDimitry Andric !if(!and(CarryIn, !not(CarryOut)), 2430e8d8bef9SDimitry Andric GetVRegNoV0<m.vrclass>.R, m.vrclass)), 24315f757f3fSDimitry Andric m.vrclass, GPR, m, CarryIn, Constraint, TargetConstraintType>; 2432e8d8bef9SDimitry Andric} 2433e8d8bef9SDimitry Andric 2434*0fca6ea1SDimitry Andricmulticlass VPseudoTiedBinaryV_XM<LMULInfo m> { 243506c3fb27SDimitry Andric def "_VXM" # "_" # m.MX: 243606c3fb27SDimitry Andric VPseudoTiedBinaryCarryIn<GetVRegNoV0<m.vrclass>.R, 2437*0fca6ea1SDimitry Andric m.vrclass, GPR, m>; 243804eeddc0SDimitry Andric} 243904eeddc0SDimitry Andric 24400eae32dcSDimitry Andricmulticlass VPseudoVMRG_FM { 2441bdd1243dSDimitry Andric foreach f = FPList in { 244204eeddc0SDimitry Andric foreach m = f.MxList in { 2443bdd1243dSDimitry Andric defvar mx = m.MX; 24445f757f3fSDimitry Andric def "_V" # f.FX # "M_" # mx 24455f757f3fSDimitry Andric : VPseudoTiedBinaryCarryIn<GetVRegNoV0<m.vrclass>.R, m.vrclass, 2446*0fca6ea1SDimitry Andric f.fprclass, m>, 24475f757f3fSDimitry Andric SchedBinary<"WriteVFMergeV", "ReadVFMergeV", "ReadVFMergeF", mx, 24485f757f3fSDimitry Andric forceMasked=1, forceMergeOpRead=true>; 2449bdd1243dSDimitry Andric } 245004eeddc0SDimitry Andric } 2451e8d8bef9SDimitry Andric} 2452e8d8bef9SDimitry Andric 2453bdd1243dSDimitry Andricmulticlass VPseudoBinaryV_IM<LMULInfo m, bit CarryOut = 0, bit CarryIn = 1, 24545f757f3fSDimitry Andric string Constraint = "", int TargetConstraintType = 1> { 2455e8d8bef9SDimitry Andric def "_VI" # !if(CarryIn, "M", "") # "_" # m.MX : 2456*0fca6ea1SDimitry Andric VPseudoBinaryCarry<!if(CarryOut, VR, 2457e8d8bef9SDimitry Andric !if(!and(CarryIn, !not(CarryOut)), 2458e8d8bef9SDimitry Andric GetVRegNoV0<m.vrclass>.R, m.vrclass)), 24595f757f3fSDimitry Andric m.vrclass, simm5, m, CarryIn, Constraint, TargetConstraintType>; 2460e8d8bef9SDimitry Andric} 2461e8d8bef9SDimitry Andric 246206c3fb27SDimitry Andricmulticlass VPseudoTiedBinaryV_IM<LMULInfo m> { 246306c3fb27SDimitry Andric def "_VIM" # "_" # m.MX: 246406c3fb27SDimitry Andric VPseudoTiedBinaryCarryIn<GetVRegNoV0<m.vrclass>.R, 2465*0fca6ea1SDimitry Andric m.vrclass, simm5, m>; 246604eeddc0SDimitry Andric} 246704eeddc0SDimitry Andric 24680eae32dcSDimitry Andricmulticlass VPseudoUnaryVMV_V_X_I { 246904eeddc0SDimitry Andric foreach m = MxList in { 2470e8d8bef9SDimitry Andric let VLMul = m.value in { 2471bdd1243dSDimitry Andric defvar mx = m.MX; 2472bdd1243dSDimitry Andric let VLMul = m.value in { 247306c3fb27SDimitry Andric def "_V_" # mx : VPseudoUnaryNoMask<m.vrclass, m.vrclass>, 24745f757f3fSDimitry Andric SchedUnary<"WriteVIMovV", "ReadVIMovV", mx, 24755f757f3fSDimitry Andric forceMergeOpRead=true>; 247606c3fb27SDimitry Andric def "_X_" # mx : VPseudoUnaryNoMask<m.vrclass, GPR>, 24775f757f3fSDimitry Andric SchedUnary<"WriteVIMovX", "ReadVIMovX", mx, 24785f757f3fSDimitry Andric forceMergeOpRead=true>; 247906c3fb27SDimitry Andric def "_I_" # mx : VPseudoUnaryNoMask<m.vrclass, simm5>, 24805f757f3fSDimitry Andric SchedNullary<"WriteVIMovI", mx, 24815f757f3fSDimitry Andric forceMergeOpRead=true>; 2482bdd1243dSDimitry Andric } 2483e8d8bef9SDimitry Andric } 2484e8d8bef9SDimitry Andric } 2485e8d8bef9SDimitry Andric} 2486e8d8bef9SDimitry Andric 24870eae32dcSDimitry Andricmulticlass VPseudoVMV_F { 248804eeddc0SDimitry Andric foreach f = FPList in { 248904eeddc0SDimitry Andric foreach m = f.MxList in { 2490bdd1243dSDimitry Andric defvar mx = m.MX; 2491e8d8bef9SDimitry Andric let VLMul = m.value in { 2492bdd1243dSDimitry Andric def "_" # f.FX # "_" # mx : 249306c3fb27SDimitry Andric VPseudoUnaryNoMask<m.vrclass, f.fprclass>, 24945f757f3fSDimitry Andric SchedUnary<"WriteVFMovV", "ReadVFMovF", mx, forceMergeOpRead=true>; 2495e8d8bef9SDimitry Andric } 2496e8d8bef9SDimitry Andric } 2497e8d8bef9SDimitry Andric } 2498e8d8bef9SDimitry Andric} 2499e8d8bef9SDimitry Andric 25000eae32dcSDimitry Andricmulticlass VPseudoVCLS_V { 250104eeddc0SDimitry Andric foreach m = MxListF in { 2502bdd1243dSDimitry Andric defvar mx = m.MX; 2503349cc55cSDimitry Andric let VLMul = m.value in { 2504bdd1243dSDimitry Andric def "_V_" # mx : VPseudoUnaryNoMask<m.vrclass, m.vrclass>, 25055f757f3fSDimitry Andric SchedUnary<"WriteVFClassV", "ReadVFClassV", mx, 25065f757f3fSDimitry Andric forceMergeOpRead=true>; 250706c3fb27SDimitry Andric def "_V_" # mx # "_MASK" : VPseudoUnaryMask<m.vrclass, m.vrclass>, 250806c3fb27SDimitry Andric RISCVMaskedPseudo<MaskIdx=2>, 25095f757f3fSDimitry Andric SchedUnary<"WriteVFClassV", "ReadVFClassV", mx, 25105f757f3fSDimitry Andric forceMergeOpRead=true>; 2511349cc55cSDimitry Andric } 2512349cc55cSDimitry Andric } 2513349cc55cSDimitry Andric} 2514349cc55cSDimitry Andric 251506c3fb27SDimitry Andricmulticlass VPseudoVSQR_V_RM { 251604eeddc0SDimitry Andric foreach m = MxListF in { 2517bdd1243dSDimitry Andric defvar mx = m.MX; 251806c3fb27SDimitry Andric defvar sews = SchedSEWSet<m.MX, isF=1>.val; 2519bdd1243dSDimitry Andric 252006c3fb27SDimitry Andric let VLMul = m.value in 252106c3fb27SDimitry Andric foreach e = sews in { 252206c3fb27SDimitry Andric defvar suffix = "_" # mx # "_E" # e; 252306c3fb27SDimitry Andric let SEW = e in { 252406c3fb27SDimitry Andric def "_V" # suffix : VPseudoUnaryNoMaskRoundingMode<m.vrclass, m.vrclass>, 25255f757f3fSDimitry Andric SchedUnary<"WriteVFSqrtV", "ReadVFSqrtV", mx, e, 25265f757f3fSDimitry Andric forceMergeOpRead=true>; 25275f757f3fSDimitry Andric def "_V" #suffix # "_MASK" 25285f757f3fSDimitry Andric : VPseudoUnaryMaskRoundingMode<m.vrclass, m.vrclass>, 252906c3fb27SDimitry Andric RISCVMaskedPseudo<MaskIdx = 2>, 25305f757f3fSDimitry Andric SchedUnary<"WriteVFSqrtV", "ReadVFSqrtV", mx, e, 25315f757f3fSDimitry Andric forceMergeOpRead=true>; 253206c3fb27SDimitry Andric } 2533e8d8bef9SDimitry Andric } 2534e8d8bef9SDimitry Andric } 2535e8d8bef9SDimitry Andric} 2536e8d8bef9SDimitry Andric 25370eae32dcSDimitry Andricmulticlass VPseudoVRCP_V { 253804eeddc0SDimitry Andric foreach m = MxListF in { 2539bdd1243dSDimitry Andric defvar mx = m.MX; 2540*0fca6ea1SDimitry Andric foreach e = SchedSEWSet<mx, isF=1>.val in { 25410eae32dcSDimitry Andric let VLMul = m.value in { 2542*0fca6ea1SDimitry Andric def "_V_" # mx # "_E" # e 25435f757f3fSDimitry Andric : VPseudoUnaryNoMask<m.vrclass, m.vrclass>, 2544*0fca6ea1SDimitry Andric SchedUnary<"WriteVFRecpV", "ReadVFRecpV", mx, e, forceMergeOpRead=true>; 2545*0fca6ea1SDimitry Andric def "_V_" # mx # "_E" # e # "_MASK" 25465f757f3fSDimitry Andric : VPseudoUnaryMask<m.vrclass, m.vrclass>, 254706c3fb27SDimitry Andric RISCVMaskedPseudo<MaskIdx = 2>, 2548*0fca6ea1SDimitry Andric SchedUnary<"WriteVFRecpV", "ReadVFRecpV", mx, e, forceMergeOpRead=true>; 2549*0fca6ea1SDimitry Andric } 255006c3fb27SDimitry Andric } 255106c3fb27SDimitry Andric } 255206c3fb27SDimitry Andric} 255306c3fb27SDimitry Andric 255406c3fb27SDimitry Andricmulticlass VPseudoVRCP_V_RM { 255506c3fb27SDimitry Andric foreach m = MxListF in { 255606c3fb27SDimitry Andric defvar mx = m.MX; 2557*0fca6ea1SDimitry Andric foreach e = SchedSEWSet<mx, isF=1>.val in { 255806c3fb27SDimitry Andric let VLMul = m.value in { 2559*0fca6ea1SDimitry Andric def "_V_" # mx # "_E" # e 25605f757f3fSDimitry Andric : VPseudoUnaryNoMaskRoundingMode<m.vrclass, m.vrclass>, 2561*0fca6ea1SDimitry Andric SchedUnary<"WriteVFRecpV", "ReadVFRecpV", mx, e, forceMergeOpRead=true>; 2562*0fca6ea1SDimitry Andric def "_V_" # mx # "_E" # e # "_MASK" 25635f757f3fSDimitry Andric : VPseudoUnaryMaskRoundingMode<m.vrclass, m.vrclass>, 256406c3fb27SDimitry Andric RISCVMaskedPseudo<MaskIdx = 2>, 2565*0fca6ea1SDimitry Andric SchedUnary<"WriteVFRecpV", "ReadVFRecpV", mx, e, forceMergeOpRead=true>; 2566*0fca6ea1SDimitry Andric } 25670eae32dcSDimitry Andric } 25680eae32dcSDimitry Andric } 25690eae32dcSDimitry Andric} 25700eae32dcSDimitry Andric 2571647cbc5dSDimitry Andricmulticlass PseudoVEXT_VF2 { 2572e8d8bef9SDimitry Andric defvar constraints = "@earlyclobber $rd"; 257306c3fb27SDimitry Andric foreach m = MxListVF2 in { 2574bdd1243dSDimitry Andric defvar mx = m.MX; 2575647cbc5dSDimitry Andric defvar CurrTypeConstraints = !if(!or(!eq(mx, "MF4"), !eq(mx, "MF2"), !eq(mx, "M1")), 1, 3); 2576e8d8bef9SDimitry Andric let VLMul = m.value in { 2577647cbc5dSDimitry Andric def "_" # mx : VPseudoUnaryNoMask<m.vrclass, m.f2vrclass, constraints, CurrTypeConstraints>, 25785f757f3fSDimitry Andric SchedUnary<"WriteVExtV", "ReadVExtV", mx, forceMergeOpRead=true>; 2579bdd1243dSDimitry Andric def "_" # mx # "_MASK" : 2580647cbc5dSDimitry Andric VPseudoUnaryMask<m.vrclass, m.f2vrclass, constraints, CurrTypeConstraints>, 258106c3fb27SDimitry Andric RISCVMaskedPseudo<MaskIdx=2>, 25825f757f3fSDimitry Andric SchedUnary<"WriteVExtV", "ReadVExtV", mx, forceMergeOpRead=true>; 2583e8d8bef9SDimitry Andric } 2584e8d8bef9SDimitry Andric } 2585e8d8bef9SDimitry Andric} 2586e8d8bef9SDimitry Andric 2587647cbc5dSDimitry Andricmulticlass PseudoVEXT_VF4 { 2588e8d8bef9SDimitry Andric defvar constraints = "@earlyclobber $rd"; 258906c3fb27SDimitry Andric foreach m = MxListVF4 in { 2590bdd1243dSDimitry Andric defvar mx = m.MX; 2591647cbc5dSDimitry Andric defvar CurrTypeConstraints = !if(!or(!eq(mx, "MF2"), !eq(mx, "M1"), !eq(mx, "M2")), 1, 3); 2592e8d8bef9SDimitry Andric let VLMul = m.value in { 2593647cbc5dSDimitry Andric def "_" # mx : VPseudoUnaryNoMask<m.vrclass, m.f4vrclass, constraints, CurrTypeConstraints>, 25945f757f3fSDimitry Andric SchedUnary<"WriteVExtV", "ReadVExtV", mx, forceMergeOpRead=true>; 2595bdd1243dSDimitry Andric def "_" # mx # "_MASK" : 2596647cbc5dSDimitry Andric VPseudoUnaryMask<m.vrclass, m.f4vrclass, constraints, CurrTypeConstraints>, 259706c3fb27SDimitry Andric RISCVMaskedPseudo<MaskIdx=2>, 25985f757f3fSDimitry Andric SchedUnary<"WriteVExtV", "ReadVExtV", mx, forceMergeOpRead=true>; 2599e8d8bef9SDimitry Andric } 2600e8d8bef9SDimitry Andric } 2601e8d8bef9SDimitry Andric} 2602e8d8bef9SDimitry Andric 2603647cbc5dSDimitry Andricmulticlass PseudoVEXT_VF8 { 2604e8d8bef9SDimitry Andric defvar constraints = "@earlyclobber $rd"; 260506c3fb27SDimitry Andric foreach m = MxListVF8 in { 2606bdd1243dSDimitry Andric defvar mx = m.MX; 2607647cbc5dSDimitry Andric defvar CurrTypeConstraints = !if(!or(!eq(mx, "M1"), !eq(mx, "M2"), !eq(mx, "M4")), 1, 3); 2608e8d8bef9SDimitry Andric let VLMul = m.value in { 2609647cbc5dSDimitry Andric def "_" # mx : VPseudoUnaryNoMask<m.vrclass, m.f8vrclass, constraints, CurrTypeConstraints>, 26105f757f3fSDimitry Andric SchedUnary<"WriteVExtV", "ReadVExtV", mx, forceMergeOpRead=true>; 2611bdd1243dSDimitry Andric def "_" # mx # "_MASK" : 2612647cbc5dSDimitry Andric VPseudoUnaryMask<m.vrclass, m.f8vrclass, constraints, CurrTypeConstraints>, 261306c3fb27SDimitry Andric RISCVMaskedPseudo<MaskIdx=2>, 26145f757f3fSDimitry Andric SchedUnary<"WriteVExtV", "ReadVExtV", mx, forceMergeOpRead=true>; 2615e8d8bef9SDimitry Andric } 2616e8d8bef9SDimitry Andric } 2617e8d8bef9SDimitry Andric} 2618e8d8bef9SDimitry Andric 2619fe6060f1SDimitry Andric// The destination EEW is 1 since "For the purposes of register group overlap 2620fe6060f1SDimitry Andric// constraints, mask elements have EEW=1." 2621e8d8bef9SDimitry Andric// The source EEW is 8, 16, 32, or 64. 2622e8d8bef9SDimitry Andric// When the destination EEW is different from source EEW, we need to use 2623e8d8bef9SDimitry Andric// @earlyclobber to avoid the overlap between destination and source registers. 2624fe6060f1SDimitry Andric// We don't need @earlyclobber for LMUL<=1 since that matches this overlap 2625fe6060f1SDimitry Andric// exception from the spec 2626fe6060f1SDimitry Andric// "The destination EEW is smaller than the source EEW and the overlap is in the 2627fe6060f1SDimitry Andric// lowest-numbered part of the source register group". 2628fe6060f1SDimitry Andric// With LMUL<=1 the source and dest occupy a single register so any overlap 2629fe6060f1SDimitry Andric// is in the lowest-numbered part. 2630*0fca6ea1SDimitry Andricmulticlass VPseudoBinaryM_VV<LMULInfo m, int TargetConstraintType = 1, 2631*0fca6ea1SDimitry Andric bit Commutable = 0> { 2632fe6060f1SDimitry Andric defm _VV : VPseudoBinaryM<VR, m.vrclass, m.vrclass, m, 2633*0fca6ea1SDimitry Andric !if(!ge(m.octuple, 16), "@earlyclobber $rd", ""), 2634*0fca6ea1SDimitry Andric TargetConstraintType, Commutable=Commutable>; 2635e8d8bef9SDimitry Andric} 2636e8d8bef9SDimitry Andric 26375f757f3fSDimitry Andricmulticlass VPseudoBinaryM_VX<LMULInfo m, int TargetConstraintType = 1> { 2638e8d8bef9SDimitry Andric defm "_VX" : 2639fe6060f1SDimitry Andric VPseudoBinaryM<VR, m.vrclass, GPR, m, 26405f757f3fSDimitry Andric !if(!ge(m.octuple, 16), "@earlyclobber $rd", ""), TargetConstraintType>; 2641e8d8bef9SDimitry Andric} 2642e8d8bef9SDimitry Andric 26435f757f3fSDimitry Andricmulticlass VPseudoBinaryM_VF<LMULInfo m, FPR_Info f, int TargetConstraintType = 1> { 2644e8d8bef9SDimitry Andric defm "_V" # f.FX : 2645fe6060f1SDimitry Andric VPseudoBinaryM<VR, m.vrclass, f.fprclass, m, 26465f757f3fSDimitry Andric !if(!ge(m.octuple, 16), "@earlyclobber $rd", ""), TargetConstraintType>; 2647e8d8bef9SDimitry Andric} 2648e8d8bef9SDimitry Andric 26495f757f3fSDimitry Andricmulticlass VPseudoBinaryM_VI<LMULInfo m, int TargetConstraintType = 1> { 2650fe6060f1SDimitry Andric defm _VI : VPseudoBinaryM<VR, m.vrclass, simm5, m, 26515f757f3fSDimitry Andric !if(!ge(m.octuple, 16), "@earlyclobber $rd", ""), TargetConstraintType>; 2652e8d8bef9SDimitry Andric} 2653e8d8bef9SDimitry Andric 2654*0fca6ea1SDimitry Andricmulticlass VPseudoVGTR_VV_VX_VI { 2655*0fca6ea1SDimitry Andric defvar constraint = "@earlyclobber $rd"; 2656bdd1243dSDimitry Andric foreach m = MxList in { 2657bdd1243dSDimitry Andric defvar mx = m.MX; 2658*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VX<m, constraint>, 26595f757f3fSDimitry Andric SchedBinary<"WriteVRGatherVX", "ReadVRGatherVX_data", 26605f757f3fSDimitry Andric "ReadVRGatherVX_index", mx, forceMergeOpRead=true>; 2661*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VI<uimm5, m, constraint>, 26625f757f3fSDimitry Andric SchedUnary<"WriteVRGatherVI", "ReadVRGatherVI_data", mx, 26635f757f3fSDimitry Andric forceMergeOpRead=true>; 266406c3fb27SDimitry Andric 266506c3fb27SDimitry Andric defvar sews = SchedSEWSet<mx>.val; 266606c3fb27SDimitry Andric foreach e = sews in { 2667*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VV<m, constraint, e>, 26685f757f3fSDimitry Andric SchedBinary<"WriteVRGatherVV", "ReadVRGatherVV_data", 26695f757f3fSDimitry Andric "ReadVRGatherVV_index", mx, e, forceMergeOpRead=true>; 267006c3fb27SDimitry Andric } 2671bdd1243dSDimitry Andric } 2672e8d8bef9SDimitry Andric} 2673e8d8bef9SDimitry Andric 2674*0fca6ea1SDimitry Andricmulticlass VPseudoVSALU_VV_VX_VI<bit Commutable = 0> { 2675bdd1243dSDimitry Andric foreach m = MxList in { 2676bdd1243dSDimitry Andric defvar mx = m.MX; 2677*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VV<m, Commutable=Commutable>, 26785f757f3fSDimitry Andric SchedBinary<"WriteVSALUV", "ReadVSALUV", "ReadVSALUX", mx, 26795f757f3fSDimitry Andric forceMergeOpRead=true>; 2680*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VX<m>, 26815f757f3fSDimitry Andric SchedBinary<"WriteVSALUX", "ReadVSALUV", "ReadVSALUX", mx, 26825f757f3fSDimitry Andric forceMergeOpRead=true>; 2683*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VI<simm5, m>, 26845f757f3fSDimitry Andric SchedUnary<"WriteVSALUI", "ReadVSALUV", mx, forceMergeOpRead=true>; 2685bdd1243dSDimitry Andric } 2686e8d8bef9SDimitry Andric} 2687e8d8bef9SDimitry Andric 26880eae32dcSDimitry Andric 2689*0fca6ea1SDimitry Andricmulticlass VPseudoVSHT_VV_VX_VI { 2690bdd1243dSDimitry Andric foreach m = MxList in { 2691bdd1243dSDimitry Andric defvar mx = m.MX; 2692*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VV<m>, 26935f757f3fSDimitry Andric SchedBinary<"WriteVShiftV", "ReadVShiftV", "ReadVShiftV", mx, 26945f757f3fSDimitry Andric forceMergeOpRead=true>; 2695*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VX<m>, 26965f757f3fSDimitry Andric SchedBinary<"WriteVShiftX", "ReadVShiftV", "ReadVShiftX", mx, 26975f757f3fSDimitry Andric forceMergeOpRead=true>; 2698*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VI<uimm5, m>, 26995f757f3fSDimitry Andric SchedUnary<"WriteVShiftI", "ReadVShiftV", mx, forceMergeOpRead=true>; 2700bdd1243dSDimitry Andric } 2701e8d8bef9SDimitry Andric} 2702e8d8bef9SDimitry Andric 2703*0fca6ea1SDimitry Andricmulticlass VPseudoVSSHT_VV_VX_VI_RM { 2704bdd1243dSDimitry Andric foreach m = MxList in { 2705bdd1243dSDimitry Andric defvar mx = m.MX; 2706*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VV_RM<m>, 27075f757f3fSDimitry Andric SchedBinary<"WriteVSShiftV", "ReadVSShiftV", "ReadVSShiftV", mx, 27085f757f3fSDimitry Andric forceMergeOpRead=true>; 2709*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VX_RM<m>, 27105f757f3fSDimitry Andric SchedBinary<"WriteVSShiftX", "ReadVSShiftV", "ReadVSShiftX", mx, 27115f757f3fSDimitry Andric forceMergeOpRead=true>; 2712*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VI_RM<uimm5, m>, 27135f757f3fSDimitry Andric SchedUnary<"WriteVSShiftI", "ReadVSShiftV", mx, forceMergeOpRead=true>; 2714bdd1243dSDimitry Andric } 2715e8d8bef9SDimitry Andric} 2716e8d8bef9SDimitry Andric 2717*0fca6ea1SDimitry Andricmulticlass VPseudoVALU_VV_VX_VI<bit Commutable = 0> { 2718bdd1243dSDimitry Andric foreach m = MxList in { 2719bdd1243dSDimitry Andric defvar mx = m.MX; 2720*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VV<m, Commutable=Commutable>, 27215f757f3fSDimitry Andric SchedBinary<"WriteVIALUV", "ReadVIALUV", "ReadVIALUV", mx, 27225f757f3fSDimitry Andric forceMergeOpRead=true>; 2723*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VX<m>, 27245f757f3fSDimitry Andric SchedBinary<"WriteVIALUX", "ReadVIALUV", "ReadVIALUX", mx, 27255f757f3fSDimitry Andric forceMergeOpRead=true>; 2726*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VI<simm5, m>, 27275f757f3fSDimitry Andric SchedUnary<"WriteVIALUI", "ReadVIALUV", mx, forceMergeOpRead=true>; 2728bdd1243dSDimitry Andric } 27290eae32dcSDimitry Andric} 27300eae32dcSDimitry Andric 27310eae32dcSDimitry Andricmulticlass VPseudoVSALU_VV_VX { 2732bdd1243dSDimitry Andric foreach m = MxList in { 2733bdd1243dSDimitry Andric defvar mx = m.MX; 2734bdd1243dSDimitry Andric defm "" : VPseudoBinaryV_VV<m>, 27355f757f3fSDimitry Andric SchedBinary<"WriteVSALUV", "ReadVSALUV", "ReadVSALUV", mx, 27365f757f3fSDimitry Andric forceMergeOpRead=true>; 2737bdd1243dSDimitry Andric defm "" : VPseudoBinaryV_VX<m>, 27385f757f3fSDimitry Andric SchedBinary<"WriteVSALUX", "ReadVSALUV", "ReadVSALUX", mx, 27395f757f3fSDimitry Andric forceMergeOpRead=true>; 2740bdd1243dSDimitry Andric } 27410eae32dcSDimitry Andric} 27420eae32dcSDimitry Andric 274306c3fb27SDimitry Andricmulticlass VPseudoVSMUL_VV_VX_RM { 2744bdd1243dSDimitry Andric foreach m = MxList in { 2745bdd1243dSDimitry Andric defvar mx = m.MX; 2746*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VV_RM<m, Commutable=1>, 27475f757f3fSDimitry Andric SchedBinary<"WriteVSMulV", "ReadVSMulV", "ReadVSMulV", mx, 27485f757f3fSDimitry Andric forceMergeOpRead=true>; 274906c3fb27SDimitry Andric defm "" : VPseudoBinaryV_VX_RM<m>, 27505f757f3fSDimitry Andric SchedBinary<"WriteVSMulX", "ReadVSMulV", "ReadVSMulX", mx, 27515f757f3fSDimitry Andric forceMergeOpRead=true>; 2752bdd1243dSDimitry Andric } 27530eae32dcSDimitry Andric} 27540eae32dcSDimitry Andric 2755*0fca6ea1SDimitry Andricmulticlass VPseudoVAALU_VV_VX_RM<bit Commutable = 0> { 2756bdd1243dSDimitry Andric foreach m = MxList in { 2757bdd1243dSDimitry Andric defvar mx = m.MX; 2758*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VV_RM<m, Commutable=Commutable>, 27595f757f3fSDimitry Andric SchedBinary<"WriteVAALUV", "ReadVAALUV", "ReadVAALUV", mx, 27605f757f3fSDimitry Andric forceMergeOpRead=true>; 276106c3fb27SDimitry Andric defm "" : VPseudoBinaryV_VX_RM<m>, 27625f757f3fSDimitry Andric SchedBinary<"WriteVAALUX", "ReadVAALUV", "ReadVAALUX", mx, 27635f757f3fSDimitry Andric forceMergeOpRead=true>; 2764bdd1243dSDimitry Andric } 27650eae32dcSDimitry Andric} 27660eae32dcSDimitry Andric 27670eae32dcSDimitry Andricmulticlass VPseudoVMINMAX_VV_VX { 2768bdd1243dSDimitry Andric foreach m = MxList in { 2769bdd1243dSDimitry Andric defvar mx = m.MX; 2770*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VV<m, Commutable=1>, 27715f757f3fSDimitry Andric SchedBinary<"WriteVIMinMaxV", "ReadVIMinMaxV", "ReadVIMinMaxV", mx>; 2772bdd1243dSDimitry Andric defm "" : VPseudoBinaryV_VX<m>, 27735f757f3fSDimitry Andric SchedBinary<"WriteVIMinMaxX", "ReadVIMinMaxV", "ReadVIMinMaxX", mx>; 2774bdd1243dSDimitry Andric } 27750eae32dcSDimitry Andric} 27760eae32dcSDimitry Andric 2777*0fca6ea1SDimitry Andricmulticlass VPseudoVMUL_VV_VX<bit Commutable = 0> { 2778bdd1243dSDimitry Andric foreach m = MxList in { 2779bdd1243dSDimitry Andric defvar mx = m.MX; 2780*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VV<m, Commutable=Commutable>, 27815f757f3fSDimitry Andric SchedBinary<"WriteVIMulV", "ReadVIMulV", "ReadVIMulV", mx>; 2782bdd1243dSDimitry Andric defm "" : VPseudoBinaryV_VX<m>, 27835f757f3fSDimitry Andric SchedBinary<"WriteVIMulX", "ReadVIMulV", "ReadVIMulX", mx>; 2784bdd1243dSDimitry Andric } 27850eae32dcSDimitry Andric} 27860eae32dcSDimitry Andric 27870eae32dcSDimitry Andricmulticlass VPseudoVDIV_VV_VX { 2788bdd1243dSDimitry Andric foreach m = MxList in { 2789bdd1243dSDimitry Andric defvar mx = m.MX; 279006c3fb27SDimitry Andric defvar sews = SchedSEWSet<mx>.val; 279106c3fb27SDimitry Andric foreach e = sews in { 279206c3fb27SDimitry Andric defm "" : VPseudoBinaryV_VV<m, "", e>, 27935f757f3fSDimitry Andric SchedBinary<"WriteVIDivV", "ReadVIDivV", "ReadVIDivV", mx, e>; 279406c3fb27SDimitry Andric defm "" : VPseudoBinaryV_VX<m, "", e>, 27955f757f3fSDimitry Andric SchedBinary<"WriteVIDivX", "ReadVIDivV", "ReadVIDivX", mx, e>; 279606c3fb27SDimitry Andric } 2797bdd1243dSDimitry Andric } 27980eae32dcSDimitry Andric} 27990eae32dcSDimitry Andric 280006c3fb27SDimitry Andricmulticlass VPseudoVFMUL_VV_VF_RM { 2801bdd1243dSDimitry Andric foreach m = MxListF in { 2802*0fca6ea1SDimitry Andric foreach e = SchedSEWSet<m.MX, isF=1>.val in 2803*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryFV_VV_RM<m, e>, 2804*0fca6ea1SDimitry Andric SchedBinary<"WriteVFMulV", "ReadVFMulV", "ReadVFMulV", m.MX, e, 28055f757f3fSDimitry Andric forceMergeOpRead=true>; 2806bdd1243dSDimitry Andric } 2807bdd1243dSDimitry Andric 2808bdd1243dSDimitry Andric foreach f = FPList in { 2809bdd1243dSDimitry Andric foreach m = f.MxList in { 2810*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VF_RM<m, f, f.SEW>, 28115f757f3fSDimitry Andric SchedBinary<"WriteVFMulF", "ReadVFMulV", "ReadVFMulF", m.MX, 2812*0fca6ea1SDimitry Andric f.SEW, forceMergeOpRead=true>; 2813bdd1243dSDimitry Andric } 2814bdd1243dSDimitry Andric } 28150eae32dcSDimitry Andric} 28160eae32dcSDimitry Andric 281706c3fb27SDimitry Andricmulticlass VPseudoVFDIV_VV_VF_RM { 2818bdd1243dSDimitry Andric foreach m = MxListF in { 2819bdd1243dSDimitry Andric defvar mx = m.MX; 282006c3fb27SDimitry Andric defvar sews = SchedSEWSet<mx, isF=1>.val; 282106c3fb27SDimitry Andric foreach e = sews in { 2822*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryFV_VV_RM<m, e>, 28235f757f3fSDimitry Andric SchedBinary<"WriteVFDivV", "ReadVFDivV", "ReadVFDivV", mx, e, 28245f757f3fSDimitry Andric forceMergeOpRead=true>; 282506c3fb27SDimitry Andric } 2826bdd1243dSDimitry Andric } 2827bdd1243dSDimitry Andric 2828bdd1243dSDimitry Andric foreach f = FPList in { 2829bdd1243dSDimitry Andric foreach m = f.MxList in { 2830*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VF_RM<m, f, f.SEW>, 28315f757f3fSDimitry Andric SchedBinary<"WriteVFDivF", "ReadVFDivV", "ReadVFDivF", m.MX, f.SEW, 28325f757f3fSDimitry Andric forceMergeOpRead=true>; 2833bdd1243dSDimitry Andric } 2834bdd1243dSDimitry Andric } 28350eae32dcSDimitry Andric} 28360eae32dcSDimitry Andric 283706c3fb27SDimitry Andricmulticlass VPseudoVFRDIV_VF_RM { 2838bdd1243dSDimitry Andric foreach f = FPList in { 2839bdd1243dSDimitry Andric foreach m = f.MxList in { 2840*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VF_RM<m, f, f.SEW>, 28415f757f3fSDimitry Andric SchedBinary<"WriteVFDivF", "ReadVFDivV", "ReadVFDivF", m.MX, f.SEW, 28425f757f3fSDimitry Andric forceMergeOpRead=true>; 2843bdd1243dSDimitry Andric } 2844bdd1243dSDimitry Andric } 28450eae32dcSDimitry Andric} 28460eae32dcSDimitry Andric 28470eae32dcSDimitry Andricmulticlass VPseudoVALU_VV_VX { 2848bdd1243dSDimitry Andric foreach m = MxList in { 2849bdd1243dSDimitry Andric defm "" : VPseudoBinaryV_VV<m>, 28505f757f3fSDimitry Andric SchedBinary<"WriteVIALUV", "ReadVIALUV", "ReadVIALUV", m.MX, 28515f757f3fSDimitry Andric forceMergeOpRead=true>; 2852bdd1243dSDimitry Andric defm "" : VPseudoBinaryV_VX<m>, 28535f757f3fSDimitry Andric SchedBinary<"WriteVIALUX", "ReadVIALUV", "ReadVIALUX", m.MX, 28545f757f3fSDimitry Andric forceMergeOpRead=true>; 2855bdd1243dSDimitry Andric } 28560eae32dcSDimitry Andric} 28570eae32dcSDimitry Andric 28580eae32dcSDimitry Andricmulticlass VPseudoVSGNJ_VV_VF { 2859bdd1243dSDimitry Andric foreach m = MxListF in { 2860*0fca6ea1SDimitry Andric foreach e = SchedSEWSet<m.MX, isF=1>.val in 2861*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VV<m, sew=e>, 28625f757f3fSDimitry Andric SchedBinary<"WriteVFSgnjV", "ReadVFSgnjV", "ReadVFSgnjV", m.MX, 2863*0fca6ea1SDimitry Andric e, forceMergeOpRead=true>; 2864bdd1243dSDimitry Andric } 2865bdd1243dSDimitry Andric 2866bdd1243dSDimitry Andric foreach f = FPList in { 2867bdd1243dSDimitry Andric foreach m = f.MxList in { 2868*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VF<m, f, sew=f.SEW>, 28695f757f3fSDimitry Andric SchedBinary<"WriteVFSgnjF", "ReadVFSgnjV", "ReadVFSgnjF", m.MX, 2870*0fca6ea1SDimitry Andric f.SEW, forceMergeOpRead=true>; 2871bdd1243dSDimitry Andric } 2872bdd1243dSDimitry Andric } 28730eae32dcSDimitry Andric} 28740eae32dcSDimitry Andric 28750eae32dcSDimitry Andricmulticlass VPseudoVMAX_VV_VF { 2876bdd1243dSDimitry Andric foreach m = MxListF in { 2877*0fca6ea1SDimitry Andric foreach e = SchedSEWSet<m.MX, isF=1>.val in 2878*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VV<m, sew=e>, 2879*0fca6ea1SDimitry Andric SchedBinary<"WriteVFMinMaxV", "ReadVFMinMaxV", "ReadVFMinMaxV", 2880*0fca6ea1SDimitry Andric m.MX, e, forceMergeOpRead=true>; 2881bdd1243dSDimitry Andric } 2882bdd1243dSDimitry Andric 2883bdd1243dSDimitry Andric foreach f = FPList in { 2884bdd1243dSDimitry Andric foreach m = f.MxList in { 2885*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VF<m, f, sew=f.SEW>, 2886*0fca6ea1SDimitry Andric SchedBinary<"WriteVFMinMaxF", "ReadVFMinMaxV", "ReadVFMinMaxF", 2887*0fca6ea1SDimitry Andric m.MX, f.SEW, forceMergeOpRead=true>; 2888bdd1243dSDimitry Andric } 2889bdd1243dSDimitry Andric } 28900eae32dcSDimitry Andric} 28910eae32dcSDimitry Andric 289206c3fb27SDimitry Andricmulticlass VPseudoVALU_VV_VF_RM { 289306c3fb27SDimitry Andric foreach m = MxListF in { 2894*0fca6ea1SDimitry Andric foreach e = SchedSEWSet<m.MX, isF=1>.val in 2895*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryFV_VV_RM<m, e>, 2896*0fca6ea1SDimitry Andric SchedBinary<"WriteVFALUV", "ReadVFALUV", "ReadVFALUV", m.MX, e, 28975f757f3fSDimitry Andric forceMergeOpRead=true>; 289806c3fb27SDimitry Andric } 289906c3fb27SDimitry Andric 290006c3fb27SDimitry Andric foreach f = FPList in { 290106c3fb27SDimitry Andric foreach m = f.MxList in { 2902*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VF_RM<m, f, f.SEW>, 29035f757f3fSDimitry Andric SchedBinary<"WriteVFALUF", "ReadVFALUV", "ReadVFALUF", m.MX, 2904*0fca6ea1SDimitry Andric f.SEW, forceMergeOpRead=true>; 2905bdd1243dSDimitry Andric } 2906bdd1243dSDimitry Andric } 29070eae32dcSDimitry Andric} 29080eae32dcSDimitry Andric 290906c3fb27SDimitry Andricmulticlass VPseudoVALU_VF_RM { 291006c3fb27SDimitry Andric foreach f = FPList in { 291106c3fb27SDimitry Andric foreach m = f.MxList in { 2912*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VF_RM<m, f, f.SEW>, 29135f757f3fSDimitry Andric SchedBinary<"WriteVFALUF", "ReadVFALUV", "ReadVFALUF", m.MX, 2914*0fca6ea1SDimitry Andric f.SEW, forceMergeOpRead=true>; 291506c3fb27SDimitry Andric } 291606c3fb27SDimitry Andric } 291706c3fb27SDimitry Andric} 291806c3fb27SDimitry Andric 2919*0fca6ea1SDimitry Andricmulticlass VPseudoVALU_VX_VI { 2920bdd1243dSDimitry Andric foreach m = MxList in { 2921bdd1243dSDimitry Andric defvar mx = m.MX; 2922bdd1243dSDimitry Andric defm "" : VPseudoBinaryV_VX<m>, 29235f757f3fSDimitry Andric SchedBinary<"WriteVIALUX", "ReadVIALUV", "ReadVIALUX", mx, 29245f757f3fSDimitry Andric forceMergeOpRead=true>; 2925*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VI<simm5, m>, 29265f757f3fSDimitry Andric SchedUnary<"WriteVIALUI", "ReadVIALUV", mx, forceMergeOpRead=true>; 2927bdd1243dSDimitry Andric } 29280eae32dcSDimitry Andric} 29290eae32dcSDimitry Andric 2930*0fca6ea1SDimitry Andricmulticlass VPseudoVWALU_VV_VX<bit Commutable = 0> { 2931bdd1243dSDimitry Andric foreach m = MxListW in { 2932bdd1243dSDimitry Andric defvar mx = m.MX; 2933*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryW_VV<m, Commutable=Commutable>, 29345f757f3fSDimitry Andric SchedBinary<"WriteVIWALUV", "ReadVIWALUV", "ReadVIWALUV", mx, 29355f757f3fSDimitry Andric forceMergeOpRead=true>; 2936bdd1243dSDimitry Andric defm "" : VPseudoBinaryW_VX<m>, 29375f757f3fSDimitry Andric SchedBinary<"WriteVIWALUX", "ReadVIWALUV", "ReadVIWALUX", mx, 29385f757f3fSDimitry Andric forceMergeOpRead=true>; 29395f757f3fSDimitry Andric } 29405f757f3fSDimitry Andric} 29415f757f3fSDimitry Andric 2942*0fca6ea1SDimitry Andricmulticlass VPseudoVWMUL_VV_VX<bit Commutable = 0> { 2943bdd1243dSDimitry Andric foreach m = MxListW in { 2944bdd1243dSDimitry Andric defvar mx = m.MX; 2945*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryW_VV<m, Commutable=Commutable>, 29465f757f3fSDimitry Andric SchedBinary<"WriteVIWMulV", "ReadVIWMulV", "ReadVIWMulV", mx, 29475f757f3fSDimitry Andric forceMergeOpRead=true>; 2948bdd1243dSDimitry Andric defm "" : VPseudoBinaryW_VX<m>, 29495f757f3fSDimitry Andric SchedBinary<"WriteVIWMulX", "ReadVIWMulV", "ReadVIWMulX", mx, 29505f757f3fSDimitry Andric forceMergeOpRead=true>; 2951bdd1243dSDimitry Andric } 29520eae32dcSDimitry Andric} 29530eae32dcSDimitry Andric 295406c3fb27SDimitry Andricmulticlass VPseudoVWMUL_VV_VF_RM { 2955bdd1243dSDimitry Andric foreach m = MxListFW in { 2956*0fca6ea1SDimitry Andric foreach e = SchedSEWSet<m.MX, isF=1, isWidening=1>.val in 2957*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryW_VV_RM<m, sew=e>, 29585f757f3fSDimitry Andric SchedBinary<"WriteVFWMulV", "ReadVFWMulV", "ReadVFWMulV", m.MX, 2959*0fca6ea1SDimitry Andric e, forceMergeOpRead=true>; 2960bdd1243dSDimitry Andric } 2961bdd1243dSDimitry Andric 2962bdd1243dSDimitry Andric foreach f = FPListW in { 2963bdd1243dSDimitry Andric foreach m = f.MxListFW in { 2964*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryW_VF_RM<m, f, sew=f.SEW>, 29655f757f3fSDimitry Andric SchedBinary<"WriteVFWMulF", "ReadVFWMulV", "ReadVFWMulF", m.MX, 2966*0fca6ea1SDimitry Andric f.SEW, forceMergeOpRead=true>; 2967bdd1243dSDimitry Andric } 2968bdd1243dSDimitry Andric } 2969e8d8bef9SDimitry Andric} 2970e8d8bef9SDimitry Andric 29710eae32dcSDimitry Andricmulticlass VPseudoVWALU_WV_WX { 2972bdd1243dSDimitry Andric foreach m = MxListW in { 2973bdd1243dSDimitry Andric defvar mx = m.MX; 2974bdd1243dSDimitry Andric defm "" : VPseudoBinaryW_WV<m>, 29755f757f3fSDimitry Andric SchedBinary<"WriteVIWALUV", "ReadVIWALUV", "ReadVIWALUV", mx, 29765f757f3fSDimitry Andric forceMergeOpRead=true>; 2977bdd1243dSDimitry Andric defm "" : VPseudoBinaryW_WX<m>, 29785f757f3fSDimitry Andric SchedBinary<"WriteVIWALUX", "ReadVIWALUV", "ReadVIWALUX", mx, 29795f757f3fSDimitry Andric forceMergeOpRead=true>; 2980bdd1243dSDimitry Andric } 2981e8d8bef9SDimitry Andric} 2982e8d8bef9SDimitry Andric 298306c3fb27SDimitry Andricmulticlass VPseudoVFWALU_VV_VF_RM { 2984bdd1243dSDimitry Andric foreach m = MxListFW in { 2985*0fca6ea1SDimitry Andric foreach e = SchedSEWSet<m.MX, isF=1, isWidening=1>.val in 2986*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryW_VV_RM<m, sew=e>, 29875f757f3fSDimitry Andric SchedBinary<"WriteVFWALUV", "ReadVFWALUV", "ReadVFWALUV", m.MX, 2988*0fca6ea1SDimitry Andric e, forceMergeOpRead=true>; 2989bdd1243dSDimitry Andric } 2990bdd1243dSDimitry Andric 2991bdd1243dSDimitry Andric foreach f = FPListW in { 2992bdd1243dSDimitry Andric foreach m = f.MxListFW in { 2993*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryW_VF_RM<m, f, sew=f.SEW>, 29945f757f3fSDimitry Andric SchedBinary<"WriteVFWALUF", "ReadVFWALUV", "ReadVFWALUF", m.MX, 2995*0fca6ea1SDimitry Andric f.SEW, forceMergeOpRead=true>; 2996bdd1243dSDimitry Andric } 2997bdd1243dSDimitry Andric } 2998e8d8bef9SDimitry Andric} 2999e8d8bef9SDimitry Andric 300006c3fb27SDimitry Andricmulticlass VPseudoVFWALU_WV_WF_RM { 3001bdd1243dSDimitry Andric foreach m = MxListFW in { 3002*0fca6ea1SDimitry Andric foreach e = SchedSEWSet<m.MX, isF=1, isWidening=1>.val in 3003*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryW_WV_RM<m, sew=e>, 30045f757f3fSDimitry Andric SchedBinary<"WriteVFWALUV", "ReadVFWALUV", "ReadVFWALUV", m.MX, 3005*0fca6ea1SDimitry Andric e, forceMergeOpRead=true>; 3006bdd1243dSDimitry Andric } 3007bdd1243dSDimitry Andric foreach f = FPListW in { 3008bdd1243dSDimitry Andric foreach m = f.MxListFW in { 3009*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryW_WF_RM<m, f, sew=f.SEW>, 30105f757f3fSDimitry Andric SchedBinary<"WriteVFWALUF", "ReadVFWALUV", "ReadVFWALUF", m.MX, 3011*0fca6ea1SDimitry Andric f.SEW, forceMergeOpRead=true>; 3012bdd1243dSDimitry Andric } 3013bdd1243dSDimitry Andric } 3014e8d8bef9SDimitry Andric} 3015e8d8bef9SDimitry Andric 30160eae32dcSDimitry Andricmulticlass VPseudoVMRG_VM_XM_IM { 3017bdd1243dSDimitry Andric foreach m = MxList in { 3018bdd1243dSDimitry Andric defvar mx = m.MX; 301906c3fb27SDimitry Andric def "_VVM" # "_" # m.MX: 302006c3fb27SDimitry Andric VPseudoTiedBinaryCarryIn<GetVRegNoV0<m.vrclass>.R, 3021*0fca6ea1SDimitry Andric m.vrclass, m.vrclass, m>, 30225f757f3fSDimitry Andric SchedBinary<"WriteVIMergeV", "ReadVIMergeV", "ReadVIMergeV", mx, 30235f757f3fSDimitry Andric forceMergeOpRead=true>; 302406c3fb27SDimitry Andric def "_VXM" # "_" # m.MX: 302506c3fb27SDimitry Andric VPseudoTiedBinaryCarryIn<GetVRegNoV0<m.vrclass>.R, 3026*0fca6ea1SDimitry Andric m.vrclass, GPR, m>, 30275f757f3fSDimitry Andric SchedBinary<"WriteVIMergeX", "ReadVIMergeV", "ReadVIMergeX", mx, 30285f757f3fSDimitry Andric forceMergeOpRead=true>; 302906c3fb27SDimitry Andric def "_VIM" # "_" # m.MX: 303006c3fb27SDimitry Andric VPseudoTiedBinaryCarryIn<GetVRegNoV0<m.vrclass>.R, 3031*0fca6ea1SDimitry Andric m.vrclass, simm5, m>, 30325f757f3fSDimitry Andric SchedUnary<"WriteVIMergeI", "ReadVIMergeV", mx, 30335f757f3fSDimitry Andric forceMergeOpRead=true>; 3034bdd1243dSDimitry Andric } 3035e8d8bef9SDimitry Andric} 3036e8d8bef9SDimitry Andric 30370eae32dcSDimitry Andricmulticlass VPseudoVCALU_VM_XM_IM { 3038bdd1243dSDimitry Andric foreach m = MxList in { 3039bdd1243dSDimitry Andric defvar mx = m.MX; 3040*0fca6ea1SDimitry Andric defm "" : VPseudoTiedBinaryV_VM<m, Commutable=1>, 30415f757f3fSDimitry Andric SchedBinary<"WriteVICALUV", "ReadVICALUV", "ReadVICALUV", mx, 30425f757f3fSDimitry Andric forceMergeOpRead=true>; 3043bdd1243dSDimitry Andric defm "" : VPseudoTiedBinaryV_XM<m>, 30445f757f3fSDimitry Andric SchedBinary<"WriteVICALUX", "ReadVICALUV", "ReadVICALUX", mx, 30455f757f3fSDimitry Andric forceMergeOpRead=true>; 3046bdd1243dSDimitry Andric defm "" : VPseudoTiedBinaryV_IM<m>, 30475f757f3fSDimitry Andric SchedUnary<"WriteVICALUI", "ReadVICALUV", mx, 30485f757f3fSDimitry Andric forceMergeOpRead=true>; 3049bdd1243dSDimitry Andric } 3050e8d8bef9SDimitry Andric} 3051e8d8bef9SDimitry Andric 30520eae32dcSDimitry Andricmulticlass VPseudoVCALU_VM_XM { 3053bdd1243dSDimitry Andric foreach m = MxList in { 3054bdd1243dSDimitry Andric defvar mx = m.MX; 3055bdd1243dSDimitry Andric defm "" : VPseudoTiedBinaryV_VM<m>, 30565f757f3fSDimitry Andric SchedBinary<"WriteVICALUV", "ReadVICALUV", "ReadVICALUV", mx, 30575f757f3fSDimitry Andric forceMergeOpRead=true>; 3058bdd1243dSDimitry Andric defm "" : VPseudoTiedBinaryV_XM<m>, 30595f757f3fSDimitry Andric SchedBinary<"WriteVICALUX", "ReadVICALUV", "ReadVICALUX", mx, 30605f757f3fSDimitry Andric forceMergeOpRead=true>; 3061bdd1243dSDimitry Andric } 3062e8d8bef9SDimitry Andric} 3063e8d8bef9SDimitry Andric 3064*0fca6ea1SDimitry Andricmulticlass VPseudoVCALUM_VM_XM_IM { 3065*0fca6ea1SDimitry Andric defvar constraint = "@earlyclobber $rd"; 3066bdd1243dSDimitry Andric foreach m = MxList in { 3067bdd1243dSDimitry Andric defvar mx = m.MX; 3068*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VM<m, CarryOut=1, CarryIn=1, Constraint=constraint, 30695f757f3fSDimitry Andric Commutable=1, TargetConstraintType=2>, 30705f757f3fSDimitry Andric SchedBinary<"WriteVICALUV", "ReadVICALUV", "ReadVICALUV", mx, forceMasked=1, 30715f757f3fSDimitry Andric forceMergeOpRead=true>; 3072*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_XM<m, CarryOut=1, CarryIn=1, Constraint=constraint, TargetConstraintType=2>, 30735f757f3fSDimitry Andric SchedBinary<"WriteVICALUX", "ReadVICALUV", "ReadVICALUX", mx, forceMasked=1, 30745f757f3fSDimitry Andric forceMergeOpRead=true>; 3075*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_IM<m, CarryOut=1, CarryIn=1, Constraint=constraint, TargetConstraintType=2>, 30765f757f3fSDimitry Andric SchedUnary<"WriteVICALUI", "ReadVICALUV", mx, forceMasked=1, 30775f757f3fSDimitry Andric forceMergeOpRead=true>; 3078bdd1243dSDimitry Andric } 3079e8d8bef9SDimitry Andric} 3080e8d8bef9SDimitry Andric 3081*0fca6ea1SDimitry Andricmulticlass VPseudoVCALUM_VM_XM { 3082*0fca6ea1SDimitry Andric defvar constraint = "@earlyclobber $rd"; 3083bdd1243dSDimitry Andric foreach m = MxList in { 3084bdd1243dSDimitry Andric defvar mx = m.MX; 3085*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VM<m, CarryOut=1, CarryIn=1, Constraint=constraint, 3086*0fca6ea1SDimitry Andric TargetConstraintType=2>, 30875f757f3fSDimitry Andric SchedBinary<"WriteVICALUV", "ReadVICALUV", "ReadVICALUV", mx, forceMasked=1, 30885f757f3fSDimitry Andric forceMergeOpRead=true>; 3089*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_XM<m, CarryOut=1, CarryIn=1, Constraint=constraint, 3090*0fca6ea1SDimitry Andric TargetConstraintType=2>, 30915f757f3fSDimitry Andric SchedBinary<"WriteVICALUX", "ReadVICALUV", "ReadVICALUX", mx, forceMasked=1, 30925f757f3fSDimitry Andric forceMergeOpRead=true>; 3093bdd1243dSDimitry Andric } 3094e8d8bef9SDimitry Andric} 3095e8d8bef9SDimitry Andric 3096*0fca6ea1SDimitry Andricmulticlass VPseudoVCALUM_V_X_I { 3097*0fca6ea1SDimitry Andric defvar constraint = "@earlyclobber $rd"; 3098bdd1243dSDimitry Andric foreach m = MxList in { 3099bdd1243dSDimitry Andric defvar mx = m.MX; 3100*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VM<m, CarryOut=1, CarryIn=0, Constraint=constraint, 31015f757f3fSDimitry Andric Commutable=1, TargetConstraintType=2>, 31025f757f3fSDimitry Andric SchedBinary<"WriteVICALUV", "ReadVICALUV", "ReadVICALUV", mx, 31035f757f3fSDimitry Andric forceMergeOpRead=true>; 3104*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_XM<m, CarryOut=1, CarryIn=0, Constraint=constraint, TargetConstraintType=2>, 31055f757f3fSDimitry Andric SchedBinary<"WriteVICALUX", "ReadVICALUV", "ReadVICALUX", mx, 31065f757f3fSDimitry Andric forceMergeOpRead=true>; 3107*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_IM<m, CarryOut=1, CarryIn=0, Constraint=constraint>, 31085f757f3fSDimitry Andric SchedUnary<"WriteVICALUI", "ReadVICALUV", mx, 31095f757f3fSDimitry Andric forceMergeOpRead=true>; 3110bdd1243dSDimitry Andric } 31110eae32dcSDimitry Andric} 31120eae32dcSDimitry Andric 3113*0fca6ea1SDimitry Andricmulticlass VPseudoVCALUM_V_X { 3114*0fca6ea1SDimitry Andric defvar constraint = "@earlyclobber $rd"; 3115bdd1243dSDimitry Andric foreach m = MxList in { 3116bdd1243dSDimitry Andric defvar mx = m.MX; 3117*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_VM<m, CarryOut=1, CarryIn=0, Constraint=constraint, TargetConstraintType=2>, 31185f757f3fSDimitry Andric SchedBinary<"WriteVICALUV", "ReadVICALUV", "ReadVICALUV", mx, 31195f757f3fSDimitry Andric forceMergeOpRead=true>; 3120*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_XM<m, CarryOut=1, CarryIn=0, Constraint=constraint, TargetConstraintType=2>, 31215f757f3fSDimitry Andric SchedBinary<"WriteVICALUX", "ReadVICALUV", "ReadVICALUX", mx, 31225f757f3fSDimitry Andric forceMergeOpRead=true>; 3123bdd1243dSDimitry Andric } 31240eae32dcSDimitry Andric} 31250eae32dcSDimitry Andric 312606c3fb27SDimitry Andricmulticlass VPseudoVNCLP_WV_WX_WI_RM { 3127bdd1243dSDimitry Andric foreach m = MxListW in { 3128bdd1243dSDimitry Andric defvar mx = m.MX; 312906c3fb27SDimitry Andric defm "" : VPseudoBinaryV_WV_RM<m>, 31305f757f3fSDimitry Andric SchedBinary<"WriteVNClipV", "ReadVNClipV", "ReadVNClipV", mx, 31315f757f3fSDimitry Andric forceMergeOpRead=true>; 313206c3fb27SDimitry Andric defm "" : VPseudoBinaryV_WX_RM<m>, 31335f757f3fSDimitry Andric SchedBinary<"WriteVNClipX", "ReadVNClipV", "ReadVNClipX", mx, 31345f757f3fSDimitry Andric forceMergeOpRead=true>; 313506c3fb27SDimitry Andric defm "" : VPseudoBinaryV_WI_RM<m>, 31365f757f3fSDimitry Andric SchedUnary<"WriteVNClipI", "ReadVNClipV", mx, 31375f757f3fSDimitry Andric forceMergeOpRead=true>; 3138bdd1243dSDimitry Andric } 31390eae32dcSDimitry Andric} 31400eae32dcSDimitry Andric 31410eae32dcSDimitry Andricmulticlass VPseudoVNSHT_WV_WX_WI { 3142bdd1243dSDimitry Andric foreach m = MxListW in { 3143bdd1243dSDimitry Andric defvar mx = m.MX; 3144*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_WV<m>, 31455f757f3fSDimitry Andric SchedBinary<"WriteVNShiftV", "ReadVNShiftV", "ReadVNShiftV", mx, 31465f757f3fSDimitry Andric forceMergeOpRead=true>; 3147*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_WX<m>, 31485f757f3fSDimitry Andric SchedBinary<"WriteVNShiftX", "ReadVNShiftV", "ReadVNShiftX", mx, 31495f757f3fSDimitry Andric forceMergeOpRead=true>; 3150*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryV_WI<m>, 31515f757f3fSDimitry Andric SchedUnary<"WriteVNShiftI", "ReadVNShiftV", mx, 31525f757f3fSDimitry Andric forceMergeOpRead=true>; 3153bdd1243dSDimitry Andric } 3154e8d8bef9SDimitry Andric} 3155e8d8bef9SDimitry Andric 315606c3fb27SDimitry Andricmulticlass VPseudoTernaryWithTailPolicy<VReg RetClass, 3157fe6060f1SDimitry Andric RegisterClass Op1Class, 3158fe6060f1SDimitry Andric DAGOperand Op2Class, 3159e8d8bef9SDimitry Andric LMULInfo MInfo, 3160*0fca6ea1SDimitry Andric int sew> { 31615f757f3fSDimitry Andric let VLMul = MInfo.value, SEW=sew in { 316206c3fb27SDimitry Andric defvar mx = MInfo.MX; 3163*0fca6ea1SDimitry Andric def "_" # mx # "_E" # sew : VPseudoTernaryNoMaskWithPolicy<RetClass, Op1Class, Op2Class>; 3164*0fca6ea1SDimitry Andric def "_" # mx # "_E" # sew # "_MASK" : VPseudoTernaryMaskPolicy<RetClass, Op1Class, Op2Class>, 3165*0fca6ea1SDimitry Andric RISCVMaskedPseudo<MaskIdx=3, ActiveAffectsRes=true>; 3166e8d8bef9SDimitry Andric } 3167e8d8bef9SDimitry Andric} 3168e8d8bef9SDimitry Andric 316906c3fb27SDimitry Andricmulticlass VPseudoTernaryWithTailPolicyRoundingMode<VReg RetClass, 317081ad6265SDimitry Andric RegisterClass Op1Class, 317181ad6265SDimitry Andric DAGOperand Op2Class, 317281ad6265SDimitry Andric LMULInfo MInfo, 3173*0fca6ea1SDimitry Andric int sew> { 31745f757f3fSDimitry Andric let VLMul = MInfo.value, SEW=sew in { 317506c3fb27SDimitry Andric defvar mx = MInfo.MX; 317606c3fb27SDimitry Andric def "_" # mx # "_E" # sew 317706c3fb27SDimitry Andric : VPseudoTernaryNoMaskWithPolicyRoundingMode<RetClass, Op1Class, 3178*0fca6ea1SDimitry Andric Op2Class>; 317906c3fb27SDimitry Andric def "_" # mx # "_E" # sew # "_MASK" 318006c3fb27SDimitry Andric : VPseudoTernaryMaskPolicyRoundingMode<RetClass, Op1Class, 3181*0fca6ea1SDimitry Andric Op2Class>, 3182*0fca6ea1SDimitry Andric RISCVMaskedPseudo<MaskIdx=3, ActiveAffectsRes=true>; 318381ad6265SDimitry Andric } 318481ad6265SDimitry Andric} 318581ad6265SDimitry Andric 3186349cc55cSDimitry Andricmulticlass VPseudoTernaryWithPolicy<VReg RetClass, 3187349cc55cSDimitry Andric RegisterClass Op1Class, 3188349cc55cSDimitry Andric DAGOperand Op2Class, 3189349cc55cSDimitry Andric LMULInfo MInfo, 3190349cc55cSDimitry Andric string Constraint = "", 31915f757f3fSDimitry Andric bit Commutable = 0, 31925f757f3fSDimitry Andric int TargetConstraintType = 1> { 3193349cc55cSDimitry Andric let VLMul = MInfo.value in { 3194349cc55cSDimitry Andric let isCommutable = Commutable in 31955f757f3fSDimitry Andric def "_" # MInfo.MX : VPseudoTernaryNoMaskWithPolicy<RetClass, Op1Class, Op2Class, Constraint, TargetConstraintType>; 31965f757f3fSDimitry Andric def "_" # MInfo.MX # "_MASK" : VPseudoBinaryMaskPolicy<RetClass, Op1Class, Op2Class, Constraint, TargetConstraintType>, 319706c3fb27SDimitry Andric RISCVMaskedPseudo<MaskIdx=3>; 319806c3fb27SDimitry Andric } 319906c3fb27SDimitry Andric} 320006c3fb27SDimitry Andric 320106c3fb27SDimitry Andricmulticlass VPseudoTernaryWithPolicyRoundingMode<VReg RetClass, 320206c3fb27SDimitry Andric RegisterClass Op1Class, 320306c3fb27SDimitry Andric DAGOperand Op2Class, 320406c3fb27SDimitry Andric LMULInfo MInfo, 320506c3fb27SDimitry Andric string Constraint = "", 3206*0fca6ea1SDimitry Andric int sew = 0, 32075f757f3fSDimitry Andric bit Commutable = 0, 32085f757f3fSDimitry Andric int TargetConstraintType = 1> { 320906c3fb27SDimitry Andric let VLMul = MInfo.value in { 3210*0fca6ea1SDimitry Andric defvar suffix = !if(sew, "_" # MInfo.MX # "_E" # sew, "_" # MInfo.MX); 321106c3fb27SDimitry Andric let isCommutable = Commutable in 3212*0fca6ea1SDimitry Andric def suffix : 321306c3fb27SDimitry Andric VPseudoTernaryNoMaskWithPolicyRoundingMode<RetClass, Op1Class, 32145f757f3fSDimitry Andric Op2Class, Constraint, 32155f757f3fSDimitry Andric TargetConstraintType>; 3216*0fca6ea1SDimitry Andric def suffix # "_MASK" : 321706c3fb27SDimitry Andric VPseudoBinaryMaskPolicyRoundingMode<RetClass, Op1Class, 321806c3fb27SDimitry Andric Op2Class, Constraint, 32195f757f3fSDimitry Andric UsesVXRM_=0, 32205f757f3fSDimitry Andric TargetConstraintType=TargetConstraintType>, 322106c3fb27SDimitry Andric RISCVMaskedPseudo<MaskIdx=3>; 3222349cc55cSDimitry Andric } 3223349cc55cSDimitry Andric} 3224fe6060f1SDimitry Andric 3225*0fca6ea1SDimitry Andricmulticlass VPseudoTernaryV_VV_AAXA<LMULInfo m> { 3226349cc55cSDimitry Andric defm _VV : VPseudoTernaryWithPolicy<m.vrclass, m.vrclass, m.vrclass, m, 3227*0fca6ea1SDimitry Andric Commutable=1>; 3228fe6060f1SDimitry Andric} 3229e8d8bef9SDimitry Andric 3230*0fca6ea1SDimitry Andricmulticlass VPseudoTernaryV_VV_AAXA_RM<LMULInfo m, int sew> { 323106c3fb27SDimitry Andric defm _VV : VPseudoTernaryWithPolicyRoundingMode<m.vrclass, m.vrclass, m.vrclass, m, 3232*0fca6ea1SDimitry Andric sew=sew, Commutable=1>; 3233e8d8bef9SDimitry Andric} 3234e8d8bef9SDimitry Andric 3235*0fca6ea1SDimitry Andricmulticlass VPseudoTernaryV_VX_AAXA<LMULInfo m> { 3236349cc55cSDimitry Andric defm "_VX" : VPseudoTernaryWithPolicy<m.vrclass, GPR, m.vrclass, m, 323706c3fb27SDimitry Andric Commutable=1>; 323806c3fb27SDimitry Andric} 323906c3fb27SDimitry Andric 3240*0fca6ea1SDimitry Andricmulticlass VPseudoTernaryV_VF_AAXA_RM<LMULInfo m, FPR_Info f, 3241*0fca6ea1SDimitry Andric int sew> { 324206c3fb27SDimitry Andric defm "_V" # f.FX : VPseudoTernaryWithPolicyRoundingMode<m.vrclass, f.fprclass, 3243*0fca6ea1SDimitry Andric m.vrclass, m, 3244*0fca6ea1SDimitry Andric sew=sew, Commutable=1>; 3245e8d8bef9SDimitry Andric} 3246e8d8bef9SDimitry Andric 3247*0fca6ea1SDimitry Andricmulticlass VPseudoTernaryW_VV<LMULInfo m, bit Commutable = 0> { 3248e8d8bef9SDimitry Andric defvar constraint = "@earlyclobber $rd"; 3249349cc55cSDimitry Andric defm _VV : VPseudoTernaryWithPolicy<m.wvrclass, m.vrclass, m.vrclass, m, 3250*0fca6ea1SDimitry Andric constraint, Commutable=Commutable, TargetConstraintType=3>; 3251fe6060f1SDimitry Andric} 3252e8d8bef9SDimitry Andric 3253*0fca6ea1SDimitry Andricmulticlass VPseudoTernaryW_VV_RM<LMULInfo m, int sew> { 325406c3fb27SDimitry Andric defvar constraint = "@earlyclobber $rd"; 325506c3fb27SDimitry Andric defm _VV : VPseudoTernaryWithPolicyRoundingMode<m.wvrclass, m.vrclass, m.vrclass, m, 3256*0fca6ea1SDimitry Andric constraint, sew, 32575f757f3fSDimitry Andric TargetConstraintType=3>; 325806c3fb27SDimitry Andric} 325906c3fb27SDimitry Andric 3260bdd1243dSDimitry Andricmulticlass VPseudoTernaryW_VX<LMULInfo m> { 3261e8d8bef9SDimitry Andric defvar constraint = "@earlyclobber $rd"; 3262349cc55cSDimitry Andric defm "_VX" : VPseudoTernaryWithPolicy<m.wvrclass, GPR, m.vrclass, m, 3263*0fca6ea1SDimitry Andric constraint, TargetConstraintType=3>; 3264e8d8bef9SDimitry Andric} 3265e8d8bef9SDimitry Andric 3266*0fca6ea1SDimitry Andricmulticlass VPseudoTernaryW_VF_RM<LMULInfo m, FPR_Info f, int sew> { 326706c3fb27SDimitry Andric defvar constraint = "@earlyclobber $rd"; 326806c3fb27SDimitry Andric defm "_V" # f.FX : VPseudoTernaryWithPolicyRoundingMode<m.wvrclass, f.fprclass, 32695f757f3fSDimitry Andric m.vrclass, m, constraint, 3270*0fca6ea1SDimitry Andric sew=sew, 32715f757f3fSDimitry Andric TargetConstraintType=3>; 327206c3fb27SDimitry Andric} 327306c3fb27SDimitry Andric 327406c3fb27SDimitry Andricmulticlass VPseudoVSLDVWithPolicy<VReg RetClass, 327506c3fb27SDimitry Andric RegisterClass Op1Class, 327606c3fb27SDimitry Andric DAGOperand Op2Class, 327706c3fb27SDimitry Andric LMULInfo MInfo, 327806c3fb27SDimitry Andric string Constraint = ""> { 327906c3fb27SDimitry Andric let VLMul = MInfo.value in { 328006c3fb27SDimitry Andric def "_" # MInfo.MX : VPseudoTernaryNoMaskWithPolicy<RetClass, Op1Class, Op2Class, Constraint>; 328106c3fb27SDimitry Andric def "_" # MInfo.MX # "_MASK" : VPseudoBinaryMaskPolicy<RetClass, Op1Class, Op2Class, Constraint>, 328206c3fb27SDimitry Andric RISCVMaskedPseudo<MaskIdx=3>; 328306c3fb27SDimitry Andric } 328406c3fb27SDimitry Andric} 328506c3fb27SDimitry Andric 328606c3fb27SDimitry Andricmulticlass VPseudoVSLDV_VX<LMULInfo m, string Constraint = ""> { 328706c3fb27SDimitry Andric defm _VX : VPseudoVSLDVWithPolicy<m.vrclass, m.vrclass, GPR, m, Constraint>; 328806c3fb27SDimitry Andric} 328906c3fb27SDimitry Andric 3290*0fca6ea1SDimitry Andricmulticlass VPseudoVSLDV_VI<LMULInfo m, string Constraint = ""> { 3291*0fca6ea1SDimitry Andric defm _VI : VPseudoVSLDVWithPolicy<m.vrclass, m.vrclass, uimm5, m, Constraint>; 3292e8d8bef9SDimitry Andric} 3293e8d8bef9SDimitry Andric 3294*0fca6ea1SDimitry Andricmulticlass VPseudoVMAC_VV_VX_AAXA { 3295bdd1243dSDimitry Andric foreach m = MxList in { 3296bdd1243dSDimitry Andric defvar mx = m.MX; 3297*0fca6ea1SDimitry Andric defm "" : VPseudoTernaryV_VV_AAXA<m>, 32985f757f3fSDimitry Andric SchedTernary<"WriteVIMulAddV", "ReadVIMulAddV", "ReadVIMulAddV", 32995f757f3fSDimitry Andric "ReadVIMulAddV", mx>; 3300*0fca6ea1SDimitry Andric defm "" : VPseudoTernaryV_VX_AAXA<m>, 33015f757f3fSDimitry Andric SchedTernary<"WriteVIMulAddX", "ReadVIMulAddV", "ReadVIMulAddX", 33025f757f3fSDimitry Andric "ReadVIMulAddV", mx>; 3303bdd1243dSDimitry Andric } 3304e8d8bef9SDimitry Andric} 3305e8d8bef9SDimitry Andric 3306*0fca6ea1SDimitry Andricmulticlass VPseudoVMAC_VV_VF_AAXA_RM { 3307bdd1243dSDimitry Andric foreach m = MxListF in { 3308*0fca6ea1SDimitry Andric foreach e = SchedSEWSet<m.MX, isF=1>.val in 3309*0fca6ea1SDimitry Andric defm "" : VPseudoTernaryV_VV_AAXA_RM<m, sew=e>, 33105f757f3fSDimitry Andric SchedTernary<"WriteVFMulAddV", "ReadVFMulAddV", "ReadVFMulAddV", 3311*0fca6ea1SDimitry Andric "ReadVFMulAddV", m.MX, e>; 3312bdd1243dSDimitry Andric } 3313bdd1243dSDimitry Andric 3314bdd1243dSDimitry Andric foreach f = FPList in { 3315bdd1243dSDimitry Andric foreach m = f.MxList in { 3316*0fca6ea1SDimitry Andric defm "" : VPseudoTernaryV_VF_AAXA_RM<m, f, sew=f.SEW>, 33175f757f3fSDimitry Andric SchedTernary<"WriteVFMulAddF", "ReadVFMulAddV", "ReadVFMulAddF", 3318*0fca6ea1SDimitry Andric "ReadVFMulAddV", m.MX, f.SEW>; 3319bdd1243dSDimitry Andric } 3320bdd1243dSDimitry Andric } 3321e8d8bef9SDimitry Andric} 3322e8d8bef9SDimitry Andric 3323*0fca6ea1SDimitry Andricmulticlass VPseudoVSLD_VX_VI<bit slidesUp = false, string Constraint = ""> { 3324*0fca6ea1SDimitry Andric defvar WriteSlideX = !if(slidesUp, "WriteVSlideUpX", "WriteVSlideDownX"); 3325bdd1243dSDimitry Andric foreach m = MxList in { 3326bdd1243dSDimitry Andric defvar mx = m.MX; 3327bdd1243dSDimitry Andric defm "" : VPseudoVSLDV_VX<m, Constraint>, 3328*0fca6ea1SDimitry Andric SchedTernary<WriteSlideX, "ReadVISlideV", "ReadVISlideV", 33295f757f3fSDimitry Andric "ReadVISlideX", mx>; 3330*0fca6ea1SDimitry Andric defm "" : VPseudoVSLDV_VI<m, Constraint>, 3331*0fca6ea1SDimitry Andric SchedBinary<"WriteVSlideI", "ReadVISlideV", "ReadVISlideV", mx>; 3332bdd1243dSDimitry Andric } 3333e8d8bef9SDimitry Andric} 3334e8d8bef9SDimitry Andric 3335*0fca6ea1SDimitry Andricmulticlass VPseudoVWMAC_VV_VX<bit Commutable = 0> { 3336bdd1243dSDimitry Andric foreach m = MxListW in { 3337bdd1243dSDimitry Andric defvar mx = m.MX; 3338*0fca6ea1SDimitry Andric defm "" : VPseudoTernaryW_VV<m, Commutable=Commutable>, 33395f757f3fSDimitry Andric SchedTernary<"WriteVIWMulAddV", "ReadVIWMulAddV", "ReadVIWMulAddV", 33405f757f3fSDimitry Andric "ReadVIWMulAddV", mx>; 3341bdd1243dSDimitry Andric defm "" : VPseudoTernaryW_VX<m>, 33425f757f3fSDimitry Andric SchedTernary<"WriteVIWMulAddX", "ReadVIWMulAddV", "ReadVIWMulAddX", 33435f757f3fSDimitry Andric "ReadVIWMulAddV", mx>; 3344bdd1243dSDimitry Andric } 3345e8d8bef9SDimitry Andric} 3346e8d8bef9SDimitry Andric 33470eae32dcSDimitry Andricmulticlass VPseudoVWMAC_VX { 3348bdd1243dSDimitry Andric foreach m = MxListW in { 3349bdd1243dSDimitry Andric defm "" : VPseudoTernaryW_VX<m>, 33505f757f3fSDimitry Andric SchedTernary<"WriteVIWMulAddX", "ReadVIWMulAddV", "ReadVIWMulAddX", 33515f757f3fSDimitry Andric "ReadVIWMulAddV", m.MX>; 3352bdd1243dSDimitry Andric } 3353e8d8bef9SDimitry Andric} 3354e8d8bef9SDimitry Andric 335506c3fb27SDimitry Andricmulticlass VPseudoVWMAC_VV_VF_RM { 3356bdd1243dSDimitry Andric foreach m = MxListFW in { 3357*0fca6ea1SDimitry Andric foreach e = SchedSEWSet<m.MX, isF=1, isWidening=1>.val in 3358*0fca6ea1SDimitry Andric defm "" : VPseudoTernaryW_VV_RM<m, sew=e>, 33595f757f3fSDimitry Andric SchedTernary<"WriteVFWMulAddV", "ReadVFWMulAddV", 3360*0fca6ea1SDimitry Andric "ReadVFWMulAddV", "ReadVFWMulAddV", m.MX, e>; 3361bdd1243dSDimitry Andric } 3362bdd1243dSDimitry Andric 3363bdd1243dSDimitry Andric foreach f = FPListW in { 3364bdd1243dSDimitry Andric foreach m = f.MxListFW in { 3365*0fca6ea1SDimitry Andric defm "" : VPseudoTernaryW_VF_RM<m, f, sew=f.SEW>, 33665f757f3fSDimitry Andric SchedTernary<"WriteVFWMulAddF", "ReadVFWMulAddV", 3367*0fca6ea1SDimitry Andric "ReadVFWMulAddF", "ReadVFWMulAddV", m.MX, f.SEW>; 33685f757f3fSDimitry Andric } 33695f757f3fSDimitry Andric } 33705f757f3fSDimitry Andric} 33715f757f3fSDimitry Andric 33725f757f3fSDimitry Andricmulticlass VPseudoVWMAC_VV_VF_BF_RM { 33735f757f3fSDimitry Andric foreach m = MxListFW in { 33745f757f3fSDimitry Andric defvar mx = m.MX; 3375*0fca6ea1SDimitry Andric foreach e = SchedSEWSet<mx, isF=1, isWidening=1>.val in 3376*0fca6ea1SDimitry Andric defm "" : VPseudoTernaryW_VV_RM<m, sew=e>, 33775f757f3fSDimitry Andric SchedTernary<"WriteVFWMulAddV", "ReadVFWMulAddV", 3378*0fca6ea1SDimitry Andric "ReadVFWMulAddV", "ReadVFWMulAddV", mx, e>; 33795f757f3fSDimitry Andric } 33805f757f3fSDimitry Andric 33815f757f3fSDimitry Andric foreach f = BFPListW in { 33825f757f3fSDimitry Andric foreach m = f.MxListFW in { 33835f757f3fSDimitry Andric defvar mx = m.MX; 3384*0fca6ea1SDimitry Andric defm "" : VPseudoTernaryW_VF_RM<m, f, sew=f.SEW>, 33855f757f3fSDimitry Andric SchedTernary<"WriteVFWMulAddF", "ReadVFWMulAddV", 3386*0fca6ea1SDimitry Andric "ReadVFWMulAddF", "ReadVFWMulAddV", mx, f.SEW>; 3387bdd1243dSDimitry Andric } 3388bdd1243dSDimitry Andric } 3389e8d8bef9SDimitry Andric} 3390e8d8bef9SDimitry Andric 3391*0fca6ea1SDimitry Andricmulticlass VPseudoVCMPM_VV_VX_VI<bit Commutable = 0> { 3392bdd1243dSDimitry Andric foreach m = MxList in { 3393bdd1243dSDimitry Andric defvar mx = m.MX; 3394*0fca6ea1SDimitry Andric defm "" : VPseudoBinaryM_VV<m, TargetConstraintType=2, Commutable=Commutable>, 33955f757f3fSDimitry Andric SchedBinary<"WriteVICmpV", "ReadVICmpV", "ReadVICmpV", mx>; 33965f757f3fSDimitry Andric defm "" : VPseudoBinaryM_VX<m, TargetConstraintType=2>, 33975f757f3fSDimitry Andric SchedBinary<"WriteVICmpX", "ReadVICmpV", "ReadVICmpX", mx>; 33985f757f3fSDimitry Andric defm "" : VPseudoBinaryM_VI<m, TargetConstraintType=2>, 33995f757f3fSDimitry Andric SchedUnary<"WriteVICmpI", "ReadVICmpV", mx>; 3400bdd1243dSDimitry Andric } 3401e8d8bef9SDimitry Andric} 3402e8d8bef9SDimitry Andric 34030eae32dcSDimitry Andricmulticlass VPseudoVCMPM_VV_VX { 3404bdd1243dSDimitry Andric foreach m = MxList in { 3405bdd1243dSDimitry Andric defvar mx = m.MX; 34065f757f3fSDimitry Andric defm "" : VPseudoBinaryM_VV<m, TargetConstraintType=2>, 34075f757f3fSDimitry Andric SchedBinary<"WriteVICmpV", "ReadVICmpV", "ReadVICmpV", mx>; 34085f757f3fSDimitry Andric defm "" : VPseudoBinaryM_VX<m, TargetConstraintType=2>, 34095f757f3fSDimitry Andric SchedBinary<"WriteVICmpX", "ReadVICmpV", "ReadVICmpX", mx>; 3410bdd1243dSDimitry Andric } 3411e8d8bef9SDimitry Andric} 3412e8d8bef9SDimitry Andric 34130eae32dcSDimitry Andricmulticlass VPseudoVCMPM_VV_VF { 3414bdd1243dSDimitry Andric foreach m = MxListF in { 34155f757f3fSDimitry Andric defm "" : VPseudoBinaryM_VV<m, TargetConstraintType=2>, 34165f757f3fSDimitry Andric SchedBinary<"WriteVFCmpV", "ReadVFCmpV", "ReadVFCmpV", m.MX>; 3417bdd1243dSDimitry Andric } 3418bdd1243dSDimitry Andric 3419bdd1243dSDimitry Andric foreach f = FPList in { 3420bdd1243dSDimitry Andric foreach m = f.MxList in { 34215f757f3fSDimitry Andric defm "" : VPseudoBinaryM_VF<m, f, TargetConstraintType=2>, 34225f757f3fSDimitry Andric SchedBinary<"WriteVFCmpF", "ReadVFCmpV", "ReadVFCmpF", m.MX>; 3423bdd1243dSDimitry Andric } 3424bdd1243dSDimitry Andric } 3425e8d8bef9SDimitry Andric} 3426e8d8bef9SDimitry Andric 34270eae32dcSDimitry Andricmulticlass VPseudoVCMPM_VF { 3428bdd1243dSDimitry Andric foreach f = FPList in { 3429bdd1243dSDimitry Andric foreach m = f.MxList in { 34305f757f3fSDimitry Andric defm "" : VPseudoBinaryM_VF<m, f, TargetConstraintType=2>, 34315f757f3fSDimitry Andric SchedBinary<"WriteVFCmpF", "ReadVFCmpV", "ReadVFCmpF", m.MX>; 3432bdd1243dSDimitry Andric } 3433bdd1243dSDimitry Andric } 34340eae32dcSDimitry Andric} 34350eae32dcSDimitry Andric 34360eae32dcSDimitry Andricmulticlass VPseudoVCMPM_VX_VI { 3437bdd1243dSDimitry Andric foreach m = MxList in { 3438bdd1243dSDimitry Andric defvar mx = m.MX; 34395f757f3fSDimitry Andric defm "" : VPseudoBinaryM_VX<m, TargetConstraintType=2>, 34405f757f3fSDimitry Andric SchedBinary<"WriteVICmpX", "ReadVICmpV", "ReadVICmpX", mx>; 34415f757f3fSDimitry Andric defm "" : VPseudoBinaryM_VI<m, TargetConstraintType=2>, 34425f757f3fSDimitry Andric SchedUnary<"WriteVICmpI", "ReadVICmpV", mx>; 3443bdd1243dSDimitry Andric } 34440eae32dcSDimitry Andric} 34450eae32dcSDimitry Andric 34460eae32dcSDimitry Andricmulticlass VPseudoVRED_VS { 344704eeddc0SDimitry Andric foreach m = MxList in { 344806c3fb27SDimitry Andric defvar mx = m.MX; 344906c3fb27SDimitry Andric foreach e = SchedSEWSet<mx>.val in { 345006c3fb27SDimitry Andric defm _VS : VPseudoTernaryWithTailPolicy<V_M1.vrclass, m.vrclass, V_M1.vrclass, m, e>, 34515f757f3fSDimitry Andric SchedReduction<"WriteVIRedV_From", "ReadVIRedV", mx, e>; 345206c3fb27SDimitry Andric } 345306c3fb27SDimitry Andric } 345406c3fb27SDimitry Andric} 345506c3fb27SDimitry Andric 345606c3fb27SDimitry Andricmulticlass VPseudoVREDMINMAX_VS { 345706c3fb27SDimitry Andric foreach m = MxList in { 345806c3fb27SDimitry Andric defvar mx = m.MX; 345906c3fb27SDimitry Andric foreach e = SchedSEWSet<mx>.val in { 346006c3fb27SDimitry Andric defm _VS : VPseudoTernaryWithTailPolicy<V_M1.vrclass, m.vrclass, V_M1.vrclass, m, e>, 34615f757f3fSDimitry Andric SchedReduction<"WriteVIRedMinMaxV_From", "ReadVIRedV", mx, e>; 346206c3fb27SDimitry Andric } 34630eae32dcSDimitry Andric } 34640eae32dcSDimitry Andric} 34650eae32dcSDimitry Andric 34660eae32dcSDimitry Andricmulticlass VPseudoVWRED_VS { 346706c3fb27SDimitry Andric foreach m = MxListWRed in { 346806c3fb27SDimitry Andric defvar mx = m.MX; 346906c3fb27SDimitry Andric foreach e = SchedSEWSet<mx, isWidening=1>.val in { 347006c3fb27SDimitry Andric defm _VS : VPseudoTernaryWithTailPolicy<V_M1.vrclass, m.vrclass, V_M1.vrclass, m, e>, 34715f757f3fSDimitry Andric SchedReduction<"WriteVIWRedV_From", "ReadVIWRedV", mx, e>; 347206c3fb27SDimitry Andric } 34730eae32dcSDimitry Andric } 34740eae32dcSDimitry Andric} 34750eae32dcSDimitry Andric 347606c3fb27SDimitry Andricmulticlass VPseudoVFRED_VS_RM { 347704eeddc0SDimitry Andric foreach m = MxListF in { 347806c3fb27SDimitry Andric defvar mx = m.MX; 347906c3fb27SDimitry Andric foreach e = SchedSEWSet<mx, isF=1>.val in { 348006c3fb27SDimitry Andric defm _VS 348106c3fb27SDimitry Andric : VPseudoTernaryWithTailPolicyRoundingMode<V_M1.vrclass, m.vrclass, 348206c3fb27SDimitry Andric V_M1.vrclass, m, e>, 34835f757f3fSDimitry Andric SchedReduction<"WriteVFRedV_From", "ReadVFRedV", mx, e>; 348406c3fb27SDimitry Andric } 34850eae32dcSDimitry Andric } 34860eae32dcSDimitry Andric} 34870eae32dcSDimitry Andric 348806c3fb27SDimitry Andricmulticlass VPseudoVFREDMINMAX_VS { 348904eeddc0SDimitry Andric foreach m = MxListF in { 349006c3fb27SDimitry Andric defvar mx = m.MX; 349106c3fb27SDimitry Andric foreach e = SchedSEWSet<mx, isF=1>.val in { 349206c3fb27SDimitry Andric defm _VS : VPseudoTernaryWithTailPolicy<V_M1.vrclass, m.vrclass, V_M1.vrclass, m, e>, 34935f757f3fSDimitry Andric SchedReduction<"WriteVFRedMinMaxV_From", "ReadVFRedV", mx, e>; 349406c3fb27SDimitry Andric } 34950eae32dcSDimitry Andric } 34960eae32dcSDimitry Andric} 34970eae32dcSDimitry Andric 349806c3fb27SDimitry Andricmulticlass VPseudoVFREDO_VS_RM { 349904eeddc0SDimitry Andric foreach m = MxListF in { 350006c3fb27SDimitry Andric defvar mx = m.MX; 350106c3fb27SDimitry Andric foreach e = SchedSEWSet<mx, isF=1>.val in { 350206c3fb27SDimitry Andric defm _VS : VPseudoTernaryWithTailPolicyRoundingMode<V_M1.vrclass, m.vrclass, 350306c3fb27SDimitry Andric V_M1.vrclass, m, e>, 35045f757f3fSDimitry Andric SchedReduction<"WriteVFRedOV_From", "ReadVFRedOV", mx, e>; 350506c3fb27SDimitry Andric } 350606c3fb27SDimitry Andric } 350706c3fb27SDimitry Andric} 350806c3fb27SDimitry Andric 350906c3fb27SDimitry Andricmulticlass VPseudoVFWRED_VS_RM { 351006c3fb27SDimitry Andric foreach m = MxListFWRed in { 351106c3fb27SDimitry Andric defvar mx = m.MX; 351206c3fb27SDimitry Andric foreach e = SchedSEWSet<mx, isF=1, isWidening=1>.val in { 351306c3fb27SDimitry Andric defm _VS 351406c3fb27SDimitry Andric : VPseudoTernaryWithTailPolicyRoundingMode<V_M1.vrclass, m.vrclass, 351506c3fb27SDimitry Andric V_M1.vrclass, m, e>, 35165f757f3fSDimitry Andric SchedReduction<"WriteVFWRedV_From", "ReadVFWRedV", mx, e>; 35175f757f3fSDimitry Andric } 35185f757f3fSDimitry Andric } 35195f757f3fSDimitry Andric} 35205f757f3fSDimitry Andric 35215f757f3fSDimitry Andricmulticlass VPseudoVFWREDO_VS_RM { 35225f757f3fSDimitry Andric foreach m = MxListFWRed in { 35235f757f3fSDimitry Andric defvar mx = m.MX; 35245f757f3fSDimitry Andric foreach e = SchedSEWSet<mx, isF=1, isWidening=1>.val in { 35255f757f3fSDimitry Andric defm _VS 35265f757f3fSDimitry Andric : VPseudoTernaryWithTailPolicyRoundingMode<V_M1.vrclass, m.vrclass, 35275f757f3fSDimitry Andric V_M1.vrclass, m, e>, 35285f757f3fSDimitry Andric SchedReduction<"WriteVFWRedOV_From", "ReadVFWRedV", mx, e>; 352906c3fb27SDimitry Andric } 3530e8d8bef9SDimitry Andric } 3531e8d8bef9SDimitry Andric} 3532e8d8bef9SDimitry Andric 3533e8d8bef9SDimitry Andricmulticlass VPseudoConversion<VReg RetClass, 3534e8d8bef9SDimitry Andric VReg Op1Class, 3535e8d8bef9SDimitry Andric LMULInfo MInfo, 35365f757f3fSDimitry Andric string Constraint = "", 3537*0fca6ea1SDimitry Andric int sew = 0, 35385f757f3fSDimitry Andric int TargetConstraintType = 1> { 3539*0fca6ea1SDimitry Andric defvar suffix = !if(sew, "_" # MInfo.MX # "_E" # sew, "_" # MInfo.MX); 3540*0fca6ea1SDimitry Andric let VLMul = MInfo.value, SEW=sew in { 3541*0fca6ea1SDimitry Andric def suffix : VPseudoUnaryNoMask<RetClass, Op1Class, Constraint, TargetConstraintType>; 3542*0fca6ea1SDimitry Andric def suffix # "_MASK" : VPseudoUnaryMask<RetClass, Op1Class, 35435f757f3fSDimitry Andric Constraint, TargetConstraintType>, 354406c3fb27SDimitry Andric RISCVMaskedPseudo<MaskIdx=2>; 3545e8d8bef9SDimitry Andric } 3546e8d8bef9SDimitry Andric} 3547e8d8bef9SDimitry Andric 354806c3fb27SDimitry Andricmulticlass VPseudoConversionRoundingMode<VReg RetClass, 354906c3fb27SDimitry Andric VReg Op1Class, 355006c3fb27SDimitry Andric LMULInfo MInfo, 35515f757f3fSDimitry Andric string Constraint = "", 3552*0fca6ea1SDimitry Andric int sew = 0, 35535f757f3fSDimitry Andric int TargetConstraintType = 1> { 3554*0fca6ea1SDimitry Andric let VLMul = MInfo.value, SEW=sew in { 3555*0fca6ea1SDimitry Andric defvar suffix = !if(sew, "_" # MInfo.MX # "_E" # sew, "_" # MInfo.MX); 3556*0fca6ea1SDimitry Andric def suffix : VPseudoUnaryNoMaskRoundingMode<RetClass, Op1Class, Constraint, TargetConstraintType>; 3557*0fca6ea1SDimitry Andric def suffix # "_MASK" : VPseudoUnaryMaskRoundingMode<RetClass, Op1Class, 3558*0fca6ea1SDimitry Andric Constraint, 3559*0fca6ea1SDimitry Andric TargetConstraintType>, 356006c3fb27SDimitry Andric RISCVMaskedPseudo<MaskIdx=2>; 356106c3fb27SDimitry Andric } 356206c3fb27SDimitry Andric} 356306c3fb27SDimitry Andric 356406c3fb27SDimitry Andric 3565bdd1243dSDimitry Andricmulticlass VPseudoConversionRM<VReg RetClass, 3566bdd1243dSDimitry Andric VReg Op1Class, 3567bdd1243dSDimitry Andric LMULInfo MInfo, 3568647cbc5dSDimitry Andric string Constraint = "", 3569*0fca6ea1SDimitry Andric int sew = 0, 3570647cbc5dSDimitry Andric int TargetConstraintType = 1> { 3571*0fca6ea1SDimitry Andric let VLMul = MInfo.value, SEW=sew in { 3572*0fca6ea1SDimitry Andric defvar suffix = !if(sew, "_" # MInfo.MX # "_E" # sew, "_" # MInfo.MX); 3573*0fca6ea1SDimitry Andric def suffix : VPseudoUnaryNoMask_FRM<RetClass, Op1Class, 3574647cbc5dSDimitry Andric Constraint, TargetConstraintType>; 3575*0fca6ea1SDimitry Andric def suffix # "_MASK" : VPseudoUnaryMask_FRM<RetClass, Op1Class, 3576647cbc5dSDimitry Andric Constraint, TargetConstraintType>, 357706c3fb27SDimitry Andric RISCVMaskedPseudo<MaskIdx=2>; 3578bdd1243dSDimitry Andric } 3579bdd1243dSDimitry Andric} 3580bdd1243dSDimitry Andric 3581bdd1243dSDimitry Andricmulticlass VPseudoConversionNoExcept<VReg RetClass, 3582bdd1243dSDimitry Andric VReg Op1Class, 3583bdd1243dSDimitry Andric LMULInfo MInfo, 3584bdd1243dSDimitry Andric string Constraint = ""> { 3585bdd1243dSDimitry Andric let VLMul = MInfo.value in { 358606c3fb27SDimitry Andric def "_" # MInfo.MX # "_MASK" : VPseudoUnaryMask_NoExcept<RetClass, Op1Class, Constraint>; 3587bdd1243dSDimitry Andric } 3588bdd1243dSDimitry Andric} 3589bdd1243dSDimitry Andric 35900eae32dcSDimitry Andricmulticlass VPseudoVCVTI_V { 3591bdd1243dSDimitry Andric foreach m = MxListF in { 35920eae32dcSDimitry Andric defm _V : VPseudoConversion<m.vrclass, m.vrclass, m>, 35935f757f3fSDimitry Andric SchedUnary<"WriteVFCvtFToIV", "ReadVFCvtFToIV", m.MX, 35945f757f3fSDimitry Andric forceMergeOpRead=true>; 3595bdd1243dSDimitry Andric } 3596bdd1243dSDimitry Andric} 3597bdd1243dSDimitry Andric 359806c3fb27SDimitry Andricmulticlass VPseudoVCVTI_V_RM { 359906c3fb27SDimitry Andric foreach m = MxListF in { 360006c3fb27SDimitry Andric defm _V : VPseudoConversionRoundingMode<m.vrclass, m.vrclass, m>, 36015f757f3fSDimitry Andric SchedUnary<"WriteVFCvtFToIV", "ReadVFCvtFToIV", m.MX, 36025f757f3fSDimitry Andric forceMergeOpRead=true>; 360306c3fb27SDimitry Andric } 360406c3fb27SDimitry Andric} 360506c3fb27SDimitry Andric 3606bdd1243dSDimitry Andricmulticlass VPseudoVCVTI_RM_V { 3607bdd1243dSDimitry Andric foreach m = MxListF in { 3608bdd1243dSDimitry Andric defm _V : VPseudoConversionRM<m.vrclass, m.vrclass, m>, 36095f757f3fSDimitry Andric SchedUnary<"WriteVFCvtFToIV", "ReadVFCvtFToIV", m.MX, 36105f757f3fSDimitry Andric forceMergeOpRead=true>; 3611bdd1243dSDimitry Andric } 3612bdd1243dSDimitry Andric} 3613bdd1243dSDimitry Andric 3614bdd1243dSDimitry Andricmulticlass VPseudoVFROUND_NOEXCEPT_V { 3615bdd1243dSDimitry Andric foreach m = MxListF in { 3616bdd1243dSDimitry Andric defm _V : VPseudoConversionNoExcept<m.vrclass, m.vrclass, m>, 36175f757f3fSDimitry Andric SchedUnary<"WriteVFCvtFToIV", "ReadVFCvtFToIV", m.MX, 36185f757f3fSDimitry Andric forceMergeOpRead=true>; 3619bdd1243dSDimitry Andric } 36200eae32dcSDimitry Andric} 36210eae32dcSDimitry Andric 362206c3fb27SDimitry Andricmulticlass VPseudoVCVTF_V_RM { 3623bdd1243dSDimitry Andric foreach m = MxListF in { 3624*0fca6ea1SDimitry Andric foreach e = SchedSEWSet<m.MX, isF=1>.val in 3625*0fca6ea1SDimitry Andric defm _V : VPseudoConversionRoundingMode<m.vrclass, m.vrclass, m, sew=e>, 3626*0fca6ea1SDimitry Andric SchedUnary<"WriteVFCvtIToFV", "ReadVFCvtIToFV", m.MX, e, 36275f757f3fSDimitry Andric forceMergeOpRead=true>; 3628bdd1243dSDimitry Andric } 3629bdd1243dSDimitry Andric} 3630bdd1243dSDimitry Andric 3631bdd1243dSDimitry Andricmulticlass VPseudoVCVTF_RM_V { 3632bdd1243dSDimitry Andric foreach m = MxListF in { 3633*0fca6ea1SDimitry Andric foreach e = SchedSEWSet<m.MX, isF=1>.val in 3634*0fca6ea1SDimitry Andric defm _V : VPseudoConversionRM<m.vrclass, m.vrclass, m, sew=e>, 3635*0fca6ea1SDimitry Andric SchedUnary<"WriteVFCvtIToFV", "ReadVFCvtIToFV", m.MX, e, 36365f757f3fSDimitry Andric forceMergeOpRead=true>; 3637bdd1243dSDimitry Andric } 3638e8d8bef9SDimitry Andric} 3639e8d8bef9SDimitry Andric 36400eae32dcSDimitry Andricmulticlass VPseudoVWCVTI_V { 36410eae32dcSDimitry Andric defvar constraint = "@earlyclobber $rd"; 3642bdd1243dSDimitry Andric foreach m = MxListFW in { 36435f757f3fSDimitry Andric defm _V : VPseudoConversion<m.wvrclass, m.vrclass, m, constraint, TargetConstraintType=3>, 36445f757f3fSDimitry Andric SchedUnary<"WriteVFWCvtFToIV", "ReadVFWCvtFToIV", m.MX, 36455f757f3fSDimitry Andric forceMergeOpRead=true>; 3646bdd1243dSDimitry Andric } 3647bdd1243dSDimitry Andric} 3648bdd1243dSDimitry Andric 364906c3fb27SDimitry Andricmulticlass VPseudoVWCVTI_V_RM { 365006c3fb27SDimitry Andric defvar constraint = "@earlyclobber $rd"; 365106c3fb27SDimitry Andric foreach m = MxListFW in { 36525f757f3fSDimitry Andric defm _V : VPseudoConversionRoundingMode<m.wvrclass, m.vrclass, m, constraint, TargetConstraintType=3>, 36535f757f3fSDimitry Andric SchedUnary<"WriteVFWCvtFToIV", "ReadVFWCvtFToIV", m.MX, 36545f757f3fSDimitry Andric forceMergeOpRead=true>; 365506c3fb27SDimitry Andric } 365606c3fb27SDimitry Andric} 365706c3fb27SDimitry Andric 3658bdd1243dSDimitry Andricmulticlass VPseudoVWCVTI_RM_V { 3659bdd1243dSDimitry Andric defvar constraint = "@earlyclobber $rd"; 3660bdd1243dSDimitry Andric foreach m = MxListFW in { 3661bdd1243dSDimitry Andric defm _V : VPseudoConversionRM<m.wvrclass, m.vrclass, m, constraint>, 36625f757f3fSDimitry Andric SchedUnary<"WriteVFWCvtFToIV", "ReadVFWCvtFToIV", m.MX, 36635f757f3fSDimitry Andric forceMergeOpRead=true>; 3664bdd1243dSDimitry Andric } 36650eae32dcSDimitry Andric} 36660eae32dcSDimitry Andric 36670eae32dcSDimitry Andricmulticlass VPseudoVWCVTF_V { 36680eae32dcSDimitry Andric defvar constraint = "@earlyclobber $rd"; 3669bdd1243dSDimitry Andric foreach m = MxListW in { 3670*0fca6ea1SDimitry Andric foreach e = SchedSEWSet<m.MX, isF=0, isWidening=1>.val in 3671*0fca6ea1SDimitry Andric defm _V : VPseudoConversion<m.wvrclass, m.vrclass, m, constraint, sew=e, 3672*0fca6ea1SDimitry Andric TargetConstraintType=3>, 3673*0fca6ea1SDimitry Andric SchedUnary<"WriteVFWCvtIToFV", "ReadVFWCvtIToFV", m.MX, e, 36745f757f3fSDimitry Andric forceMergeOpRead=true>; 3675bdd1243dSDimitry Andric } 3676bdd1243dSDimitry Andric} 3677bdd1243dSDimitry Andric 36780eae32dcSDimitry Andricmulticlass VPseudoVWCVTD_V { 36790eae32dcSDimitry Andric defvar constraint = "@earlyclobber $rd"; 3680bdd1243dSDimitry Andric foreach m = MxListFW in { 3681*0fca6ea1SDimitry Andric foreach e = SchedSEWSet<m.MX, isF=1, isWidening=1>.val in 3682*0fca6ea1SDimitry Andric defm _V : VPseudoConversion<m.wvrclass, m.vrclass, m, constraint, sew=e, 3683*0fca6ea1SDimitry Andric TargetConstraintType=3>, 3684*0fca6ea1SDimitry Andric SchedUnary<"WriteVFWCvtFToFV", "ReadVFWCvtFToFV", m.MX, e, 36855f757f3fSDimitry Andric forceMergeOpRead=true>; 3686bdd1243dSDimitry Andric } 36870eae32dcSDimitry Andric} 36880eae32dcSDimitry Andric 36890eae32dcSDimitry Andricmulticlass VPseudoVNCVTI_W { 36900eae32dcSDimitry Andric defvar constraint = "@earlyclobber $rd"; 3691bdd1243dSDimitry Andric foreach m = MxListW in { 36925f757f3fSDimitry Andric defm _W : VPseudoConversion<m.vrclass, m.wvrclass, m, constraint, TargetConstraintType=2>, 36935f757f3fSDimitry Andric SchedUnary<"WriteVFNCvtFToIV", "ReadVFNCvtFToIV", m.MX, 36945f757f3fSDimitry Andric forceMergeOpRead=true>; 3695bdd1243dSDimitry Andric } 3696bdd1243dSDimitry Andric} 3697bdd1243dSDimitry Andric 369806c3fb27SDimitry Andricmulticlass VPseudoVNCVTI_W_RM { 369906c3fb27SDimitry Andric defvar constraint = "@earlyclobber $rd"; 370006c3fb27SDimitry Andric foreach m = MxListW in { 37015f757f3fSDimitry Andric defm _W : VPseudoConversionRoundingMode<m.vrclass, m.wvrclass, m, constraint, TargetConstraintType=2>, 37025f757f3fSDimitry Andric SchedUnary<"WriteVFNCvtFToIV", "ReadVFNCvtFToIV", m.MX, 37035f757f3fSDimitry Andric forceMergeOpRead=true>; 370406c3fb27SDimitry Andric } 370506c3fb27SDimitry Andric} 370606c3fb27SDimitry Andric 3707bdd1243dSDimitry Andricmulticlass VPseudoVNCVTI_RM_W { 3708bdd1243dSDimitry Andric defvar constraint = "@earlyclobber $rd"; 3709bdd1243dSDimitry Andric foreach m = MxListW in { 3710647cbc5dSDimitry Andric defm _W : VPseudoConversionRM<m.vrclass, m.wvrclass, m, constraint, TargetConstraintType=2>, 37115f757f3fSDimitry Andric SchedUnary<"WriteVFNCvtFToIV", "ReadVFNCvtFToIV", m.MX, 37125f757f3fSDimitry Andric forceMergeOpRead=true>; 3713bdd1243dSDimitry Andric } 37140eae32dcSDimitry Andric} 37150eae32dcSDimitry Andric 371606c3fb27SDimitry Andricmulticlass VPseudoVNCVTF_W_RM { 37170eae32dcSDimitry Andric defvar constraint = "@earlyclobber $rd"; 3718bdd1243dSDimitry Andric foreach m = MxListFW in { 3719*0fca6ea1SDimitry Andric foreach e = SchedSEWSet<m.MX, isF=1, isWidening=1>.val in 3720*0fca6ea1SDimitry Andric defm _W : VPseudoConversionRoundingMode<m.vrclass, m.wvrclass, m, 3721*0fca6ea1SDimitry Andric constraint, sew=e, 3722*0fca6ea1SDimitry Andric TargetConstraintType=2>, 3723*0fca6ea1SDimitry Andric SchedUnary<"WriteVFNCvtIToFV", "ReadVFNCvtIToFV", m.MX, e, 37245f757f3fSDimitry Andric forceMergeOpRead=true>; 3725bdd1243dSDimitry Andric } 3726bdd1243dSDimitry Andric} 3727bdd1243dSDimitry Andric 3728bdd1243dSDimitry Andricmulticlass VPseudoVNCVTF_RM_W { 3729bdd1243dSDimitry Andric defvar constraint = "@earlyclobber $rd"; 3730bdd1243dSDimitry Andric foreach m = MxListFW in { 3731*0fca6ea1SDimitry Andric foreach e = SchedSEWSet<m.MX, isF=1, isWidening=1>.val in 3732*0fca6ea1SDimitry Andric defm _W : VPseudoConversionRM<m.vrclass, m.wvrclass, m, constraint, sew=e>, 3733*0fca6ea1SDimitry Andric SchedUnary<"WriteVFNCvtIToFV", "ReadVFNCvtIToFV", m.MX, e, 37345f757f3fSDimitry Andric forceMergeOpRead=true>; 3735bdd1243dSDimitry Andric } 37360eae32dcSDimitry Andric} 37370eae32dcSDimitry Andric 37380eae32dcSDimitry Andricmulticlass VPseudoVNCVTD_W { 3739e8d8bef9SDimitry Andric defvar constraint = "@earlyclobber $rd"; 3740bdd1243dSDimitry Andric foreach m = MxListFW in { 3741*0fca6ea1SDimitry Andric foreach e = SchedSEWSet<m.MX, isF=1, isWidening=1>.val in 3742*0fca6ea1SDimitry Andric defm _W : VPseudoConversion<m.vrclass, m.wvrclass, m, constraint, sew=e, 3743*0fca6ea1SDimitry Andric TargetConstraintType=2>, 3744*0fca6ea1SDimitry Andric SchedUnary<"WriteVFNCvtFToFV", "ReadVFNCvtFToFV", m.MX, e, 37455f757f3fSDimitry Andric forceMergeOpRead=true>; 3746bdd1243dSDimitry Andric } 3747e8d8bef9SDimitry Andric} 3748e8d8bef9SDimitry Andric 374906c3fb27SDimitry Andricmulticlass VPseudoVNCVTD_W_RM { 375006c3fb27SDimitry Andric defvar constraint = "@earlyclobber $rd"; 375106c3fb27SDimitry Andric foreach m = MxListFW in { 3752*0fca6ea1SDimitry Andric foreach e = SchedSEWSet<m.MX, isF=1, isWidening=1>.val in 3753*0fca6ea1SDimitry Andric defm _W : VPseudoConversionRoundingMode<m.vrclass, m.wvrclass, m, 3754*0fca6ea1SDimitry Andric constraint, sew=e, 3755*0fca6ea1SDimitry Andric TargetConstraintType=2>, 3756*0fca6ea1SDimitry Andric SchedUnary<"WriteVFNCvtFToFV", "ReadVFNCvtFToFV", m.MX, e, 37575f757f3fSDimitry Andric forceMergeOpRead=true>; 375806c3fb27SDimitry Andric } 375906c3fb27SDimitry Andric} 376006c3fb27SDimitry Andric 376181ad6265SDimitry Andricmulticlass VPseudoUSSegLoad { 3762e8d8bef9SDimitry Andric foreach eew = EEWList in { 3763e8d8bef9SDimitry Andric foreach lmul = MxSet<eew>.m in { 3764e8d8bef9SDimitry Andric defvar LInfo = lmul.MX; 376506c3fb27SDimitry Andric let VLMul = lmul.value, SEW=eew in { 3766e8d8bef9SDimitry Andric foreach nf = NFSet<lmul>.L in { 3767e8d8bef9SDimitry Andric defvar vreg = SegRegClass<lmul, nf>.RC; 376881ad6265SDimitry Andric def nf # "E" # eew # "_V_" # LInfo : 3769bdd1243dSDimitry Andric VPseudoUSSegLoadNoMask<vreg, eew, nf>, VLSEGSched<nf, eew, LInfo>; 377081ad6265SDimitry Andric def nf # "E" # eew # "_V_" # LInfo # "_MASK" : 3771bdd1243dSDimitry Andric VPseudoUSSegLoadMask<vreg, eew, nf>, VLSEGSched<nf, eew, LInfo>; 377281ad6265SDimitry Andric } 377381ad6265SDimitry Andric } 377481ad6265SDimitry Andric } 377581ad6265SDimitry Andric } 377681ad6265SDimitry Andric} 377781ad6265SDimitry Andric 377881ad6265SDimitry Andricmulticlass VPseudoUSSegLoadFF { 377981ad6265SDimitry Andric foreach eew = EEWList in { 378081ad6265SDimitry Andric foreach lmul = MxSet<eew>.m in { 378181ad6265SDimitry Andric defvar LInfo = lmul.MX; 378206c3fb27SDimitry Andric let VLMul = lmul.value, SEW=eew in { 378381ad6265SDimitry Andric foreach nf = NFSet<lmul>.L in { 378481ad6265SDimitry Andric defvar vreg = SegRegClass<lmul, nf>.RC; 378581ad6265SDimitry Andric def nf # "E" # eew # "FF_V_" # LInfo : 3786bdd1243dSDimitry Andric VPseudoUSSegLoadFFNoMask<vreg, eew, nf>, VLSEGFFSched<nf, eew, LInfo>; 378781ad6265SDimitry Andric def nf # "E" # eew # "FF_V_" # LInfo # "_MASK" : 3788bdd1243dSDimitry Andric VPseudoUSSegLoadFFMask<vreg, eew, nf>, VLSEGFFSched<nf, eew, LInfo>; 3789e8d8bef9SDimitry Andric } 3790e8d8bef9SDimitry Andric } 3791e8d8bef9SDimitry Andric } 3792e8d8bef9SDimitry Andric } 3793e8d8bef9SDimitry Andric} 3794e8d8bef9SDimitry Andric 3795e8d8bef9SDimitry Andricmulticlass VPseudoSSegLoad { 3796e8d8bef9SDimitry Andric foreach eew = EEWList in { 3797e8d8bef9SDimitry Andric foreach lmul = MxSet<eew>.m in { 3798e8d8bef9SDimitry Andric defvar LInfo = lmul.MX; 379906c3fb27SDimitry Andric let VLMul = lmul.value, SEW=eew in { 3800e8d8bef9SDimitry Andric foreach nf = NFSet<lmul>.L in { 3801e8d8bef9SDimitry Andric defvar vreg = SegRegClass<lmul, nf>.RC; 3802bdd1243dSDimitry Andric def nf # "E" # eew # "_V_" # LInfo : VPseudoSSegLoadNoMask<vreg, eew, nf>, 3803bdd1243dSDimitry Andric VLSSEGSched<nf, eew, LInfo>; 3804bdd1243dSDimitry Andric def nf # "E" # eew # "_V_" # LInfo # "_MASK" : VPseudoSSegLoadMask<vreg, eew, nf>, 3805bdd1243dSDimitry Andric VLSSEGSched<nf, eew, LInfo>; 3806e8d8bef9SDimitry Andric } 3807e8d8bef9SDimitry Andric } 3808e8d8bef9SDimitry Andric } 3809e8d8bef9SDimitry Andric } 3810e8d8bef9SDimitry Andric} 3811e8d8bef9SDimitry Andric 3812fe6060f1SDimitry Andricmulticlass VPseudoISegLoad<bit Ordered> { 381306c3fb27SDimitry Andric foreach idxEEW = EEWList in { 381406c3fb27SDimitry Andric foreach dataEEW = EEWList in { 381506c3fb27SDimitry Andric foreach dataEMUL = MxSet<dataEEW>.m in { 381606c3fb27SDimitry Andric defvar dataEMULOctuple = dataEMUL.octuple; 3817fe6060f1SDimitry Andric // Calculate emul = eew * lmul / sew 381806c3fb27SDimitry Andric defvar idxEMULOctuple = !srl(!mul(idxEEW, dataEMULOctuple), !logtwo(dataEEW)); 381906c3fb27SDimitry Andric if !and(!ge(idxEMULOctuple, 1), !le(idxEMULOctuple, 64)) then { 382006c3fb27SDimitry Andric defvar DataLInfo = dataEMUL.MX; 382106c3fb27SDimitry Andric defvar IdxLInfo = octuple_to_str<idxEMULOctuple>.ret; 382206c3fb27SDimitry Andric defvar idxEMUL = !cast<LMULInfo>("V_" # IdxLInfo); 382306c3fb27SDimitry Andric defvar DataVreg = dataEMUL.vrclass; 382406c3fb27SDimitry Andric defvar IdxVreg = idxEMUL.vrclass; 382506c3fb27SDimitry Andric let VLMul = dataEMUL.value in { 382606c3fb27SDimitry Andric foreach nf = NFSet<dataEMUL>.L in { 382706c3fb27SDimitry Andric defvar Vreg = SegRegClass<dataEMUL, nf>.RC; 382806c3fb27SDimitry Andric def nf # "EI" # idxEEW # "_V_" # IdxLInfo # "_" # DataLInfo : 382906c3fb27SDimitry Andric VPseudoISegLoadNoMask<Vreg, IdxVreg, idxEEW, idxEMUL.value, 3830bdd1243dSDimitry Andric nf, Ordered>, 38315f757f3fSDimitry Andric VLXSEGSched<nf, dataEEW, Ordered, DataLInfo>; 383206c3fb27SDimitry Andric def nf # "EI" # idxEEW # "_V_" # IdxLInfo # "_" # DataLInfo # "_MASK" : 383306c3fb27SDimitry Andric VPseudoISegLoadMask<Vreg, IdxVreg, idxEEW, idxEMUL.value, 3834bdd1243dSDimitry Andric nf, Ordered>, 38355f757f3fSDimitry Andric VLXSEGSched<nf, dataEEW, Ordered, DataLInfo>; 3836fe6060f1SDimitry Andric } 3837e8d8bef9SDimitry Andric } 3838e8d8bef9SDimitry Andric } 3839e8d8bef9SDimitry Andric } 3840e8d8bef9SDimitry Andric } 3841e8d8bef9SDimitry Andric } 3842e8d8bef9SDimitry Andric} 3843e8d8bef9SDimitry Andric 3844e8d8bef9SDimitry Andricmulticlass VPseudoUSSegStore { 3845e8d8bef9SDimitry Andric foreach eew = EEWList in { 3846e8d8bef9SDimitry Andric foreach lmul = MxSet<eew>.m in { 3847e8d8bef9SDimitry Andric defvar LInfo = lmul.MX; 384806c3fb27SDimitry Andric let VLMul = lmul.value, SEW=eew in { 3849e8d8bef9SDimitry Andric foreach nf = NFSet<lmul>.L in { 3850e8d8bef9SDimitry Andric defvar vreg = SegRegClass<lmul, nf>.RC; 3851bdd1243dSDimitry Andric def nf # "E" # eew # "_V_" # LInfo : VPseudoUSSegStoreNoMask<vreg, eew, nf>, 3852bdd1243dSDimitry Andric VSSEGSched<nf, eew, LInfo>; 3853bdd1243dSDimitry Andric def nf # "E" # eew # "_V_" # LInfo # "_MASK" : VPseudoUSSegStoreMask<vreg, eew, nf>, 3854bdd1243dSDimitry Andric VSSEGSched<nf, eew, LInfo>; 3855e8d8bef9SDimitry Andric } 3856e8d8bef9SDimitry Andric } 3857e8d8bef9SDimitry Andric } 3858e8d8bef9SDimitry Andric } 3859e8d8bef9SDimitry Andric} 3860e8d8bef9SDimitry Andric 3861e8d8bef9SDimitry Andricmulticlass VPseudoSSegStore { 3862e8d8bef9SDimitry Andric foreach eew = EEWList in { 3863e8d8bef9SDimitry Andric foreach lmul = MxSet<eew>.m in { 3864e8d8bef9SDimitry Andric defvar LInfo = lmul.MX; 386506c3fb27SDimitry Andric let VLMul = lmul.value, SEW=eew in { 3866e8d8bef9SDimitry Andric foreach nf = NFSet<lmul>.L in { 3867e8d8bef9SDimitry Andric defvar vreg = SegRegClass<lmul, nf>.RC; 3868bdd1243dSDimitry Andric def nf # "E" # eew # "_V_" # LInfo : VPseudoSSegStoreNoMask<vreg, eew, nf>, 3869bdd1243dSDimitry Andric VSSSEGSched<nf, eew, LInfo>; 3870bdd1243dSDimitry Andric def nf # "E" # eew # "_V_" # LInfo # "_MASK" : VPseudoSSegStoreMask<vreg, eew, nf>, 3871bdd1243dSDimitry Andric VSSSEGSched<nf, eew, LInfo>; 3872e8d8bef9SDimitry Andric } 3873e8d8bef9SDimitry Andric } 3874e8d8bef9SDimitry Andric } 3875e8d8bef9SDimitry Andric } 3876e8d8bef9SDimitry Andric} 3877e8d8bef9SDimitry Andric 3878fe6060f1SDimitry Andricmulticlass VPseudoISegStore<bit Ordered> { 387906c3fb27SDimitry Andric foreach idxEEW = EEWList in { 388006c3fb27SDimitry Andric foreach dataEEW = EEWList in { 388106c3fb27SDimitry Andric foreach dataEMUL = MxSet<dataEEW>.m in { 388206c3fb27SDimitry Andric defvar dataEMULOctuple = dataEMUL.octuple; 3883fe6060f1SDimitry Andric // Calculate emul = eew * lmul / sew 388406c3fb27SDimitry Andric defvar idxEMULOctuple = !srl(!mul(idxEEW, dataEMULOctuple), !logtwo(dataEEW)); 388506c3fb27SDimitry Andric if !and(!ge(idxEMULOctuple, 1), !le(idxEMULOctuple, 64)) then { 388606c3fb27SDimitry Andric defvar DataLInfo = dataEMUL.MX; 388706c3fb27SDimitry Andric defvar IdxLInfo = octuple_to_str<idxEMULOctuple>.ret; 388806c3fb27SDimitry Andric defvar idxEMUL = !cast<LMULInfo>("V_" # IdxLInfo); 388906c3fb27SDimitry Andric defvar DataVreg = dataEMUL.vrclass; 389006c3fb27SDimitry Andric defvar IdxVreg = idxEMUL.vrclass; 389106c3fb27SDimitry Andric let VLMul = dataEMUL.value in { 389206c3fb27SDimitry Andric foreach nf = NFSet<dataEMUL>.L in { 389306c3fb27SDimitry Andric defvar Vreg = SegRegClass<dataEMUL, nf>.RC; 389406c3fb27SDimitry Andric def nf # "EI" # idxEEW # "_V_" # IdxLInfo # "_" # DataLInfo : 389506c3fb27SDimitry Andric VPseudoISegStoreNoMask<Vreg, IdxVreg, idxEEW, idxEMUL.value, 3896bdd1243dSDimitry Andric nf, Ordered>, 38975f757f3fSDimitry Andric VSXSEGSched<nf, idxEEW, Ordered, DataLInfo>; 389806c3fb27SDimitry Andric def nf # "EI" # idxEEW # "_V_" # IdxLInfo # "_" # DataLInfo # "_MASK" : 389906c3fb27SDimitry Andric VPseudoISegStoreMask<Vreg, IdxVreg, idxEEW, idxEMUL.value, 3900bdd1243dSDimitry Andric nf, Ordered>, 39015f757f3fSDimitry Andric VSXSEGSched<nf, idxEEW, Ordered, DataLInfo>; 3902fe6060f1SDimitry Andric } 3903e8d8bef9SDimitry Andric } 3904e8d8bef9SDimitry Andric } 3905e8d8bef9SDimitry Andric } 3906e8d8bef9SDimitry Andric } 3907e8d8bef9SDimitry Andric } 3908e8d8bef9SDimitry Andric} 3909e8d8bef9SDimitry Andric 3910e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 3911e8d8bef9SDimitry Andric// Helpers to define the intrinsic patterns. 3912e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 3913e8d8bef9SDimitry Andric 3914e8d8bef9SDimitry Andricclass VPatUnaryNoMask<string intrinsic_name, 3915e8d8bef9SDimitry Andric string inst, 3916e8d8bef9SDimitry Andric string kind, 3917e8d8bef9SDimitry Andric ValueType result_type, 3918e8d8bef9SDimitry Andric ValueType op2_type, 391906c3fb27SDimitry Andric int log2sew, 3920e8d8bef9SDimitry Andric LMULInfo vlmul, 392106c3fb27SDimitry Andric VReg result_reg_class, 3922*0fca6ea1SDimitry Andric VReg op2_reg_class, 3923*0fca6ea1SDimitry Andric bit isSEWAware = 0> : 3924e8d8bef9SDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic_name) 392506c3fb27SDimitry Andric (result_type result_reg_class:$merge), 3926e8d8bef9SDimitry Andric (op2_type op2_reg_class:$rs2), 3927fe6060f1SDimitry Andric VLOpFrag)), 3928*0fca6ea1SDimitry Andric (!cast<Instruction>( 3929*0fca6ea1SDimitry Andric !if(isSEWAware, 3930*0fca6ea1SDimitry Andric inst#"_"#kind#"_"#vlmul.MX#"_E"#!shl(1, log2sew), 3931*0fca6ea1SDimitry Andric inst#"_"#kind#"_"#vlmul.MX)) 393206c3fb27SDimitry Andric (result_type result_reg_class:$merge), 3933e8d8bef9SDimitry Andric (op2_type op2_reg_class:$rs2), 393406c3fb27SDimitry Andric GPR:$vl, log2sew, TU_MU)>; 3935e8d8bef9SDimitry Andric 393606c3fb27SDimitry Andricclass VPatUnaryNoMaskRoundingMode<string intrinsic_name, 393781ad6265SDimitry Andric string inst, 393881ad6265SDimitry Andric string kind, 393981ad6265SDimitry Andric ValueType result_type, 394081ad6265SDimitry Andric ValueType op2_type, 394106c3fb27SDimitry Andric int log2sew, 394281ad6265SDimitry Andric LMULInfo vlmul, 394381ad6265SDimitry Andric VReg result_reg_class, 394406c3fb27SDimitry Andric VReg op2_reg_class, 394506c3fb27SDimitry Andric bit isSEWAware = 0> : 394681ad6265SDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic_name) 394781ad6265SDimitry Andric (result_type result_reg_class:$merge), 394881ad6265SDimitry Andric (op2_type op2_reg_class:$rs2), 394906c3fb27SDimitry Andric (XLenVT timm:$round), 395081ad6265SDimitry Andric VLOpFrag)), 395106c3fb27SDimitry Andric (!cast<Instruction>( 395206c3fb27SDimitry Andric !if(isSEWAware, 395306c3fb27SDimitry Andric inst#"_"#kind#"_"#vlmul.MX#"_E"#!shl(1, log2sew), 395406c3fb27SDimitry Andric inst#"_"#kind#"_"#vlmul.MX)) 395581ad6265SDimitry Andric (result_type result_reg_class:$merge), 395681ad6265SDimitry Andric (op2_type op2_reg_class:$rs2), 395706c3fb27SDimitry Andric (XLenVT timm:$round), 395806c3fb27SDimitry Andric GPR:$vl, log2sew, TU_MU)>; 395906c3fb27SDimitry Andric 3960*0fca6ea1SDimitry Andricclass VPatUnaryNoMaskRTZ<string intrinsic_name, 3961*0fca6ea1SDimitry Andric string inst, 3962*0fca6ea1SDimitry Andric string kind, 3963*0fca6ea1SDimitry Andric ValueType result_type, 3964*0fca6ea1SDimitry Andric ValueType op2_type, 3965*0fca6ea1SDimitry Andric int log2sew, 3966*0fca6ea1SDimitry Andric LMULInfo vlmul, 3967*0fca6ea1SDimitry Andric VReg result_reg_class, 3968*0fca6ea1SDimitry Andric VReg op2_reg_class, 3969*0fca6ea1SDimitry Andric bit isSEWAware = 0> : 3970*0fca6ea1SDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic_name) 3971*0fca6ea1SDimitry Andric (result_type result_reg_class:$merge), 3972*0fca6ea1SDimitry Andric (op2_type op2_reg_class:$rs2), 3973*0fca6ea1SDimitry Andric (XLenVT 0b001), 3974*0fca6ea1SDimitry Andric VLOpFrag)), 3975*0fca6ea1SDimitry Andric (!cast<Instruction>( 3976*0fca6ea1SDimitry Andric !if(isSEWAware, 3977*0fca6ea1SDimitry Andric inst#"_"#kind#"_"#vlmul.MX#"_E"#!shl(1, log2sew), 3978*0fca6ea1SDimitry Andric inst#"_"#kind#"_"#vlmul.MX)) 3979*0fca6ea1SDimitry Andric (result_type result_reg_class:$merge), 3980*0fca6ea1SDimitry Andric (op2_type op2_reg_class:$rs2), 3981*0fca6ea1SDimitry Andric GPR:$vl, log2sew, TU_MU)>; 398281ad6265SDimitry Andric 3983e8d8bef9SDimitry Andricclass VPatUnaryMask<string intrinsic_name, 3984e8d8bef9SDimitry Andric string inst, 3985e8d8bef9SDimitry Andric string kind, 3986e8d8bef9SDimitry Andric ValueType result_type, 3987e8d8bef9SDimitry Andric ValueType op2_type, 3988e8d8bef9SDimitry Andric ValueType mask_type, 398906c3fb27SDimitry Andric int log2sew, 3990e8d8bef9SDimitry Andric LMULInfo vlmul, 3991e8d8bef9SDimitry Andric VReg result_reg_class, 3992*0fca6ea1SDimitry Andric VReg op2_reg_class, 3993*0fca6ea1SDimitry Andric bit isSEWAware = 0> : 3994349cc55cSDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic_name#"_mask") 3995349cc55cSDimitry Andric (result_type result_reg_class:$merge), 3996349cc55cSDimitry Andric (op2_type op2_reg_class:$rs2), 3997349cc55cSDimitry Andric (mask_type V0), 3998349cc55cSDimitry Andric VLOpFrag, (XLenVT timm:$policy))), 3999*0fca6ea1SDimitry Andric (!cast<Instruction>( 4000*0fca6ea1SDimitry Andric !if(isSEWAware, 4001*0fca6ea1SDimitry Andric inst#"_"#kind#"_"#vlmul.MX#"_E"#!shl(1, log2sew)#"_MASK", 4002*0fca6ea1SDimitry Andric inst#"_"#kind#"_"#vlmul.MX#"_MASK")) 4003349cc55cSDimitry Andric (result_type result_reg_class:$merge), 4004349cc55cSDimitry Andric (op2_type op2_reg_class:$rs2), 400506c3fb27SDimitry Andric (mask_type V0), GPR:$vl, log2sew, (XLenVT timm:$policy))>; 400606c3fb27SDimitry Andric 400706c3fb27SDimitry Andricclass VPatUnaryMaskRoundingMode<string intrinsic_name, 400806c3fb27SDimitry Andric string inst, 400906c3fb27SDimitry Andric string kind, 401006c3fb27SDimitry Andric ValueType result_type, 401106c3fb27SDimitry Andric ValueType op2_type, 401206c3fb27SDimitry Andric ValueType mask_type, 401306c3fb27SDimitry Andric int log2sew, 401406c3fb27SDimitry Andric LMULInfo vlmul, 401506c3fb27SDimitry Andric VReg result_reg_class, 401606c3fb27SDimitry Andric VReg op2_reg_class, 401706c3fb27SDimitry Andric bit isSEWAware = 0> : 401806c3fb27SDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic_name#"_mask") 401906c3fb27SDimitry Andric (result_type result_reg_class:$merge), 402006c3fb27SDimitry Andric (op2_type op2_reg_class:$rs2), 402106c3fb27SDimitry Andric (mask_type V0), 402206c3fb27SDimitry Andric (XLenVT timm:$round), 402306c3fb27SDimitry Andric VLOpFrag, (XLenVT timm:$policy))), 402406c3fb27SDimitry Andric (!cast<Instruction>( 402506c3fb27SDimitry Andric !if(isSEWAware, 402606c3fb27SDimitry Andric inst#"_"#kind#"_"#vlmul.MX#"_E"#!shl(1, log2sew)#"_MASK", 402706c3fb27SDimitry Andric inst#"_"#kind#"_"#vlmul.MX#"_MASK")) 402806c3fb27SDimitry Andric (result_type result_reg_class:$merge), 402906c3fb27SDimitry Andric (op2_type op2_reg_class:$rs2), 403006c3fb27SDimitry Andric (mask_type V0), 403106c3fb27SDimitry Andric (XLenVT timm:$round), 403206c3fb27SDimitry Andric GPR:$vl, log2sew, (XLenVT timm:$policy))>; 403306c3fb27SDimitry Andric 4034*0fca6ea1SDimitry Andricclass VPatUnaryMaskRTZ<string intrinsic_name, 4035*0fca6ea1SDimitry Andric string inst, 4036*0fca6ea1SDimitry Andric string kind, 4037*0fca6ea1SDimitry Andric ValueType result_type, 4038*0fca6ea1SDimitry Andric ValueType op2_type, 4039*0fca6ea1SDimitry Andric ValueType mask_type, 4040*0fca6ea1SDimitry Andric int log2sew, 4041*0fca6ea1SDimitry Andric LMULInfo vlmul, 4042*0fca6ea1SDimitry Andric VReg result_reg_class, 4043*0fca6ea1SDimitry Andric VReg op2_reg_class, 4044*0fca6ea1SDimitry Andric bit isSEWAware = 0> : 4045*0fca6ea1SDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic_name#"_mask") 4046*0fca6ea1SDimitry Andric (result_type result_reg_class:$merge), 4047*0fca6ea1SDimitry Andric (op2_type op2_reg_class:$rs2), 4048*0fca6ea1SDimitry Andric (mask_type V0), 4049*0fca6ea1SDimitry Andric (XLenVT 0b001), 4050*0fca6ea1SDimitry Andric VLOpFrag, (XLenVT timm:$policy))), 4051*0fca6ea1SDimitry Andric (!cast<Instruction>( 4052*0fca6ea1SDimitry Andric !if(isSEWAware, 4053*0fca6ea1SDimitry Andric inst#"_"#kind#"_"#vlmul.MX#"_E"#!shl(1, log2sew)#"_MASK", 4054*0fca6ea1SDimitry Andric inst#"_"#kind#"_"#vlmul.MX#"_MASK")) 4055*0fca6ea1SDimitry Andric (result_type result_reg_class:$merge), 4056*0fca6ea1SDimitry Andric (op2_type op2_reg_class:$rs2), 4057*0fca6ea1SDimitry Andric (mask_type V0), 4058*0fca6ea1SDimitry Andric GPR:$vl, log2sew, (XLenVT timm:$policy))>; 4059349cc55cSDimitry Andric 4060e8d8bef9SDimitry Andricclass VPatMaskUnaryNoMask<string intrinsic_name, 4061e8d8bef9SDimitry Andric string inst, 4062e8d8bef9SDimitry Andric MTypeInfo mti> : 4063e8d8bef9SDimitry Andric Pat<(mti.Mask (!cast<Intrinsic>(intrinsic_name) 4064e8d8bef9SDimitry Andric (mti.Mask VR:$rs2), 4065fe6060f1SDimitry Andric VLOpFrag)), 4066e8d8bef9SDimitry Andric (!cast<Instruction>(inst#"_M_"#mti.BX) 4067e8d8bef9SDimitry Andric (mti.Mask VR:$rs2), 4068*0fca6ea1SDimitry Andric GPR:$vl, mti.Log2SEW)>; 4069e8d8bef9SDimitry Andric 4070e8d8bef9SDimitry Andricclass VPatMaskUnaryMask<string intrinsic_name, 4071e8d8bef9SDimitry Andric string inst, 4072e8d8bef9SDimitry Andric MTypeInfo mti> : 4073e8d8bef9SDimitry Andric Pat<(mti.Mask (!cast<Intrinsic>(intrinsic_name#"_mask") 4074e8d8bef9SDimitry Andric (mti.Mask VR:$merge), 4075e8d8bef9SDimitry Andric (mti.Mask VR:$rs2), 4076e8d8bef9SDimitry Andric (mti.Mask V0), 4077fe6060f1SDimitry Andric VLOpFrag)), 4078e8d8bef9SDimitry Andric (!cast<Instruction>(inst#"_M_"#mti.BX#"_MASK") 4079e8d8bef9SDimitry Andric (mti.Mask VR:$merge), 4080e8d8bef9SDimitry Andric (mti.Mask VR:$rs2), 408106c3fb27SDimitry Andric (mti.Mask V0), GPR:$vl, mti.Log2SEW, TU_MU)>; 4082e8d8bef9SDimitry Andric 4083e8d8bef9SDimitry Andricclass VPatUnaryAnyMask<string intrinsic, 4084e8d8bef9SDimitry Andric string inst, 4085e8d8bef9SDimitry Andric string kind, 4086e8d8bef9SDimitry Andric ValueType result_type, 4087e8d8bef9SDimitry Andric ValueType op1_type, 4088e8d8bef9SDimitry Andric ValueType mask_type, 408906c3fb27SDimitry Andric int log2sew, 4090e8d8bef9SDimitry Andric LMULInfo vlmul, 4091e8d8bef9SDimitry Andric VReg result_reg_class, 4092e8d8bef9SDimitry Andric VReg op1_reg_class> : 4093e8d8bef9SDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic) 4094e8d8bef9SDimitry Andric (result_type result_reg_class:$merge), 4095e8d8bef9SDimitry Andric (op1_type op1_reg_class:$rs1), 4096e8d8bef9SDimitry Andric (mask_type VR:$rs2), 4097fe6060f1SDimitry Andric VLOpFrag)), 409806c3fb27SDimitry Andric (!cast<Instruction>(inst#"_"#kind#"_"#vlmul.MX#"_E"#!shl(1, log2sew)) 4099e8d8bef9SDimitry Andric (result_type result_reg_class:$merge), 4100e8d8bef9SDimitry Andric (op1_type op1_reg_class:$rs1), 4101e8d8bef9SDimitry Andric (mask_type VR:$rs2), 410206c3fb27SDimitry Andric GPR:$vl, log2sew)>; 4103e8d8bef9SDimitry Andric 410481ad6265SDimitry Andricclass VPatBinaryM<string intrinsic_name, 4105e8d8bef9SDimitry Andric string inst, 4106e8d8bef9SDimitry Andric ValueType result_type, 4107e8d8bef9SDimitry Andric ValueType op1_type, 4108e8d8bef9SDimitry Andric ValueType op2_type, 4109e8d8bef9SDimitry Andric int sew, 4110e8d8bef9SDimitry Andric VReg op1_reg_class, 4111e8d8bef9SDimitry Andric DAGOperand op2_kind> : 4112e8d8bef9SDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic_name) 4113e8d8bef9SDimitry Andric (op1_type op1_reg_class:$rs1), 4114e8d8bef9SDimitry Andric (op2_type op2_kind:$rs2), 4115fe6060f1SDimitry Andric VLOpFrag)), 4116fe6060f1SDimitry Andric (!cast<Instruction>(inst) 4117fe6060f1SDimitry Andric (op1_type op1_reg_class:$rs1), 4118fe6060f1SDimitry Andric (op2_type op2_kind:$rs2), 4119fe6060f1SDimitry Andric GPR:$vl, sew)>; 4120fe6060f1SDimitry Andric 412181ad6265SDimitry Andricclass VPatBinaryNoMaskTU<string intrinsic_name, 412281ad6265SDimitry Andric string inst, 412381ad6265SDimitry Andric ValueType result_type, 412481ad6265SDimitry Andric ValueType op1_type, 412581ad6265SDimitry Andric ValueType op2_type, 412681ad6265SDimitry Andric int sew, 412781ad6265SDimitry Andric VReg result_reg_class, 412881ad6265SDimitry Andric VReg op1_reg_class, 412981ad6265SDimitry Andric DAGOperand op2_kind> : 413081ad6265SDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic_name) 413181ad6265SDimitry Andric (result_type result_reg_class:$merge), 413281ad6265SDimitry Andric (op1_type op1_reg_class:$rs1), 413381ad6265SDimitry Andric (op2_type op2_kind:$rs2), 413481ad6265SDimitry Andric VLOpFrag)), 413506c3fb27SDimitry Andric (!cast<Instruction>(inst) 413681ad6265SDimitry Andric (result_type result_reg_class:$merge), 413781ad6265SDimitry Andric (op1_type op1_reg_class:$rs1), 413881ad6265SDimitry Andric (op2_type op2_kind:$rs2), 413906c3fb27SDimitry Andric GPR:$vl, sew, TU_MU)>; 414006c3fb27SDimitry Andric 414106c3fb27SDimitry Andricclass VPatBinaryNoMaskTURoundingMode<string intrinsic_name, 414206c3fb27SDimitry Andric string inst, 414306c3fb27SDimitry Andric ValueType result_type, 414406c3fb27SDimitry Andric ValueType op1_type, 414506c3fb27SDimitry Andric ValueType op2_type, 414606c3fb27SDimitry Andric int sew, 414706c3fb27SDimitry Andric VReg result_reg_class, 414806c3fb27SDimitry Andric VReg op1_reg_class, 414906c3fb27SDimitry Andric DAGOperand op2_kind> : 415006c3fb27SDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic_name) 415106c3fb27SDimitry Andric (result_type result_reg_class:$merge), 415206c3fb27SDimitry Andric (op1_type op1_reg_class:$rs1), 415306c3fb27SDimitry Andric (op2_type op2_kind:$rs2), 415406c3fb27SDimitry Andric (XLenVT timm:$round), 415506c3fb27SDimitry Andric VLOpFrag)), 415606c3fb27SDimitry Andric (!cast<Instruction>(inst) 415706c3fb27SDimitry Andric (result_type result_reg_class:$merge), 415806c3fb27SDimitry Andric (op1_type op1_reg_class:$rs1), 415906c3fb27SDimitry Andric (op2_type op2_kind:$rs2), 416006c3fb27SDimitry Andric (XLenVT timm:$round), 416106c3fb27SDimitry Andric GPR:$vl, sew, TU_MU)>; 416206c3fb27SDimitry Andric 416381ad6265SDimitry Andric 4164*0fca6ea1SDimitry Andric// Same as VPatBinaryM but source operands are swapped. 4165*0fca6ea1SDimitry Andricclass VPatBinaryMSwapped<string intrinsic_name, 4166fe6060f1SDimitry Andric string inst, 4167fe6060f1SDimitry Andric ValueType result_type, 4168fe6060f1SDimitry Andric ValueType op1_type, 4169fe6060f1SDimitry Andric ValueType op2_type, 4170fe6060f1SDimitry Andric int sew, 4171fe6060f1SDimitry Andric VReg op1_reg_class, 4172fe6060f1SDimitry Andric DAGOperand op2_kind> : 4173fe6060f1SDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic_name) 4174fe6060f1SDimitry Andric (op2_type op2_kind:$rs2), 4175fe6060f1SDimitry Andric (op1_type op1_reg_class:$rs1), 4176fe6060f1SDimitry Andric VLOpFrag)), 4177e8d8bef9SDimitry Andric (!cast<Instruction>(inst) 4178e8d8bef9SDimitry Andric (op1_type op1_reg_class:$rs1), 4179e8d8bef9SDimitry Andric (op2_type op2_kind:$rs2), 4180d409305fSDimitry Andric GPR:$vl, sew)>; 4181e8d8bef9SDimitry Andric 4182e8d8bef9SDimitry Andricclass VPatBinaryMask<string intrinsic_name, 4183e8d8bef9SDimitry Andric string inst, 4184e8d8bef9SDimitry Andric ValueType result_type, 4185e8d8bef9SDimitry Andric ValueType op1_type, 4186e8d8bef9SDimitry Andric ValueType op2_type, 4187e8d8bef9SDimitry Andric ValueType mask_type, 4188e8d8bef9SDimitry Andric int sew, 4189e8d8bef9SDimitry Andric VReg result_reg_class, 4190e8d8bef9SDimitry Andric VReg op1_reg_class, 4191e8d8bef9SDimitry Andric DAGOperand op2_kind> : 4192e8d8bef9SDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic_name#"_mask") 4193e8d8bef9SDimitry Andric (result_type result_reg_class:$merge), 4194e8d8bef9SDimitry Andric (op1_type op1_reg_class:$rs1), 4195e8d8bef9SDimitry Andric (op2_type op2_kind:$rs2), 4196e8d8bef9SDimitry Andric (mask_type V0), 4197fe6060f1SDimitry Andric VLOpFrag)), 4198e8d8bef9SDimitry Andric (!cast<Instruction>(inst#"_MASK") 4199e8d8bef9SDimitry Andric (result_type result_reg_class:$merge), 4200e8d8bef9SDimitry Andric (op1_type op1_reg_class:$rs1), 4201e8d8bef9SDimitry Andric (op2_type op2_kind:$rs2), 4202d409305fSDimitry Andric (mask_type V0), GPR:$vl, sew)>; 4203e8d8bef9SDimitry Andric 4204*0fca6ea1SDimitry Andricclass VPatBinaryMaskPolicy<string intrinsic_name, 4205349cc55cSDimitry Andric string inst, 4206349cc55cSDimitry Andric ValueType result_type, 4207349cc55cSDimitry Andric ValueType op1_type, 4208349cc55cSDimitry Andric ValueType op2_type, 4209349cc55cSDimitry Andric ValueType mask_type, 4210349cc55cSDimitry Andric int sew, 4211349cc55cSDimitry Andric VReg result_reg_class, 4212349cc55cSDimitry Andric VReg op1_reg_class, 4213349cc55cSDimitry Andric DAGOperand op2_kind> : 4214349cc55cSDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic_name#"_mask") 4215349cc55cSDimitry Andric (result_type result_reg_class:$merge), 4216349cc55cSDimitry Andric (op1_type op1_reg_class:$rs1), 4217349cc55cSDimitry Andric (op2_type op2_kind:$rs2), 4218349cc55cSDimitry Andric (mask_type V0), 4219349cc55cSDimitry Andric VLOpFrag, (XLenVT timm:$policy))), 4220349cc55cSDimitry Andric (!cast<Instruction>(inst#"_MASK") 4221349cc55cSDimitry Andric (result_type result_reg_class:$merge), 4222349cc55cSDimitry Andric (op1_type op1_reg_class:$rs1), 4223349cc55cSDimitry Andric (op2_type op2_kind:$rs2), 4224349cc55cSDimitry Andric (mask_type V0), GPR:$vl, sew, (XLenVT timm:$policy))>; 4225349cc55cSDimitry Andric 4226*0fca6ea1SDimitry Andricclass VPatBinaryMaskPolicyRoundingMode<string intrinsic_name, 422706c3fb27SDimitry Andric string inst, 422806c3fb27SDimitry Andric ValueType result_type, 422906c3fb27SDimitry Andric ValueType op1_type, 423006c3fb27SDimitry Andric ValueType op2_type, 423106c3fb27SDimitry Andric ValueType mask_type, 423206c3fb27SDimitry Andric int sew, 423306c3fb27SDimitry Andric VReg result_reg_class, 423406c3fb27SDimitry Andric VReg op1_reg_class, 423506c3fb27SDimitry Andric DAGOperand op2_kind> : 423606c3fb27SDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic_name#"_mask") 423706c3fb27SDimitry Andric (result_type result_reg_class:$merge), 423806c3fb27SDimitry Andric (op1_type op1_reg_class:$rs1), 423906c3fb27SDimitry Andric (op2_type op2_kind:$rs2), 424006c3fb27SDimitry Andric (mask_type V0), 424106c3fb27SDimitry Andric (XLenVT timm:$round), 424206c3fb27SDimitry Andric VLOpFrag, (XLenVT timm:$policy))), 424306c3fb27SDimitry Andric (!cast<Instruction>(inst#"_MASK") 424406c3fb27SDimitry Andric (result_type result_reg_class:$merge), 424506c3fb27SDimitry Andric (op1_type op1_reg_class:$rs1), 424606c3fb27SDimitry Andric (op2_type op2_kind:$rs2), 424706c3fb27SDimitry Andric (mask_type V0), 424806c3fb27SDimitry Andric (XLenVT timm:$round), 424906c3fb27SDimitry Andric GPR:$vl, sew, (XLenVT timm:$policy))>; 425006c3fb27SDimitry Andric 4251*0fca6ea1SDimitry Andric// Same as VPatBinaryMask but source operands are swapped. 4252fe6060f1SDimitry Andricclass VPatBinaryMaskSwapped<string intrinsic_name, 4253fe6060f1SDimitry Andric string inst, 4254fe6060f1SDimitry Andric ValueType result_type, 4255fe6060f1SDimitry Andric ValueType op1_type, 4256fe6060f1SDimitry Andric ValueType op2_type, 4257fe6060f1SDimitry Andric ValueType mask_type, 4258fe6060f1SDimitry Andric int sew, 4259fe6060f1SDimitry Andric VReg result_reg_class, 4260fe6060f1SDimitry Andric VReg op1_reg_class, 4261fe6060f1SDimitry Andric DAGOperand op2_kind> : 4262fe6060f1SDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic_name#"_mask") 4263fe6060f1SDimitry Andric (result_type result_reg_class:$merge), 4264fe6060f1SDimitry Andric (op2_type op2_kind:$rs2), 4265fe6060f1SDimitry Andric (op1_type op1_reg_class:$rs1), 4266fe6060f1SDimitry Andric (mask_type V0), 4267fe6060f1SDimitry Andric VLOpFrag)), 4268fe6060f1SDimitry Andric (!cast<Instruction>(inst#"_MASK") 4269fe6060f1SDimitry Andric (result_type result_reg_class:$merge), 4270fe6060f1SDimitry Andric (op1_type op1_reg_class:$rs1), 4271fe6060f1SDimitry Andric (op2_type op2_kind:$rs2), 4272fe6060f1SDimitry Andric (mask_type V0), GPR:$vl, sew)>; 4273fe6060f1SDimitry Andric 4274fe6060f1SDimitry Andricclass VPatTiedBinaryNoMask<string intrinsic_name, 4275fe6060f1SDimitry Andric string inst, 4276fe6060f1SDimitry Andric ValueType result_type, 4277fe6060f1SDimitry Andric ValueType op2_type, 4278fe6060f1SDimitry Andric int sew, 4279fe6060f1SDimitry Andric VReg result_reg_class, 4280fe6060f1SDimitry Andric DAGOperand op2_kind> : 4281fe6060f1SDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic_name) 428281ad6265SDimitry Andric (result_type (undef)), 4283fe6060f1SDimitry Andric (result_type result_reg_class:$rs1), 4284fe6060f1SDimitry Andric (op2_type op2_kind:$rs2), 4285fe6060f1SDimitry Andric VLOpFrag)), 4286fe6060f1SDimitry Andric (!cast<Instruction>(inst#"_TIED") 4287fe6060f1SDimitry Andric (result_type result_reg_class:$rs1), 4288fe6060f1SDimitry Andric (op2_type op2_kind:$rs2), 428981ad6265SDimitry Andric GPR:$vl, sew, TAIL_AGNOSTIC)>; 429081ad6265SDimitry Andric 429106c3fb27SDimitry Andricclass VPatTiedBinaryNoMaskRoundingMode<string intrinsic_name, 429206c3fb27SDimitry Andric string inst, 429306c3fb27SDimitry Andric ValueType result_type, 429406c3fb27SDimitry Andric ValueType op2_type, 429506c3fb27SDimitry Andric int sew, 429606c3fb27SDimitry Andric VReg result_reg_class, 429706c3fb27SDimitry Andric DAGOperand op2_kind> : 429806c3fb27SDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic_name) 429906c3fb27SDimitry Andric (result_type (undef)), 430006c3fb27SDimitry Andric (result_type result_reg_class:$rs1), 430106c3fb27SDimitry Andric (op2_type op2_kind:$rs2), 430206c3fb27SDimitry Andric (XLenVT timm:$round), 430306c3fb27SDimitry Andric VLOpFrag)), 430406c3fb27SDimitry Andric (!cast<Instruction>(inst#"_TIED") 430506c3fb27SDimitry Andric (result_type result_reg_class:$rs1), 430606c3fb27SDimitry Andric (op2_type op2_kind:$rs2), 430706c3fb27SDimitry Andric (XLenVT timm:$round), 430806c3fb27SDimitry Andric GPR:$vl, sew, TAIL_AGNOSTIC)>; 430906c3fb27SDimitry Andric 431081ad6265SDimitry Andricclass VPatTiedBinaryNoMaskTU<string intrinsic_name, 431181ad6265SDimitry Andric string inst, 431281ad6265SDimitry Andric ValueType result_type, 431381ad6265SDimitry Andric ValueType op2_type, 431481ad6265SDimitry Andric int sew, 431581ad6265SDimitry Andric VReg result_reg_class, 431681ad6265SDimitry Andric DAGOperand op2_kind> : 431781ad6265SDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic_name) 431881ad6265SDimitry Andric (result_type result_reg_class:$merge), 431981ad6265SDimitry Andric (result_type result_reg_class:$merge), 432081ad6265SDimitry Andric (op2_type op2_kind:$rs2), 432181ad6265SDimitry Andric VLOpFrag)), 432281ad6265SDimitry Andric (!cast<Instruction>(inst#"_TIED") 432381ad6265SDimitry Andric (result_type result_reg_class:$merge), 432481ad6265SDimitry Andric (op2_type op2_kind:$rs2), 432506c3fb27SDimitry Andric GPR:$vl, sew, TU_MU)>; 432606c3fb27SDimitry Andric 432706c3fb27SDimitry Andricclass VPatTiedBinaryNoMaskTURoundingMode<string intrinsic_name, 432806c3fb27SDimitry Andric string inst, 432906c3fb27SDimitry Andric ValueType result_type, 433006c3fb27SDimitry Andric ValueType op2_type, 433106c3fb27SDimitry Andric int sew, 433206c3fb27SDimitry Andric VReg result_reg_class, 433306c3fb27SDimitry Andric DAGOperand op2_kind> : 433406c3fb27SDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic_name) 433506c3fb27SDimitry Andric (result_type result_reg_class:$merge), 433606c3fb27SDimitry Andric (result_type result_reg_class:$merge), 433706c3fb27SDimitry Andric (op2_type op2_kind:$rs2), 433806c3fb27SDimitry Andric (XLenVT timm:$round), 433906c3fb27SDimitry Andric VLOpFrag)), 434006c3fb27SDimitry Andric (!cast<Instruction>(inst#"_TIED") 434106c3fb27SDimitry Andric (result_type result_reg_class:$merge), 434206c3fb27SDimitry Andric (op2_type op2_kind:$rs2), 434306c3fb27SDimitry Andric (XLenVT timm:$round), 434406c3fb27SDimitry Andric GPR:$vl, sew, TU_MU)>; 4345fe6060f1SDimitry Andric 4346fe6060f1SDimitry Andricclass VPatTiedBinaryMask<string intrinsic_name, 4347fe6060f1SDimitry Andric string inst, 4348fe6060f1SDimitry Andric ValueType result_type, 4349fe6060f1SDimitry Andric ValueType op2_type, 4350fe6060f1SDimitry Andric ValueType mask_type, 4351fe6060f1SDimitry Andric int sew, 4352fe6060f1SDimitry Andric VReg result_reg_class, 4353fe6060f1SDimitry Andric DAGOperand op2_kind> : 4354fe6060f1SDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic_name#"_mask") 4355fe6060f1SDimitry Andric (result_type result_reg_class:$merge), 4356fe6060f1SDimitry Andric (result_type result_reg_class:$merge), 4357fe6060f1SDimitry Andric (op2_type op2_kind:$rs2), 4358fe6060f1SDimitry Andric (mask_type V0), 4359349cc55cSDimitry Andric VLOpFrag, (XLenVT timm:$policy))), 4360fe6060f1SDimitry Andric (!cast<Instruction>(inst#"_MASK_TIED") 4361fe6060f1SDimitry Andric (result_type result_reg_class:$merge), 4362fe6060f1SDimitry Andric (op2_type op2_kind:$rs2), 4363349cc55cSDimitry Andric (mask_type V0), GPR:$vl, sew, (XLenVT timm:$policy))>; 4364fe6060f1SDimitry Andric 436506c3fb27SDimitry Andricclass VPatTiedBinaryMaskRoundingMode<string intrinsic_name, 436606c3fb27SDimitry Andric string inst, 436706c3fb27SDimitry Andric ValueType result_type, 436806c3fb27SDimitry Andric ValueType op2_type, 436906c3fb27SDimitry Andric ValueType mask_type, 437006c3fb27SDimitry Andric int sew, 437106c3fb27SDimitry Andric VReg result_reg_class, 437206c3fb27SDimitry Andric DAGOperand op2_kind> : 437306c3fb27SDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic_name#"_mask") 437406c3fb27SDimitry Andric (result_type result_reg_class:$merge), 437506c3fb27SDimitry Andric (result_type result_reg_class:$merge), 437606c3fb27SDimitry Andric (op2_type op2_kind:$rs2), 437706c3fb27SDimitry Andric (mask_type V0), 437806c3fb27SDimitry Andric (XLenVT timm:$round), 437906c3fb27SDimitry Andric VLOpFrag, (XLenVT timm:$policy))), 438006c3fb27SDimitry Andric (!cast<Instruction>(inst#"_MASK_TIED") 438106c3fb27SDimitry Andric (result_type result_reg_class:$merge), 438206c3fb27SDimitry Andric (op2_type op2_kind:$rs2), 438306c3fb27SDimitry Andric (mask_type V0), 438406c3fb27SDimitry Andric (XLenVT timm:$round), 438506c3fb27SDimitry Andric GPR:$vl, sew, (XLenVT timm:$policy))>; 438606c3fb27SDimitry Andric 4387*0fca6ea1SDimitry Andricclass VPatTernaryNoMaskTU<string intrinsic, 438806c3fb27SDimitry Andric string inst, 438906c3fb27SDimitry Andric string kind, 439006c3fb27SDimitry Andric ValueType result_type, 439106c3fb27SDimitry Andric ValueType op1_type, 439206c3fb27SDimitry Andric ValueType op2_type, 439306c3fb27SDimitry Andric int log2sew, 439406c3fb27SDimitry Andric LMULInfo vlmul, 439506c3fb27SDimitry Andric VReg result_reg_class, 439606c3fb27SDimitry Andric RegisterClass op1_reg_class, 439706c3fb27SDimitry Andric DAGOperand op2_kind> : 439806c3fb27SDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic) 439906c3fb27SDimitry Andric (result_type result_reg_class:$rs3), 440006c3fb27SDimitry Andric (op1_type op1_reg_class:$rs1), 440106c3fb27SDimitry Andric (op2_type op2_kind:$rs2), 440206c3fb27SDimitry Andric VLOpFrag)), 440306c3fb27SDimitry Andric (!cast<Instruction>(inst#"_"#kind#"_"#vlmul.MX#"_E"#!shl(1, log2sew)) 440406c3fb27SDimitry Andric result_reg_class:$rs3, 440506c3fb27SDimitry Andric (op1_type op1_reg_class:$rs1), 440606c3fb27SDimitry Andric op2_kind:$rs2, 4407*0fca6ea1SDimitry Andric GPR:$vl, log2sew, TU_MU)>; 440806c3fb27SDimitry Andric 4409*0fca6ea1SDimitry Andricclass VPatTernaryNoMaskTURoundingMode<string intrinsic, 441006c3fb27SDimitry Andric string inst, 441106c3fb27SDimitry Andric string kind, 441206c3fb27SDimitry Andric ValueType result_type, 441306c3fb27SDimitry Andric ValueType op1_type, 441406c3fb27SDimitry Andric ValueType op2_type, 441506c3fb27SDimitry Andric int log2sew, 441606c3fb27SDimitry Andric LMULInfo vlmul, 441706c3fb27SDimitry Andric VReg result_reg_class, 441806c3fb27SDimitry Andric RegisterClass op1_reg_class, 441906c3fb27SDimitry Andric DAGOperand op2_kind> : 442006c3fb27SDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic) 442106c3fb27SDimitry Andric (result_type result_reg_class:$rs3), 442206c3fb27SDimitry Andric (op1_type op1_reg_class:$rs1), 442306c3fb27SDimitry Andric (op2_type op2_kind:$rs2), 442406c3fb27SDimitry Andric (XLenVT timm:$round), 442506c3fb27SDimitry Andric VLOpFrag)), 442606c3fb27SDimitry Andric (!cast<Instruction>(inst#"_"#kind#"_"#vlmul.MX#"_E"#!shl(1, log2sew)) 442706c3fb27SDimitry Andric result_reg_class:$rs3, 442806c3fb27SDimitry Andric (op1_type op1_reg_class:$rs1), 442906c3fb27SDimitry Andric op2_kind:$rs2, 443006c3fb27SDimitry Andric (XLenVT timm:$round), 4431*0fca6ea1SDimitry Andric GPR:$vl, log2sew, TU_MU)>; 443206c3fb27SDimitry Andric 4433349cc55cSDimitry Andricclass VPatTernaryNoMaskWithPolicy<string intrinsic, 4434349cc55cSDimitry Andric string inst, 4435349cc55cSDimitry Andric string kind, 4436349cc55cSDimitry Andric ValueType result_type, 4437349cc55cSDimitry Andric ValueType op1_type, 4438349cc55cSDimitry Andric ValueType op2_type, 4439349cc55cSDimitry Andric int sew, 4440349cc55cSDimitry Andric LMULInfo vlmul, 4441349cc55cSDimitry Andric VReg result_reg_class, 4442349cc55cSDimitry Andric RegisterClass op1_reg_class, 4443349cc55cSDimitry Andric DAGOperand op2_kind> : 4444349cc55cSDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic) 4445349cc55cSDimitry Andric (result_type result_reg_class:$rs3), 4446349cc55cSDimitry Andric (op1_type op1_reg_class:$rs1), 4447349cc55cSDimitry Andric (op2_type op2_kind:$rs2), 444881ad6265SDimitry Andric VLOpFrag, (XLenVT timm:$policy))), 4449349cc55cSDimitry Andric (!cast<Instruction>(inst#"_"#kind#"_"#vlmul.MX) 4450349cc55cSDimitry Andric result_reg_class:$rs3, 4451349cc55cSDimitry Andric (op1_type op1_reg_class:$rs1), 4452349cc55cSDimitry Andric op2_kind:$rs2, 445381ad6265SDimitry Andric GPR:$vl, sew, (XLenVT timm:$policy))>; 4454349cc55cSDimitry Andric 445506c3fb27SDimitry Andricclass VPatTernaryNoMaskWithPolicyRoundingMode<string intrinsic, 445606c3fb27SDimitry Andric string inst, 445706c3fb27SDimitry Andric string kind, 445806c3fb27SDimitry Andric ValueType result_type, 445906c3fb27SDimitry Andric ValueType op1_type, 446006c3fb27SDimitry Andric ValueType op2_type, 4461*0fca6ea1SDimitry Andric int log2sew, 446206c3fb27SDimitry Andric LMULInfo vlmul, 446306c3fb27SDimitry Andric VReg result_reg_class, 446406c3fb27SDimitry Andric RegisterClass op1_reg_class, 4465*0fca6ea1SDimitry Andric DAGOperand op2_kind, 4466*0fca6ea1SDimitry Andric bit isSEWAware = 0> : 446706c3fb27SDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic) 446806c3fb27SDimitry Andric (result_type result_reg_class:$rs3), 446906c3fb27SDimitry Andric (op1_type op1_reg_class:$rs1), 447006c3fb27SDimitry Andric (op2_type op2_kind:$rs2), 447106c3fb27SDimitry Andric (XLenVT timm:$round), 447206c3fb27SDimitry Andric VLOpFrag, (XLenVT timm:$policy))), 4473*0fca6ea1SDimitry Andric (!cast<Instruction>(!if(isSEWAware, 4474*0fca6ea1SDimitry Andric inst#"_"#kind#"_"#vlmul.MX#"_E"#!shl(1, log2sew), 4475*0fca6ea1SDimitry Andric inst#"_"#kind#"_"#vlmul.MX)) 447606c3fb27SDimitry Andric result_reg_class:$rs3, 447706c3fb27SDimitry Andric (op1_type op1_reg_class:$rs1), 447806c3fb27SDimitry Andric op2_kind:$rs2, 447906c3fb27SDimitry Andric (XLenVT timm:$round), 4480*0fca6ea1SDimitry Andric GPR:$vl, log2sew, (XLenVT timm:$policy))>; 4481e8d8bef9SDimitry Andric 448281ad6265SDimitry Andricclass VPatTernaryMaskPolicy<string intrinsic, 448381ad6265SDimitry Andric string inst, 448481ad6265SDimitry Andric string kind, 448581ad6265SDimitry Andric ValueType result_type, 448681ad6265SDimitry Andric ValueType op1_type, 448781ad6265SDimitry Andric ValueType op2_type, 448881ad6265SDimitry Andric ValueType mask_type, 448981ad6265SDimitry Andric int sew, 449081ad6265SDimitry Andric LMULInfo vlmul, 449181ad6265SDimitry Andric VReg result_reg_class, 449281ad6265SDimitry Andric RegisterClass op1_reg_class, 449381ad6265SDimitry Andric DAGOperand op2_kind> : 449481ad6265SDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic#"_mask") 449581ad6265SDimitry Andric (result_type result_reg_class:$rs3), 449681ad6265SDimitry Andric (op1_type op1_reg_class:$rs1), 449781ad6265SDimitry Andric (op2_type op2_kind:$rs2), 449881ad6265SDimitry Andric (mask_type V0), 449981ad6265SDimitry Andric VLOpFrag, (XLenVT timm:$policy))), 450081ad6265SDimitry Andric (!cast<Instruction>(inst#"_"#kind#"_"#vlmul.MX # "_MASK") 450181ad6265SDimitry Andric result_reg_class:$rs3, 450281ad6265SDimitry Andric (op1_type op1_reg_class:$rs1), 450381ad6265SDimitry Andric op2_kind:$rs2, 450481ad6265SDimitry Andric (mask_type V0), 450581ad6265SDimitry Andric GPR:$vl, sew, (XLenVT timm:$policy))>; 450681ad6265SDimitry Andric 450706c3fb27SDimitry Andricclass VPatTernaryMaskPolicyRoundingMode<string intrinsic, 450806c3fb27SDimitry Andric string inst, 450906c3fb27SDimitry Andric string kind, 451006c3fb27SDimitry Andric ValueType result_type, 451106c3fb27SDimitry Andric ValueType op1_type, 451206c3fb27SDimitry Andric ValueType op2_type, 451306c3fb27SDimitry Andric ValueType mask_type, 4514*0fca6ea1SDimitry Andric int log2sew, 451506c3fb27SDimitry Andric LMULInfo vlmul, 451606c3fb27SDimitry Andric VReg result_reg_class, 451706c3fb27SDimitry Andric RegisterClass op1_reg_class, 4518*0fca6ea1SDimitry Andric DAGOperand op2_kind, 4519*0fca6ea1SDimitry Andric bit isSEWAware = 0> : 452006c3fb27SDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic#"_mask") 452106c3fb27SDimitry Andric (result_type result_reg_class:$rs3), 452206c3fb27SDimitry Andric (op1_type op1_reg_class:$rs1), 452306c3fb27SDimitry Andric (op2_type op2_kind:$rs2), 452406c3fb27SDimitry Andric (mask_type V0), 452506c3fb27SDimitry Andric (XLenVT timm:$round), 452606c3fb27SDimitry Andric VLOpFrag, (XLenVT timm:$policy))), 4527*0fca6ea1SDimitry Andric (!cast<Instruction>(!if(isSEWAware, 4528*0fca6ea1SDimitry Andric inst#"_"#kind#"_"#vlmul.MX#"_E"#!shl(1, log2sew) # "_MASK", 4529*0fca6ea1SDimitry Andric inst#"_"#kind#"_"#vlmul.MX # "_MASK")) 453006c3fb27SDimitry Andric result_reg_class:$rs3, 453106c3fb27SDimitry Andric (op1_type op1_reg_class:$rs1), 453206c3fb27SDimitry Andric op2_kind:$rs2, 453306c3fb27SDimitry Andric (mask_type V0), 453406c3fb27SDimitry Andric (XLenVT timm:$round), 4535*0fca6ea1SDimitry Andric GPR:$vl, log2sew, (XLenVT timm:$policy))>; 453606c3fb27SDimitry Andric 4537*0fca6ea1SDimitry Andricclass VPatTernaryMaskTU<string intrinsic, 453806c3fb27SDimitry Andric string inst, 453906c3fb27SDimitry Andric string kind, 454006c3fb27SDimitry Andric ValueType result_type, 454106c3fb27SDimitry Andric ValueType op1_type, 454206c3fb27SDimitry Andric ValueType op2_type, 454306c3fb27SDimitry Andric ValueType mask_type, 454406c3fb27SDimitry Andric int log2sew, 454506c3fb27SDimitry Andric LMULInfo vlmul, 454606c3fb27SDimitry Andric VReg result_reg_class, 454706c3fb27SDimitry Andric RegisterClass op1_reg_class, 454806c3fb27SDimitry Andric DAGOperand op2_kind> : 454906c3fb27SDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic#"_mask") 455006c3fb27SDimitry Andric (result_type result_reg_class:$rs3), 455106c3fb27SDimitry Andric (op1_type op1_reg_class:$rs1), 455206c3fb27SDimitry Andric (op2_type op2_kind:$rs2), 455306c3fb27SDimitry Andric (mask_type V0), 455406c3fb27SDimitry Andric VLOpFrag)), 455506c3fb27SDimitry Andric (!cast<Instruction>(inst#"_"#kind#"_"#vlmul.MX#"_E"#!shl(1, log2sew)# "_MASK") 455606c3fb27SDimitry Andric result_reg_class:$rs3, 455706c3fb27SDimitry Andric (op1_type op1_reg_class:$rs1), 455806c3fb27SDimitry Andric op2_kind:$rs2, 455906c3fb27SDimitry Andric (mask_type V0), 4560*0fca6ea1SDimitry Andric GPR:$vl, log2sew, TU_MU)>; 456106c3fb27SDimitry Andric 4562*0fca6ea1SDimitry Andricclass VPatTernaryMaskTURoundingMode<string intrinsic, 456306c3fb27SDimitry Andric string inst, 456406c3fb27SDimitry Andric string kind, 456506c3fb27SDimitry Andric ValueType result_type, 456606c3fb27SDimitry Andric ValueType op1_type, 456706c3fb27SDimitry Andric ValueType op2_type, 456806c3fb27SDimitry Andric ValueType mask_type, 456906c3fb27SDimitry Andric int log2sew, 457006c3fb27SDimitry Andric LMULInfo vlmul, 457106c3fb27SDimitry Andric VReg result_reg_class, 457206c3fb27SDimitry Andric RegisterClass op1_reg_class, 457306c3fb27SDimitry Andric DAGOperand op2_kind> : 457406c3fb27SDimitry Andric Pat<(result_type (!cast<Intrinsic>(intrinsic#"_mask") 457506c3fb27SDimitry Andric (result_type result_reg_class:$rs3), 457606c3fb27SDimitry Andric (op1_type op1_reg_class:$rs1), 457706c3fb27SDimitry Andric (op2_type op2_kind:$rs2), 457806c3fb27SDimitry Andric (mask_type V0), 457906c3fb27SDimitry Andric (XLenVT timm:$round), 458006c3fb27SDimitry Andric VLOpFrag)), 458106c3fb27SDimitry Andric (!cast<Instruction>(inst#"_"#kind#"_"#vlmul.MX#"_E"#!shl(1, log2sew)# "_MASK") 458206c3fb27SDimitry Andric result_reg_class:$rs3, 458306c3fb27SDimitry Andric (op1_type op1_reg_class:$rs1), 458406c3fb27SDimitry Andric op2_kind:$rs2, 458506c3fb27SDimitry Andric (mask_type V0), 458606c3fb27SDimitry Andric (XLenVT timm:$round), 4587*0fca6ea1SDimitry Andric GPR:$vl, log2sew, TU_MU)>; 458806c3fb27SDimitry Andric 4589e8d8bef9SDimitry Andricmulticlass VPatUnaryS_M<string intrinsic_name, 459006c3fb27SDimitry Andric string inst> { 4591e8d8bef9SDimitry Andric foreach mti = AllMasks in { 4592e8d8bef9SDimitry Andric def : Pat<(XLenVT (!cast<Intrinsic>(intrinsic_name) 4593fe6060f1SDimitry Andric (mti.Mask VR:$rs1), VLOpFrag)), 4594e8d8bef9SDimitry Andric (!cast<Instruction>(inst#"_M_"#mti.BX) $rs1, 4595fe6060f1SDimitry Andric GPR:$vl, mti.Log2SEW)>; 4596e8d8bef9SDimitry Andric def : Pat<(XLenVT (!cast<Intrinsic>(intrinsic_name # "_mask") 4597fe6060f1SDimitry Andric (mti.Mask VR:$rs1), (mti.Mask V0), VLOpFrag)), 4598e8d8bef9SDimitry Andric (!cast<Instruction>(inst#"_M_"#mti.BX#"_MASK") $rs1, 4599fe6060f1SDimitry Andric (mti.Mask V0), GPR:$vl, mti.Log2SEW)>; 4600e8d8bef9SDimitry Andric } 4601e8d8bef9SDimitry Andric} 4602e8d8bef9SDimitry Andric 4603e8d8bef9SDimitry Andricmulticlass VPatUnaryV_V_AnyMask<string intrinsic, string instruction, 4604e8d8bef9SDimitry Andric list<VTypeInfo> vtilist> { 4605e8d8bef9SDimitry Andric foreach vti = vtilist in { 460606c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 4607e8d8bef9SDimitry Andric def : VPatUnaryAnyMask<intrinsic, instruction, "VM", 4608e8d8bef9SDimitry Andric vti.Vector, vti.Vector, vti.Mask, 460906c3fb27SDimitry Andric vti.Log2SEW, vti.LMul, vti.RegClass, vti.RegClass>; 4610e8d8bef9SDimitry Andric } 4611e8d8bef9SDimitry Andric} 4612e8d8bef9SDimitry Andric 4613e8d8bef9SDimitry Andricmulticlass VPatUnaryM_M<string intrinsic, 461406c3fb27SDimitry Andric string inst> { 4615e8d8bef9SDimitry Andric foreach mti = AllMasks in { 4616e8d8bef9SDimitry Andric def : VPatMaskUnaryNoMask<intrinsic, inst, mti>; 4617e8d8bef9SDimitry Andric def : VPatMaskUnaryMask<intrinsic, inst, mti>; 4618e8d8bef9SDimitry Andric } 4619e8d8bef9SDimitry Andric} 4620e8d8bef9SDimitry Andric 462106c3fb27SDimitry Andricmulticlass VPatUnaryV_M<string intrinsic, string instruction> { 4622e8d8bef9SDimitry Andric foreach vti = AllIntegerVectors in { 462306c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in { 4624e8d8bef9SDimitry Andric def : VPatUnaryNoMask<intrinsic, instruction, "M", vti.Vector, vti.Mask, 462581ad6265SDimitry Andric vti.Log2SEW, vti.LMul, vti.RegClass, VR>; 462606c3fb27SDimitry Andric def : VPatUnaryMask<intrinsic, instruction, "M", vti.Vector, vti.Mask, 4627fe6060f1SDimitry Andric vti.Mask, vti.Log2SEW, vti.LMul, vti.RegClass, VR>; 4628e8d8bef9SDimitry Andric } 4629e8d8bef9SDimitry Andric } 463006c3fb27SDimitry Andric} 4631e8d8bef9SDimitry Andric 4632e8d8bef9SDimitry Andricmulticlass VPatUnaryV_VF<string intrinsic, string instruction, string suffix, 463306c3fb27SDimitry Andric list<VTypeInfoToFraction> fractionList> { 463406c3fb27SDimitry Andric foreach vtiTofti = fractionList in { 4635e8d8bef9SDimitry Andric defvar vti = vtiTofti.Vti; 4636e8d8bef9SDimitry Andric defvar fti = vtiTofti.Fti; 463706c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<vti>.Predicates, 463806c3fb27SDimitry Andric GetVTypePredicates<fti>.Predicates) in { 4639e8d8bef9SDimitry Andric def : VPatUnaryNoMask<intrinsic, instruction, suffix, 4640e8d8bef9SDimitry Andric vti.Vector, fti.Vector, 464181ad6265SDimitry Andric vti.Log2SEW, vti.LMul, vti.RegClass, fti.RegClass>; 464206c3fb27SDimitry Andric def : VPatUnaryMask<intrinsic, instruction, suffix, 4643e8d8bef9SDimitry Andric vti.Vector, fti.Vector, vti.Mask, 4644fe6060f1SDimitry Andric vti.Log2SEW, vti.LMul, vti.RegClass, fti.RegClass>; 4645e8d8bef9SDimitry Andric } 4646e8d8bef9SDimitry Andric } 464706c3fb27SDimitry Andric} 4648e8d8bef9SDimitry Andric 4649e8d8bef9SDimitry Andricmulticlass VPatUnaryV_V<string intrinsic, string instruction, 4650*0fca6ea1SDimitry Andric list<VTypeInfo> vtilist, bit isSEWAware = 0> { 4651e8d8bef9SDimitry Andric foreach vti = vtilist in { 465206c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in { 4653e8d8bef9SDimitry Andric def : VPatUnaryNoMask<intrinsic, instruction, "V", 465406c3fb27SDimitry Andric vti.Vector, vti.Vector, vti.Log2SEW, 4655*0fca6ea1SDimitry Andric vti.LMul, vti.RegClass, vti.RegClass, isSEWAware>; 465606c3fb27SDimitry Andric def : VPatUnaryMask<intrinsic, instruction, "V", 465706c3fb27SDimitry Andric vti.Vector, vti.Vector, vti.Mask, vti.Log2SEW, 4658*0fca6ea1SDimitry Andric vti.LMul, vti.RegClass, vti.RegClass, isSEWAware>; 465906c3fb27SDimitry Andric } 4660e8d8bef9SDimitry Andric } 4661e8d8bef9SDimitry Andric} 4662e8d8bef9SDimitry Andric 466306c3fb27SDimitry Andricmulticlass VPatUnaryV_V_RM<string intrinsic, string instruction, 466406c3fb27SDimitry Andric list<VTypeInfo> vtilist, bit isSEWAware = 0> { 466506c3fb27SDimitry Andric foreach vti = vtilist in { 466606c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in { 466706c3fb27SDimitry Andric def : VPatUnaryNoMaskRoundingMode<intrinsic, instruction, "V", 466806c3fb27SDimitry Andric vti.Vector, vti.Vector, vti.Log2SEW, 466906c3fb27SDimitry Andric vti.LMul, vti.RegClass, vti.RegClass, isSEWAware>; 467006c3fb27SDimitry Andric def : VPatUnaryMaskRoundingMode<intrinsic, instruction, "V", 467106c3fb27SDimitry Andric vti.Vector, vti.Vector, vti.Mask, vti.Log2SEW, 467206c3fb27SDimitry Andric vti.LMul, vti.RegClass, vti.RegClass, isSEWAware>; 467306c3fb27SDimitry Andric } 467406c3fb27SDimitry Andric } 467506c3fb27SDimitry Andric} 467606c3fb27SDimitry Andric 467706c3fb27SDimitry Andricmulticlass VPatNullaryV<string intrinsic, string instruction> { 4678e8d8bef9SDimitry Andric foreach vti = AllIntegerVectors in { 467906c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in { 468081ad6265SDimitry Andric def : Pat<(vti.Vector (!cast<Intrinsic>(intrinsic) 468181ad6265SDimitry Andric (vti.Vector vti.RegClass:$merge), 468281ad6265SDimitry Andric VLOpFrag)), 468306c3fb27SDimitry Andric (!cast<Instruction>(instruction#"_V_" # vti.LMul.MX) 468406c3fb27SDimitry Andric vti.RegClass:$merge, GPR:$vl, vti.Log2SEW, TU_MU)>; 4685e8d8bef9SDimitry Andric def : Pat<(vti.Vector (!cast<Intrinsic>(intrinsic # "_mask") 4686e8d8bef9SDimitry Andric (vti.Vector vti.RegClass:$merge), 468781ad6265SDimitry Andric (vti.Mask V0), VLOpFrag, (XLenVT timm:$policy))), 4688e8d8bef9SDimitry Andric (!cast<Instruction>(instruction#"_V_" # vti.LMul.MX # "_MASK") 4689e8d8bef9SDimitry Andric vti.RegClass:$merge, (vti.Mask V0), 469081ad6265SDimitry Andric GPR:$vl, vti.Log2SEW, (XLenVT timm:$policy))>; 4691e8d8bef9SDimitry Andric } 4692e8d8bef9SDimitry Andric } 469306c3fb27SDimitry Andric} 4694e8d8bef9SDimitry Andric 4695e8d8bef9SDimitry Andricmulticlass VPatNullaryM<string intrinsic, string inst> { 4696e8d8bef9SDimitry Andric foreach mti = AllMasks in 4697e8d8bef9SDimitry Andric def : Pat<(mti.Mask (!cast<Intrinsic>(intrinsic) 469881ad6265SDimitry Andric VLOpFrag)), 4699e8d8bef9SDimitry Andric (!cast<Instruction>(inst#"_M_"#mti.BX) 4700fe6060f1SDimitry Andric GPR:$vl, mti.Log2SEW)>; 4701e8d8bef9SDimitry Andric} 4702e8d8bef9SDimitry Andric 470381ad6265SDimitry Andricmulticlass VPatBinaryM<string intrinsic, 4704e8d8bef9SDimitry Andric string inst, 4705e8d8bef9SDimitry Andric ValueType result_type, 4706e8d8bef9SDimitry Andric ValueType op1_type, 4707e8d8bef9SDimitry Andric ValueType op2_type, 4708e8d8bef9SDimitry Andric ValueType mask_type, 4709e8d8bef9SDimitry Andric int sew, 4710e8d8bef9SDimitry Andric VReg result_reg_class, 4711e8d8bef9SDimitry Andric VReg op1_reg_class, 471206c3fb27SDimitry Andric DAGOperand op2_kind> { 471381ad6265SDimitry Andric def : VPatBinaryM<intrinsic, inst, result_type, op1_type, op2_type, 4714e8d8bef9SDimitry Andric sew, op1_reg_class, op2_kind>; 4715e8d8bef9SDimitry Andric def : VPatBinaryMask<intrinsic, inst, result_type, op1_type, op2_type, 4716e8d8bef9SDimitry Andric mask_type, sew, result_reg_class, op1_reg_class, 4717e8d8bef9SDimitry Andric op2_kind>; 4718e8d8bef9SDimitry Andric} 4719e8d8bef9SDimitry Andric 472006c3fb27SDimitry Andricmulticlass VPatBinary<string intrinsic, 4721349cc55cSDimitry Andric string inst, 4722349cc55cSDimitry Andric ValueType result_type, 4723349cc55cSDimitry Andric ValueType op1_type, 4724349cc55cSDimitry Andric ValueType op2_type, 4725349cc55cSDimitry Andric ValueType mask_type, 4726349cc55cSDimitry Andric int sew, 4727349cc55cSDimitry Andric VReg result_reg_class, 4728349cc55cSDimitry Andric VReg op1_reg_class, 472906c3fb27SDimitry Andric DAGOperand op2_kind> { 473081ad6265SDimitry Andric def : VPatBinaryNoMaskTU<intrinsic, inst, result_type, op1_type, op2_type, 473181ad6265SDimitry Andric sew, result_reg_class, op1_reg_class, op2_kind>; 4732*0fca6ea1SDimitry Andric def : VPatBinaryMaskPolicy<intrinsic, inst, result_type, op1_type, op2_type, 4733349cc55cSDimitry Andric mask_type, sew, result_reg_class, op1_reg_class, 4734349cc55cSDimitry Andric op2_kind>; 4735349cc55cSDimitry Andric} 4736349cc55cSDimitry Andric 473706c3fb27SDimitry Andricmulticlass VPatBinaryRoundingMode<string intrinsic, 473806c3fb27SDimitry Andric string inst, 473906c3fb27SDimitry Andric ValueType result_type, 474006c3fb27SDimitry Andric ValueType op1_type, 474106c3fb27SDimitry Andric ValueType op2_type, 474206c3fb27SDimitry Andric ValueType mask_type, 474306c3fb27SDimitry Andric int sew, 474406c3fb27SDimitry Andric VReg result_reg_class, 474506c3fb27SDimitry Andric VReg op1_reg_class, 474606c3fb27SDimitry Andric DAGOperand op2_kind> { 474706c3fb27SDimitry Andric def : VPatBinaryNoMaskTURoundingMode<intrinsic, inst, result_type, op1_type, op2_type, 474806c3fb27SDimitry Andric sew, result_reg_class, op1_reg_class, op2_kind>; 4749*0fca6ea1SDimitry Andric def : VPatBinaryMaskPolicyRoundingMode<intrinsic, inst, result_type, op1_type, op2_type, 475006c3fb27SDimitry Andric mask_type, sew, result_reg_class, op1_reg_class, 475106c3fb27SDimitry Andric op2_kind>; 475206c3fb27SDimitry Andric} 475306c3fb27SDimitry Andric 4754*0fca6ea1SDimitry Andricmulticlass VPatBinaryMSwapped<string intrinsic, 4755fe6060f1SDimitry Andric string inst, 4756fe6060f1SDimitry Andric ValueType result_type, 4757fe6060f1SDimitry Andric ValueType op1_type, 4758fe6060f1SDimitry Andric ValueType op2_type, 4759fe6060f1SDimitry Andric ValueType mask_type, 4760fe6060f1SDimitry Andric int sew, 4761fe6060f1SDimitry Andric VReg result_reg_class, 4762fe6060f1SDimitry Andric VReg op1_reg_class, 476306c3fb27SDimitry Andric DAGOperand op2_kind> { 4764*0fca6ea1SDimitry Andric def : VPatBinaryMSwapped<intrinsic, inst, result_type, op1_type, op2_type, 4765fe6060f1SDimitry Andric sew, op1_reg_class, op2_kind>; 4766fe6060f1SDimitry Andric def : VPatBinaryMaskSwapped<intrinsic, inst, result_type, op1_type, op2_type, 4767fe6060f1SDimitry Andric mask_type, sew, result_reg_class, op1_reg_class, 4768fe6060f1SDimitry Andric op2_kind>; 4769fe6060f1SDimitry Andric} 4770fe6060f1SDimitry Andric 477181ad6265SDimitry Andricmulticlass VPatBinaryCarryInTAIL<string intrinsic, 477281ad6265SDimitry Andric string inst, 477381ad6265SDimitry Andric string kind, 477481ad6265SDimitry Andric ValueType result_type, 477581ad6265SDimitry Andric ValueType op1_type, 477681ad6265SDimitry Andric ValueType op2_type, 477781ad6265SDimitry Andric ValueType mask_type, 477881ad6265SDimitry Andric int sew, 477981ad6265SDimitry Andric LMULInfo vlmul, 478081ad6265SDimitry Andric VReg result_reg_class, 478181ad6265SDimitry Andric VReg op1_reg_class, 478206c3fb27SDimitry Andric DAGOperand op2_kind> { 478381ad6265SDimitry Andric def : Pat<(result_type (!cast<Intrinsic>(intrinsic) 478481ad6265SDimitry Andric (result_type result_reg_class:$merge), 478581ad6265SDimitry Andric (op1_type op1_reg_class:$rs1), 478681ad6265SDimitry Andric (op2_type op2_kind:$rs2), 478781ad6265SDimitry Andric (mask_type V0), 478881ad6265SDimitry Andric VLOpFrag)), 478906c3fb27SDimitry Andric (!cast<Instruction>(inst#"_"#kind#"_"#vlmul.MX) 479081ad6265SDimitry Andric (result_type result_reg_class:$merge), 479181ad6265SDimitry Andric (op1_type op1_reg_class:$rs1), 479281ad6265SDimitry Andric (op2_type op2_kind:$rs2), 479381ad6265SDimitry Andric (mask_type V0), GPR:$vl, sew)>; 479481ad6265SDimitry Andric} 479581ad6265SDimitry Andric 4796e8d8bef9SDimitry Andricmulticlass VPatBinaryCarryIn<string intrinsic, 4797e8d8bef9SDimitry Andric string inst, 4798e8d8bef9SDimitry Andric string kind, 4799e8d8bef9SDimitry Andric ValueType result_type, 4800e8d8bef9SDimitry Andric ValueType op1_type, 4801e8d8bef9SDimitry Andric ValueType op2_type, 4802e8d8bef9SDimitry Andric ValueType mask_type, 4803e8d8bef9SDimitry Andric int sew, 4804e8d8bef9SDimitry Andric LMULInfo vlmul, 4805e8d8bef9SDimitry Andric VReg op1_reg_class, 480606c3fb27SDimitry Andric DAGOperand op2_kind> { 4807e8d8bef9SDimitry Andric def : Pat<(result_type (!cast<Intrinsic>(intrinsic) 4808e8d8bef9SDimitry Andric (op1_type op1_reg_class:$rs1), 4809e8d8bef9SDimitry Andric (op2_type op2_kind:$rs2), 4810e8d8bef9SDimitry Andric (mask_type V0), 4811fe6060f1SDimitry Andric VLOpFrag)), 4812e8d8bef9SDimitry Andric (!cast<Instruction>(inst#"_"#kind#"_"#vlmul.MX) 4813e8d8bef9SDimitry Andric (op1_type op1_reg_class:$rs1), 4814e8d8bef9SDimitry Andric (op2_type op2_kind:$rs2), 4815d409305fSDimitry Andric (mask_type V0), GPR:$vl, sew)>; 4816e8d8bef9SDimitry Andric} 4817e8d8bef9SDimitry Andric 4818e8d8bef9SDimitry Andricmulticlass VPatBinaryMaskOut<string intrinsic, 4819e8d8bef9SDimitry Andric string inst, 4820e8d8bef9SDimitry Andric string kind, 4821e8d8bef9SDimitry Andric ValueType result_type, 4822e8d8bef9SDimitry Andric ValueType op1_type, 4823e8d8bef9SDimitry Andric ValueType op2_type, 4824e8d8bef9SDimitry Andric int sew, 4825e8d8bef9SDimitry Andric LMULInfo vlmul, 4826e8d8bef9SDimitry Andric VReg op1_reg_class, 482706c3fb27SDimitry Andric DAGOperand op2_kind> { 4828e8d8bef9SDimitry Andric def : Pat<(result_type (!cast<Intrinsic>(intrinsic) 4829e8d8bef9SDimitry Andric (op1_type op1_reg_class:$rs1), 4830e8d8bef9SDimitry Andric (op2_type op2_kind:$rs2), 4831fe6060f1SDimitry Andric VLOpFrag)), 4832e8d8bef9SDimitry Andric (!cast<Instruction>(inst#"_"#kind#"_"#vlmul.MX) 4833e8d8bef9SDimitry Andric (op1_type op1_reg_class:$rs1), 4834e8d8bef9SDimitry Andric (op2_type op2_kind:$rs2), 4835d409305fSDimitry Andric GPR:$vl, sew)>; 4836e8d8bef9SDimitry Andric} 4837e8d8bef9SDimitry Andric 4838*0fca6ea1SDimitry Andricmulticlass VPatConversion<string intrinsic, 4839349cc55cSDimitry Andric string inst, 4840349cc55cSDimitry Andric string kind, 4841349cc55cSDimitry Andric ValueType result_type, 4842349cc55cSDimitry Andric ValueType op1_type, 4843349cc55cSDimitry Andric ValueType mask_type, 4844*0fca6ea1SDimitry Andric int log2sew, 4845349cc55cSDimitry Andric LMULInfo vlmul, 4846349cc55cSDimitry Andric VReg result_reg_class, 4847*0fca6ea1SDimitry Andric VReg op1_reg_class, 4848*0fca6ea1SDimitry Andric bit isSEWAware = 0> { 4849349cc55cSDimitry Andric def : VPatUnaryNoMask<intrinsic, inst, kind, result_type, op1_type, 4850*0fca6ea1SDimitry Andric log2sew, vlmul, result_reg_class, op1_reg_class, 4851*0fca6ea1SDimitry Andric isSEWAware>; 485206c3fb27SDimitry Andric def : VPatUnaryMask<intrinsic, inst, kind, result_type, op1_type, 4853*0fca6ea1SDimitry Andric mask_type, log2sew, vlmul, result_reg_class, op1_reg_class, 4854*0fca6ea1SDimitry Andric isSEWAware>; 485506c3fb27SDimitry Andric} 485606c3fb27SDimitry Andric 4857*0fca6ea1SDimitry Andricmulticlass VPatConversionRoundingMode<string intrinsic, 485806c3fb27SDimitry Andric string inst, 485906c3fb27SDimitry Andric string kind, 486006c3fb27SDimitry Andric ValueType result_type, 486106c3fb27SDimitry Andric ValueType op1_type, 486206c3fb27SDimitry Andric ValueType mask_type, 4863*0fca6ea1SDimitry Andric int log2sew, 486406c3fb27SDimitry Andric LMULInfo vlmul, 486506c3fb27SDimitry Andric VReg result_reg_class, 4866*0fca6ea1SDimitry Andric VReg op1_reg_class, 4867*0fca6ea1SDimitry Andric bit isSEWAware = 0> { 486806c3fb27SDimitry Andric def : VPatUnaryNoMaskRoundingMode<intrinsic, inst, kind, result_type, op1_type, 4869*0fca6ea1SDimitry Andric log2sew, vlmul, result_reg_class, 4870*0fca6ea1SDimitry Andric op1_reg_class, isSEWAware>; 487106c3fb27SDimitry Andric def : VPatUnaryMaskRoundingMode<intrinsic, inst, kind, result_type, op1_type, 4872*0fca6ea1SDimitry Andric mask_type, log2sew, vlmul, result_reg_class, 4873*0fca6ea1SDimitry Andric op1_reg_class, isSEWAware>; 4874*0fca6ea1SDimitry Andric} 4875*0fca6ea1SDimitry Andric 4876*0fca6ea1SDimitry Andricmulticlass VPatConversionRTZ<string intrinsic, 4877*0fca6ea1SDimitry Andric string inst, 4878*0fca6ea1SDimitry Andric string kind, 4879*0fca6ea1SDimitry Andric ValueType result_type, 4880*0fca6ea1SDimitry Andric ValueType op1_type, 4881*0fca6ea1SDimitry Andric ValueType mask_type, 4882*0fca6ea1SDimitry Andric int log2sew, 4883*0fca6ea1SDimitry Andric LMULInfo vlmul, 4884*0fca6ea1SDimitry Andric VReg result_reg_class, 4885*0fca6ea1SDimitry Andric VReg op1_reg_class, 4886*0fca6ea1SDimitry Andric bit isSEWAware = 0> { 4887*0fca6ea1SDimitry Andric def : VPatUnaryNoMaskRTZ<intrinsic, inst, kind, result_type, op1_type, 4888*0fca6ea1SDimitry Andric log2sew, vlmul, result_reg_class, 4889*0fca6ea1SDimitry Andric op1_reg_class, isSEWAware>; 4890*0fca6ea1SDimitry Andric def : VPatUnaryMaskRTZ<intrinsic, inst, kind, result_type, op1_type, 4891*0fca6ea1SDimitry Andric mask_type, log2sew, vlmul, result_reg_class, 4892*0fca6ea1SDimitry Andric op1_reg_class, isSEWAware>; 4893349cc55cSDimitry Andric} 4894349cc55cSDimitry Andric 4895e8d8bef9SDimitry Andricmulticlass VPatBinaryV_VV<string intrinsic, string instruction, 489606c3fb27SDimitry Andric list<VTypeInfo> vtilist, bit isSEWAware = 0> { 4897e8d8bef9SDimitry Andric foreach vti = vtilist in 489806c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 489906c3fb27SDimitry Andric defm : VPatBinary<intrinsic, 490006c3fb27SDimitry Andric !if(isSEWAware, 490106c3fb27SDimitry Andric instruction # "_VV_" # vti.LMul.MX # "_E" # vti.SEW, 490206c3fb27SDimitry Andric instruction # "_VV_" # vti.LMul.MX), 490306c3fb27SDimitry Andric vti.Vector, vti.Vector, vti.Vector,vti.Mask, 490406c3fb27SDimitry Andric vti.Log2SEW, vti.RegClass, 490506c3fb27SDimitry Andric vti.RegClass, vti.RegClass>; 490606c3fb27SDimitry Andric} 490706c3fb27SDimitry Andric 490806c3fb27SDimitry Andricmulticlass VPatBinaryV_VV_RM<string intrinsic, string instruction, 490906c3fb27SDimitry Andric list<VTypeInfo> vtilist, bit isSEWAware = 0> { 491006c3fb27SDimitry Andric foreach vti = vtilist in 491106c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 491206c3fb27SDimitry Andric defm : VPatBinaryRoundingMode<intrinsic, 491306c3fb27SDimitry Andric !if(isSEWAware, 491406c3fb27SDimitry Andric instruction # "_VV_" # vti.LMul.MX # "_E" # vti.SEW, 491506c3fb27SDimitry Andric instruction # "_VV_" # vti.LMul.MX), 4916e8d8bef9SDimitry Andric vti.Vector, vti.Vector, vti.Vector,vti.Mask, 4917fe6060f1SDimitry Andric vti.Log2SEW, vti.RegClass, 4918e8d8bef9SDimitry Andric vti.RegClass, vti.RegClass>; 4919e8d8bef9SDimitry Andric} 4920e8d8bef9SDimitry Andric 4921e8d8bef9SDimitry Andricmulticlass VPatBinaryV_VV_INT<string intrinsic, string instruction, 4922e8d8bef9SDimitry Andric list<VTypeInfo> vtilist> { 4923e8d8bef9SDimitry Andric foreach vti = vtilist in { 4924e8d8bef9SDimitry Andric defvar ivti = GetIntVTypeInfo<vti>.Vti; 492506c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 492606c3fb27SDimitry Andric defm : VPatBinary<intrinsic, 492706c3fb27SDimitry Andric instruction # "_VV_" # vti.LMul.MX # "_E" # vti.SEW, 4928e8d8bef9SDimitry Andric vti.Vector, vti.Vector, ivti.Vector, vti.Mask, 4929fe6060f1SDimitry Andric vti.Log2SEW, vti.RegClass, 4930e8d8bef9SDimitry Andric vti.RegClass, vti.RegClass>; 4931e8d8bef9SDimitry Andric } 4932e8d8bef9SDimitry Andric} 4933e8d8bef9SDimitry Andric 4934e8d8bef9SDimitry Andricmulticlass VPatBinaryV_VV_INT_EEW<string intrinsic, string instruction, 4935e8d8bef9SDimitry Andric int eew, list<VTypeInfo> vtilist> { 4936e8d8bef9SDimitry Andric foreach vti = vtilist in { 4937e8d8bef9SDimitry Andric // emul = lmul * eew / sew 4938e8d8bef9SDimitry Andric defvar vlmul = vti.LMul; 4939fe6060f1SDimitry Andric defvar octuple_lmul = vlmul.octuple; 4940fe6060f1SDimitry Andric defvar octuple_emul = !srl(!mul(octuple_lmul, eew), vti.Log2SEW); 4941e8d8bef9SDimitry Andric if !and(!ge(octuple_emul, 1), !le(octuple_emul, 64)) then { 4942e8d8bef9SDimitry Andric defvar emul_str = octuple_to_str<octuple_emul>.ret; 4943e8d8bef9SDimitry Andric defvar ivti = !cast<VTypeInfo>("VI" # eew # emul_str); 494406c3fb27SDimitry Andric defvar inst = instruction # "_VV_" # vti.LMul.MX # "_E" # vti.SEW # "_" # emul_str; 494506c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<vti>.Predicates, 494606c3fb27SDimitry Andric GetVTypePredicates<ivti>.Predicates) in 494706c3fb27SDimitry Andric defm : VPatBinary<intrinsic, inst, 4948e8d8bef9SDimitry Andric vti.Vector, vti.Vector, ivti.Vector, vti.Mask, 4949fe6060f1SDimitry Andric vti.Log2SEW, vti.RegClass, 4950e8d8bef9SDimitry Andric vti.RegClass, ivti.RegClass>; 4951e8d8bef9SDimitry Andric } 4952e8d8bef9SDimitry Andric } 4953e8d8bef9SDimitry Andric} 4954e8d8bef9SDimitry Andric 4955e8d8bef9SDimitry Andricmulticlass VPatBinaryV_VX<string intrinsic, string instruction, 495606c3fb27SDimitry Andric list<VTypeInfo> vtilist, bit isSEWAware = 0> { 4957e8d8bef9SDimitry Andric foreach vti = vtilist in { 4958e8d8bef9SDimitry Andric defvar kind = "V"#vti.ScalarSuffix; 495906c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 496006c3fb27SDimitry Andric defm : VPatBinary<intrinsic, 496106c3fb27SDimitry Andric !if(isSEWAware, 496206c3fb27SDimitry Andric instruction#"_"#kind#"_"#vti.LMul.MX#"_E"#vti.SEW, 496306c3fb27SDimitry Andric instruction#"_"#kind#"_"#vti.LMul.MX), 496406c3fb27SDimitry Andric vti.Vector, vti.Vector, vti.Scalar, vti.Mask, 496506c3fb27SDimitry Andric vti.Log2SEW, vti.RegClass, 496606c3fb27SDimitry Andric vti.RegClass, vti.ScalarRegClass>; 496706c3fb27SDimitry Andric } 496806c3fb27SDimitry Andric} 496906c3fb27SDimitry Andric 497006c3fb27SDimitry Andricmulticlass VPatBinaryV_VX_RM<string intrinsic, string instruction, 497106c3fb27SDimitry Andric list<VTypeInfo> vtilist, bit isSEWAware = 0> { 497206c3fb27SDimitry Andric foreach vti = vtilist in { 497306c3fb27SDimitry Andric defvar kind = "V"#vti.ScalarSuffix; 497406c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 497506c3fb27SDimitry Andric defm : VPatBinaryRoundingMode<intrinsic, 497606c3fb27SDimitry Andric !if(isSEWAware, 497706c3fb27SDimitry Andric instruction#"_"#kind#"_"#vti.LMul.MX#"_E"#vti.SEW, 497806c3fb27SDimitry Andric instruction#"_"#kind#"_"#vti.LMul.MX), 4979e8d8bef9SDimitry Andric vti.Vector, vti.Vector, vti.Scalar, vti.Mask, 4980fe6060f1SDimitry Andric vti.Log2SEW, vti.RegClass, 4981e8d8bef9SDimitry Andric vti.RegClass, vti.ScalarRegClass>; 4982e8d8bef9SDimitry Andric } 4983e8d8bef9SDimitry Andric} 4984e8d8bef9SDimitry Andric 4985e8d8bef9SDimitry Andricmulticlass VPatBinaryV_VX_INT<string intrinsic, string instruction, 4986e8d8bef9SDimitry Andric list<VTypeInfo> vtilist> { 4987e8d8bef9SDimitry Andric foreach vti = vtilist in 498806c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 498906c3fb27SDimitry Andric defm : VPatBinary<intrinsic, instruction # "_VX_" # vti.LMul.MX, 4990e8d8bef9SDimitry Andric vti.Vector, vti.Vector, XLenVT, vti.Mask, 4991fe6060f1SDimitry Andric vti.Log2SEW, vti.RegClass, 4992e8d8bef9SDimitry Andric vti.RegClass, GPR>; 4993e8d8bef9SDimitry Andric} 4994e8d8bef9SDimitry Andric 4995e8d8bef9SDimitry Andricmulticlass VPatBinaryV_VI<string intrinsic, string instruction, 4996e8d8bef9SDimitry Andric list<VTypeInfo> vtilist, Operand imm_type> { 4997e8d8bef9SDimitry Andric foreach vti = vtilist in 499806c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 499906c3fb27SDimitry Andric defm : VPatBinary<intrinsic, instruction # "_VI_" # vti.LMul.MX, 500006c3fb27SDimitry Andric vti.Vector, vti.Vector, XLenVT, vti.Mask, 500106c3fb27SDimitry Andric vti.Log2SEW, vti.RegClass, 500206c3fb27SDimitry Andric vti.RegClass, imm_type>; 500306c3fb27SDimitry Andric} 500406c3fb27SDimitry Andric 500506c3fb27SDimitry Andricmulticlass VPatBinaryV_VI_RM<string intrinsic, string instruction, 500606c3fb27SDimitry Andric list<VTypeInfo> vtilist, 500706c3fb27SDimitry Andric Operand imm_type> { 500806c3fb27SDimitry Andric foreach vti = vtilist in 500906c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 501006c3fb27SDimitry Andric defm : VPatBinaryRoundingMode<intrinsic, 501106c3fb27SDimitry Andric instruction # "_VI_" # vti.LMul.MX, 5012e8d8bef9SDimitry Andric vti.Vector, vti.Vector, XLenVT, vti.Mask, 5013fe6060f1SDimitry Andric vti.Log2SEW, vti.RegClass, 5014e8d8bef9SDimitry Andric vti.RegClass, imm_type>; 5015e8d8bef9SDimitry Andric} 5016e8d8bef9SDimitry Andric 5017e8d8bef9SDimitry Andricmulticlass VPatBinaryM_MM<string intrinsic, string instruction> { 5018e8d8bef9SDimitry Andric foreach mti = AllMasks in 501906c3fb27SDimitry Andric let Predicates = [HasVInstructions] in 502081ad6265SDimitry Andric def : VPatBinaryM<intrinsic, instruction # "_MM_" # mti.LMul.MX, 5021e8d8bef9SDimitry Andric mti.Mask, mti.Mask, mti.Mask, 5022fe6060f1SDimitry Andric mti.Log2SEW, VR, VR>; 5023e8d8bef9SDimitry Andric} 5024e8d8bef9SDimitry Andric 5025e8d8bef9SDimitry Andricmulticlass VPatBinaryW_VV<string intrinsic, string instruction, 5026e8d8bef9SDimitry Andric list<VTypeInfoToWide> vtilist> { 5027e8d8bef9SDimitry Andric foreach VtiToWti = vtilist in { 5028e8d8bef9SDimitry Andric defvar Vti = VtiToWti.Vti; 5029e8d8bef9SDimitry Andric defvar Wti = VtiToWti.Wti; 503006c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<Vti>.Predicates, 503106c3fb27SDimitry Andric GetVTypePredicates<Wti>.Predicates) in 503206c3fb27SDimitry Andric defm : VPatBinary<intrinsic, instruction # "_VV_" # Vti.LMul.MX, 503306c3fb27SDimitry Andric Wti.Vector, Vti.Vector, Vti.Vector, Vti.Mask, 503406c3fb27SDimitry Andric Vti.Log2SEW, Wti.RegClass, 503506c3fb27SDimitry Andric Vti.RegClass, Vti.RegClass>; 503606c3fb27SDimitry Andric } 503706c3fb27SDimitry Andric} 503806c3fb27SDimitry Andric 503906c3fb27SDimitry Andricmulticlass VPatBinaryW_VV_RM<string intrinsic, string instruction, 5040*0fca6ea1SDimitry Andric list<VTypeInfoToWide> vtilist, bit isSEWAware = 0> { 504106c3fb27SDimitry Andric foreach VtiToWti = vtilist in { 504206c3fb27SDimitry Andric defvar Vti = VtiToWti.Vti; 504306c3fb27SDimitry Andric defvar Wti = VtiToWti.Wti; 5044*0fca6ea1SDimitry Andric defvar name = !if(isSEWAware, 5045*0fca6ea1SDimitry Andric instruction # "_VV_" # Vti.LMul.MX # "_E" # Vti.SEW, 5046*0fca6ea1SDimitry Andric instruction # "_VV_" # Vti.LMul.MX); 504706c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<Vti>.Predicates, 504806c3fb27SDimitry Andric GetVTypePredicates<Wti>.Predicates) in 5049*0fca6ea1SDimitry Andric defm : VPatBinaryRoundingMode<intrinsic, name, 5050e8d8bef9SDimitry Andric Wti.Vector, Vti.Vector, Vti.Vector, Vti.Mask, 5051fe6060f1SDimitry Andric Vti.Log2SEW, Wti.RegClass, 5052e8d8bef9SDimitry Andric Vti.RegClass, Vti.RegClass>; 5053e8d8bef9SDimitry Andric } 5054e8d8bef9SDimitry Andric} 5055e8d8bef9SDimitry Andric 5056e8d8bef9SDimitry Andricmulticlass VPatBinaryW_VX<string intrinsic, string instruction, 5057e8d8bef9SDimitry Andric list<VTypeInfoToWide> vtilist> { 5058e8d8bef9SDimitry Andric foreach VtiToWti = vtilist in { 5059e8d8bef9SDimitry Andric defvar Vti = VtiToWti.Vti; 5060e8d8bef9SDimitry Andric defvar Wti = VtiToWti.Wti; 5061e8d8bef9SDimitry Andric defvar kind = "V"#Vti.ScalarSuffix; 506206c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<Vti>.Predicates, 506306c3fb27SDimitry Andric GetVTypePredicates<Wti>.Predicates) in 506406c3fb27SDimitry Andric defm : VPatBinary<intrinsic, instruction#"_"#kind#"_"#Vti.LMul.MX, 506506c3fb27SDimitry Andric Wti.Vector, Vti.Vector, Vti.Scalar, Vti.Mask, 506606c3fb27SDimitry Andric Vti.Log2SEW, Wti.RegClass, 506706c3fb27SDimitry Andric Vti.RegClass, Vti.ScalarRegClass>; 506806c3fb27SDimitry Andric } 506906c3fb27SDimitry Andric} 507006c3fb27SDimitry Andric 507106c3fb27SDimitry Andricmulticlass VPatBinaryW_VX_RM<string intrinsic, string instruction, 5072*0fca6ea1SDimitry Andric list<VTypeInfoToWide> vtilist, bit isSEWAware = 0> { 507306c3fb27SDimitry Andric foreach VtiToWti = vtilist in { 507406c3fb27SDimitry Andric defvar Vti = VtiToWti.Vti; 507506c3fb27SDimitry Andric defvar Wti = VtiToWti.Wti; 507606c3fb27SDimitry Andric defvar kind = "V"#Vti.ScalarSuffix; 5077*0fca6ea1SDimitry Andric defvar name = !if(isSEWAware, 5078*0fca6ea1SDimitry Andric instruction#"_"#kind#"_"#Vti.LMul.MX # "_E" # Vti.SEW, 5079*0fca6ea1SDimitry Andric instruction#"_"#kind#"_"#Vti.LMul.MX); 508006c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<Vti>.Predicates, 508106c3fb27SDimitry Andric GetVTypePredicates<Wti>.Predicates) in 5082*0fca6ea1SDimitry Andric defm : VPatBinaryRoundingMode<intrinsic, name, 5083e8d8bef9SDimitry Andric Wti.Vector, Vti.Vector, Vti.Scalar, Vti.Mask, 5084fe6060f1SDimitry Andric Vti.Log2SEW, Wti.RegClass, 5085e8d8bef9SDimitry Andric Vti.RegClass, Vti.ScalarRegClass>; 5086e8d8bef9SDimitry Andric } 5087e8d8bef9SDimitry Andric} 5088e8d8bef9SDimitry Andric 5089e8d8bef9SDimitry Andricmulticlass VPatBinaryW_WV<string intrinsic, string instruction, 5090e8d8bef9SDimitry Andric list<VTypeInfoToWide> vtilist> { 5091e8d8bef9SDimitry Andric foreach VtiToWti = vtilist in { 5092e8d8bef9SDimitry Andric defvar Vti = VtiToWti.Vti; 5093e8d8bef9SDimitry Andric defvar Wti = VtiToWti.Wti; 509406c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<Vti>.Predicates, 509506c3fb27SDimitry Andric GetVTypePredicates<Wti>.Predicates) in { 5096fe6060f1SDimitry Andric def : VPatTiedBinaryNoMask<intrinsic, instruction # "_WV_" # Vti.LMul.MX, 5097fe6060f1SDimitry Andric Wti.Vector, Vti.Vector, 5098fe6060f1SDimitry Andric Vti.Log2SEW, Wti.RegClass, Vti.RegClass>; 509981ad6265SDimitry Andric def : VPatBinaryNoMaskTU<intrinsic, instruction # "_WV_" # Vti.LMul.MX, 510081ad6265SDimitry Andric Wti.Vector, Wti.Vector, Vti.Vector, Vti.Log2SEW, 510181ad6265SDimitry Andric Wti.RegClass, Wti.RegClass, Vti.RegClass>; 510281ad6265SDimitry Andric let AddedComplexity = 1 in { 510381ad6265SDimitry Andric def : VPatTiedBinaryNoMaskTU<intrinsic, instruction # "_WV_" # Vti.LMul.MX, 510481ad6265SDimitry Andric Wti.Vector, Vti.Vector, 510581ad6265SDimitry Andric Vti.Log2SEW, Wti.RegClass, Vti.RegClass>; 5106fe6060f1SDimitry Andric def : VPatTiedBinaryMask<intrinsic, instruction # "_WV_" # Vti.LMul.MX, 5107fe6060f1SDimitry Andric Wti.Vector, Vti.Vector, Vti.Mask, 5108fe6060f1SDimitry Andric Vti.Log2SEW, Wti.RegClass, Vti.RegClass>; 510981ad6265SDimitry Andric } 5110*0fca6ea1SDimitry Andric def : VPatBinaryMaskPolicy<intrinsic, instruction # "_WV_" # Vti.LMul.MX, 5111e8d8bef9SDimitry Andric Wti.Vector, Wti.Vector, Vti.Vector, Vti.Mask, 5112fe6060f1SDimitry Andric Vti.Log2SEW, Wti.RegClass, 5113e8d8bef9SDimitry Andric Wti.RegClass, Vti.RegClass>; 5114e8d8bef9SDimitry Andric } 5115e8d8bef9SDimitry Andric } 511606c3fb27SDimitry Andric} 511706c3fb27SDimitry Andric 511806c3fb27SDimitry Andricmulticlass VPatBinaryW_WV_RM<string intrinsic, string instruction, 5119*0fca6ea1SDimitry Andric list<VTypeInfoToWide> vtilist, bit isSEWAware = 0> { 512006c3fb27SDimitry Andric foreach VtiToWti = vtilist in { 512106c3fb27SDimitry Andric defvar Vti = VtiToWti.Vti; 512206c3fb27SDimitry Andric defvar Wti = VtiToWti.Wti; 5123*0fca6ea1SDimitry Andric defvar name = !if(isSEWAware, 5124*0fca6ea1SDimitry Andric instruction # "_WV_" # Vti.LMul.MX # "_E" # Vti.SEW, 5125*0fca6ea1SDimitry Andric instruction # "_WV_" # Vti.LMul.MX); 512606c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<Vti>.Predicates, 512706c3fb27SDimitry Andric GetVTypePredicates<Wti>.Predicates) in { 5128*0fca6ea1SDimitry Andric def : VPatTiedBinaryNoMaskRoundingMode<intrinsic, name, 512906c3fb27SDimitry Andric Wti.Vector, Vti.Vector, 513006c3fb27SDimitry Andric Vti.Log2SEW, Wti.RegClass, Vti.RegClass>; 5131*0fca6ea1SDimitry Andric def : VPatBinaryNoMaskTURoundingMode<intrinsic, name, 513206c3fb27SDimitry Andric Wti.Vector, Wti.Vector, Vti.Vector, Vti.Log2SEW, 513306c3fb27SDimitry Andric Wti.RegClass, Wti.RegClass, Vti.RegClass>; 513406c3fb27SDimitry Andric let AddedComplexity = 1 in { 5135*0fca6ea1SDimitry Andric def : VPatTiedBinaryNoMaskTURoundingMode<intrinsic, name, 513606c3fb27SDimitry Andric Wti.Vector, Vti.Vector, 513706c3fb27SDimitry Andric Vti.Log2SEW, Wti.RegClass, Vti.RegClass>; 5138*0fca6ea1SDimitry Andric def : VPatTiedBinaryMaskRoundingMode<intrinsic, name, 513906c3fb27SDimitry Andric Wti.Vector, Vti.Vector, Vti.Mask, 514006c3fb27SDimitry Andric Vti.Log2SEW, Wti.RegClass, Vti.RegClass>; 514106c3fb27SDimitry Andric } 5142*0fca6ea1SDimitry Andric def : VPatBinaryMaskPolicyRoundingMode<intrinsic, name, 514306c3fb27SDimitry Andric Wti.Vector, Wti.Vector, Vti.Vector, Vti.Mask, 514406c3fb27SDimitry Andric Vti.Log2SEW, Wti.RegClass, 514506c3fb27SDimitry Andric Wti.RegClass, Vti.RegClass>; 514606c3fb27SDimitry Andric } 514706c3fb27SDimitry Andric } 514806c3fb27SDimitry Andric} 5149e8d8bef9SDimitry Andric 5150e8d8bef9SDimitry Andricmulticlass VPatBinaryW_WX<string intrinsic, string instruction, 5151e8d8bef9SDimitry Andric list<VTypeInfoToWide> vtilist> { 5152e8d8bef9SDimitry Andric foreach VtiToWti = vtilist in { 5153e8d8bef9SDimitry Andric defvar Vti = VtiToWti.Vti; 5154e8d8bef9SDimitry Andric defvar Wti = VtiToWti.Wti; 5155e8d8bef9SDimitry Andric defvar kind = "W"#Vti.ScalarSuffix; 515606c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<Vti>.Predicates, 515706c3fb27SDimitry Andric GetVTypePredicates<Wti>.Predicates) in 515806c3fb27SDimitry Andric defm : VPatBinary<intrinsic, instruction#"_"#kind#"_"#Vti.LMul.MX, 515906c3fb27SDimitry Andric Wti.Vector, Wti.Vector, Vti.Scalar, Vti.Mask, 516006c3fb27SDimitry Andric Vti.Log2SEW, Wti.RegClass, 516106c3fb27SDimitry Andric Wti.RegClass, Vti.ScalarRegClass>; 516206c3fb27SDimitry Andric } 516306c3fb27SDimitry Andric} 516406c3fb27SDimitry Andric 516506c3fb27SDimitry Andricmulticlass VPatBinaryW_WX_RM<string intrinsic, string instruction, 5166*0fca6ea1SDimitry Andric list<VTypeInfoToWide> vtilist, bit isSEWAware = 0> { 516706c3fb27SDimitry Andric foreach VtiToWti = vtilist in { 516806c3fb27SDimitry Andric defvar Vti = VtiToWti.Vti; 516906c3fb27SDimitry Andric defvar Wti = VtiToWti.Wti; 517006c3fb27SDimitry Andric defvar kind = "W"#Vti.ScalarSuffix; 5171*0fca6ea1SDimitry Andric defvar name = !if(isSEWAware, 5172*0fca6ea1SDimitry Andric instruction#"_"#kind#"_"#Vti.LMul.MX#"_E"#Vti.SEW, 5173*0fca6ea1SDimitry Andric instruction#"_"#kind#"_"#Vti.LMul.MX); 517406c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<Vti>.Predicates, 517506c3fb27SDimitry Andric GetVTypePredicates<Wti>.Predicates) in 5176*0fca6ea1SDimitry Andric defm : VPatBinaryRoundingMode<intrinsic, name, 5177e8d8bef9SDimitry Andric Wti.Vector, Wti.Vector, Vti.Scalar, Vti.Mask, 5178fe6060f1SDimitry Andric Vti.Log2SEW, Wti.RegClass, 5179e8d8bef9SDimitry Andric Wti.RegClass, Vti.ScalarRegClass>; 5180e8d8bef9SDimitry Andric } 5181e8d8bef9SDimitry Andric} 5182e8d8bef9SDimitry Andric 5183e8d8bef9SDimitry Andricmulticlass VPatBinaryV_WV<string intrinsic, string instruction, 5184e8d8bef9SDimitry Andric list<VTypeInfoToWide> vtilist> { 5185e8d8bef9SDimitry Andric foreach VtiToWti = vtilist in { 5186e8d8bef9SDimitry Andric defvar Vti = VtiToWti.Vti; 5187e8d8bef9SDimitry Andric defvar Wti = VtiToWti.Wti; 518806c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<Vti>.Predicates, 518906c3fb27SDimitry Andric GetVTypePredicates<Wti>.Predicates) in 519006c3fb27SDimitry Andric defm : VPatBinary<intrinsic, instruction # "_WV_" # Vti.LMul.MX, 519106c3fb27SDimitry Andric Vti.Vector, Wti.Vector, Vti.Vector, Vti.Mask, 519206c3fb27SDimitry Andric Vti.Log2SEW, Vti.RegClass, 519306c3fb27SDimitry Andric Wti.RegClass, Vti.RegClass>; 519406c3fb27SDimitry Andric } 519506c3fb27SDimitry Andric} 519606c3fb27SDimitry Andric 519706c3fb27SDimitry Andricmulticlass VPatBinaryV_WV_RM<string intrinsic, string instruction, 519806c3fb27SDimitry Andric list<VTypeInfoToWide> vtilist> { 519906c3fb27SDimitry Andric foreach VtiToWti = vtilist in { 520006c3fb27SDimitry Andric defvar Vti = VtiToWti.Vti; 520106c3fb27SDimitry Andric defvar Wti = VtiToWti.Wti; 520206c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<Vti>.Predicates, 520306c3fb27SDimitry Andric GetVTypePredicates<Wti>.Predicates) in 520406c3fb27SDimitry Andric defm : VPatBinaryRoundingMode<intrinsic, 520506c3fb27SDimitry Andric instruction # "_WV_" # Vti.LMul.MX, 5206e8d8bef9SDimitry Andric Vti.Vector, Wti.Vector, Vti.Vector, Vti.Mask, 5207fe6060f1SDimitry Andric Vti.Log2SEW, Vti.RegClass, 5208e8d8bef9SDimitry Andric Wti.RegClass, Vti.RegClass>; 5209e8d8bef9SDimitry Andric } 5210e8d8bef9SDimitry Andric} 5211e8d8bef9SDimitry Andric 5212e8d8bef9SDimitry Andricmulticlass VPatBinaryV_WX<string intrinsic, string instruction, 5213e8d8bef9SDimitry Andric list<VTypeInfoToWide> vtilist> { 5214e8d8bef9SDimitry Andric foreach VtiToWti = vtilist in { 5215e8d8bef9SDimitry Andric defvar Vti = VtiToWti.Vti; 5216e8d8bef9SDimitry Andric defvar Wti = VtiToWti.Wti; 5217e8d8bef9SDimitry Andric defvar kind = "W"#Vti.ScalarSuffix; 521806c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<Vti>.Predicates, 521906c3fb27SDimitry Andric GetVTypePredicates<Wti>.Predicates) in 522006c3fb27SDimitry Andric defm : VPatBinary<intrinsic, instruction#"_"#kind#"_"#Vti.LMul.MX, 5221e8d8bef9SDimitry Andric Vti.Vector, Wti.Vector, Vti.Scalar, Vti.Mask, 5222fe6060f1SDimitry Andric Vti.Log2SEW, Vti.RegClass, 5223e8d8bef9SDimitry Andric Wti.RegClass, Vti.ScalarRegClass>; 5224e8d8bef9SDimitry Andric } 5225e8d8bef9SDimitry Andric} 5226e8d8bef9SDimitry Andric 522706c3fb27SDimitry Andricmulticlass VPatBinaryV_WX_RM<string intrinsic, string instruction, 522806c3fb27SDimitry Andric list<VTypeInfoToWide> vtilist> { 522906c3fb27SDimitry Andric foreach VtiToWti = vtilist in { 523006c3fb27SDimitry Andric defvar Vti = VtiToWti.Vti; 523106c3fb27SDimitry Andric defvar Wti = VtiToWti.Wti; 523206c3fb27SDimitry Andric defvar kind = "W"#Vti.ScalarSuffix; 523306c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<Vti>.Predicates, 523406c3fb27SDimitry Andric GetVTypePredicates<Wti>.Predicates) in 523506c3fb27SDimitry Andric defm : VPatBinaryRoundingMode<intrinsic, 523606c3fb27SDimitry Andric instruction#"_"#kind#"_"#Vti.LMul.MX, 523706c3fb27SDimitry Andric Vti.Vector, Wti.Vector, Vti.Scalar, Vti.Mask, 523806c3fb27SDimitry Andric Vti.Log2SEW, Vti.RegClass, 523906c3fb27SDimitry Andric Wti.RegClass, Vti.ScalarRegClass>; 524006c3fb27SDimitry Andric } 524106c3fb27SDimitry Andric} 524206c3fb27SDimitry Andric 524306c3fb27SDimitry Andric 5244e8d8bef9SDimitry Andricmulticlass VPatBinaryV_WI<string intrinsic, string instruction, 5245e8d8bef9SDimitry Andric list<VTypeInfoToWide> vtilist> { 5246e8d8bef9SDimitry Andric foreach VtiToWti = vtilist in { 5247e8d8bef9SDimitry Andric defvar Vti = VtiToWti.Vti; 5248e8d8bef9SDimitry Andric defvar Wti = VtiToWti.Wti; 524906c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<Vti>.Predicates, 525006c3fb27SDimitry Andric GetVTypePredicates<Wti>.Predicates) in 525106c3fb27SDimitry Andric defm : VPatBinary<intrinsic, instruction # "_WI_" # Vti.LMul.MX, 525206c3fb27SDimitry Andric Vti.Vector, Wti.Vector, XLenVT, Vti.Mask, 525306c3fb27SDimitry Andric Vti.Log2SEW, Vti.RegClass, 525406c3fb27SDimitry Andric Wti.RegClass, uimm5>; 525506c3fb27SDimitry Andric } 525606c3fb27SDimitry Andric} 525706c3fb27SDimitry Andric 525806c3fb27SDimitry Andricmulticlass VPatBinaryV_WI_RM<string intrinsic, string instruction, 525906c3fb27SDimitry Andric list<VTypeInfoToWide> vtilist> { 526006c3fb27SDimitry Andric foreach VtiToWti = vtilist in { 526106c3fb27SDimitry Andric defvar Vti = VtiToWti.Vti; 526206c3fb27SDimitry Andric defvar Wti = VtiToWti.Wti; 526306c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<Vti>.Predicates, 526406c3fb27SDimitry Andric GetVTypePredicates<Wti>.Predicates) in 526506c3fb27SDimitry Andric defm : VPatBinaryRoundingMode<intrinsic, 526606c3fb27SDimitry Andric instruction # "_WI_" # Vti.LMul.MX, 5267e8d8bef9SDimitry Andric Vti.Vector, Wti.Vector, XLenVT, Vti.Mask, 5268fe6060f1SDimitry Andric Vti.Log2SEW, Vti.RegClass, 5269e8d8bef9SDimitry Andric Wti.RegClass, uimm5>; 5270e8d8bef9SDimitry Andric } 5271e8d8bef9SDimitry Andric} 5272e8d8bef9SDimitry Andric 5273e8d8bef9SDimitry Andricmulticlass VPatBinaryV_VM<string intrinsic, string instruction, 5274e8d8bef9SDimitry Andric bit CarryOut = 0, 5275e8d8bef9SDimitry Andric list<VTypeInfo> vtilist = AllIntegerVectors> { 5276e8d8bef9SDimitry Andric foreach vti = vtilist in 527706c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 5278e8d8bef9SDimitry Andric defm : VPatBinaryCarryIn<intrinsic, instruction, "VVM", 5279e8d8bef9SDimitry Andric !if(CarryOut, vti.Mask, vti.Vector), 5280e8d8bef9SDimitry Andric vti.Vector, vti.Vector, vti.Mask, 5281fe6060f1SDimitry Andric vti.Log2SEW, vti.LMul, 5282e8d8bef9SDimitry Andric vti.RegClass, vti.RegClass>; 5283e8d8bef9SDimitry Andric} 5284e8d8bef9SDimitry Andric 5285e8d8bef9SDimitry Andricmulticlass VPatBinaryV_XM<string intrinsic, string instruction, 5286e8d8bef9SDimitry Andric bit CarryOut = 0, 5287e8d8bef9SDimitry Andric list<VTypeInfo> vtilist = AllIntegerVectors> { 5288e8d8bef9SDimitry Andric foreach vti = vtilist in 528906c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 5290e8d8bef9SDimitry Andric defm : VPatBinaryCarryIn<intrinsic, instruction, 5291e8d8bef9SDimitry Andric "V"#vti.ScalarSuffix#"M", 5292e8d8bef9SDimitry Andric !if(CarryOut, vti.Mask, vti.Vector), 5293e8d8bef9SDimitry Andric vti.Vector, vti.Scalar, vti.Mask, 5294fe6060f1SDimitry Andric vti.Log2SEW, vti.LMul, 5295e8d8bef9SDimitry Andric vti.RegClass, vti.ScalarRegClass>; 5296e8d8bef9SDimitry Andric} 5297e8d8bef9SDimitry Andric 5298e8d8bef9SDimitry Andricmulticlass VPatBinaryV_IM<string intrinsic, string instruction, 5299e8d8bef9SDimitry Andric bit CarryOut = 0> { 5300e8d8bef9SDimitry Andric foreach vti = AllIntegerVectors in 530106c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 5302e8d8bef9SDimitry Andric defm : VPatBinaryCarryIn<intrinsic, instruction, "VIM", 5303e8d8bef9SDimitry Andric !if(CarryOut, vti.Mask, vti.Vector), 5304e8d8bef9SDimitry Andric vti.Vector, XLenVT, vti.Mask, 5305fe6060f1SDimitry Andric vti.Log2SEW, vti.LMul, 5306e8d8bef9SDimitry Andric vti.RegClass, simm5>; 5307e8d8bef9SDimitry Andric} 5308e8d8bef9SDimitry Andric 530906c3fb27SDimitry Andricmulticlass VPatBinaryV_VM_TAIL<string intrinsic, string instruction> { 531006c3fb27SDimitry Andric foreach vti = AllIntegerVectors in 531106c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 531281ad6265SDimitry Andric defm : VPatBinaryCarryInTAIL<intrinsic, instruction, "VVM", 531306c3fb27SDimitry Andric vti.Vector, 531481ad6265SDimitry Andric vti.Vector, vti.Vector, vti.Mask, 531581ad6265SDimitry Andric vti.Log2SEW, vti.LMul, vti.RegClass, 531681ad6265SDimitry Andric vti.RegClass, vti.RegClass>; 531781ad6265SDimitry Andric} 531881ad6265SDimitry Andric 531906c3fb27SDimitry Andricmulticlass VPatBinaryV_XM_TAIL<string intrinsic, string instruction> { 532006c3fb27SDimitry Andric foreach vti = AllIntegerVectors in 532106c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 532281ad6265SDimitry Andric defm : VPatBinaryCarryInTAIL<intrinsic, instruction, 532381ad6265SDimitry Andric "V"#vti.ScalarSuffix#"M", 532406c3fb27SDimitry Andric vti.Vector, 532581ad6265SDimitry Andric vti.Vector, vti.Scalar, vti.Mask, 532681ad6265SDimitry Andric vti.Log2SEW, vti.LMul, vti.RegClass, 532781ad6265SDimitry Andric vti.RegClass, vti.ScalarRegClass>; 532881ad6265SDimitry Andric} 532981ad6265SDimitry Andric 533006c3fb27SDimitry Andricmulticlass VPatBinaryV_IM_TAIL<string intrinsic, string instruction> { 533181ad6265SDimitry Andric foreach vti = AllIntegerVectors in 533206c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 533381ad6265SDimitry Andric defm : VPatBinaryCarryInTAIL<intrinsic, instruction, "VIM", 533406c3fb27SDimitry Andric vti.Vector, 533581ad6265SDimitry Andric vti.Vector, XLenVT, vti.Mask, 533681ad6265SDimitry Andric vti.Log2SEW, vti.LMul, 533781ad6265SDimitry Andric vti.RegClass, vti.RegClass, simm5>; 533881ad6265SDimitry Andric} 533981ad6265SDimitry Andric 5340e8d8bef9SDimitry Andricmulticlass VPatBinaryV_V<string intrinsic, string instruction> { 5341e8d8bef9SDimitry Andric foreach vti = AllIntegerVectors in 534206c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 5343e8d8bef9SDimitry Andric defm : VPatBinaryMaskOut<intrinsic, instruction, "VV", 5344e8d8bef9SDimitry Andric vti.Mask, vti.Vector, vti.Vector, 5345fe6060f1SDimitry Andric vti.Log2SEW, vti.LMul, 5346e8d8bef9SDimitry Andric vti.RegClass, vti.RegClass>; 5347e8d8bef9SDimitry Andric} 5348e8d8bef9SDimitry Andric 5349e8d8bef9SDimitry Andricmulticlass VPatBinaryV_X<string intrinsic, string instruction> { 5350e8d8bef9SDimitry Andric foreach vti = AllIntegerVectors in 535106c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 5352e8d8bef9SDimitry Andric defm : VPatBinaryMaskOut<intrinsic, instruction, "VX", 5353e8d8bef9SDimitry Andric vti.Mask, vti.Vector, XLenVT, 5354fe6060f1SDimitry Andric vti.Log2SEW, vti.LMul, 5355e8d8bef9SDimitry Andric vti.RegClass, GPR>; 5356e8d8bef9SDimitry Andric} 5357e8d8bef9SDimitry Andric 5358e8d8bef9SDimitry Andricmulticlass VPatBinaryV_I<string intrinsic, string instruction> { 5359e8d8bef9SDimitry Andric foreach vti = AllIntegerVectors in 536006c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 5361e8d8bef9SDimitry Andric defm : VPatBinaryMaskOut<intrinsic, instruction, "VI", 5362e8d8bef9SDimitry Andric vti.Mask, vti.Vector, XLenVT, 5363fe6060f1SDimitry Andric vti.Log2SEW, vti.LMul, 5364e8d8bef9SDimitry Andric vti.RegClass, simm5>; 5365e8d8bef9SDimitry Andric} 5366e8d8bef9SDimitry Andric 5367e8d8bef9SDimitry Andricmulticlass VPatBinaryM_VV<string intrinsic, string instruction, 5368e8d8bef9SDimitry Andric list<VTypeInfo> vtilist> { 5369e8d8bef9SDimitry Andric foreach vti = vtilist in 537006c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 537181ad6265SDimitry Andric defm : VPatBinaryM<intrinsic, instruction # "_VV_" # vti.LMul.MX, 5372e8d8bef9SDimitry Andric vti.Mask, vti.Vector, vti.Vector, vti.Mask, 5373fe6060f1SDimitry Andric vti.Log2SEW, VR, 5374fe6060f1SDimitry Andric vti.RegClass, vti.RegClass>; 5375fe6060f1SDimitry Andric} 5376fe6060f1SDimitry Andric 5377fe6060f1SDimitry Andricmulticlass VPatBinarySwappedM_VV<string intrinsic, string instruction, 5378fe6060f1SDimitry Andric list<VTypeInfo> vtilist> { 5379fe6060f1SDimitry Andric foreach vti = vtilist in 538006c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 5381*0fca6ea1SDimitry Andric defm : VPatBinaryMSwapped<intrinsic, instruction # "_VV_" # vti.LMul.MX, 5382fe6060f1SDimitry Andric vti.Mask, vti.Vector, vti.Vector, vti.Mask, 5383fe6060f1SDimitry Andric vti.Log2SEW, VR, 5384e8d8bef9SDimitry Andric vti.RegClass, vti.RegClass>; 5385e8d8bef9SDimitry Andric} 5386e8d8bef9SDimitry Andric 5387e8d8bef9SDimitry Andricmulticlass VPatBinaryM_VX<string intrinsic, string instruction, 5388e8d8bef9SDimitry Andric list<VTypeInfo> vtilist> { 5389e8d8bef9SDimitry Andric foreach vti = vtilist in { 5390e8d8bef9SDimitry Andric defvar kind = "V"#vti.ScalarSuffix; 539106c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 539281ad6265SDimitry Andric defm : VPatBinaryM<intrinsic, instruction#"_"#kind#"_"#vti.LMul.MX, 5393e8d8bef9SDimitry Andric vti.Mask, vti.Vector, vti.Scalar, vti.Mask, 5394fe6060f1SDimitry Andric vti.Log2SEW, VR, 5395e8d8bef9SDimitry Andric vti.RegClass, vti.ScalarRegClass>; 5396e8d8bef9SDimitry Andric } 5397e8d8bef9SDimitry Andric} 5398e8d8bef9SDimitry Andric 5399e8d8bef9SDimitry Andricmulticlass VPatBinaryM_VI<string intrinsic, string instruction, 5400e8d8bef9SDimitry Andric list<VTypeInfo> vtilist> { 5401e8d8bef9SDimitry Andric foreach vti = vtilist in 540206c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 540381ad6265SDimitry Andric defm : VPatBinaryM<intrinsic, instruction # "_VI_" # vti.LMul.MX, 5404e8d8bef9SDimitry Andric vti.Mask, vti.Vector, XLenVT, vti.Mask, 5405fe6060f1SDimitry Andric vti.Log2SEW, VR, 5406e8d8bef9SDimitry Andric vti.RegClass, simm5>; 5407e8d8bef9SDimitry Andric} 5408e8d8bef9SDimitry Andric 5409e8d8bef9SDimitry Andricmulticlass VPatBinaryV_VV_VX_VI<string intrinsic, string instruction, 5410e8d8bef9SDimitry Andric list<VTypeInfo> vtilist, Operand ImmType = simm5> 5411fe6060f1SDimitry Andric : VPatBinaryV_VV<intrinsic, instruction, vtilist>, 5412fe6060f1SDimitry Andric VPatBinaryV_VX<intrinsic, instruction, vtilist>, 5413fe6060f1SDimitry Andric VPatBinaryV_VI<intrinsic, instruction, vtilist, ImmType>; 5414e8d8bef9SDimitry Andric 541506c3fb27SDimitry Andricmulticlass VPatBinaryV_VV_VX_VI_RM<string intrinsic, string instruction, 5416*0fca6ea1SDimitry Andric list<VTypeInfo> vtilist, Operand ImmType> 541706c3fb27SDimitry Andric : VPatBinaryV_VV_RM<intrinsic, instruction, vtilist>, 541806c3fb27SDimitry Andric VPatBinaryV_VX_RM<intrinsic, instruction, vtilist>, 541906c3fb27SDimitry Andric VPatBinaryV_VI_RM<intrinsic, instruction, vtilist, ImmType>; 542006c3fb27SDimitry Andric 5421e8d8bef9SDimitry Andricmulticlass VPatBinaryV_VV_VX<string intrinsic, string instruction, 542206c3fb27SDimitry Andric list<VTypeInfo> vtilist, bit isSEWAware = 0> 542306c3fb27SDimitry Andric : VPatBinaryV_VV<intrinsic, instruction, vtilist, isSEWAware>, 542406c3fb27SDimitry Andric VPatBinaryV_VX<intrinsic, instruction, vtilist, isSEWAware>; 542506c3fb27SDimitry Andric 542606c3fb27SDimitry Andricmulticlass VPatBinaryV_VV_VX_RM<string intrinsic, string instruction, 542706c3fb27SDimitry Andric list<VTypeInfo> vtilist, bit isSEWAware = 0> 542806c3fb27SDimitry Andric : VPatBinaryV_VV_RM<intrinsic, instruction, vtilist, isSEWAware>, 542906c3fb27SDimitry Andric VPatBinaryV_VX_RM<intrinsic, instruction, vtilist, isSEWAware>; 5430e8d8bef9SDimitry Andric 5431e8d8bef9SDimitry Andricmulticlass VPatBinaryV_VX_VI<string intrinsic, string instruction, 5432e8d8bef9SDimitry Andric list<VTypeInfo> vtilist> 5433fe6060f1SDimitry Andric : VPatBinaryV_VX<intrinsic, instruction, vtilist>, 5434fe6060f1SDimitry Andric VPatBinaryV_VI<intrinsic, instruction, vtilist, simm5>; 5435e8d8bef9SDimitry Andric 5436e8d8bef9SDimitry Andricmulticlass VPatBinaryW_VV_VX<string intrinsic, string instruction, 5437e8d8bef9SDimitry Andric list<VTypeInfoToWide> vtilist> 5438fe6060f1SDimitry Andric : VPatBinaryW_VV<intrinsic, instruction, vtilist>, 5439fe6060f1SDimitry Andric VPatBinaryW_VX<intrinsic, instruction, vtilist>; 5440e8d8bef9SDimitry Andric 5441*0fca6ea1SDimitry Andricmulticlass 5442*0fca6ea1SDimitry Andric VPatBinaryW_VV_VX_RM<string intrinsic, string instruction, 5443*0fca6ea1SDimitry Andric list<VTypeInfoToWide> vtilist, bit isSEWAware = 0> 5444*0fca6ea1SDimitry Andric : VPatBinaryW_VV_RM<intrinsic, instruction, vtilist, isSEWAware>, 5445*0fca6ea1SDimitry Andric VPatBinaryW_VX_RM<intrinsic, instruction, vtilist, isSEWAware>; 544606c3fb27SDimitry Andric 5447e8d8bef9SDimitry Andricmulticlass VPatBinaryW_WV_WX<string intrinsic, string instruction, 5448e8d8bef9SDimitry Andric list<VTypeInfoToWide> vtilist> 5449fe6060f1SDimitry Andric : VPatBinaryW_WV<intrinsic, instruction, vtilist>, 5450fe6060f1SDimitry Andric VPatBinaryW_WX<intrinsic, instruction, vtilist>; 5451e8d8bef9SDimitry Andric 5452*0fca6ea1SDimitry Andricmulticlass 5453*0fca6ea1SDimitry Andric VPatBinaryW_WV_WX_RM<string intrinsic, string instruction, 5454*0fca6ea1SDimitry Andric list<VTypeInfoToWide> vtilist, bit isSEWAware = 0> 5455*0fca6ea1SDimitry Andric : VPatBinaryW_WV_RM<intrinsic, instruction, vtilist, isSEWAware>, 5456*0fca6ea1SDimitry Andric VPatBinaryW_WX_RM<intrinsic, instruction, vtilist, isSEWAware>; 545706c3fb27SDimitry Andric 5458e8d8bef9SDimitry Andricmulticlass VPatBinaryV_WV_WX_WI<string intrinsic, string instruction, 5459e8d8bef9SDimitry Andric list<VTypeInfoToWide> vtilist> 5460fe6060f1SDimitry Andric : VPatBinaryV_WV<intrinsic, instruction, vtilist>, 5461fe6060f1SDimitry Andric VPatBinaryV_WX<intrinsic, instruction, vtilist>, 5462fe6060f1SDimitry Andric VPatBinaryV_WI<intrinsic, instruction, vtilist>; 5463e8d8bef9SDimitry Andric 546406c3fb27SDimitry Andricmulticlass VPatBinaryV_WV_WX_WI_RM<string intrinsic, string instruction, 546506c3fb27SDimitry Andric list<VTypeInfoToWide> vtilist> 546606c3fb27SDimitry Andric : VPatBinaryV_WV_RM<intrinsic, instruction, vtilist>, 546706c3fb27SDimitry Andric VPatBinaryV_WX_RM<intrinsic, instruction, vtilist>, 546806c3fb27SDimitry Andric VPatBinaryV_WI_RM<intrinsic, instruction, vtilist>; 546906c3fb27SDimitry Andric 5470e8d8bef9SDimitry Andricmulticlass VPatBinaryV_VM_XM_IM<string intrinsic, string instruction> 547181ad6265SDimitry Andric : VPatBinaryV_VM_TAIL<intrinsic, instruction>, 547281ad6265SDimitry Andric VPatBinaryV_XM_TAIL<intrinsic, instruction>, 547381ad6265SDimitry Andric VPatBinaryV_IM_TAIL<intrinsic, instruction>; 5474e8d8bef9SDimitry Andric 5475e8d8bef9SDimitry Andricmulticlass VPatBinaryM_VM_XM_IM<string intrinsic, string instruction> 547606c3fb27SDimitry Andric : VPatBinaryV_VM<intrinsic, instruction, CarryOut=1>, 547706c3fb27SDimitry Andric VPatBinaryV_XM<intrinsic, instruction, CarryOut=1>, 547806c3fb27SDimitry Andric VPatBinaryV_IM<intrinsic, instruction, CarryOut=1>; 5479e8d8bef9SDimitry Andric 5480e8d8bef9SDimitry Andricmulticlass VPatBinaryM_V_X_I<string intrinsic, string instruction> 5481fe6060f1SDimitry Andric : VPatBinaryV_V<intrinsic, instruction>, 5482fe6060f1SDimitry Andric VPatBinaryV_X<intrinsic, instruction>, 5483fe6060f1SDimitry Andric VPatBinaryV_I<intrinsic, instruction>; 5484e8d8bef9SDimitry Andric 5485e8d8bef9SDimitry Andricmulticlass VPatBinaryV_VM_XM<string intrinsic, string instruction> 548681ad6265SDimitry Andric : VPatBinaryV_VM_TAIL<intrinsic, instruction>, 548781ad6265SDimitry Andric VPatBinaryV_XM_TAIL<intrinsic, instruction>; 5488e8d8bef9SDimitry Andric 5489e8d8bef9SDimitry Andricmulticlass VPatBinaryM_VM_XM<string intrinsic, string instruction> 549006c3fb27SDimitry Andric : VPatBinaryV_VM<intrinsic, instruction, CarryOut=1>, 549106c3fb27SDimitry Andric VPatBinaryV_XM<intrinsic, instruction, CarryOut=1>; 5492e8d8bef9SDimitry Andric 5493e8d8bef9SDimitry Andricmulticlass VPatBinaryM_V_X<string intrinsic, string instruction> 5494fe6060f1SDimitry Andric : VPatBinaryV_V<intrinsic, instruction>, 5495fe6060f1SDimitry Andric VPatBinaryV_X<intrinsic, instruction>; 5496e8d8bef9SDimitry Andric 5497349cc55cSDimitry Andricmulticlass VPatTernaryWithPolicy<string intrinsic, 5498349cc55cSDimitry Andric string inst, 5499349cc55cSDimitry Andric string kind, 5500349cc55cSDimitry Andric ValueType result_type, 5501349cc55cSDimitry Andric ValueType op1_type, 5502349cc55cSDimitry Andric ValueType op2_type, 5503349cc55cSDimitry Andric ValueType mask_type, 5504349cc55cSDimitry Andric int sew, 5505349cc55cSDimitry Andric LMULInfo vlmul, 5506349cc55cSDimitry Andric VReg result_reg_class, 5507349cc55cSDimitry Andric RegisterClass op1_reg_class, 5508349cc55cSDimitry Andric DAGOperand op2_kind> { 5509349cc55cSDimitry Andric def : VPatTernaryNoMaskWithPolicy<intrinsic, inst, kind, result_type, op1_type, 5510349cc55cSDimitry Andric op2_type, sew, vlmul, result_reg_class, 5511349cc55cSDimitry Andric op1_reg_class, op2_kind>; 551281ad6265SDimitry Andric def : VPatTernaryMaskPolicy<intrinsic, inst, kind, result_type, op1_type, op2_type, 5513349cc55cSDimitry Andric mask_type, sew, vlmul, result_reg_class, op1_reg_class, 5514349cc55cSDimitry Andric op2_kind>; 5515349cc55cSDimitry Andric} 5516349cc55cSDimitry Andric 551706c3fb27SDimitry Andricmulticlass VPatTernaryWithPolicyRoundingMode<string intrinsic, 551806c3fb27SDimitry Andric string inst, 551906c3fb27SDimitry Andric string kind, 552006c3fb27SDimitry Andric ValueType result_type, 552106c3fb27SDimitry Andric ValueType op1_type, 552206c3fb27SDimitry Andric ValueType op2_type, 552306c3fb27SDimitry Andric ValueType mask_type, 552406c3fb27SDimitry Andric int sew, 552506c3fb27SDimitry Andric LMULInfo vlmul, 552606c3fb27SDimitry Andric VReg result_reg_class, 552706c3fb27SDimitry Andric RegisterClass op1_reg_class, 5528*0fca6ea1SDimitry Andric DAGOperand op2_kind, 5529*0fca6ea1SDimitry Andric bit isSEWAware = 0> { 553006c3fb27SDimitry Andric def : VPatTernaryNoMaskWithPolicyRoundingMode<intrinsic, inst, kind, result_type, 553106c3fb27SDimitry Andric op1_type, op2_type, sew, vlmul, 553206c3fb27SDimitry Andric result_reg_class, op1_reg_class, 5533*0fca6ea1SDimitry Andric op2_kind, isSEWAware>; 553406c3fb27SDimitry Andric def : VPatTernaryMaskPolicyRoundingMode<intrinsic, inst, kind, result_type, op1_type, 553506c3fb27SDimitry Andric op2_type, mask_type, sew, vlmul, 553606c3fb27SDimitry Andric result_reg_class, op1_reg_class, 5537*0fca6ea1SDimitry Andric op2_kind, isSEWAware>; 553806c3fb27SDimitry Andric} 553906c3fb27SDimitry Andric 5540*0fca6ea1SDimitry Andricmulticlass VPatTernaryTU<string intrinsic, 554106c3fb27SDimitry Andric string inst, 554206c3fb27SDimitry Andric string kind, 554306c3fb27SDimitry Andric ValueType result_type, 554406c3fb27SDimitry Andric ValueType op1_type, 554506c3fb27SDimitry Andric ValueType op2_type, 554606c3fb27SDimitry Andric ValueType mask_type, 554706c3fb27SDimitry Andric int log2sew, 554806c3fb27SDimitry Andric LMULInfo vlmul, 554906c3fb27SDimitry Andric VReg result_reg_class, 555006c3fb27SDimitry Andric RegisterClass op1_reg_class, 555106c3fb27SDimitry Andric DAGOperand op2_kind> { 5552*0fca6ea1SDimitry Andric def : VPatTernaryNoMaskTU<intrinsic, inst, kind, result_type, op1_type, 555306c3fb27SDimitry Andric op2_type, log2sew, vlmul, result_reg_class, 555406c3fb27SDimitry Andric op1_reg_class, op2_kind>; 5555*0fca6ea1SDimitry Andric def : VPatTernaryMaskTU<intrinsic, inst, kind, result_type, op1_type, 555606c3fb27SDimitry Andric op2_type, mask_type, log2sew, vlmul, 555706c3fb27SDimitry Andric result_reg_class, op1_reg_class, op2_kind>; 555806c3fb27SDimitry Andric} 555906c3fb27SDimitry Andric 5560*0fca6ea1SDimitry Andricmulticlass VPatTernaryTURoundingMode<string intrinsic, 556106c3fb27SDimitry Andric string inst, 556206c3fb27SDimitry Andric string kind, 556306c3fb27SDimitry Andric ValueType result_type, 556406c3fb27SDimitry Andric ValueType op1_type, 556506c3fb27SDimitry Andric ValueType op2_type, 556606c3fb27SDimitry Andric ValueType mask_type, 556706c3fb27SDimitry Andric int log2sew, 556806c3fb27SDimitry Andric LMULInfo vlmul, 556906c3fb27SDimitry Andric VReg result_reg_class, 557006c3fb27SDimitry Andric RegisterClass op1_reg_class, 557106c3fb27SDimitry Andric DAGOperand op2_kind> { 5572*0fca6ea1SDimitry Andric def : VPatTernaryNoMaskTURoundingMode<intrinsic, inst, kind, result_type, op1_type, 557306c3fb27SDimitry Andric op2_type, log2sew, vlmul, result_reg_class, 557406c3fb27SDimitry Andric op1_reg_class, op2_kind>; 5575*0fca6ea1SDimitry Andric def : VPatTernaryMaskTURoundingMode<intrinsic, inst, kind, result_type, op1_type, 557606c3fb27SDimitry Andric op2_type, mask_type, log2sew, vlmul, 557706c3fb27SDimitry Andric result_reg_class, op1_reg_class, op2_kind>; 557806c3fb27SDimitry Andric} 557906c3fb27SDimitry Andric 5580349cc55cSDimitry Andricmulticlass VPatTernaryV_VV_AAXA<string intrinsic, string instruction, 5581e8d8bef9SDimitry Andric list<VTypeInfo> vtilist> { 5582e8d8bef9SDimitry Andric foreach vti = vtilist in 558306c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 5584349cc55cSDimitry Andric defm : VPatTernaryWithPolicy<intrinsic, instruction, "VV", 5585e8d8bef9SDimitry Andric vti.Vector, vti.Vector, vti.Vector, vti.Mask, 5586fe6060f1SDimitry Andric vti.Log2SEW, vti.LMul, vti.RegClass, 5587e8d8bef9SDimitry Andric vti.RegClass, vti.RegClass>; 5588e8d8bef9SDimitry Andric} 5589e8d8bef9SDimitry Andric 559006c3fb27SDimitry Andricmulticlass VPatTernaryV_VV_AAXA_RM<string intrinsic, string instruction, 5591*0fca6ea1SDimitry Andric list<VTypeInfo> vtilist, bit isSEWAware = 0> { 559206c3fb27SDimitry Andric foreach vti = vtilist in 559306c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 559406c3fb27SDimitry Andric defm : VPatTernaryWithPolicyRoundingMode<intrinsic, instruction, "VV", 559506c3fb27SDimitry Andric vti.Vector, vti.Vector, vti.Vector, vti.Mask, 559606c3fb27SDimitry Andric vti.Log2SEW, vti.LMul, vti.RegClass, 5597*0fca6ea1SDimitry Andric vti.RegClass, vti.RegClass, isSEWAware>; 559806c3fb27SDimitry Andric} 559906c3fb27SDimitry Andric 5600e8d8bef9SDimitry Andricmulticlass VPatTernaryV_VX<string intrinsic, string instruction, 5601e8d8bef9SDimitry Andric list<VTypeInfo> vtilist> { 5602e8d8bef9SDimitry Andric foreach vti = vtilist in 560306c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 560481ad6265SDimitry Andric defm : VPatTernaryWithPolicy<intrinsic, instruction, "VX", 5605e8d8bef9SDimitry Andric vti.Vector, vti.Vector, XLenVT, vti.Mask, 5606fe6060f1SDimitry Andric vti.Log2SEW, vti.LMul, vti.RegClass, 5607e8d8bef9SDimitry Andric vti.RegClass, GPR>; 5608e8d8bef9SDimitry Andric} 5609e8d8bef9SDimitry Andric 5610e8d8bef9SDimitry Andricmulticlass VPatTernaryV_VX_AAXA<string intrinsic, string instruction, 5611e8d8bef9SDimitry Andric list<VTypeInfo> vtilist> { 5612e8d8bef9SDimitry Andric foreach vti = vtilist in 561306c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 5614349cc55cSDimitry Andric defm : VPatTernaryWithPolicy<intrinsic, instruction, 5615e8d8bef9SDimitry Andric "V"#vti.ScalarSuffix, 5616e8d8bef9SDimitry Andric vti.Vector, vti.Scalar, vti.Vector, vti.Mask, 5617fe6060f1SDimitry Andric vti.Log2SEW, vti.LMul, vti.RegClass, 5618e8d8bef9SDimitry Andric vti.ScalarRegClass, vti.RegClass>; 5619e8d8bef9SDimitry Andric} 5620e8d8bef9SDimitry Andric 562106c3fb27SDimitry Andricmulticlass VPatTernaryV_VX_AAXA_RM<string intrinsic, string instruction, 5622*0fca6ea1SDimitry Andric list<VTypeInfo> vtilist, bit isSEWAware = 0> { 562306c3fb27SDimitry Andric foreach vti = vtilist in 562406c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 562506c3fb27SDimitry Andric defm : VPatTernaryWithPolicyRoundingMode<intrinsic, instruction, 562606c3fb27SDimitry Andric "V"#vti.ScalarSuffix, 562706c3fb27SDimitry Andric vti.Vector, vti.Scalar, vti.Vector, vti.Mask, 562806c3fb27SDimitry Andric vti.Log2SEW, vti.LMul, vti.RegClass, 5629*0fca6ea1SDimitry Andric vti.ScalarRegClass, vti.RegClass, isSEWAware>; 563006c3fb27SDimitry Andric} 563106c3fb27SDimitry Andric 5632e8d8bef9SDimitry Andricmulticlass VPatTernaryV_VI<string intrinsic, string instruction, 5633e8d8bef9SDimitry Andric list<VTypeInfo> vtilist, Operand Imm_type> { 5634e8d8bef9SDimitry Andric foreach vti = vtilist in 563506c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 563681ad6265SDimitry Andric defm : VPatTernaryWithPolicy<intrinsic, instruction, "VI", 5637e8d8bef9SDimitry Andric vti.Vector, vti.Vector, XLenVT, vti.Mask, 5638fe6060f1SDimitry Andric vti.Log2SEW, vti.LMul, vti.RegClass, 5639e8d8bef9SDimitry Andric vti.RegClass, Imm_type>; 5640e8d8bef9SDimitry Andric} 5641e8d8bef9SDimitry Andric 5642e8d8bef9SDimitry Andricmulticlass VPatTernaryW_VV<string intrinsic, string instruction, 5643e8d8bef9SDimitry Andric list<VTypeInfoToWide> vtilist> { 5644e8d8bef9SDimitry Andric foreach vtiToWti = vtilist in { 5645e8d8bef9SDimitry Andric defvar vti = vtiToWti.Vti; 5646e8d8bef9SDimitry Andric defvar wti = vtiToWti.Wti; 564706c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<vti>.Predicates, 564806c3fb27SDimitry Andric GetVTypePredicates<wti>.Predicates) in 5649349cc55cSDimitry Andric defm : VPatTernaryWithPolicy<intrinsic, instruction, "VV", 5650e8d8bef9SDimitry Andric wti.Vector, vti.Vector, vti.Vector, 5651fe6060f1SDimitry Andric vti.Mask, vti.Log2SEW, vti.LMul, 5652e8d8bef9SDimitry Andric wti.RegClass, vti.RegClass, vti.RegClass>; 5653e8d8bef9SDimitry Andric } 5654e8d8bef9SDimitry Andric} 5655e8d8bef9SDimitry Andric 565606c3fb27SDimitry Andricmulticlass VPatTernaryW_VV_RM<string intrinsic, string instruction, 5657*0fca6ea1SDimitry Andric list<VTypeInfoToWide> vtilist, bit isSEWAware = 0> { 565806c3fb27SDimitry Andric foreach vtiToWti = vtilist in { 565906c3fb27SDimitry Andric defvar vti = vtiToWti.Vti; 566006c3fb27SDimitry Andric defvar wti = vtiToWti.Wti; 566106c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<vti>.Predicates, 566206c3fb27SDimitry Andric GetVTypePredicates<wti>.Predicates) in 566306c3fb27SDimitry Andric defm : VPatTernaryWithPolicyRoundingMode<intrinsic, instruction, "VV", 566406c3fb27SDimitry Andric wti.Vector, vti.Vector, vti.Vector, 566506c3fb27SDimitry Andric vti.Mask, vti.Log2SEW, vti.LMul, 5666*0fca6ea1SDimitry Andric wti.RegClass, vti.RegClass, 5667*0fca6ea1SDimitry Andric vti.RegClass, isSEWAware>; 566806c3fb27SDimitry Andric } 566906c3fb27SDimitry Andric} 567006c3fb27SDimitry Andric 5671e8d8bef9SDimitry Andricmulticlass VPatTernaryW_VX<string intrinsic, string instruction, 5672e8d8bef9SDimitry Andric list<VTypeInfoToWide> vtilist> { 5673e8d8bef9SDimitry Andric foreach vtiToWti = vtilist in { 5674e8d8bef9SDimitry Andric defvar vti = vtiToWti.Vti; 5675e8d8bef9SDimitry Andric defvar wti = vtiToWti.Wti; 567606c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<vti>.Predicates, 567706c3fb27SDimitry Andric GetVTypePredicates<wti>.Predicates) in 5678349cc55cSDimitry Andric defm : VPatTernaryWithPolicy<intrinsic, instruction, 5679e8d8bef9SDimitry Andric "V"#vti.ScalarSuffix, 5680e8d8bef9SDimitry Andric wti.Vector, vti.Scalar, vti.Vector, 5681fe6060f1SDimitry Andric vti.Mask, vti.Log2SEW, vti.LMul, 5682e8d8bef9SDimitry Andric wti.RegClass, vti.ScalarRegClass, vti.RegClass>; 5683e8d8bef9SDimitry Andric } 5684e8d8bef9SDimitry Andric} 5685e8d8bef9SDimitry Andric 5686*0fca6ea1SDimitry Andricmulticlass 5687*0fca6ea1SDimitry Andric VPatTernaryW_VX_RM<string intrinsic, string instruction, 5688*0fca6ea1SDimitry Andric list<VTypeInfoToWide> vtilist, bit isSEWAware = 0> { 568906c3fb27SDimitry Andric foreach vtiToWti = vtilist in { 569006c3fb27SDimitry Andric defvar vti = vtiToWti.Vti; 569106c3fb27SDimitry Andric defvar wti = vtiToWti.Wti; 569206c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<vti>.Predicates, 5693*0fca6ea1SDimitry Andric GetVTypePredicates<wti>.Predicates) in defm 5694*0fca6ea1SDimitry Andric : VPatTernaryWithPolicyRoundingMode< 5695*0fca6ea1SDimitry Andric intrinsic, instruction, "V" #vti.ScalarSuffix, wti.Vector, 5696*0fca6ea1SDimitry Andric vti.Scalar, vti.Vector, vti.Mask, vti.Log2SEW, vti.LMul, 5697*0fca6ea1SDimitry Andric wti.RegClass, vti.ScalarRegClass, vti.RegClass, isSEWAware>; 569806c3fb27SDimitry Andric } 569906c3fb27SDimitry Andric} 570006c3fb27SDimitry Andric 5701e8d8bef9SDimitry Andricmulticlass VPatTernaryV_VV_VX_AAXA<string intrinsic, string instruction, 5702fe6060f1SDimitry Andric list<VTypeInfo> vtilist> 5703349cc55cSDimitry Andric : VPatTernaryV_VV_AAXA<intrinsic, instruction, vtilist>, 5704fe6060f1SDimitry Andric VPatTernaryV_VX_AAXA<intrinsic, instruction, vtilist>; 5705e8d8bef9SDimitry Andric 570606c3fb27SDimitry Andricmulticlass VPatTernaryV_VV_VX_AAXA_RM<string intrinsic, string instruction, 5707*0fca6ea1SDimitry Andric list<VTypeInfo> vtilist, bit isSEWAware = 0> 5708*0fca6ea1SDimitry Andric : VPatTernaryV_VV_AAXA_RM<intrinsic, instruction, vtilist, isSEWAware>, 5709*0fca6ea1SDimitry Andric VPatTernaryV_VX_AAXA_RM<intrinsic, instruction, vtilist, isSEWAware>; 571006c3fb27SDimitry Andric 5711e8d8bef9SDimitry Andricmulticlass VPatTernaryV_VX_VI<string intrinsic, string instruction, 5712*0fca6ea1SDimitry Andric list<VTypeInfo> vtilist, Operand Imm_type> 5713fe6060f1SDimitry Andric : VPatTernaryV_VX<intrinsic, instruction, vtilist>, 5714fe6060f1SDimitry Andric VPatTernaryV_VI<intrinsic, instruction, vtilist, Imm_type>; 5715e8d8bef9SDimitry Andric 571681ad6265SDimitry Andric 5717e8d8bef9SDimitry Andricmulticlass VPatBinaryM_VV_VX_VI<string intrinsic, string instruction, 5718e8d8bef9SDimitry Andric list<VTypeInfo> vtilist> 5719fe6060f1SDimitry Andric : VPatBinaryM_VV<intrinsic, instruction, vtilist>, 5720fe6060f1SDimitry Andric VPatBinaryM_VX<intrinsic, instruction, vtilist>, 5721fe6060f1SDimitry Andric VPatBinaryM_VI<intrinsic, instruction, vtilist>; 5722e8d8bef9SDimitry Andric 5723e8d8bef9SDimitry Andricmulticlass VPatTernaryW_VV_VX<string intrinsic, string instruction, 5724fe6060f1SDimitry Andric list<VTypeInfoToWide> vtilist> 5725fe6060f1SDimitry Andric : VPatTernaryW_VV<intrinsic, instruction, vtilist>, 5726fe6060f1SDimitry Andric VPatTernaryW_VX<intrinsic, instruction, vtilist>; 5727e8d8bef9SDimitry Andric 572806c3fb27SDimitry Andricmulticlass VPatTernaryW_VV_VX_RM<string intrinsic, string instruction, 5729*0fca6ea1SDimitry Andric list<VTypeInfoToWide> vtilist, bit isSEWAware = 1> 5730*0fca6ea1SDimitry Andric : VPatTernaryW_VV_RM<intrinsic, instruction, vtilist, isSEWAware>, 5731*0fca6ea1SDimitry Andric VPatTernaryW_VX_RM<intrinsic, instruction, vtilist, isSEWAware>; 573206c3fb27SDimitry Andric 5733e8d8bef9SDimitry Andricmulticlass VPatBinaryM_VV_VX<string intrinsic, string instruction, 5734e8d8bef9SDimitry Andric list<VTypeInfo> vtilist> 5735fe6060f1SDimitry Andric : VPatBinaryM_VV<intrinsic, instruction, vtilist>, 5736fe6060f1SDimitry Andric VPatBinaryM_VX<intrinsic, instruction, vtilist>; 5737e8d8bef9SDimitry Andric 5738e8d8bef9SDimitry Andricmulticlass VPatBinaryM_VX_VI<string intrinsic, string instruction, 5739e8d8bef9SDimitry Andric list<VTypeInfo> vtilist> 5740fe6060f1SDimitry Andric : VPatBinaryM_VX<intrinsic, instruction, vtilist>, 5741fe6060f1SDimitry Andric VPatBinaryM_VI<intrinsic, instruction, vtilist>; 5742e8d8bef9SDimitry Andric 5743e8d8bef9SDimitry Andricmulticlass VPatBinaryV_VV_VX_VI_INT<string intrinsic, string instruction, 5744*0fca6ea1SDimitry Andric list<VTypeInfo> vtilist, Operand ImmType> 5745fe6060f1SDimitry Andric : VPatBinaryV_VV_INT<intrinsic#"_vv", instruction, vtilist>, 5746fe6060f1SDimitry Andric VPatBinaryV_VX_INT<intrinsic#"_vx", instruction, vtilist>, 5747fe6060f1SDimitry Andric VPatBinaryV_VI<intrinsic#"_vx", instruction, vtilist, ImmType>; 5748e8d8bef9SDimitry Andric 5749e8d8bef9SDimitry Andricmulticlass VPatReductionV_VS<string intrinsic, string instruction, bit IsFloat = 0> { 575006c3fb27SDimitry Andric foreach vti = !if(IsFloat, NoGroupFloatVectors, NoGroupIntegerVectors) in { 5751e8d8bef9SDimitry Andric defvar vectorM1 = !cast<VTypeInfo>(!if(IsFloat, "VF", "VI") # vti.SEW # "M1"); 575206c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 5753*0fca6ea1SDimitry Andric defm : VPatTernaryTU<intrinsic, instruction, "VS", 5754e8d8bef9SDimitry Andric vectorM1.Vector, vti.Vector, 5755e8d8bef9SDimitry Andric vectorM1.Vector, vti.Mask, 5756fe6060f1SDimitry Andric vti.Log2SEW, vti.LMul, 5757e8d8bef9SDimitry Andric VR, vti.RegClass, VR>; 5758e8d8bef9SDimitry Andric } 575906c3fb27SDimitry Andric foreach gvti = !if(IsFloat, GroupFloatVectors, GroupIntegerVectors) in { 576006c3fb27SDimitry Andric let Predicates = GetVTypePredicates<gvti>.Predicates in 5761*0fca6ea1SDimitry Andric defm : VPatTernaryTU<intrinsic, instruction, "VS", 576206c3fb27SDimitry Andric gvti.VectorM1, gvti.Vector, 576306c3fb27SDimitry Andric gvti.VectorM1, gvti.Mask, 576406c3fb27SDimitry Andric gvti.Log2SEW, gvti.LMul, 576506c3fb27SDimitry Andric VR, gvti.RegClass, VR>; 576606c3fb27SDimitry Andric } 576706c3fb27SDimitry Andric} 576806c3fb27SDimitry Andric 576906c3fb27SDimitry Andricmulticlass VPatReductionV_VS_RM<string intrinsic, string instruction, bit IsFloat = 0> { 577006c3fb27SDimitry Andric foreach vti = !if(IsFloat, NoGroupFloatVectors, NoGroupIntegerVectors) in { 577106c3fb27SDimitry Andric defvar vectorM1 = !cast<VTypeInfo>(!if(IsFloat, "VF", "VI") # vti.SEW # "M1"); 577206c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 5773*0fca6ea1SDimitry Andric defm : VPatTernaryTURoundingMode<intrinsic, instruction, "VS", 577406c3fb27SDimitry Andric vectorM1.Vector, vti.Vector, 577506c3fb27SDimitry Andric vectorM1.Vector, vti.Mask, 577606c3fb27SDimitry Andric vti.Log2SEW, vti.LMul, 577706c3fb27SDimitry Andric VR, vti.RegClass, VR>; 577806c3fb27SDimitry Andric } 577906c3fb27SDimitry Andric foreach gvti = !if(IsFloat, GroupFloatVectors, GroupIntegerVectors) in { 578006c3fb27SDimitry Andric let Predicates = GetVTypePredicates<gvti>.Predicates in 5781*0fca6ea1SDimitry Andric defm : VPatTernaryTURoundingMode<intrinsic, instruction, "VS", 5782e8d8bef9SDimitry Andric gvti.VectorM1, gvti.Vector, 5783e8d8bef9SDimitry Andric gvti.VectorM1, gvti.Mask, 5784fe6060f1SDimitry Andric gvti.Log2SEW, gvti.LMul, 5785e8d8bef9SDimitry Andric VR, gvti.RegClass, VR>; 5786e8d8bef9SDimitry Andric } 5787e8d8bef9SDimitry Andric} 5788e8d8bef9SDimitry Andric 5789e8d8bef9SDimitry Andricmulticlass VPatReductionW_VS<string intrinsic, string instruction, bit IsFloat = 0> { 579006c3fb27SDimitry Andric foreach vti = !if(IsFloat, AllFloatVectors, AllIntegerVectors) in { 5791e8d8bef9SDimitry Andric defvar wtiSEW = !mul(vti.SEW, 2); 5792e8d8bef9SDimitry Andric if !le(wtiSEW, 64) then { 5793e8d8bef9SDimitry Andric defvar wtiM1 = !cast<VTypeInfo>(!if(IsFloat, "VF", "VI") # wtiSEW # "M1"); 579406c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 5795*0fca6ea1SDimitry Andric defm : VPatTernaryTU<intrinsic, instruction, "VS", 579606c3fb27SDimitry Andric wtiM1.Vector, vti.Vector, 579706c3fb27SDimitry Andric wtiM1.Vector, vti.Mask, 579806c3fb27SDimitry Andric vti.Log2SEW, vti.LMul, 579906c3fb27SDimitry Andric wtiM1.RegClass, vti.RegClass, 580006c3fb27SDimitry Andric wtiM1.RegClass>; 580106c3fb27SDimitry Andric } 580206c3fb27SDimitry Andric } 580306c3fb27SDimitry Andric} 580406c3fb27SDimitry Andric 580506c3fb27SDimitry Andricmulticlass VPatReductionW_VS_RM<string intrinsic, string instruction, bit IsFloat = 0> { 580606c3fb27SDimitry Andric foreach vti = !if(IsFloat, AllFloatVectors, AllIntegerVectors) in { 580706c3fb27SDimitry Andric defvar wtiSEW = !mul(vti.SEW, 2); 580806c3fb27SDimitry Andric if !le(wtiSEW, 64) then { 580906c3fb27SDimitry Andric defvar wtiM1 = !cast<VTypeInfo>(!if(IsFloat, "VF", "VI") # wtiSEW # "M1"); 581006c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 5811*0fca6ea1SDimitry Andric defm : VPatTernaryTURoundingMode<intrinsic, instruction, "VS", 5812e8d8bef9SDimitry Andric wtiM1.Vector, vti.Vector, 5813e8d8bef9SDimitry Andric wtiM1.Vector, vti.Mask, 5814fe6060f1SDimitry Andric vti.Log2SEW, vti.LMul, 5815e8d8bef9SDimitry Andric wtiM1.RegClass, vti.RegClass, 5816e8d8bef9SDimitry Andric wtiM1.RegClass>; 5817e8d8bef9SDimitry Andric } 5818e8d8bef9SDimitry Andric } 5819e8d8bef9SDimitry Andric} 5820e8d8bef9SDimitry Andric 5821349cc55cSDimitry Andricmulticlass VPatConversionVI_VF<string intrinsic, 582206c3fb27SDimitry Andric string instruction> { 582306c3fb27SDimitry Andric foreach fvti = AllFloatVectors in { 5824349cc55cSDimitry Andric defvar ivti = GetIntVTypeInfo<fvti>.Vti; 582506c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<fvti>.Predicates, 582606c3fb27SDimitry Andric GetVTypePredicates<ivti>.Predicates) in 5827*0fca6ea1SDimitry Andric defm : VPatConversion<intrinsic, instruction, "V", 5828349cc55cSDimitry Andric ivti.Vector, fvti.Vector, ivti.Mask, fvti.Log2SEW, 5829349cc55cSDimitry Andric fvti.LMul, ivti.RegClass, fvti.RegClass>; 5830349cc55cSDimitry Andric } 5831349cc55cSDimitry Andric} 5832349cc55cSDimitry Andric 583306c3fb27SDimitry Andricmulticlass VPatConversionVI_VF_RM<string intrinsic, 583406c3fb27SDimitry Andric string instruction> { 583506c3fb27SDimitry Andric foreach fvti = AllFloatVectors in { 5836e8d8bef9SDimitry Andric defvar ivti = GetIntVTypeInfo<fvti>.Vti; 583706c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<fvti>.Predicates, 583806c3fb27SDimitry Andric GetVTypePredicates<ivti>.Predicates) in 5839*0fca6ea1SDimitry Andric defm : VPatConversionRoundingMode<intrinsic, instruction, "V", 584006c3fb27SDimitry Andric ivti.Vector, fvti.Vector, ivti.Mask, fvti.Log2SEW, 584106c3fb27SDimitry Andric fvti.LMul, ivti.RegClass, fvti.RegClass>; 584206c3fb27SDimitry Andric } 584306c3fb27SDimitry Andric} 5844e8d8bef9SDimitry Andric 5845*0fca6ea1SDimitry Andricmulticlass VPatConversionVI_VF_RTZ<string intrinsic, 584606c3fb27SDimitry Andric string instruction> { 584706c3fb27SDimitry Andric foreach fvti = AllFloatVectors in { 584806c3fb27SDimitry Andric defvar ivti = GetIntVTypeInfo<fvti>.Vti; 584906c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<fvti>.Predicates, 585006c3fb27SDimitry Andric GetVTypePredicates<ivti>.Predicates) in 5851*0fca6ea1SDimitry Andric defm : VPatConversionRTZ<intrinsic, instruction, "V", 5852*0fca6ea1SDimitry Andric ivti.Vector, fvti.Vector, ivti.Mask, fvti.Log2SEW, 5853*0fca6ea1SDimitry Andric fvti.LMul, ivti.RegClass, fvti.RegClass>; 5854*0fca6ea1SDimitry Andric } 5855*0fca6ea1SDimitry Andric} 5856*0fca6ea1SDimitry Andric 5857*0fca6ea1SDimitry Andricmulticlass VPatConversionVF_VI_RM<string intrinsic, string instruction, 5858*0fca6ea1SDimitry Andric bit isSEWAware = 0> { 5859*0fca6ea1SDimitry Andric foreach fvti = AllFloatVectors in { 5860*0fca6ea1SDimitry Andric defvar ivti = GetIntVTypeInfo<fvti>.Vti; 5861*0fca6ea1SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<fvti>.Predicates, 5862*0fca6ea1SDimitry Andric GetVTypePredicates<ivti>.Predicates) in 5863*0fca6ea1SDimitry Andric defm : VPatConversionRoundingMode<intrinsic, instruction, "V", 5864fe6060f1SDimitry Andric fvti.Vector, ivti.Vector, fvti.Mask, ivti.Log2SEW, 5865*0fca6ea1SDimitry Andric ivti.LMul, fvti.RegClass, ivti.RegClass, 5866*0fca6ea1SDimitry Andric isSEWAware>; 5867e8d8bef9SDimitry Andric } 5868e8d8bef9SDimitry Andric} 5869e8d8bef9SDimitry Andric 5870e8d8bef9SDimitry Andricmulticlass VPatConversionWI_VF<string intrinsic, string instruction> { 587106c3fb27SDimitry Andric foreach fvtiToFWti = AllWidenableFloatVectors in { 5872e8d8bef9SDimitry Andric defvar fvti = fvtiToFWti.Vti; 5873e8d8bef9SDimitry Andric defvar iwti = GetIntVTypeInfo<fvtiToFWti.Wti>.Vti; 587406c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<fvti>.Predicates, 587506c3fb27SDimitry Andric GetVTypePredicates<iwti>.Predicates) in 5876*0fca6ea1SDimitry Andric defm : VPatConversion<intrinsic, instruction, "V", 5877fe6060f1SDimitry Andric iwti.Vector, fvti.Vector, iwti.Mask, fvti.Log2SEW, 5878e8d8bef9SDimitry Andric fvti.LMul, iwti.RegClass, fvti.RegClass>; 5879e8d8bef9SDimitry Andric } 5880e8d8bef9SDimitry Andric} 5881e8d8bef9SDimitry Andric 588206c3fb27SDimitry Andricmulticlass VPatConversionWI_VF_RM<string intrinsic, string instruction> { 588306c3fb27SDimitry Andric foreach fvtiToFWti = AllWidenableFloatVectors in { 588406c3fb27SDimitry Andric defvar fvti = fvtiToFWti.Vti; 588506c3fb27SDimitry Andric defvar iwti = GetIntVTypeInfo<fvtiToFWti.Wti>.Vti; 588606c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<fvti>.Predicates, 588706c3fb27SDimitry Andric GetVTypePredicates<iwti>.Predicates) in 5888*0fca6ea1SDimitry Andric defm : VPatConversionRoundingMode<intrinsic, instruction, "V", 588906c3fb27SDimitry Andric iwti.Vector, fvti.Vector, iwti.Mask, fvti.Log2SEW, 589006c3fb27SDimitry Andric fvti.LMul, iwti.RegClass, fvti.RegClass>; 589106c3fb27SDimitry Andric } 589206c3fb27SDimitry Andric} 589306c3fb27SDimitry Andric 5894*0fca6ea1SDimitry Andricmulticlass VPatConversionWI_VF_RTZ<string intrinsic, string instruction> { 5895*0fca6ea1SDimitry Andric foreach fvtiToFWti = AllWidenableFloatVectors in { 5896*0fca6ea1SDimitry Andric defvar fvti = fvtiToFWti.Vti; 5897*0fca6ea1SDimitry Andric defvar iwti = GetIntVTypeInfo<fvtiToFWti.Wti>.Vti; 5898*0fca6ea1SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<fvti>.Predicates, 5899*0fca6ea1SDimitry Andric GetVTypePredicates<iwti>.Predicates) in 5900*0fca6ea1SDimitry Andric defm : VPatConversionRTZ<intrinsic, instruction, "V", 5901*0fca6ea1SDimitry Andric iwti.Vector, fvti.Vector, iwti.Mask, fvti.Log2SEW, 5902*0fca6ea1SDimitry Andric fvti.LMul, iwti.RegClass, fvti.RegClass>; 5903*0fca6ea1SDimitry Andric } 5904*0fca6ea1SDimitry Andric} 5905*0fca6ea1SDimitry Andric 5906*0fca6ea1SDimitry Andricmulticlass VPatConversionWF_VI<string intrinsic, string instruction, 5907*0fca6ea1SDimitry Andric bit isSEWAware = 0> { 590806c3fb27SDimitry Andric foreach vtiToWti = AllWidenableIntToFloatVectors in { 5909e8d8bef9SDimitry Andric defvar vti = vtiToWti.Vti; 5910e8d8bef9SDimitry Andric defvar fwti = vtiToWti.Wti; 591106c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<vti>.Predicates, 591206c3fb27SDimitry Andric GetVTypePredicates<fwti>.Predicates) in 5913*0fca6ea1SDimitry Andric defm : VPatConversion<intrinsic, instruction, "V", 5914fe6060f1SDimitry Andric fwti.Vector, vti.Vector, fwti.Mask, vti.Log2SEW, 5915*0fca6ea1SDimitry Andric vti.LMul, fwti.RegClass, vti.RegClass, isSEWAware>; 5916e8d8bef9SDimitry Andric } 5917e8d8bef9SDimitry Andric} 5918e8d8bef9SDimitry Andric 5919*0fca6ea1SDimitry Andricmulticlass VPatConversionWF_VF<string intrinsic, string instruction, 5920*0fca6ea1SDimitry Andric bit isSEWAware = 0> { 592106c3fb27SDimitry Andric foreach fvtiToFWti = AllWidenableFloatVectors in { 5922e8d8bef9SDimitry Andric defvar fvti = fvtiToFWti.Vti; 5923e8d8bef9SDimitry Andric defvar fwti = fvtiToFWti.Wti; 59245f757f3fSDimitry Andric // Define vfwcvt.f.f.v for f16 when Zvfhmin is enable. 59255f757f3fSDimitry Andric let Predicates = !if(!eq(fvti.Scalar, f16), [HasVInstructionsF16Minimal], 59265f757f3fSDimitry Andric !listconcat(GetVTypePredicates<fvti>.Predicates, 59275f757f3fSDimitry Andric GetVTypePredicates<fwti>.Predicates)) in 5928*0fca6ea1SDimitry Andric defm : VPatConversion<intrinsic, instruction, "V", 59295f757f3fSDimitry Andric fwti.Vector, fvti.Vector, fwti.Mask, fvti.Log2SEW, 5930*0fca6ea1SDimitry Andric fvti.LMul, fwti.RegClass, fvti.RegClass, isSEWAware>; 59315f757f3fSDimitry Andric } 59325f757f3fSDimitry Andric} 59335f757f3fSDimitry Andric 5934*0fca6ea1SDimitry Andricmulticlass VPatConversionWF_VF_BF<string intrinsic, string instruction, 5935*0fca6ea1SDimitry Andric bit isSEWAware = 0> { 59365f757f3fSDimitry Andric foreach fvtiToFWti = AllWidenableBFloatToFloatVectors in 59375f757f3fSDimitry Andric { 59385f757f3fSDimitry Andric defvar fvti = fvtiToFWti.Vti; 59395f757f3fSDimitry Andric defvar fwti = fvtiToFWti.Wti; 594006c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<fvti>.Predicates, 594106c3fb27SDimitry Andric GetVTypePredicates<fwti>.Predicates) in 5942*0fca6ea1SDimitry Andric defm : VPatConversion<intrinsic, instruction, "V", 5943fe6060f1SDimitry Andric fwti.Vector, fvti.Vector, fwti.Mask, fvti.Log2SEW, 5944*0fca6ea1SDimitry Andric fvti.LMul, fwti.RegClass, fvti.RegClass, isSEWAware>; 5945e8d8bef9SDimitry Andric } 5946e8d8bef9SDimitry Andric} 5947e8d8bef9SDimitry Andric 5948e8d8bef9SDimitry Andricmulticlass VPatConversionVI_WF<string intrinsic, string instruction> { 594906c3fb27SDimitry Andric foreach vtiToWti = AllWidenableIntToFloatVectors in { 5950e8d8bef9SDimitry Andric defvar vti = vtiToWti.Vti; 5951e8d8bef9SDimitry Andric defvar fwti = vtiToWti.Wti; 595206c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<vti>.Predicates, 595306c3fb27SDimitry Andric GetVTypePredicates<fwti>.Predicates) in 5954*0fca6ea1SDimitry Andric defm : VPatConversion<intrinsic, instruction, "W", 5955fe6060f1SDimitry Andric vti.Vector, fwti.Vector, vti.Mask, vti.Log2SEW, 5956e8d8bef9SDimitry Andric vti.LMul, vti.RegClass, fwti.RegClass>; 5957e8d8bef9SDimitry Andric } 5958e8d8bef9SDimitry Andric} 5959e8d8bef9SDimitry Andric 596006c3fb27SDimitry Andricmulticlass VPatConversionVI_WF_RM <string intrinsic, string instruction> { 596106c3fb27SDimitry Andric foreach vtiToWti = AllWidenableIntToFloatVectors in { 596206c3fb27SDimitry Andric defvar vti = vtiToWti.Vti; 596306c3fb27SDimitry Andric defvar fwti = vtiToWti.Wti; 596406c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<vti>.Predicates, 596506c3fb27SDimitry Andric GetVTypePredicates<fwti>.Predicates) in 5966*0fca6ea1SDimitry Andric defm : VPatConversionRoundingMode<intrinsic, instruction, "W", 596706c3fb27SDimitry Andric vti.Vector, fwti.Vector, vti.Mask, vti.Log2SEW, 596806c3fb27SDimitry Andric vti.LMul, vti.RegClass, fwti.RegClass>; 596906c3fb27SDimitry Andric } 597006c3fb27SDimitry Andric} 597106c3fb27SDimitry Andric 5972*0fca6ea1SDimitry Andricmulticlass VPatConversionVI_WF_RTZ <string intrinsic, string instruction> { 5973*0fca6ea1SDimitry Andric foreach vtiToWti = AllWidenableIntToFloatVectors in { 5974*0fca6ea1SDimitry Andric defvar vti = vtiToWti.Vti; 5975*0fca6ea1SDimitry Andric defvar fwti = vtiToWti.Wti; 5976*0fca6ea1SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<vti>.Predicates, 5977*0fca6ea1SDimitry Andric GetVTypePredicates<fwti>.Predicates) in 5978*0fca6ea1SDimitry Andric defm : VPatConversionRTZ<intrinsic, instruction, "W", 5979*0fca6ea1SDimitry Andric vti.Vector, fwti.Vector, vti.Mask, vti.Log2SEW, 5980*0fca6ea1SDimitry Andric vti.LMul, vti.RegClass, fwti.RegClass>; 5981*0fca6ea1SDimitry Andric } 5982*0fca6ea1SDimitry Andric} 5983*0fca6ea1SDimitry Andric 5984*0fca6ea1SDimitry Andricmulticlass VPatConversionVF_WI_RM <string intrinsic, string instruction, 5985*0fca6ea1SDimitry Andric bit isSEWAware = 0> { 598606c3fb27SDimitry Andric foreach fvtiToFWti = AllWidenableFloatVectors in { 5987e8d8bef9SDimitry Andric defvar fvti = fvtiToFWti.Vti; 5988e8d8bef9SDimitry Andric defvar iwti = GetIntVTypeInfo<fvtiToFWti.Wti>.Vti; 598906c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<fvti>.Predicates, 599006c3fb27SDimitry Andric GetVTypePredicates<iwti>.Predicates) in 5991*0fca6ea1SDimitry Andric defm : VPatConversionRoundingMode<intrinsic, instruction, "W", 5992fe6060f1SDimitry Andric fvti.Vector, iwti.Vector, fvti.Mask, fvti.Log2SEW, 5993*0fca6ea1SDimitry Andric fvti.LMul, fvti.RegClass, iwti.RegClass, 5994*0fca6ea1SDimitry Andric isSEWAware>; 5995e8d8bef9SDimitry Andric } 5996e8d8bef9SDimitry Andric} 5997e8d8bef9SDimitry Andric 5998*0fca6ea1SDimitry Andricmulticlass VPatConversionVF_WF<string intrinsic, string instruction, 5999*0fca6ea1SDimitry Andric bit isSEWAware = 0> { 600006c3fb27SDimitry Andric foreach fvtiToFWti = AllWidenableFloatVectors in { 6001e8d8bef9SDimitry Andric defvar fvti = fvtiToFWti.Vti; 6002e8d8bef9SDimitry Andric defvar fwti = fvtiToFWti.Wti; 600306c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<fvti>.Predicates, 600406c3fb27SDimitry Andric GetVTypePredicates<fwti>.Predicates) in 6005*0fca6ea1SDimitry Andric defm : VPatConversion<intrinsic, instruction, "W", 6006fe6060f1SDimitry Andric fvti.Vector, fwti.Vector, fvti.Mask, fvti.Log2SEW, 6007*0fca6ea1SDimitry Andric fvti.LMul, fvti.RegClass, fwti.RegClass, isSEWAware>; 6008e8d8bef9SDimitry Andric } 6009e8d8bef9SDimitry Andric} 6010e8d8bef9SDimitry Andric 60115f757f3fSDimitry Andricmulticlass VPatConversionVF_WF_RM<string intrinsic, string instruction, 6012*0fca6ea1SDimitry Andric list<VTypeInfoToWide> wlist = AllWidenableFloatVectors, 6013*0fca6ea1SDimitry Andric bit isSEWAware = 0> { 60145f757f3fSDimitry Andric foreach fvtiToFWti = wlist in { 60155f757f3fSDimitry Andric defvar fvti = fvtiToFWti.Vti; 60165f757f3fSDimitry Andric defvar fwti = fvtiToFWti.Wti; 60175f757f3fSDimitry Andric let Predicates = !listconcat(GetVTypePredicates<fvti>.Predicates, 60185f757f3fSDimitry Andric GetVTypePredicates<fwti>.Predicates) in 6019*0fca6ea1SDimitry Andric defm : VPatConversionRoundingMode<intrinsic, instruction, "W", 60205f757f3fSDimitry Andric fvti.Vector, fwti.Vector, fvti.Mask, fvti.Log2SEW, 6021*0fca6ea1SDimitry Andric fvti.LMul, fvti.RegClass, fwti.RegClass, 6022*0fca6ea1SDimitry Andric isSEWAware>; 60235f757f3fSDimitry Andric } 60245f757f3fSDimitry Andric} 60255f757f3fSDimitry Andric 6026*0fca6ea1SDimitry Andricmulticlass VPatConversionVF_WF_RTZ<string intrinsic, string instruction, 6027*0fca6ea1SDimitry Andric list<VTypeInfoToWide> wlist = AllWidenableFloatVectors, 6028*0fca6ea1SDimitry Andric bit isSEWAware = 0> { 6029*0fca6ea1SDimitry Andric foreach fvtiToFWti = wlist in { 6030*0fca6ea1SDimitry Andric defvar fvti = fvtiToFWti.Vti; 6031*0fca6ea1SDimitry Andric defvar fwti = fvtiToFWti.Wti; 6032*0fca6ea1SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<fvti>.Predicates, 6033*0fca6ea1SDimitry Andric GetVTypePredicates<fwti>.Predicates) in 6034*0fca6ea1SDimitry Andric defm : VPatConversionRTZ<intrinsic, instruction, "W", 6035*0fca6ea1SDimitry Andric fvti.Vector, fwti.Vector, fvti.Mask, fvti.Log2SEW, 6036*0fca6ea1SDimitry Andric fvti.LMul, fvti.RegClass, fwti.RegClass, isSEWAware>; 6037*0fca6ea1SDimitry Andric } 6038*0fca6ea1SDimitry Andric} 6039*0fca6ea1SDimitry Andric 6040*0fca6ea1SDimitry Andricmulticlass VPatConversionVF_WF_BF_RM<string intrinsic, string instruction, 6041*0fca6ea1SDimitry Andric bit isSEWAware = 0> { 60425f757f3fSDimitry Andric foreach fvtiToFWti = AllWidenableBFloatToFloatVectors in { 604306c3fb27SDimitry Andric defvar fvti = fvtiToFWti.Vti; 604406c3fb27SDimitry Andric defvar fwti = fvtiToFWti.Wti; 604506c3fb27SDimitry Andric let Predicates = !listconcat(GetVTypePredicates<fvti>.Predicates, 604606c3fb27SDimitry Andric GetVTypePredicates<fwti>.Predicates) in 6047*0fca6ea1SDimitry Andric defm : VPatConversionRoundingMode<intrinsic, instruction, "W", 604806c3fb27SDimitry Andric fvti.Vector, fwti.Vector, fvti.Mask, fvti.Log2SEW, 6049*0fca6ea1SDimitry Andric fvti.LMul, fvti.RegClass, fwti.RegClass, 6050*0fca6ea1SDimitry Andric isSEWAware>; 605106c3fb27SDimitry Andric } 605206c3fb27SDimitry Andric} 605306c3fb27SDimitry Andric 605404eeddc0SDimitry Andricmulticlass VPatCompare_VI<string intrinsic, string inst, 60551fd87a68SDimitry Andric ImmLeaf ImmType> { 605604eeddc0SDimitry Andric foreach vti = AllIntegerVectors in { 605704eeddc0SDimitry Andric defvar Intr = !cast<Intrinsic>(intrinsic); 605804eeddc0SDimitry Andric defvar Pseudo = !cast<Instruction>(inst#"_VI_"#vti.LMul.MX); 605906c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 606004eeddc0SDimitry Andric def : Pat<(vti.Mask (Intr (vti.Vector vti.RegClass:$rs1), 606104eeddc0SDimitry Andric (vti.Scalar ImmType:$rs2), 606204eeddc0SDimitry Andric VLOpFrag)), 606304eeddc0SDimitry Andric (Pseudo vti.RegClass:$rs1, (DecImm ImmType:$rs2), 606404eeddc0SDimitry Andric GPR:$vl, vti.Log2SEW)>; 606504eeddc0SDimitry Andric defvar IntrMask = !cast<Intrinsic>(intrinsic # "_mask"); 606604eeddc0SDimitry Andric defvar PseudoMask = !cast<Instruction>(inst#"_VI_"#vti.LMul.MX#"_MASK"); 606706c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 606804eeddc0SDimitry Andric def : Pat<(vti.Mask (IntrMask (vti.Mask VR:$merge), 606904eeddc0SDimitry Andric (vti.Vector vti.RegClass:$rs1), 607004eeddc0SDimitry Andric (vti.Scalar ImmType:$rs2), 607104eeddc0SDimitry Andric (vti.Mask V0), 607204eeddc0SDimitry Andric VLOpFrag)), 607304eeddc0SDimitry Andric (PseudoMask VR:$merge, vti.RegClass:$rs1, (DecImm ImmType:$rs2), 607404eeddc0SDimitry Andric (vti.Mask V0), GPR:$vl, vti.Log2SEW)>; 607504eeddc0SDimitry Andric } 607604eeddc0SDimitry Andric} 607704eeddc0SDimitry Andric 6078e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6079e8d8bef9SDimitry Andric// Pseudo instructions 6080e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6081e8d8bef9SDimitry Andric 6082349cc55cSDimitry Andriclet Predicates = [HasVInstructions] in { 6083e8d8bef9SDimitry Andric 6084e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6085e8d8bef9SDimitry Andric// Pseudo Instructions for CodeGen 6086e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6087e8d8bef9SDimitry Andric 6088e8d8bef9SDimitry Andriclet hasSideEffects = 0, mayLoad = 0, mayStore = 0, isCodeGenOnly = 1 in { 6089e8d8bef9SDimitry Andric def PseudoReadVLENB : Pseudo<(outs GPR:$rd), (ins), 6090bdd1243dSDimitry Andric [(set GPR:$rd, (riscv_read_vlenb))]>, 609106c3fb27SDimitry Andric PseudoInstExpansion<(CSRRS GPR:$rd, SysRegVLENB.Encoding, X0)>, 6092bdd1243dSDimitry Andric Sched<[WriteRdVLENB]>; 6093e8d8bef9SDimitry Andric} 6094e8d8bef9SDimitry Andric 6095e8d8bef9SDimitry Andriclet hasSideEffects = 0, mayLoad = 0, mayStore = 0, isCodeGenOnly = 1, 6096e8d8bef9SDimitry Andric Uses = [VL] in 609706c3fb27SDimitry Andricdef PseudoReadVL : Pseudo<(outs GPR:$rd), (ins), []>, 609806c3fb27SDimitry Andric PseudoInstExpansion<(CSRRS GPR:$rd, SysRegVL.Encoding, X0)>; 6099fe6060f1SDimitry Andric 610004eeddc0SDimitry Andricforeach lmul = MxList in { 6101fe6060f1SDimitry Andric foreach nf = NFSet<lmul>.L in { 6102fe6060f1SDimitry Andric defvar vreg = SegRegClass<lmul, nf>.RC; 61031fd87a68SDimitry Andric let hasSideEffects = 0, mayLoad = 0, mayStore = 1, isCodeGenOnly = 1, 61041fd87a68SDimitry Andric Size = !mul(4, !sub(!mul(nf, 2), 1)) in { 6105fe6060f1SDimitry Andric def "PseudoVSPILL" # nf # "_" # lmul.MX : 6106bdd1243dSDimitry Andric Pseudo<(outs), (ins vreg:$rs1, GPR:$rs2), []>; 6107fe6060f1SDimitry Andric } 61081fd87a68SDimitry Andric let hasSideEffects = 0, mayLoad = 1, mayStore = 0, isCodeGenOnly = 1, 61091fd87a68SDimitry Andric Size = !mul(4, !sub(!mul(nf, 2), 1)) in { 6110fe6060f1SDimitry Andric def "PseudoVRELOAD" # nf # "_" # lmul.MX : 6111bdd1243dSDimitry Andric Pseudo<(outs vreg:$rs1), (ins GPR:$rs2), []>; 6112fe6060f1SDimitry Andric } 6113fe6060f1SDimitry Andric } 6114fe6060f1SDimitry Andric} 6115e8d8bef9SDimitry Andric 611606c3fb27SDimitry Andric/// Empty pseudo for RISCVInitUndefPass 611706c3fb27SDimitry Andriclet hasSideEffects = 0, mayLoad = 0, mayStore = 0, Size = 0, 611806c3fb27SDimitry Andric isCodeGenOnly = 1 in { 611906c3fb27SDimitry Andric def PseudoRVVInitUndefM1 : Pseudo<(outs VR:$vd), (ins), [], "">; 612006c3fb27SDimitry Andric def PseudoRVVInitUndefM2 : Pseudo<(outs VRM2:$vd), (ins), [], "">; 612106c3fb27SDimitry Andric def PseudoRVVInitUndefM4 : Pseudo<(outs VRM4:$vd), (ins), [], "">; 612206c3fb27SDimitry Andric def PseudoRVVInitUndefM8 : Pseudo<(outs VRM8:$vd), (ins), [], "">; 612306c3fb27SDimitry Andric} 612406c3fb27SDimitry Andric 6125e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6126e8d8bef9SDimitry Andric// 6. Configuration-Setting Instructions 6127e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6128e8d8bef9SDimitry Andric 6129e8d8bef9SDimitry Andric// Pseudos. 6130*0fca6ea1SDimitry Andriclet hasSideEffects = 0, mayLoad = 0, mayStore = 0, Defs = [VL, VTYPE] in { 6131349cc55cSDimitry Andric// Due to rs1=X0 having special meaning, we need a GPRNoX0 register class for 6132349cc55cSDimitry Andric// the when we aren't using one of the special X0 encodings. Otherwise it could 6133349cc55cSDimitry Andric// be accidentally be made X0 by MachineIR optimizations. To satisfy the 6134349cc55cSDimitry Andric// verifier, we also need a GPRX0 instruction for the special encodings. 6135bdd1243dSDimitry Andricdef PseudoVSETVLI : Pseudo<(outs GPR:$rd), (ins GPRNoX0:$rs1, VTypeIOp11:$vtypei), []>, 6136bdd1243dSDimitry Andric Sched<[WriteVSETVLI, ReadVSETVLI]>; 6137bdd1243dSDimitry Andricdef PseudoVSETVLIX0 : Pseudo<(outs GPR:$rd), (ins GPRX0:$rs1, VTypeIOp11:$vtypei), []>, 6138bdd1243dSDimitry Andric Sched<[WriteVSETVLI, ReadVSETVLI]>; 6139bdd1243dSDimitry Andricdef PseudoVSETIVLI : Pseudo<(outs GPR:$rd), (ins uimm5:$rs1, VTypeIOp10:$vtypei), []>, 6140bdd1243dSDimitry Andric Sched<[WriteVSETIVLI]>; 6141e8d8bef9SDimitry Andric} 6142e8d8bef9SDimitry Andric 6143e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6144e8d8bef9SDimitry Andric// 7. Vector Loads and Stores 6145e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6146e8d8bef9SDimitry Andric 6147e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6148e8d8bef9SDimitry Andric// 7.4 Vector Unit-Stride Instructions 6149e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6150e8d8bef9SDimitry Andric 6151e8d8bef9SDimitry Andric// Pseudos Unit-Stride Loads and Stores 61520eae32dcSDimitry Andricdefm PseudoVL : VPseudoUSLoad; 6153fe6060f1SDimitry Andricdefm PseudoVS : VPseudoUSStore; 6154e8d8bef9SDimitry Andric 6155bdd1243dSDimitry Andricdefm PseudoVLM : VPseudoLoadMask; 6156bdd1243dSDimitry Andricdefm PseudoVSM : VPseudoStoreMask; 6157d409305fSDimitry Andric 6158e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6159e8d8bef9SDimitry Andric// 7.5 Vector Strided Instructions 6160e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6161e8d8bef9SDimitry Andric 6162e8d8bef9SDimitry Andric// Vector Strided Loads and Stores 6163fe6060f1SDimitry Andricdefm PseudoVLS : VPseudoSLoad; 6164fe6060f1SDimitry Andricdefm PseudoVSS : VPseudoSStore; 6165e8d8bef9SDimitry Andric 6166e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6167e8d8bef9SDimitry Andric// 7.6 Vector Indexed Instructions 6168e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6169e8d8bef9SDimitry Andric 6170e8d8bef9SDimitry Andric// Vector Indexed Loads and Stores 617106c3fb27SDimitry Andricdefm PseudoVLUX : VPseudoILoad<Ordered=false>; 617206c3fb27SDimitry Andricdefm PseudoVLOX : VPseudoILoad<Ordered=true>; 617306c3fb27SDimitry Andricdefm PseudoVSOX : VPseudoIStore<Ordered=true>; 617406c3fb27SDimitry Andricdefm PseudoVSUX : VPseudoIStore<Ordered=false>; 6175e8d8bef9SDimitry Andric 6176e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6177e8d8bef9SDimitry Andric// 7.7. Unit-stride Fault-Only-First Loads 6178e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6179e8d8bef9SDimitry Andric 6180e8d8bef9SDimitry Andric// vleff may update VL register 6181*0fca6ea1SDimitry Andriclet Defs = [VL] in 61820eae32dcSDimitry Andricdefm PseudoVL : VPseudoFFLoad; 6183e8d8bef9SDimitry Andric 6184e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6185e8d8bef9SDimitry Andric// 7.8. Vector Load/Store Segment Instructions 6186e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 618781ad6265SDimitry Andricdefm PseudoVLSEG : VPseudoUSSegLoad; 6188e8d8bef9SDimitry Andricdefm PseudoVLSSEG : VPseudoSSegLoad; 618906c3fb27SDimitry Andricdefm PseudoVLOXSEG : VPseudoISegLoad<Ordered=true>; 619006c3fb27SDimitry Andricdefm PseudoVLUXSEG : VPseudoISegLoad<Ordered=false>; 6191e8d8bef9SDimitry Andricdefm PseudoVSSEG : VPseudoUSSegStore; 6192e8d8bef9SDimitry Andricdefm PseudoVSSSEG : VPseudoSSegStore; 619306c3fb27SDimitry Andricdefm PseudoVSOXSEG : VPseudoISegStore<Ordered=true>; 619406c3fb27SDimitry Andricdefm PseudoVSUXSEG : VPseudoISegStore<Ordered=false>; 6195e8d8bef9SDimitry Andric 6196e8d8bef9SDimitry Andric// vlseg<nf>e<eew>ff.v may update VL register 6197*0fca6ea1SDimitry Andriclet Defs = [VL] in { 619881ad6265SDimitry Andricdefm PseudoVLSEG : VPseudoUSSegLoadFF; 619981ad6265SDimitry Andric} 6200e8d8bef9SDimitry Andric 6201e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6202bdd1243dSDimitry Andric// 11. Vector Integer Arithmetic Instructions 6203e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6204e8d8bef9SDimitry Andric 6205e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6206bdd1243dSDimitry Andric// 11.1. Vector Single-Width Integer Add and Subtract 6207e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6208*0fca6ea1SDimitry Andricdefm PseudoVADD : VPseudoVALU_VV_VX_VI<Commutable=1>; 62090eae32dcSDimitry Andricdefm PseudoVSUB : VPseudoVALU_VV_VX; 62100eae32dcSDimitry Andricdefm PseudoVRSUB : VPseudoVALU_VX_VI; 6211e8d8bef9SDimitry Andric 6212fe6060f1SDimitry Andricforeach vti = AllIntegerVectors in { 6213fe6060f1SDimitry Andric // Match vrsub with 2 vector operands to vsub.vv by swapping operands. This 6214fe6060f1SDimitry Andric // Occurs when legalizing vrsub.vx intrinsics for i64 on RV32 since we need 6215fe6060f1SDimitry Andric // to use a more complex splat sequence. Add the pattern for all VTs for 6216fe6060f1SDimitry Andric // consistency. 621706c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in { 621881ad6265SDimitry Andric def : Pat<(vti.Vector (int_riscv_vrsub (vti.Vector vti.RegClass:$merge), 621981ad6265SDimitry Andric (vti.Vector vti.RegClass:$rs2), 622081ad6265SDimitry Andric (vti.Vector vti.RegClass:$rs1), 622181ad6265SDimitry Andric VLOpFrag)), 622206c3fb27SDimitry Andric (!cast<Instruction>("PseudoVSUB_VV_"#vti.LMul.MX) 622381ad6265SDimitry Andric vti.RegClass:$merge, 622481ad6265SDimitry Andric vti.RegClass:$rs1, 622581ad6265SDimitry Andric vti.RegClass:$rs2, 622681ad6265SDimitry Andric GPR:$vl, 622706c3fb27SDimitry Andric vti.Log2SEW, TU_MU)>; 6228fe6060f1SDimitry Andric def : Pat<(vti.Vector (int_riscv_vrsub_mask (vti.Vector vti.RegClass:$merge), 6229fe6060f1SDimitry Andric (vti.Vector vti.RegClass:$rs2), 6230fe6060f1SDimitry Andric (vti.Vector vti.RegClass:$rs1), 6231fe6060f1SDimitry Andric (vti.Mask V0), 6232349cc55cSDimitry Andric VLOpFrag, 6233349cc55cSDimitry Andric (XLenVT timm:$policy))), 6234fe6060f1SDimitry Andric (!cast<Instruction>("PseudoVSUB_VV_"#vti.LMul.MX#"_MASK") 6235fe6060f1SDimitry Andric vti.RegClass:$merge, 6236fe6060f1SDimitry Andric vti.RegClass:$rs1, 6237fe6060f1SDimitry Andric vti.RegClass:$rs2, 6238fe6060f1SDimitry Andric (vti.Mask V0), 6239fe6060f1SDimitry Andric GPR:$vl, 6240349cc55cSDimitry Andric vti.Log2SEW, 6241349cc55cSDimitry Andric (XLenVT timm:$policy))>; 6242fe6060f1SDimitry Andric 6243fe6060f1SDimitry Andric // Match VSUB with a small immediate to vadd.vi by negating the immediate. 6244*0fca6ea1SDimitry Andric def : Pat<(vti.Vector (int_riscv_vsub (vti.Vector vti.RegClass:$merge), 624581ad6265SDimitry Andric (vti.Vector vti.RegClass:$rs1), 6246fe6060f1SDimitry Andric (vti.Scalar simm5_plus1:$rs2), 6247fe6060f1SDimitry Andric VLOpFrag)), 6248*0fca6ea1SDimitry Andric (!cast<Instruction>("PseudoVADD_VI_"#vti.LMul.MX) 6249*0fca6ea1SDimitry Andric vti.RegClass:$merge, 625006c3fb27SDimitry Andric vti.RegClass:$rs1, 6251fe6060f1SDimitry Andric (NegImm simm5_plus1:$rs2), 6252fe6060f1SDimitry Andric GPR:$vl, 6253*0fca6ea1SDimitry Andric vti.Log2SEW, TU_MU)>; 6254fe6060f1SDimitry Andric def : Pat<(vti.Vector (int_riscv_vsub_mask (vti.Vector vti.RegClass:$merge), 6255fe6060f1SDimitry Andric (vti.Vector vti.RegClass:$rs1), 6256fe6060f1SDimitry Andric (vti.Scalar simm5_plus1:$rs2), 6257fe6060f1SDimitry Andric (vti.Mask V0), 6258349cc55cSDimitry Andric VLOpFrag, 6259349cc55cSDimitry Andric (XLenVT timm:$policy))), 6260fe6060f1SDimitry Andric (!cast<Instruction>("PseudoVADD_VI_"#vti.LMul.MX#"_MASK") 6261fe6060f1SDimitry Andric vti.RegClass:$merge, 6262fe6060f1SDimitry Andric vti.RegClass:$rs1, 6263fe6060f1SDimitry Andric (NegImm simm5_plus1:$rs2), 6264fe6060f1SDimitry Andric (vti.Mask V0), 6265fe6060f1SDimitry Andric GPR:$vl, 6266349cc55cSDimitry Andric vti.Log2SEW, 6267349cc55cSDimitry Andric (XLenVT timm:$policy))>; 6268fe6060f1SDimitry Andric } 626906c3fb27SDimitry Andric} 6270fe6060f1SDimitry Andric 6271e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6272bdd1243dSDimitry Andric// 11.2. Vector Widening Integer Add/Subtract 6273e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6274*0fca6ea1SDimitry Andricdefm PseudoVWADDU : VPseudoVWALU_VV_VX<Commutable=1>; 62750eae32dcSDimitry Andricdefm PseudoVWSUBU : VPseudoVWALU_VV_VX; 6276*0fca6ea1SDimitry Andricdefm PseudoVWADD : VPseudoVWALU_VV_VX<Commutable=1>; 62770eae32dcSDimitry Andricdefm PseudoVWSUB : VPseudoVWALU_VV_VX; 62780eae32dcSDimitry Andricdefm PseudoVWADDU : VPseudoVWALU_WV_WX; 62790eae32dcSDimitry Andricdefm PseudoVWSUBU : VPseudoVWALU_WV_WX; 62800eae32dcSDimitry Andricdefm PseudoVWADD : VPseudoVWALU_WV_WX; 62810eae32dcSDimitry Andricdefm PseudoVWSUB : VPseudoVWALU_WV_WX; 6282e8d8bef9SDimitry Andric 6283e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6284bdd1243dSDimitry Andric// 11.3. Vector Integer Extension 6285e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 62860eae32dcSDimitry Andricdefm PseudoVZEXT_VF2 : PseudoVEXT_VF2; 62870eae32dcSDimitry Andricdefm PseudoVZEXT_VF4 : PseudoVEXT_VF4; 62880eae32dcSDimitry Andricdefm PseudoVZEXT_VF8 : PseudoVEXT_VF8; 62890eae32dcSDimitry Andricdefm PseudoVSEXT_VF2 : PseudoVEXT_VF2; 62900eae32dcSDimitry Andricdefm PseudoVSEXT_VF4 : PseudoVEXT_VF4; 62910eae32dcSDimitry Andricdefm PseudoVSEXT_VF8 : PseudoVEXT_VF8; 6292e8d8bef9SDimitry Andric 6293e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6294bdd1243dSDimitry Andric// 11.4. Vector Integer Add-with-Carry / Subtract-with-Borrow Instructions 6295e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 62960eae32dcSDimitry Andricdefm PseudoVADC : VPseudoVCALU_VM_XM_IM; 6297*0fca6ea1SDimitry Andricdefm PseudoVMADC : VPseudoVCALUM_VM_XM_IM; 6298*0fca6ea1SDimitry Andricdefm PseudoVMADC : VPseudoVCALUM_V_X_I; 6299e8d8bef9SDimitry Andric 63000eae32dcSDimitry Andricdefm PseudoVSBC : VPseudoVCALU_VM_XM; 6301*0fca6ea1SDimitry Andricdefm PseudoVMSBC : VPseudoVCALUM_VM_XM; 6302*0fca6ea1SDimitry Andricdefm PseudoVMSBC : VPseudoVCALUM_V_X; 6303e8d8bef9SDimitry Andric 6304e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6305bdd1243dSDimitry Andric// 11.5. Vector Bitwise Logical Instructions 6306e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6307*0fca6ea1SDimitry Andricdefm PseudoVAND : VPseudoVALU_VV_VX_VI<Commutable=1>; 6308*0fca6ea1SDimitry Andricdefm PseudoVOR : VPseudoVALU_VV_VX_VI<Commutable=1>; 6309*0fca6ea1SDimitry Andricdefm PseudoVXOR : VPseudoVALU_VV_VX_VI<Commutable=1>; 6310e8d8bef9SDimitry Andric 6311e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6312bdd1243dSDimitry Andric// 11.6. Vector Single-Width Bit Shift Instructions 6313e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6314*0fca6ea1SDimitry Andricdefm PseudoVSLL : VPseudoVSHT_VV_VX_VI; 6315*0fca6ea1SDimitry Andricdefm PseudoVSRL : VPseudoVSHT_VV_VX_VI; 6316*0fca6ea1SDimitry Andricdefm PseudoVSRA : VPseudoVSHT_VV_VX_VI; 6317e8d8bef9SDimitry Andric 6318e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6319bdd1243dSDimitry Andric// 11.7. Vector Narrowing Integer Right Shift Instructions 6320e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 63210eae32dcSDimitry Andricdefm PseudoVNSRL : VPseudoVNSHT_WV_WX_WI; 63220eae32dcSDimitry Andricdefm PseudoVNSRA : VPseudoVNSHT_WV_WX_WI; 6323e8d8bef9SDimitry Andric 6324e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6325bdd1243dSDimitry Andric// 11.8. Vector Integer Comparison Instructions 6326e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6327*0fca6ea1SDimitry Andricdefm PseudoVMSEQ : VPseudoVCMPM_VV_VX_VI<Commutable=1>; 6328*0fca6ea1SDimitry Andricdefm PseudoVMSNE : VPseudoVCMPM_VV_VX_VI<Commutable=1>; 63290eae32dcSDimitry Andricdefm PseudoVMSLTU : VPseudoVCMPM_VV_VX; 63300eae32dcSDimitry Andricdefm PseudoVMSLT : VPseudoVCMPM_VV_VX; 63310eae32dcSDimitry Andricdefm PseudoVMSLEU : VPseudoVCMPM_VV_VX_VI; 63320eae32dcSDimitry Andricdefm PseudoVMSLE : VPseudoVCMPM_VV_VX_VI; 63330eae32dcSDimitry Andricdefm PseudoVMSGTU : VPseudoVCMPM_VX_VI; 63340eae32dcSDimitry Andricdefm PseudoVMSGT : VPseudoVCMPM_VX_VI; 6335e8d8bef9SDimitry Andric 6336e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6337bdd1243dSDimitry Andric// 11.9. Vector Integer Min/Max Instructions 6338e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 63390eae32dcSDimitry Andricdefm PseudoVMINU : VPseudoVMINMAX_VV_VX; 63400eae32dcSDimitry Andricdefm PseudoVMIN : VPseudoVMINMAX_VV_VX; 63410eae32dcSDimitry Andricdefm PseudoVMAXU : VPseudoVMINMAX_VV_VX; 63420eae32dcSDimitry Andricdefm PseudoVMAX : VPseudoVMINMAX_VV_VX; 6343e8d8bef9SDimitry Andric 6344e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6345bdd1243dSDimitry Andric// 11.10. Vector Single-Width Integer Multiply Instructions 6346e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6347*0fca6ea1SDimitry Andricdefm PseudoVMUL : VPseudoVMUL_VV_VX<Commutable=1>; 6348*0fca6ea1SDimitry Andricdefm PseudoVMULH : VPseudoVMUL_VV_VX<Commutable=1>; 6349*0fca6ea1SDimitry Andricdefm PseudoVMULHU : VPseudoVMUL_VV_VX<Commutable=1>; 63500eae32dcSDimitry Andricdefm PseudoVMULHSU : VPseudoVMUL_VV_VX; 6351e8d8bef9SDimitry Andric 6352e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6353bdd1243dSDimitry Andric// 11.11. Vector Integer Divide Instructions 6354e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 63550eae32dcSDimitry Andricdefm PseudoVDIVU : VPseudoVDIV_VV_VX; 63560eae32dcSDimitry Andricdefm PseudoVDIV : VPseudoVDIV_VV_VX; 63570eae32dcSDimitry Andricdefm PseudoVREMU : VPseudoVDIV_VV_VX; 63580eae32dcSDimitry Andricdefm PseudoVREM : VPseudoVDIV_VV_VX; 6359e8d8bef9SDimitry Andric 6360e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6361bdd1243dSDimitry Andric// 11.12. Vector Widening Integer Multiply Instructions 6362e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6363*0fca6ea1SDimitry Andricdefm PseudoVWMUL : VPseudoVWMUL_VV_VX<Commutable=1>; 6364*0fca6ea1SDimitry Andricdefm PseudoVWMULU : VPseudoVWMUL_VV_VX<Commutable=1>; 63650eae32dcSDimitry Andricdefm PseudoVWMULSU : VPseudoVWMUL_VV_VX; 6366e8d8bef9SDimitry Andric 6367e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6368bdd1243dSDimitry Andric// 11.13. Vector Single-Width Integer Multiply-Add Instructions 6369e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 63700eae32dcSDimitry Andricdefm PseudoVMACC : VPseudoVMAC_VV_VX_AAXA; 63710eae32dcSDimitry Andricdefm PseudoVNMSAC : VPseudoVMAC_VV_VX_AAXA; 63720eae32dcSDimitry Andricdefm PseudoVMADD : VPseudoVMAC_VV_VX_AAXA; 63730eae32dcSDimitry Andricdefm PseudoVNMSUB : VPseudoVMAC_VV_VX_AAXA; 6374e8d8bef9SDimitry Andric 6375e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6376bdd1243dSDimitry Andric// 11.14. Vector Widening Integer Multiply-Add Instructions 6377e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6378*0fca6ea1SDimitry Andricdefm PseudoVWMACCU : VPseudoVWMAC_VV_VX<Commutable=1>; 6379*0fca6ea1SDimitry Andricdefm PseudoVWMACC : VPseudoVWMAC_VV_VX<Commutable=1>; 63800eae32dcSDimitry Andricdefm PseudoVWMACCSU : VPseudoVWMAC_VV_VX; 63810eae32dcSDimitry Andricdefm PseudoVWMACCUS : VPseudoVWMAC_VX; 6382e8d8bef9SDimitry Andric 6383e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6384bdd1243dSDimitry Andric// 11.15. Vector Integer Merge Instructions 6385e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 63860eae32dcSDimitry Andricdefm PseudoVMERGE : VPseudoVMRG_VM_XM_IM; 6387e8d8bef9SDimitry Andric 6388e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6389bdd1243dSDimitry Andric// 11.16. Vector Integer Move Instructions 6390e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 63910eae32dcSDimitry Andricdefm PseudoVMV_V : VPseudoUnaryVMV_V_X_I; 6392e8d8bef9SDimitry Andric 6393e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6394bdd1243dSDimitry Andric// 12. Vector Fixed-Point Arithmetic Instructions 6395bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 6396bdd1243dSDimitry Andric 6397bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 6398bdd1243dSDimitry Andric// 12.1. Vector Single-Width Saturating Add and Subtract 6399e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6400*0fca6ea1SDimitry Andriclet Defs = [VXSAT] in { 6401*0fca6ea1SDimitry Andric defm PseudoVSADDU : VPseudoVSALU_VV_VX_VI<Commutable=1>; 6402*0fca6ea1SDimitry Andric defm PseudoVSADD : VPseudoVSALU_VV_VX_VI<Commutable=1>; 64030eae32dcSDimitry Andric defm PseudoVSSUBU : VPseudoVSALU_VV_VX; 64040eae32dcSDimitry Andric defm PseudoVSSUB : VPseudoVSALU_VV_VX; 6405e8d8bef9SDimitry Andric} 6406e8d8bef9SDimitry Andric 6407e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6408bdd1243dSDimitry Andric// 12.2. Vector Single-Width Averaging Add and Subtract 6409e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6410*0fca6ea1SDimitry Andricdefm PseudoVAADDU : VPseudoVAALU_VV_VX_RM<Commutable=1>; 6411*0fca6ea1SDimitry Andricdefm PseudoVAADD : VPseudoVAALU_VV_VX_RM<Commutable=1>; 641206c3fb27SDimitry Andricdefm PseudoVASUBU : VPseudoVAALU_VV_VX_RM; 641306c3fb27SDimitry Andricdefm PseudoVASUB : VPseudoVAALU_VV_VX_RM; 6414e8d8bef9SDimitry Andric 6415e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6416bdd1243dSDimitry Andric// 12.3. Vector Single-Width Fractional Multiply with Rounding and Saturation 6417e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6418*0fca6ea1SDimitry Andriclet Defs = [VXSAT] in { 641906c3fb27SDimitry Andric defm PseudoVSMUL : VPseudoVSMUL_VV_VX_RM; 6420e8d8bef9SDimitry Andric} 6421e8d8bef9SDimitry Andric 6422e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6423bdd1243dSDimitry Andric// 12.4. Vector Single-Width Scaling Shift Instructions 6424e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6425*0fca6ea1SDimitry Andricdefm PseudoVSSRL : VPseudoVSSHT_VV_VX_VI_RM; 6426*0fca6ea1SDimitry Andricdefm PseudoVSSRA : VPseudoVSSHT_VV_VX_VI_RM; 6427e8d8bef9SDimitry Andric 6428e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6429bdd1243dSDimitry Andric// 12.5. Vector Narrowing Fixed-Point Clip Instructions 6430e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6431*0fca6ea1SDimitry Andriclet Defs = [VXSAT] in { 643206c3fb27SDimitry Andric defm PseudoVNCLIP : VPseudoVNCLP_WV_WX_WI_RM; 643306c3fb27SDimitry Andric defm PseudoVNCLIPU : VPseudoVNCLP_WV_WX_WI_RM; 6434e8d8bef9SDimitry Andric} 6435e8d8bef9SDimitry Andric 6436349cc55cSDimitry Andric} // Predicates = [HasVInstructions] 6437e8d8bef9SDimitry Andric 6438bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 6439bdd1243dSDimitry Andric// 13. Vector Floating-Point Instructions 6440bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 6441bdd1243dSDimitry Andric 6442349cc55cSDimitry Andriclet Predicates = [HasVInstructionsAnyF] in { 6443e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6444bdd1243dSDimitry Andric// 13.2. Vector Single-Width Floating-Point Add/Subtract Instructions 6445e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 644606c3fb27SDimitry Andriclet mayRaiseFPException = true, hasPostISelHook = 1 in { 644706c3fb27SDimitry Andricdefm PseudoVFADD : VPseudoVALU_VV_VF_RM; 644806c3fb27SDimitry Andricdefm PseudoVFSUB : VPseudoVALU_VV_VF_RM; 644906c3fb27SDimitry Andricdefm PseudoVFRSUB : VPseudoVALU_VF_RM; 645081ad6265SDimitry Andric} 6451e8d8bef9SDimitry Andric 6452e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6453bdd1243dSDimitry Andric// 13.3. Vector Widening Floating-Point Add/Subtract Instructions 6454e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 645506c3fb27SDimitry Andriclet mayRaiseFPException = true, hasSideEffects = 0, hasPostISelHook = 1 in { 645606c3fb27SDimitry Andricdefm PseudoVFWADD : VPseudoVFWALU_VV_VF_RM; 645706c3fb27SDimitry Andricdefm PseudoVFWSUB : VPseudoVFWALU_VV_VF_RM; 645806c3fb27SDimitry Andricdefm PseudoVFWADD : VPseudoVFWALU_WV_WF_RM; 645906c3fb27SDimitry Andricdefm PseudoVFWSUB : VPseudoVFWALU_WV_WF_RM; 646081ad6265SDimitry Andric} 6461e8d8bef9SDimitry Andric 6462e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6463bdd1243dSDimitry Andric// 13.4. Vector Single-Width Floating-Point Multiply/Divide Instructions 6464e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 646506c3fb27SDimitry Andriclet mayRaiseFPException = true, hasSideEffects = 0, hasPostISelHook = 1 in { 646606c3fb27SDimitry Andricdefm PseudoVFMUL : VPseudoVFMUL_VV_VF_RM; 646706c3fb27SDimitry Andricdefm PseudoVFDIV : VPseudoVFDIV_VV_VF_RM; 646806c3fb27SDimitry Andricdefm PseudoVFRDIV : VPseudoVFRDIV_VF_RM; 646981ad6265SDimitry Andric} 6470e8d8bef9SDimitry Andric 6471e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6472bdd1243dSDimitry Andric// 13.5. Vector Widening Floating-Point Multiply 6473e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 647406c3fb27SDimitry Andriclet mayRaiseFPException = true, hasSideEffects = 0 in { 647506c3fb27SDimitry Andricdefm PseudoVFWMUL : VPseudoVWMUL_VV_VF_RM; 647681ad6265SDimitry Andric} 6477e8d8bef9SDimitry Andric 6478e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6479bdd1243dSDimitry Andric// 13.6. Vector Single-Width Floating-Point Fused Multiply-Add Instructions 6480e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 648106c3fb27SDimitry Andriclet mayRaiseFPException = true, hasSideEffects = 0, hasPostISelHook = 1 in { 648206c3fb27SDimitry Andricdefm PseudoVFMACC : VPseudoVMAC_VV_VF_AAXA_RM; 648306c3fb27SDimitry Andricdefm PseudoVFNMACC : VPseudoVMAC_VV_VF_AAXA_RM; 648406c3fb27SDimitry Andricdefm PseudoVFMSAC : VPseudoVMAC_VV_VF_AAXA_RM; 648506c3fb27SDimitry Andricdefm PseudoVFNMSAC : VPseudoVMAC_VV_VF_AAXA_RM; 648606c3fb27SDimitry Andricdefm PseudoVFMADD : VPseudoVMAC_VV_VF_AAXA_RM; 648706c3fb27SDimitry Andricdefm PseudoVFNMADD : VPseudoVMAC_VV_VF_AAXA_RM; 648806c3fb27SDimitry Andricdefm PseudoVFMSUB : VPseudoVMAC_VV_VF_AAXA_RM; 648906c3fb27SDimitry Andricdefm PseudoVFNMSUB : VPseudoVMAC_VV_VF_AAXA_RM; 649081ad6265SDimitry Andric} 6491e8d8bef9SDimitry Andric 6492e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6493bdd1243dSDimitry Andric// 13.7. Vector Widening Floating-Point Fused Multiply-Add Instructions 6494e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 649506c3fb27SDimitry Andriclet mayRaiseFPException = true, hasSideEffects = 0, hasPostISelHook = 1 in { 649606c3fb27SDimitry Andricdefm PseudoVFWMACC : VPseudoVWMAC_VV_VF_RM; 649706c3fb27SDimitry Andricdefm PseudoVFWNMACC : VPseudoVWMAC_VV_VF_RM; 649806c3fb27SDimitry Andricdefm PseudoVFWMSAC : VPseudoVWMAC_VV_VF_RM; 649906c3fb27SDimitry Andricdefm PseudoVFWNMSAC : VPseudoVWMAC_VV_VF_RM; 65005f757f3fSDimitry Andriclet Predicates = [HasStdExtZvfbfwma] in 65015f757f3fSDimitry Andricdefm PseudoVFWMACCBF16 : VPseudoVWMAC_VV_VF_BF_RM; 650281ad6265SDimitry Andric} 6503e8d8bef9SDimitry Andric 6504e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6505bdd1243dSDimitry Andric// 13.8. Vector Floating-Point Square-Root Instruction 6506e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 650706c3fb27SDimitry Andriclet mayRaiseFPException = true, hasSideEffects = 0 in 650806c3fb27SDimitry Andricdefm PseudoVFSQRT : VPseudoVSQR_V_RM; 6509e8d8bef9SDimitry Andric 6510e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6511bdd1243dSDimitry Andric// 13.9. Vector Floating-Point Reciprocal Square-Root Estimate Instruction 6512e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 651381ad6265SDimitry Andriclet mayRaiseFPException = true in 65140eae32dcSDimitry Andricdefm PseudoVFRSQRT7 : VPseudoVRCP_V; 6515e8d8bef9SDimitry Andric 6516e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6517bdd1243dSDimitry Andric// 13.10. Vector Floating-Point Reciprocal Estimate Instruction 6518e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 651906c3fb27SDimitry Andriclet mayRaiseFPException = true, hasSideEffects = 0 in 652006c3fb27SDimitry Andricdefm PseudoVFREC7 : VPseudoVRCP_V_RM; 6521e8d8bef9SDimitry Andric 6522e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6523bdd1243dSDimitry Andric// 13.11. Vector Floating-Point Min/Max Instructions 6524e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 652581ad6265SDimitry Andriclet mayRaiseFPException = true in { 65260eae32dcSDimitry Andricdefm PseudoVFMIN : VPseudoVMAX_VV_VF; 65270eae32dcSDimitry Andricdefm PseudoVFMAX : VPseudoVMAX_VV_VF; 652881ad6265SDimitry Andric} 6529e8d8bef9SDimitry Andric 6530e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6531bdd1243dSDimitry Andric// 13.12. Vector Floating-Point Sign-Injection Instructions 6532e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 65330eae32dcSDimitry Andricdefm PseudoVFSGNJ : VPseudoVSGNJ_VV_VF; 65340eae32dcSDimitry Andricdefm PseudoVFSGNJN : VPseudoVSGNJ_VV_VF; 65350eae32dcSDimitry Andricdefm PseudoVFSGNJX : VPseudoVSGNJ_VV_VF; 6536e8d8bef9SDimitry Andric 6537e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6538bdd1243dSDimitry Andric// 13.13. Vector Floating-Point Compare Instructions 6539e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 654081ad6265SDimitry Andriclet mayRaiseFPException = true in { 65410eae32dcSDimitry Andricdefm PseudoVMFEQ : VPseudoVCMPM_VV_VF; 65420eae32dcSDimitry Andricdefm PseudoVMFNE : VPseudoVCMPM_VV_VF; 65430eae32dcSDimitry Andricdefm PseudoVMFLT : VPseudoVCMPM_VV_VF; 65440eae32dcSDimitry Andricdefm PseudoVMFLE : VPseudoVCMPM_VV_VF; 65450eae32dcSDimitry Andricdefm PseudoVMFGT : VPseudoVCMPM_VF; 65460eae32dcSDimitry Andricdefm PseudoVMFGE : VPseudoVCMPM_VF; 654781ad6265SDimitry Andric} 6548e8d8bef9SDimitry Andric 6549e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6550bdd1243dSDimitry Andric// 13.14. Vector Floating-Point Classify Instruction 6551e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 65520eae32dcSDimitry Andricdefm PseudoVFCLASS : VPseudoVCLS_V; 6553e8d8bef9SDimitry Andric 6554e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6555bdd1243dSDimitry Andric// 13.15. Vector Floating-Point Merge Instruction 6556e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 65570eae32dcSDimitry Andricdefm PseudoVFMERGE : VPseudoVMRG_FM; 6558e8d8bef9SDimitry Andric 6559e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6560bdd1243dSDimitry Andric// 13.16. Vector Floating-Point Move Instruction 6561e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 65620eae32dcSDimitry Andricdefm PseudoVFMV_V : VPseudoVMV_F; 6563e8d8bef9SDimitry Andric 6564e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6565bdd1243dSDimitry Andric// 13.17. Single-Width Floating-Point/Integer Type-Convert Instructions 6566e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6567bdd1243dSDimitry Andriclet mayRaiseFPException = true in { 656806c3fb27SDimitry Andriclet hasSideEffects = 0, hasPostISelHook = 1 in { 656906c3fb27SDimitry Andricdefm PseudoVFCVT_XU_F : VPseudoVCVTI_V_RM; 657006c3fb27SDimitry Andricdefm PseudoVFCVT_X_F : VPseudoVCVTI_V_RM; 6571bdd1243dSDimitry Andric} 6572bdd1243dSDimitry Andric 6573bdd1243dSDimitry Andricdefm PseudoVFCVT_RM_XU_F : VPseudoVCVTI_RM_V; 6574bdd1243dSDimitry Andricdefm PseudoVFCVT_RM_X_F : VPseudoVCVTI_RM_V; 6575bdd1243dSDimitry Andric 65760eae32dcSDimitry Andricdefm PseudoVFCVT_RTZ_XU_F : VPseudoVCVTI_V; 65770eae32dcSDimitry Andricdefm PseudoVFCVT_RTZ_X_F : VPseudoVCVTI_V; 6578bdd1243dSDimitry Andric 6579bdd1243dSDimitry Andricdefm PseudoVFROUND_NOEXCEPT : VPseudoVFROUND_NOEXCEPT_V; 658006c3fb27SDimitry Andriclet hasSideEffects = 0, hasPostISelHook = 1 in { 658106c3fb27SDimitry Andricdefm PseudoVFCVT_F_XU : VPseudoVCVTF_V_RM; 658206c3fb27SDimitry Andricdefm PseudoVFCVT_F_X : VPseudoVCVTF_V_RM; 6583bdd1243dSDimitry Andric} 6584bdd1243dSDimitry Andricdefm PseudoVFCVT_RM_F_XU : VPseudoVCVTF_RM_V; 6585bdd1243dSDimitry Andricdefm PseudoVFCVT_RM_F_X : VPseudoVCVTF_RM_V; 6586bdd1243dSDimitry Andric} // mayRaiseFPException = true 6587e8d8bef9SDimitry Andric 6588e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6589bdd1243dSDimitry Andric// 13.18. Widening Floating-Point/Integer Type-Convert Instructions 6590e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6591bdd1243dSDimitry Andriclet mayRaiseFPException = true in { 659206c3fb27SDimitry Andriclet hasSideEffects = 0, hasPostISelHook = 1 in { 659306c3fb27SDimitry Andricdefm PseudoVFWCVT_XU_F : VPseudoVWCVTI_V_RM; 659406c3fb27SDimitry Andricdefm PseudoVFWCVT_X_F : VPseudoVWCVTI_V_RM; 6595bdd1243dSDimitry Andric} 6596bdd1243dSDimitry Andricdefm PseudoVFWCVT_RM_XU_F : VPseudoVWCVTI_RM_V; 6597bdd1243dSDimitry Andricdefm PseudoVFWCVT_RM_X_F : VPseudoVWCVTI_RM_V; 6598bdd1243dSDimitry Andric 65990eae32dcSDimitry Andricdefm PseudoVFWCVT_RTZ_XU_F : VPseudoVWCVTI_V; 66000eae32dcSDimitry Andricdefm PseudoVFWCVT_RTZ_X_F : VPseudoVWCVTI_V; 6601bdd1243dSDimitry Andric 66020eae32dcSDimitry Andricdefm PseudoVFWCVT_F_XU : VPseudoVWCVTF_V; 66030eae32dcSDimitry Andricdefm PseudoVFWCVT_F_X : VPseudoVWCVTF_V; 6604bdd1243dSDimitry Andric 66050eae32dcSDimitry Andricdefm PseudoVFWCVT_F_F : VPseudoVWCVTD_V; 66065f757f3fSDimitry Andricdefm PseudoVFWCVTBF16_F_F : VPseudoVWCVTD_V; 6607bdd1243dSDimitry Andric} // mayRaiseFPException = true 6608e8d8bef9SDimitry Andric 6609e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6610bdd1243dSDimitry Andric// 13.19. Narrowing Floating-Point/Integer Type-Convert Instructions 6611e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6612bdd1243dSDimitry Andriclet mayRaiseFPException = true in { 661306c3fb27SDimitry Andriclet hasSideEffects = 0, hasPostISelHook = 1 in { 661406c3fb27SDimitry Andricdefm PseudoVFNCVT_XU_F : VPseudoVNCVTI_W_RM; 661506c3fb27SDimitry Andricdefm PseudoVFNCVT_X_F : VPseudoVNCVTI_W_RM; 6616bdd1243dSDimitry Andric} 6617bdd1243dSDimitry Andricdefm PseudoVFNCVT_RM_XU_F : VPseudoVNCVTI_RM_W; 6618bdd1243dSDimitry Andricdefm PseudoVFNCVT_RM_X_F : VPseudoVNCVTI_RM_W; 6619bdd1243dSDimitry Andric 66200eae32dcSDimitry Andricdefm PseudoVFNCVT_RTZ_XU_F : VPseudoVNCVTI_W; 66210eae32dcSDimitry Andricdefm PseudoVFNCVT_RTZ_X_F : VPseudoVNCVTI_W; 6622bdd1243dSDimitry Andric 662306c3fb27SDimitry Andriclet hasSideEffects = 0, hasPostISelHook = 1 in { 662406c3fb27SDimitry Andricdefm PseudoVFNCVT_F_XU : VPseudoVNCVTF_W_RM; 662506c3fb27SDimitry Andricdefm PseudoVFNCVT_F_X : VPseudoVNCVTF_W_RM; 6626bdd1243dSDimitry Andric} 6627bdd1243dSDimitry Andricdefm PseudoVFNCVT_RM_F_XU : VPseudoVNCVTF_RM_W; 6628bdd1243dSDimitry Andricdefm PseudoVFNCVT_RM_F_X : VPseudoVNCVTF_RM_W; 6629bdd1243dSDimitry Andric 663006c3fb27SDimitry Andriclet hasSideEffects = 0, hasPostISelHook = 1 in 663106c3fb27SDimitry Andricdefm PseudoVFNCVT_F_F : VPseudoVNCVTD_W_RM; 66325f757f3fSDimitry Andricdefm PseudoVFNCVTBF16_F_F : VPseudoVNCVTD_W_RM; 6633bdd1243dSDimitry Andric 66340eae32dcSDimitry Andricdefm PseudoVFNCVT_ROD_F_F : VPseudoVNCVTD_W; 6635bdd1243dSDimitry Andric} // mayRaiseFPException = true 6636349cc55cSDimitry Andric} // Predicates = [HasVInstructionsAnyF] 6637e8d8bef9SDimitry Andric 6638bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 6639bdd1243dSDimitry Andric// 14. Vector Reduction Operations 6640bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 6641bdd1243dSDimitry Andric 6642349cc55cSDimitry Andriclet Predicates = [HasVInstructions] in { 6643e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6644bdd1243dSDimitry Andric// 14.1. Vector Single-Width Integer Reduction Instructions 6645e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 66460eae32dcSDimitry Andricdefm PseudoVREDSUM : VPseudoVRED_VS; 66470eae32dcSDimitry Andricdefm PseudoVREDAND : VPseudoVRED_VS; 66480eae32dcSDimitry Andricdefm PseudoVREDOR : VPseudoVRED_VS; 66490eae32dcSDimitry Andricdefm PseudoVREDXOR : VPseudoVRED_VS; 665006c3fb27SDimitry Andricdefm PseudoVREDMINU : VPseudoVREDMINMAX_VS; 665106c3fb27SDimitry Andricdefm PseudoVREDMIN : VPseudoVREDMINMAX_VS; 665206c3fb27SDimitry Andricdefm PseudoVREDMAXU : VPseudoVREDMINMAX_VS; 665306c3fb27SDimitry Andricdefm PseudoVREDMAX : VPseudoVREDMINMAX_VS; 6654e8d8bef9SDimitry Andric 6655e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6656bdd1243dSDimitry Andric// 14.2. Vector Widening Integer Reduction Instructions 6657e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6658349cc55cSDimitry Andriclet IsRVVWideningReduction = 1 in { 66590eae32dcSDimitry Andricdefm PseudoVWREDSUMU : VPseudoVWRED_VS; 66600eae32dcSDimitry Andricdefm PseudoVWREDSUM : VPseudoVWRED_VS; 6661349cc55cSDimitry Andric} 6662349cc55cSDimitry Andric} // Predicates = [HasVInstructions] 6663e8d8bef9SDimitry Andric 6664349cc55cSDimitry Andriclet Predicates = [HasVInstructionsAnyF] in { 6665e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6666bdd1243dSDimitry Andric// 14.3. Vector Single-Width Floating-Point Reduction Instructions 6667e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 666806c3fb27SDimitry Andriclet mayRaiseFPException = true, 666906c3fb27SDimitry Andric hasSideEffects = 0 in { 667006c3fb27SDimitry Andricdefm PseudoVFREDOSUM : VPseudoVFREDO_VS_RM; 667106c3fb27SDimitry Andricdefm PseudoVFREDUSUM : VPseudoVFRED_VS_RM; 667281ad6265SDimitry Andric} 667381ad6265SDimitry Andriclet mayRaiseFPException = true in { 667406c3fb27SDimitry Andricdefm PseudoVFREDMIN : VPseudoVFREDMINMAX_VS; 667506c3fb27SDimitry Andricdefm PseudoVFREDMAX : VPseudoVFREDMINMAX_VS; 667681ad6265SDimitry Andric} 6677e8d8bef9SDimitry Andric 6678e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6679bdd1243dSDimitry Andric// 14.4. Vector Widening Floating-Point Reduction Instructions 6680e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 668181ad6265SDimitry Andriclet IsRVVWideningReduction = 1, 668206c3fb27SDimitry Andric hasSideEffects = 0, 668381ad6265SDimitry Andric mayRaiseFPException = true in { 668406c3fb27SDimitry Andricdefm PseudoVFWREDUSUM : VPseudoVFWRED_VS_RM; 66855f757f3fSDimitry Andricdefm PseudoVFWREDOSUM : VPseudoVFWREDO_VS_RM; 6686349cc55cSDimitry Andric} 6687e8d8bef9SDimitry Andric 6688349cc55cSDimitry Andric} // Predicates = [HasVInstructionsAnyF] 6689e8d8bef9SDimitry Andric 6690e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6691bdd1243dSDimitry Andric// 15. Vector Mask Instructions 6692e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6693e8d8bef9SDimitry Andric 6694*0fca6ea1SDimitry Andriclet Predicates = [HasVInstructions] in { 6695e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6696bdd1243dSDimitry Andric// 15.1 Vector Mask-Register Logical Instructions 6697e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6698e8d8bef9SDimitry Andric 66995f757f3fSDimitry Andricdefm PseudoVMAND: VPseudoVALU_MM<Commutable=1>; 67005f757f3fSDimitry Andricdefm PseudoVMNAND: VPseudoVALU_MM<Commutable=1>; 67010eae32dcSDimitry Andricdefm PseudoVMANDN: VPseudoVALU_MM; 67025f757f3fSDimitry Andricdefm PseudoVMXOR: VPseudoVALU_MM<Commutable=1>; 67035f757f3fSDimitry Andricdefm PseudoVMOR: VPseudoVALU_MM<Commutable=1>; 67045f757f3fSDimitry Andricdefm PseudoVMNOR: VPseudoVALU_MM<Commutable=1>; 67050eae32dcSDimitry Andricdefm PseudoVMORN: VPseudoVALU_MM; 67065f757f3fSDimitry Andricdefm PseudoVMXNOR: VPseudoVALU_MM<Commutable=1>; 6707e8d8bef9SDimitry Andric 6708fe6060f1SDimitry Andric// Pseudo instructions 6709bdd1243dSDimitry Andricdefm PseudoVMCLR : VPseudoNullaryPseudoM<"VMXOR">; 6710bdd1243dSDimitry Andricdefm PseudoVMSET : VPseudoNullaryPseudoM<"VMXNOR">; 6711e8d8bef9SDimitry Andric 6712e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6713bdd1243dSDimitry Andric// 15.2. Vector mask population count vcpop 6714e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 67151db9f3b2SDimitry Andriclet IsSignExtendingOpW = 1 in 67160eae32dcSDimitry Andricdefm PseudoVCPOP: VPseudoVPOP_M; 6717e8d8bef9SDimitry Andric 6718e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6719bdd1243dSDimitry Andric// 15.3. vfirst find-first-set mask bit 6720e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6721e8d8bef9SDimitry Andric 67221db9f3b2SDimitry Andriclet IsSignExtendingOpW = 1 in 67230eae32dcSDimitry Andricdefm PseudoVFIRST: VPseudoV1ST_M; 6724e8d8bef9SDimitry Andric 6725e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6726bdd1243dSDimitry Andric// 15.4. vmsbf.m set-before-first mask bit 6727e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 67280eae32dcSDimitry Andricdefm PseudoVMSBF: VPseudoVSFS_M; 6729e8d8bef9SDimitry Andric 6730e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6731bdd1243dSDimitry Andric// 15.5. vmsif.m set-including-first mask bit 6732e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 67330eae32dcSDimitry Andricdefm PseudoVMSIF: VPseudoVSFS_M; 6734e8d8bef9SDimitry Andric 6735e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6736bdd1243dSDimitry Andric// 15.6. vmsof.m set-only-first mask bit 6737e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 67380eae32dcSDimitry Andricdefm PseudoVMSOF: VPseudoVSFS_M; 6739e8d8bef9SDimitry Andric 6740e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6741bdd1243dSDimitry Andric// 15.8. Vector Iota Instruction 6742e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6743*0fca6ea1SDimitry Andricdefm PseudoVIOTA_M: VPseudoVIOTA_M; 6744e8d8bef9SDimitry Andric 6745e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6746bdd1243dSDimitry Andric// 15.9. Vector Element Index Instruction 6747e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6748*0fca6ea1SDimitry Andriclet isReMaterializable = 1 in 67490eae32dcSDimitry Andricdefm PseudoVID : VPseudoVID_V; 6750*0fca6ea1SDimitry Andric} // Predicates = [HasVInstructions] 6751e8d8bef9SDimitry Andric 6752e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6753bdd1243dSDimitry Andric// 16. Vector Permutation Instructions 6754e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6755e8d8bef9SDimitry Andric 6756e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6757bdd1243dSDimitry Andric// 16.1. Integer Scalar Move Instructions 6758e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6759e8d8bef9SDimitry Andric 6760349cc55cSDimitry Andriclet Predicates = [HasVInstructions] in { 6761fe6060f1SDimitry Andriclet mayLoad = 0, mayStore = 0, hasSideEffects = 0 in { 6762e8d8bef9SDimitry Andric let HasSEWOp = 1, BaseInstr = VMV_X_S in 67637a6dacacSDimitry Andric def PseudoVMV_X_S: 67647a6dacacSDimitry Andric Pseudo<(outs GPR:$rd), (ins VR:$rs2, ixlenimm:$sew), []>, 6765*0fca6ea1SDimitry Andric Sched<[WriteVMovXS, ReadVMovXS]>, 67660eae32dcSDimitry Andric RISCVVPseudo; 6767fe6060f1SDimitry Andric let HasVLOp = 1, HasSEWOp = 1, BaseInstr = VMV_S_X, 6768e8d8bef9SDimitry Andric Constraints = "$rd = $rs1" in 67697a6dacacSDimitry Andric def PseudoVMV_S_X: Pseudo<(outs VR:$rd), 67707a6dacacSDimitry Andric (ins VR:$rs1, GPR:$rs2, AVL:$vl, ixlenimm:$sew), 67710eae32dcSDimitry Andric []>, 6772*0fca6ea1SDimitry Andric Sched<[WriteVMovSX, ReadVMovSX_V, ReadVMovSX_X]>, 67730eae32dcSDimitry Andric RISCVVPseudo; 6774e8d8bef9SDimitry Andric} 6775349cc55cSDimitry Andric} // Predicates = [HasVInstructions] 6776e8d8bef9SDimitry Andric 6777e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6778bdd1243dSDimitry Andric// 16.2. Floating-Point Scalar Move Instructions 6779e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6780e8d8bef9SDimitry Andric 6781349cc55cSDimitry Andriclet Predicates = [HasVInstructionsAnyF] in { 6782fe6060f1SDimitry Andriclet mayLoad = 0, mayStore = 0, hasSideEffects = 0 in { 678304eeddc0SDimitry Andric foreach f = FPList in { 678404eeddc0SDimitry Andric foreach m = f.MxList in { 6785bdd1243dSDimitry Andric defvar mx = m.MX; 6786e8d8bef9SDimitry Andric let VLMul = m.value in { 6787e8d8bef9SDimitry Andric let HasSEWOp = 1, BaseInstr = VFMV_F_S in 6788bdd1243dSDimitry Andric def "PseudoVFMV_" # f.FX # "_S_" # mx : 6789e8d8bef9SDimitry Andric Pseudo<(outs f.fprclass:$rd), 67900eae32dcSDimitry Andric (ins m.vrclass:$rs2, ixlenimm:$sew), []>, 6791*0fca6ea1SDimitry Andric Sched<[WriteVMovFS, ReadVMovFS]>, 67920eae32dcSDimitry Andric RISCVVPseudo; 6793fe6060f1SDimitry Andric let HasVLOp = 1, HasSEWOp = 1, BaseInstr = VFMV_S_F, 6794e8d8bef9SDimitry Andric Constraints = "$rd = $rs1" in 6795bdd1243dSDimitry Andric def "PseudoVFMV_S_" # f.FX # "_" # mx : 6796e8d8bef9SDimitry Andric Pseudo<(outs m.vrclass:$rd), 6797e8d8bef9SDimitry Andric (ins m.vrclass:$rs1, f.fprclass:$rs2, 6798fe6060f1SDimitry Andric AVL:$vl, ixlenimm:$sew), 67990eae32dcSDimitry Andric []>, 6800*0fca6ea1SDimitry Andric Sched<[WriteVMovSF, ReadVMovSF_V, ReadVMovSF_F]>, 68010eae32dcSDimitry Andric RISCVVPseudo; 6802e8d8bef9SDimitry Andric } 6803e8d8bef9SDimitry Andric } 6804e8d8bef9SDimitry Andric } 6805e8d8bef9SDimitry Andric} 6806349cc55cSDimitry Andric} // Predicates = [HasVInstructionsAnyF] 6807e8d8bef9SDimitry Andric 6808e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6809bdd1243dSDimitry Andric// 16.3. Vector Slide Instructions 6810e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6811349cc55cSDimitry Andriclet Predicates = [HasVInstructions] in { 6812*0fca6ea1SDimitry Andric defm PseudoVSLIDEUP : VPseudoVSLD_VX_VI</*slidesUp=*/true, "@earlyclobber $rd">; 6813*0fca6ea1SDimitry Andric defm PseudoVSLIDEDOWN : VPseudoVSLD_VX_VI</*slidesUp=*/false>; 68140eae32dcSDimitry Andric defm PseudoVSLIDE1UP : VPseudoVSLD1_VX<"@earlyclobber $rd">; 68150eae32dcSDimitry Andric defm PseudoVSLIDE1DOWN : VPseudoVSLD1_VX; 6816349cc55cSDimitry Andric} // Predicates = [HasVInstructions] 6817e8d8bef9SDimitry Andric 6818349cc55cSDimitry Andriclet Predicates = [HasVInstructionsAnyF] in { 68190eae32dcSDimitry Andric defm PseudoVFSLIDE1UP : VPseudoVSLD1_VF<"@earlyclobber $rd">; 68200eae32dcSDimitry Andric defm PseudoVFSLIDE1DOWN : VPseudoVSLD1_VF; 6821349cc55cSDimitry Andric} // Predicates = [HasVInstructionsAnyF] 6822e8d8bef9SDimitry Andric 6823e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6824bdd1243dSDimitry Andric// 16.4. Vector Register Gather Instructions 6825e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6826*0fca6ea1SDimitry Andriclet Predicates = [HasVInstructions] in { 6827*0fca6ea1SDimitry Andricdefm PseudoVRGATHER : VPseudoVGTR_VV_VX_VI; 6828*0fca6ea1SDimitry Andricdefm PseudoVRGATHEREI16 : VPseudoVGTR_EI16_VV; 6829e8d8bef9SDimitry Andric 6830e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6831bdd1243dSDimitry Andric// 16.5. Vector Compress Instruction 6832e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 68330eae32dcSDimitry Andricdefm PseudoVCOMPRESS : VPseudoVCPR_V; 6834*0fca6ea1SDimitry Andric} // Predicates = [HasVInstructions] 6835e8d8bef9SDimitry Andric 6836e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6837e8d8bef9SDimitry Andric// Patterns. 6838e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6839e8d8bef9SDimitry Andric 6840e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6841bdd1243dSDimitry Andric// 11. Vector Integer Arithmetic Instructions 6842e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6843e8d8bef9SDimitry Andric 6844e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6845bdd1243dSDimitry Andric// 11.1. Vector Single-Width Integer Add and Subtract 6846e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6847fe6060f1SDimitry Andricdefm : VPatBinaryV_VV_VX_VI<"int_riscv_vadd", "PseudoVADD", AllIntegerVectors>; 6848fe6060f1SDimitry Andricdefm : VPatBinaryV_VV_VX<"int_riscv_vsub", "PseudoVSUB", AllIntegerVectors>; 6849fe6060f1SDimitry Andricdefm : VPatBinaryV_VX_VI<"int_riscv_vrsub", "PseudoVRSUB", AllIntegerVectors>; 6850e8d8bef9SDimitry Andric 6851e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6852bdd1243dSDimitry Andric// 11.2. Vector Widening Integer Add/Subtract 6853e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6854fe6060f1SDimitry Andricdefm : VPatBinaryW_VV_VX<"int_riscv_vwaddu", "PseudoVWADDU", AllWidenableIntVectors>; 6855fe6060f1SDimitry Andricdefm : VPatBinaryW_VV_VX<"int_riscv_vwsubu", "PseudoVWSUBU", AllWidenableIntVectors>; 6856fe6060f1SDimitry Andricdefm : VPatBinaryW_VV_VX<"int_riscv_vwadd", "PseudoVWADD", AllWidenableIntVectors>; 6857fe6060f1SDimitry Andricdefm : VPatBinaryW_VV_VX<"int_riscv_vwsub", "PseudoVWSUB", AllWidenableIntVectors>; 6858fe6060f1SDimitry Andricdefm : VPatBinaryW_WV_WX<"int_riscv_vwaddu_w", "PseudoVWADDU", AllWidenableIntVectors>; 6859fe6060f1SDimitry Andricdefm : VPatBinaryW_WV_WX<"int_riscv_vwsubu_w", "PseudoVWSUBU", AllWidenableIntVectors>; 6860fe6060f1SDimitry Andricdefm : VPatBinaryW_WV_WX<"int_riscv_vwadd_w", "PseudoVWADD", AllWidenableIntVectors>; 6861fe6060f1SDimitry Andricdefm : VPatBinaryW_WV_WX<"int_riscv_vwsub_w", "PseudoVWSUB", AllWidenableIntVectors>; 6862e8d8bef9SDimitry Andric 6863e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6864bdd1243dSDimitry Andric// 11.3. Vector Integer Extension 6865e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6866fe6060f1SDimitry Andricdefm : VPatUnaryV_VF<"int_riscv_vzext", "PseudoVZEXT", "VF2", 6867e8d8bef9SDimitry Andric AllFractionableVF2IntVectors>; 6868fe6060f1SDimitry Andricdefm : VPatUnaryV_VF<"int_riscv_vzext", "PseudoVZEXT", "VF4", 6869e8d8bef9SDimitry Andric AllFractionableVF4IntVectors>; 6870fe6060f1SDimitry Andricdefm : VPatUnaryV_VF<"int_riscv_vzext", "PseudoVZEXT", "VF8", 6871e8d8bef9SDimitry Andric AllFractionableVF8IntVectors>; 6872fe6060f1SDimitry Andricdefm : VPatUnaryV_VF<"int_riscv_vsext", "PseudoVSEXT", "VF2", 6873e8d8bef9SDimitry Andric AllFractionableVF2IntVectors>; 6874fe6060f1SDimitry Andricdefm : VPatUnaryV_VF<"int_riscv_vsext", "PseudoVSEXT", "VF4", 6875e8d8bef9SDimitry Andric AllFractionableVF4IntVectors>; 6876fe6060f1SDimitry Andricdefm : VPatUnaryV_VF<"int_riscv_vsext", "PseudoVSEXT", "VF8", 6877e8d8bef9SDimitry Andric AllFractionableVF8IntVectors>; 6878e8d8bef9SDimitry Andric 6879e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6880bdd1243dSDimitry Andric// 11.4. Vector Integer Add-with-Carry / Subtract-with-Borrow Instructions 6881e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6882fe6060f1SDimitry Andricdefm : VPatBinaryV_VM_XM_IM<"int_riscv_vadc", "PseudoVADC">; 6883fe6060f1SDimitry Andricdefm : VPatBinaryM_VM_XM_IM<"int_riscv_vmadc_carry_in", "PseudoVMADC">; 6884fe6060f1SDimitry Andricdefm : VPatBinaryM_V_X_I<"int_riscv_vmadc", "PseudoVMADC">; 6885e8d8bef9SDimitry Andric 6886fe6060f1SDimitry Andricdefm : VPatBinaryV_VM_XM<"int_riscv_vsbc", "PseudoVSBC">; 6887fe6060f1SDimitry Andricdefm : VPatBinaryM_VM_XM<"int_riscv_vmsbc_borrow_in", "PseudoVMSBC">; 6888fe6060f1SDimitry Andricdefm : VPatBinaryM_V_X<"int_riscv_vmsbc", "PseudoVMSBC">; 6889e8d8bef9SDimitry Andric 6890e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6891bdd1243dSDimitry Andric// 11.5. Vector Bitwise Logical Instructions 6892e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6893fe6060f1SDimitry Andricdefm : VPatBinaryV_VV_VX_VI<"int_riscv_vand", "PseudoVAND", AllIntegerVectors>; 6894fe6060f1SDimitry Andricdefm : VPatBinaryV_VV_VX_VI<"int_riscv_vor", "PseudoVOR", AllIntegerVectors>; 6895fe6060f1SDimitry Andricdefm : VPatBinaryV_VV_VX_VI<"int_riscv_vxor", "PseudoVXOR", AllIntegerVectors>; 6896e8d8bef9SDimitry Andric 6897e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6898bdd1243dSDimitry Andric// 11.6. Vector Single-Width Bit Shift Instructions 6899e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6900fe6060f1SDimitry Andricdefm : VPatBinaryV_VV_VX_VI<"int_riscv_vsll", "PseudoVSLL", AllIntegerVectors, 6901e8d8bef9SDimitry Andric uimm5>; 6902fe6060f1SDimitry Andricdefm : VPatBinaryV_VV_VX_VI<"int_riscv_vsrl", "PseudoVSRL", AllIntegerVectors, 6903e8d8bef9SDimitry Andric uimm5>; 6904fe6060f1SDimitry Andricdefm : VPatBinaryV_VV_VX_VI<"int_riscv_vsra", "PseudoVSRA", AllIntegerVectors, 6905e8d8bef9SDimitry Andric uimm5>; 6906e8d8bef9SDimitry Andric 690704eeddc0SDimitry Andricforeach vti = AllIntegerVectors in { 690804eeddc0SDimitry Andric // Emit shift by 1 as an add since it might be faster. 690906c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in { 6910*0fca6ea1SDimitry Andric def : Pat<(vti.Vector (int_riscv_vsll (vti.Vector vti.RegClass:$merge), 691181ad6265SDimitry Andric (vti.Vector vti.RegClass:$rs1), 691204eeddc0SDimitry Andric (XLenVT 1), VLOpFrag)), 691306c3fb27SDimitry Andric (!cast<Instruction>("PseudoVADD_VV_"#vti.LMul.MX) 6914*0fca6ea1SDimitry Andric vti.RegClass:$merge, vti.RegClass:$rs1, 6915*0fca6ea1SDimitry Andric vti.RegClass:$rs1, GPR:$vl, vti.Log2SEW, TU_MU)>; 691604eeddc0SDimitry Andric def : Pat<(vti.Vector (int_riscv_vsll_mask (vti.Vector vti.RegClass:$merge), 691704eeddc0SDimitry Andric (vti.Vector vti.RegClass:$rs1), 691804eeddc0SDimitry Andric (XLenVT 1), 691904eeddc0SDimitry Andric (vti.Mask V0), 692004eeddc0SDimitry Andric VLOpFrag, 692104eeddc0SDimitry Andric (XLenVT timm:$policy))), 692204eeddc0SDimitry Andric (!cast<Instruction>("PseudoVADD_VV_"#vti.LMul.MX#"_MASK") 692304eeddc0SDimitry Andric vti.RegClass:$merge, 692404eeddc0SDimitry Andric vti.RegClass:$rs1, 692504eeddc0SDimitry Andric vti.RegClass:$rs1, 692604eeddc0SDimitry Andric (vti.Mask V0), 692704eeddc0SDimitry Andric GPR:$vl, 692804eeddc0SDimitry Andric vti.Log2SEW, 692904eeddc0SDimitry Andric (XLenVT timm:$policy))>; 693004eeddc0SDimitry Andric } 693106c3fb27SDimitry Andric} 693204eeddc0SDimitry Andric 6933e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6934bdd1243dSDimitry Andric// 11.7. Vector Narrowing Integer Right Shift Instructions 6935e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6936fe6060f1SDimitry Andricdefm : VPatBinaryV_WV_WX_WI<"int_riscv_vnsrl", "PseudoVNSRL", AllWidenableIntVectors>; 6937fe6060f1SDimitry Andricdefm : VPatBinaryV_WV_WX_WI<"int_riscv_vnsra", "PseudoVNSRA", AllWidenableIntVectors>; 6938e8d8bef9SDimitry Andric 6939e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6940bdd1243dSDimitry Andric// 11.8. Vector Integer Comparison Instructions 6941e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6942fe6060f1SDimitry Andricdefm : VPatBinaryM_VV_VX_VI<"int_riscv_vmseq", "PseudoVMSEQ", AllIntegerVectors>; 6943fe6060f1SDimitry Andricdefm : VPatBinaryM_VV_VX_VI<"int_riscv_vmsne", "PseudoVMSNE", AllIntegerVectors>; 6944fe6060f1SDimitry Andricdefm : VPatBinaryM_VV_VX<"int_riscv_vmsltu", "PseudoVMSLTU", AllIntegerVectors>; 6945fe6060f1SDimitry Andricdefm : VPatBinaryM_VV_VX<"int_riscv_vmslt", "PseudoVMSLT", AllIntegerVectors>; 6946fe6060f1SDimitry Andricdefm : VPatBinaryM_VV_VX_VI<"int_riscv_vmsleu", "PseudoVMSLEU", AllIntegerVectors>; 6947fe6060f1SDimitry Andricdefm : VPatBinaryM_VV_VX_VI<"int_riscv_vmsle", "PseudoVMSLE", AllIntegerVectors>; 6948e8d8bef9SDimitry Andric 6949fe6060f1SDimitry Andricdefm : VPatBinaryM_VX_VI<"int_riscv_vmsgtu", "PseudoVMSGTU", AllIntegerVectors>; 6950fe6060f1SDimitry Andricdefm : VPatBinaryM_VX_VI<"int_riscv_vmsgt", "PseudoVMSGT", AllIntegerVectors>; 6951fe6060f1SDimitry Andric 6952fe6060f1SDimitry Andric// Match vmsgt with 2 vector operands to vmslt with the operands swapped. 6953fe6060f1SDimitry Andricdefm : VPatBinarySwappedM_VV<"int_riscv_vmsgtu", "PseudoVMSLTU", AllIntegerVectors>; 6954fe6060f1SDimitry Andricdefm : VPatBinarySwappedM_VV<"int_riscv_vmsgt", "PseudoVMSLT", AllIntegerVectors>; 6955fe6060f1SDimitry Andric 6956fe6060f1SDimitry Andricdefm : VPatBinarySwappedM_VV<"int_riscv_vmsgeu", "PseudoVMSLEU", AllIntegerVectors>; 6957fe6060f1SDimitry Andricdefm : VPatBinarySwappedM_VV<"int_riscv_vmsge", "PseudoVMSLE", AllIntegerVectors>; 6958e8d8bef9SDimitry Andric 69591fd87a68SDimitry Andric// Match vmslt(u).vx intrinsics to vmsle(u).vi if the scalar is -15 to 16 and 69601fd87a68SDimitry Andric// non-zero. Zero can be .vx with x0. This avoids the user needing to know that 69611fd87a68SDimitry Andric// there is no vmslt(u).vi instruction. Similar for vmsge(u).vx intrinsics 69621fd87a68SDimitry Andric// using vmslt(u).vi. 69631fd87a68SDimitry Andricdefm : VPatCompare_VI<"int_riscv_vmslt", "PseudoVMSLE", simm5_plus1_nonzero>; 696404eeddc0SDimitry Andricdefm : VPatCompare_VI<"int_riscv_vmsltu", "PseudoVMSLEU", simm5_plus1_nonzero>; 6965e8d8bef9SDimitry Andric 69661fd87a68SDimitry Andric// We need to handle 0 for vmsge.vi using vmslt.vi because there is no vmsge.vx. 69671fd87a68SDimitry Andricdefm : VPatCompare_VI<"int_riscv_vmsge", "PseudoVMSGT", simm5_plus1>; 696804eeddc0SDimitry Andricdefm : VPatCompare_VI<"int_riscv_vmsgeu", "PseudoVMSGTU", simm5_plus1_nonzero>; 6969e8d8bef9SDimitry Andric 6970e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6971bdd1243dSDimitry Andric// 11.9. Vector Integer Min/Max Instructions 6972e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6973fe6060f1SDimitry Andricdefm : VPatBinaryV_VV_VX<"int_riscv_vminu", "PseudoVMINU", AllIntegerVectors>; 6974fe6060f1SDimitry Andricdefm : VPatBinaryV_VV_VX<"int_riscv_vmin", "PseudoVMIN", AllIntegerVectors>; 6975fe6060f1SDimitry Andricdefm : VPatBinaryV_VV_VX<"int_riscv_vmaxu", "PseudoVMAXU", AllIntegerVectors>; 6976fe6060f1SDimitry Andricdefm : VPatBinaryV_VV_VX<"int_riscv_vmax", "PseudoVMAX", AllIntegerVectors>; 6977e8d8bef9SDimitry Andric 6978e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6979bdd1243dSDimitry Andric// 11.10. Vector Single-Width Integer Multiply Instructions 6980e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 6981fe6060f1SDimitry Andricdefm : VPatBinaryV_VV_VX<"int_riscv_vmul", "PseudoVMUL", AllIntegerVectors>; 698206c3fb27SDimitry Andric 698306c3fb27SDimitry Andricdefvar IntegerVectorsExceptI64 = !filter(vti, AllIntegerVectors, 698406c3fb27SDimitry Andric !ne(vti.SEW, 64)); 698506c3fb27SDimitry Andricdefm : VPatBinaryV_VV_VX<"int_riscv_vmulh", "PseudoVMULH", 698606c3fb27SDimitry Andric IntegerVectorsExceptI64>; 698706c3fb27SDimitry Andricdefm : VPatBinaryV_VV_VX<"int_riscv_vmulhu", "PseudoVMULHU", 698806c3fb27SDimitry Andric IntegerVectorsExceptI64>; 698906c3fb27SDimitry Andricdefm : VPatBinaryV_VV_VX<"int_riscv_vmulhsu", "PseudoVMULHSU", 699006c3fb27SDimitry Andric IntegerVectorsExceptI64>; 699106c3fb27SDimitry Andric 699206c3fb27SDimitry Andric// vmulh, vmulhu, vmulhsu are not included for EEW=64 in Zve64*. 699306c3fb27SDimitry Andricdefvar I64IntegerVectors = !filter(vti, AllIntegerVectors, !eq(vti.SEW, 64)); 699406c3fb27SDimitry Andriclet Predicates = [HasVInstructionsFullMultiply] in { 699506c3fb27SDimitry Andric defm : VPatBinaryV_VV_VX<"int_riscv_vmulh", "PseudoVMULH", 699606c3fb27SDimitry Andric I64IntegerVectors>; 699706c3fb27SDimitry Andric defm : VPatBinaryV_VV_VX<"int_riscv_vmulhu", "PseudoVMULHU", 699806c3fb27SDimitry Andric I64IntegerVectors>; 699906c3fb27SDimitry Andric defm : VPatBinaryV_VV_VX<"int_riscv_vmulhsu", "PseudoVMULHSU", 700006c3fb27SDimitry Andric I64IntegerVectors>; 700106c3fb27SDimitry Andric} 7002e8d8bef9SDimitry Andric 7003e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7004bdd1243dSDimitry Andric// 11.11. Vector Integer Divide Instructions 7005e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 700606c3fb27SDimitry Andricdefm : VPatBinaryV_VV_VX<"int_riscv_vdivu", "PseudoVDIVU", AllIntegerVectors, isSEWAware=1>; 700706c3fb27SDimitry Andricdefm : VPatBinaryV_VV_VX<"int_riscv_vdiv", "PseudoVDIV", AllIntegerVectors, isSEWAware=1>; 700806c3fb27SDimitry Andricdefm : VPatBinaryV_VV_VX<"int_riscv_vremu", "PseudoVREMU", AllIntegerVectors, isSEWAware=1>; 700906c3fb27SDimitry Andricdefm : VPatBinaryV_VV_VX<"int_riscv_vrem", "PseudoVREM", AllIntegerVectors, isSEWAware=1>; 7010e8d8bef9SDimitry Andric 7011e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7012bdd1243dSDimitry Andric// 11.12. Vector Widening Integer Multiply Instructions 7013e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7014fe6060f1SDimitry Andricdefm : VPatBinaryW_VV_VX<"int_riscv_vwmul", "PseudoVWMUL", AllWidenableIntVectors>; 7015fe6060f1SDimitry Andricdefm : VPatBinaryW_VV_VX<"int_riscv_vwmulu", "PseudoVWMULU", AllWidenableIntVectors>; 7016fe6060f1SDimitry Andricdefm : VPatBinaryW_VV_VX<"int_riscv_vwmulsu", "PseudoVWMULSU", AllWidenableIntVectors>; 7017e8d8bef9SDimitry Andric 7018e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7019bdd1243dSDimitry Andric// 11.13. Vector Single-Width Integer Multiply-Add Instructions 7020e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7021fe6060f1SDimitry Andricdefm : VPatTernaryV_VV_VX_AAXA<"int_riscv_vmadd", "PseudoVMADD", AllIntegerVectors>; 7022fe6060f1SDimitry Andricdefm : VPatTernaryV_VV_VX_AAXA<"int_riscv_vnmsub", "PseudoVNMSUB", AllIntegerVectors>; 7023fe6060f1SDimitry Andricdefm : VPatTernaryV_VV_VX_AAXA<"int_riscv_vmacc", "PseudoVMACC", AllIntegerVectors>; 7024fe6060f1SDimitry Andricdefm : VPatTernaryV_VV_VX_AAXA<"int_riscv_vnmsac", "PseudoVNMSAC", AllIntegerVectors>; 7025e8d8bef9SDimitry Andric 7026e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7027bdd1243dSDimitry Andric// 11.14. Vector Widening Integer Multiply-Add Instructions 7028e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7029fe6060f1SDimitry Andricdefm : VPatTernaryW_VV_VX<"int_riscv_vwmaccu", "PseudoVWMACCU", AllWidenableIntVectors>; 7030fe6060f1SDimitry Andricdefm : VPatTernaryW_VV_VX<"int_riscv_vwmacc", "PseudoVWMACC", AllWidenableIntVectors>; 7031fe6060f1SDimitry Andricdefm : VPatTernaryW_VV_VX<"int_riscv_vwmaccsu", "PseudoVWMACCSU", AllWidenableIntVectors>; 7032fe6060f1SDimitry Andricdefm : VPatTernaryW_VX<"int_riscv_vwmaccus", "PseudoVWMACCUS", AllWidenableIntVectors>; 7033e8d8bef9SDimitry Andric 7034e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7035bdd1243dSDimitry Andric// 11.15. Vector Integer Merge Instructions 7036e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7037fe6060f1SDimitry Andricdefm : VPatBinaryV_VM_XM_IM<"int_riscv_vmerge", "PseudoVMERGE">; 7038e8d8bef9SDimitry Andric 7039e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7040bdd1243dSDimitry Andric// 11.16. Vector Integer Move Instructions 7041e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7042e8d8bef9SDimitry Andricforeach vti = AllVectors in { 704306c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in { 704481ad6265SDimitry Andric def : Pat<(vti.Vector (int_riscv_vmv_v_v (vti.Vector vti.RegClass:$passthru), 704581ad6265SDimitry Andric (vti.Vector vti.RegClass:$rs1), 704681ad6265SDimitry Andric VLOpFrag)), 704706c3fb27SDimitry Andric (!cast<Instruction>("PseudoVMV_V_V_"#vti.LMul.MX) 704806c3fb27SDimitry Andric $passthru, $rs1, GPR:$vl, vti.Log2SEW, TU_MU)>; 7049e8d8bef9SDimitry Andric 7050fe6060f1SDimitry Andric // vmv.v.x/vmv.v.i are handled in RISCInstrVInstrInfoVVLPatterns.td 7051e8d8bef9SDimitry Andric } 705206c3fb27SDimitry Andric} 7053e8d8bef9SDimitry Andric 7054e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7055bdd1243dSDimitry Andric// 12. Vector Fixed-Point Arithmetic Instructions 7056bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 7057bdd1243dSDimitry Andric 7058bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 7059bdd1243dSDimitry Andric// 12.1. Vector Single-Width Saturating Add and Subtract 7060e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7061fe6060f1SDimitry Andricdefm : VPatBinaryV_VV_VX_VI<"int_riscv_vsaddu", "PseudoVSADDU", AllIntegerVectors>; 7062fe6060f1SDimitry Andricdefm : VPatBinaryV_VV_VX_VI<"int_riscv_vsadd", "PseudoVSADD", AllIntegerVectors>; 7063fe6060f1SDimitry Andricdefm : VPatBinaryV_VV_VX<"int_riscv_vssubu", "PseudoVSSUBU", AllIntegerVectors>; 7064fe6060f1SDimitry Andricdefm : VPatBinaryV_VV_VX<"int_riscv_vssub", "PseudoVSSUB", AllIntegerVectors>; 7065e8d8bef9SDimitry Andric 7066e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7067bdd1243dSDimitry Andric// 12.2. Vector Single-Width Averaging Add and Subtract 7068e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 706906c3fb27SDimitry Andricdefm : VPatBinaryV_VV_VX_RM<"int_riscv_vaaddu", "PseudoVAADDU", 707006c3fb27SDimitry Andric AllIntegerVectors>; 707106c3fb27SDimitry Andricdefm : VPatBinaryV_VV_VX_RM<"int_riscv_vasubu", "PseudoVASUBU", 707206c3fb27SDimitry Andric AllIntegerVectors>; 707306c3fb27SDimitry Andricdefm : VPatBinaryV_VV_VX_RM<"int_riscv_vasub", "PseudoVASUB", 707406c3fb27SDimitry Andric AllIntegerVectors>; 707506c3fb27SDimitry Andricdefm : VPatBinaryV_VV_VX_RM<"int_riscv_vaadd", "PseudoVAADD", 707606c3fb27SDimitry Andric AllIntegerVectors>; 7077e8d8bef9SDimitry Andric 7078e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7079bdd1243dSDimitry Andric// 12.3. Vector Single-Width Fractional Multiply with Rounding and Saturation 7080e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 708106c3fb27SDimitry Andricdefm : VPatBinaryV_VV_VX_RM<"int_riscv_vsmul", "PseudoVSMUL", 708206c3fb27SDimitry Andric IntegerVectorsExceptI64>; 708306c3fb27SDimitry Andric// vsmul.vv and vsmul.vx are not included in EEW=64 in Zve64*. 708406c3fb27SDimitry Andriclet Predicates = [HasVInstructionsFullMultiply] in 708506c3fb27SDimitry Andricdefm : VPatBinaryV_VV_VX_RM<"int_riscv_vsmul", "PseudoVSMUL", 708606c3fb27SDimitry Andric I64IntegerVectors>; 7087e8d8bef9SDimitry Andric 7088e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7089bdd1243dSDimitry Andric// 12.4. Vector Single-Width Scaling Shift Instructions 7090e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 709106c3fb27SDimitry Andricdefm : VPatBinaryV_VV_VX_VI_RM<"int_riscv_vssrl", "PseudoVSSRL", 709206c3fb27SDimitry Andric AllIntegerVectors, uimm5>; 709306c3fb27SDimitry Andricdefm : VPatBinaryV_VV_VX_VI_RM<"int_riscv_vssra", "PseudoVSSRA", 709406c3fb27SDimitry Andric AllIntegerVectors, uimm5>; 7095e8d8bef9SDimitry Andric 7096e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7097bdd1243dSDimitry Andric// 12.5. Vector Narrowing Fixed-Point Clip Instructions 7098e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 709906c3fb27SDimitry Andricdefm : VPatBinaryV_WV_WX_WI_RM<"int_riscv_vnclipu", "PseudoVNCLIPU", 710006c3fb27SDimitry Andric AllWidenableIntVectors>; 710106c3fb27SDimitry Andricdefm : VPatBinaryV_WV_WX_WI_RM<"int_riscv_vnclip", "PseudoVNCLIP", 710206c3fb27SDimitry Andric AllWidenableIntVectors>; 7103e8d8bef9SDimitry Andric 7104bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 7105bdd1243dSDimitry Andric// 13. Vector Floating-Point Instructions 7106bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 7107bdd1243dSDimitry Andric 7108e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7109bdd1243dSDimitry Andric// 13.2. Vector Single-Width Floating-Point Add/Subtract Instructions 7110e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7111*0fca6ea1SDimitry Andricdefm : VPatBinaryV_VV_VX_RM<"int_riscv_vfadd", "PseudoVFADD", AllFloatVectors, 7112*0fca6ea1SDimitry Andric isSEWAware = 1>; 7113*0fca6ea1SDimitry Andricdefm : VPatBinaryV_VV_VX_RM<"int_riscv_vfsub", "PseudoVFSUB", AllFloatVectors, 7114*0fca6ea1SDimitry Andric isSEWAware = 1>; 7115*0fca6ea1SDimitry Andricdefm : VPatBinaryV_VX_RM<"int_riscv_vfrsub", "PseudoVFRSUB", AllFloatVectors, 7116*0fca6ea1SDimitry Andric isSEWAware = 1>; 7117e8d8bef9SDimitry Andric 7118e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7119bdd1243dSDimitry Andric// 13.3. Vector Widening Floating-Point Add/Subtract Instructions 7120e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 712106c3fb27SDimitry Andricdefm : VPatBinaryW_VV_VX_RM<"int_riscv_vfwadd", "PseudoVFWADD", 7122*0fca6ea1SDimitry Andric AllWidenableFloatVectors, isSEWAware=1>; 712306c3fb27SDimitry Andricdefm : VPatBinaryW_VV_VX_RM<"int_riscv_vfwsub", "PseudoVFWSUB", 7124*0fca6ea1SDimitry Andric AllWidenableFloatVectors, isSEWAware=1>; 712506c3fb27SDimitry Andricdefm : VPatBinaryW_WV_WX_RM<"int_riscv_vfwadd_w", "PseudoVFWADD", 7126*0fca6ea1SDimitry Andric AllWidenableFloatVectors, isSEWAware=1>; 712706c3fb27SDimitry Andricdefm : VPatBinaryW_WV_WX_RM<"int_riscv_vfwsub_w", "PseudoVFWSUB", 7128*0fca6ea1SDimitry Andric AllWidenableFloatVectors, isSEWAware=1>; 7129e8d8bef9SDimitry Andric 7130e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7131bdd1243dSDimitry Andric// 13.4. Vector Single-Width Floating-Point Multiply/Divide Instructions 7132e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 713306c3fb27SDimitry Andricdefm : VPatBinaryV_VV_VX_RM<"int_riscv_vfmul", "PseudoVFMUL", 7134*0fca6ea1SDimitry Andric AllFloatVectors, isSEWAware=1>; 713506c3fb27SDimitry Andricdefm : VPatBinaryV_VV_VX_RM<"int_riscv_vfdiv", "PseudoVFDIV", 713606c3fb27SDimitry Andric AllFloatVectors, isSEWAware=1>; 713706c3fb27SDimitry Andricdefm : VPatBinaryV_VX_RM<"int_riscv_vfrdiv", "PseudoVFRDIV", 713806c3fb27SDimitry Andric AllFloatVectors, isSEWAware=1>; 7139e8d8bef9SDimitry Andric 7140e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7141bdd1243dSDimitry Andric// 13.5. Vector Widening Floating-Point Multiply 7142e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 714306c3fb27SDimitry Andricdefm : VPatBinaryW_VV_VX_RM<"int_riscv_vfwmul", "PseudoVFWMUL", 7144*0fca6ea1SDimitry Andric AllWidenableFloatVectors, isSEWAware=1>; 7145e8d8bef9SDimitry Andric 7146e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7147bdd1243dSDimitry Andric// 13.6. Vector Single-Width Floating-Point Fused Multiply-Add Instructions 7148e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7149*0fca6ea1SDimitry Andricdefm : VPatTernaryV_VV_VX_AAXA_RM<"int_riscv_vfmacc", "PseudoVFMACC", 7150*0fca6ea1SDimitry Andric AllFloatVectors, isSEWAware=1>; 7151*0fca6ea1SDimitry Andricdefm : VPatTernaryV_VV_VX_AAXA_RM<"int_riscv_vfnmacc", "PseudoVFNMACC", 7152*0fca6ea1SDimitry Andric AllFloatVectors, isSEWAware=1>; 7153*0fca6ea1SDimitry Andricdefm : VPatTernaryV_VV_VX_AAXA_RM<"int_riscv_vfmsac", "PseudoVFMSAC", 7154*0fca6ea1SDimitry Andric AllFloatVectors, isSEWAware=1>; 7155*0fca6ea1SDimitry Andricdefm : VPatTernaryV_VV_VX_AAXA_RM<"int_riscv_vfnmsac", "PseudoVFNMSAC", 7156*0fca6ea1SDimitry Andric AllFloatVectors, isSEWAware=1>; 7157*0fca6ea1SDimitry Andricdefm : VPatTernaryV_VV_VX_AAXA_RM<"int_riscv_vfmadd", "PseudoVFMADD", 7158*0fca6ea1SDimitry Andric AllFloatVectors, isSEWAware=1>; 7159*0fca6ea1SDimitry Andricdefm : VPatTernaryV_VV_VX_AAXA_RM<"int_riscv_vfnmadd", "PseudoVFNMADD", 7160*0fca6ea1SDimitry Andric AllFloatVectors, isSEWAware=1>; 7161*0fca6ea1SDimitry Andricdefm : VPatTernaryV_VV_VX_AAXA_RM<"int_riscv_vfmsub", "PseudoVFMSUB", 7162*0fca6ea1SDimitry Andric AllFloatVectors, isSEWAware=1>; 7163*0fca6ea1SDimitry Andricdefm : VPatTernaryV_VV_VX_AAXA_RM<"int_riscv_vfnmsub", "PseudoVFNMSUB", 7164*0fca6ea1SDimitry Andric AllFloatVectors, isSEWAware=1>; 7165e8d8bef9SDimitry Andric 7166e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7167bdd1243dSDimitry Andric// 13.7. Vector Widening Floating-Point Fused Multiply-Add Instructions 7168e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 716906c3fb27SDimitry Andricdefm : VPatTernaryW_VV_VX_RM<"int_riscv_vfwmacc", "PseudoVFWMACC", 7170*0fca6ea1SDimitry Andric AllWidenableFloatVectors, isSEWAware=1>; 717106c3fb27SDimitry Andricdefm : VPatTernaryW_VV_VX_RM<"int_riscv_vfwnmacc", "PseudoVFWNMACC", 7172*0fca6ea1SDimitry Andric AllWidenableFloatVectors, isSEWAware=1>; 717306c3fb27SDimitry Andricdefm : VPatTernaryW_VV_VX_RM<"int_riscv_vfwmsac", "PseudoVFWMSAC", 7174*0fca6ea1SDimitry Andric AllWidenableFloatVectors, isSEWAware=1>; 717506c3fb27SDimitry Andricdefm : VPatTernaryW_VV_VX_RM<"int_riscv_vfwnmsac", "PseudoVFWNMSAC", 7176*0fca6ea1SDimitry Andric AllWidenableFloatVectors, isSEWAware=1>; 71775f757f3fSDimitry Andriclet Predicates = [HasStdExtZvfbfwma] in 71785f757f3fSDimitry Andricdefm : VPatTernaryW_VV_VX_RM<"int_riscv_vfwmaccbf16", "PseudoVFWMACCBF16", 7179*0fca6ea1SDimitry Andric AllWidenableBFloatToFloatVectors, isSEWAware=1>; 7180e8d8bef9SDimitry Andric 7181e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7182bdd1243dSDimitry Andric// 13.8. Vector Floating-Point Square-Root Instruction 7183e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 718406c3fb27SDimitry Andricdefm : VPatUnaryV_V_RM<"int_riscv_vfsqrt", "PseudoVFSQRT", AllFloatVectors, isSEWAware=1>; 7185e8d8bef9SDimitry Andric 7186e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7187bdd1243dSDimitry Andric// 13.9. Vector Floating-Point Reciprocal Square-Root Estimate Instruction 7188e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7189*0fca6ea1SDimitry Andricdefm : VPatUnaryV_V<"int_riscv_vfrsqrt7", "PseudoVFRSQRT7", AllFloatVectors, isSEWAware=1>; 7190e8d8bef9SDimitry Andric 7191e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7192bdd1243dSDimitry Andric// 13.10. Vector Floating-Point Reciprocal Estimate Instruction 7193e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7194*0fca6ea1SDimitry Andricdefm : VPatUnaryV_V_RM<"int_riscv_vfrec7", "PseudoVFREC7", AllFloatVectors, isSEWAware=1>; 7195e8d8bef9SDimitry Andric 7196e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7197bdd1243dSDimitry Andric// 13.11. Vector Floating-Point Min/Max Instructions 7198e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7199*0fca6ea1SDimitry Andricdefm : VPatBinaryV_VV_VX<"int_riscv_vfmin", "PseudoVFMIN", AllFloatVectors, 7200*0fca6ea1SDimitry Andric isSEWAware=1>; 7201*0fca6ea1SDimitry Andricdefm : VPatBinaryV_VV_VX<"int_riscv_vfmax", "PseudoVFMAX", AllFloatVectors, 7202*0fca6ea1SDimitry Andric isSEWAware=1>; 7203e8d8bef9SDimitry Andric 7204e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7205bdd1243dSDimitry Andric// 13.12. Vector Floating-Point Sign-Injection Instructions 7206e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7207*0fca6ea1SDimitry Andricdefm : VPatBinaryV_VV_VX<"int_riscv_vfsgnj", "PseudoVFSGNJ", AllFloatVectors, 7208*0fca6ea1SDimitry Andric isSEWAware=1>; 7209*0fca6ea1SDimitry Andricdefm : VPatBinaryV_VV_VX<"int_riscv_vfsgnjn", "PseudoVFSGNJN", AllFloatVectors, 7210*0fca6ea1SDimitry Andric isSEWAware=1>; 7211*0fca6ea1SDimitry Andricdefm : VPatBinaryV_VV_VX<"int_riscv_vfsgnjx", "PseudoVFSGNJX", AllFloatVectors, 7212*0fca6ea1SDimitry Andric isSEWAware=1>; 7213e8d8bef9SDimitry Andric 7214e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7215bdd1243dSDimitry Andric// 13.13. Vector Floating-Point Compare Instructions 7216e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7217fe6060f1SDimitry Andricdefm : VPatBinaryM_VV_VX<"int_riscv_vmfeq", "PseudoVMFEQ", AllFloatVectors>; 7218fe6060f1SDimitry Andricdefm : VPatBinaryM_VV_VX<"int_riscv_vmfle", "PseudoVMFLE", AllFloatVectors>; 7219fe6060f1SDimitry Andricdefm : VPatBinaryM_VV_VX<"int_riscv_vmflt", "PseudoVMFLT", AllFloatVectors>; 7220fe6060f1SDimitry Andricdefm : VPatBinaryM_VV_VX<"int_riscv_vmfne", "PseudoVMFNE", AllFloatVectors>; 7221fe6060f1SDimitry Andricdefm : VPatBinaryM_VX<"int_riscv_vmfgt", "PseudoVMFGT", AllFloatVectors>; 7222fe6060f1SDimitry Andricdefm : VPatBinaryM_VX<"int_riscv_vmfge", "PseudoVMFGE", AllFloatVectors>; 7223fe6060f1SDimitry Andricdefm : VPatBinarySwappedM_VV<"int_riscv_vmfgt", "PseudoVMFLT", AllFloatVectors>; 7224fe6060f1SDimitry Andricdefm : VPatBinarySwappedM_VV<"int_riscv_vmfge", "PseudoVMFLE", AllFloatVectors>; 7225e8d8bef9SDimitry Andric 7226e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7227bdd1243dSDimitry Andric// 13.14. Vector Floating-Point Classify Instruction 7228e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 722981ad6265SDimitry Andricdefm : VPatConversionVI_VF<"int_riscv_vfclass", "PseudoVFCLASS">; 7230e8d8bef9SDimitry Andric 7231e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7232bdd1243dSDimitry Andric// 13.15. Vector Floating-Point Merge Instruction 7233e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7234e8d8bef9SDimitry Andric// We can use vmerge.vvm to support vector-vector vfmerge. 7235349cc55cSDimitry Andric// NOTE: Clang previously used int_riscv_vfmerge for vector-vector, but now uses 7236349cc55cSDimitry Andric// int_riscv_vmerge. Support both for compatibility. 723706c3fb27SDimitry Andricforeach vti = AllFloatVectors in { 723806c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in { 723906c3fb27SDimitry Andric defm : VPatBinaryCarryInTAIL<"int_riscv_vmerge", "PseudoVMERGE", "VVM", 724006c3fb27SDimitry Andric vti.Vector, 724106c3fb27SDimitry Andric vti.Vector, vti.Vector, vti.Mask, 724206c3fb27SDimitry Andric vti.Log2SEW, vti.LMul, vti.RegClass, 724306c3fb27SDimitry Andric vti.RegClass, vti.RegClass>; 724406c3fb27SDimitry Andric defm : VPatBinaryCarryInTAIL<"int_riscv_vfmerge", "PseudoVMERGE", "VVM", 724506c3fb27SDimitry Andric vti.Vector, 724606c3fb27SDimitry Andric vti.Vector, vti.Vector, vti.Mask, 724706c3fb27SDimitry Andric vti.Log2SEW, vti.LMul, vti.RegClass, 724806c3fb27SDimitry Andric vti.RegClass, vti.RegClass>; 724906c3fb27SDimitry Andric defm : VPatBinaryCarryInTAIL<"int_riscv_vfmerge", "PseudoVFMERGE", 725006c3fb27SDimitry Andric "V"#vti.ScalarSuffix#"M", 725106c3fb27SDimitry Andric vti.Vector, 725206c3fb27SDimitry Andric vti.Vector, vti.Scalar, vti.Mask, 725306c3fb27SDimitry Andric vti.Log2SEW, vti.LMul, vti.RegClass, 725406c3fb27SDimitry Andric vti.RegClass, vti.ScalarRegClass>; 725506c3fb27SDimitry Andric } 725606c3fb27SDimitry Andric} 7257e8d8bef9SDimitry Andric 7258e8d8bef9SDimitry Andricforeach fvti = AllFloatVectors in { 7259e8d8bef9SDimitry Andric defvar instr = !cast<Instruction>("PseudoVMERGE_VIM_"#fvti.LMul.MX); 726006c3fb27SDimitry Andric let Predicates = GetVTypePredicates<fvti>.Predicates in 726181ad6265SDimitry Andric def : Pat<(fvti.Vector (int_riscv_vfmerge (fvti.Vector fvti.RegClass:$merge), 726281ad6265SDimitry Andric (fvti.Vector fvti.RegClass:$rs2), 726381ad6265SDimitry Andric (fvti.Scalar (fpimm0)), 726481ad6265SDimitry Andric (fvti.Mask V0), VLOpFrag)), 726506c3fb27SDimitry Andric (instr fvti.RegClass:$merge, fvti.RegClass:$rs2, 0, 726681ad6265SDimitry Andric (fvti.Mask V0), GPR:$vl, fvti.Log2SEW)>; 7267e8d8bef9SDimitry Andric} 7268e8d8bef9SDimitry Andric 7269e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7270bdd1243dSDimitry Andric// 13.17. Single-Width Floating-Point/Integer Type-Convert Instructions 7271e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7272*0fca6ea1SDimitry Andricdefm : VPatConversionVI_VF_RTZ<"int_riscv_vfcvt_x_f_v", "PseudoVFCVT_RTZ_X_F">; 7273*0fca6ea1SDimitry Andricdefm : VPatConversionVI_VF_RTZ<"int_riscv_vfcvt_xu_f_v", "PseudoVFCVT_RTZ_XU_F">; 727406c3fb27SDimitry Andricdefm : VPatConversionVI_VF_RM<"int_riscv_vfcvt_x_f_v", "PseudoVFCVT_X_F">; 727506c3fb27SDimitry Andricdefm : VPatConversionVI_VF_RM<"int_riscv_vfcvt_xu_f_v", "PseudoVFCVT_XU_F">; 7276fe6060f1SDimitry Andricdefm : VPatConversionVI_VF<"int_riscv_vfcvt_rtz_xu_f_v", "PseudoVFCVT_RTZ_XU_F">; 7277fe6060f1SDimitry Andricdefm : VPatConversionVI_VF<"int_riscv_vfcvt_rtz_x_f_v", "PseudoVFCVT_RTZ_X_F">; 7278*0fca6ea1SDimitry Andricdefm : VPatConversionVF_VI_RM<"int_riscv_vfcvt_f_x_v", "PseudoVFCVT_F_X", 7279*0fca6ea1SDimitry Andric isSEWAware=1>; 7280*0fca6ea1SDimitry Andricdefm : VPatConversionVF_VI_RM<"int_riscv_vfcvt_f_xu_v", "PseudoVFCVT_F_XU", 7281*0fca6ea1SDimitry Andric isSEWAware=1>; 7282e8d8bef9SDimitry Andric 7283e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7284bdd1243dSDimitry Andric// 13.18. Widening Floating-Point/Integer Type-Convert Instructions 7285e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7286*0fca6ea1SDimitry Andricdefm : VPatConversionWI_VF_RTZ<"int_riscv_vfwcvt_xu_f_v", "PseudoVFWCVT_RTZ_XU_F">; 7287*0fca6ea1SDimitry Andricdefm : VPatConversionWI_VF_RTZ<"int_riscv_vfwcvt_x_f_v", "PseudoVFWCVT_RTZ_X_F">; 728806c3fb27SDimitry Andricdefm : VPatConversionWI_VF_RM<"int_riscv_vfwcvt_xu_f_v", "PseudoVFWCVT_XU_F">; 728906c3fb27SDimitry Andricdefm : VPatConversionWI_VF_RM<"int_riscv_vfwcvt_x_f_v", "PseudoVFWCVT_X_F">; 7290fe6060f1SDimitry Andricdefm : VPatConversionWI_VF<"int_riscv_vfwcvt_rtz_xu_f_v", "PseudoVFWCVT_RTZ_XU_F">; 7291fe6060f1SDimitry Andricdefm : VPatConversionWI_VF<"int_riscv_vfwcvt_rtz_x_f_v", "PseudoVFWCVT_RTZ_X_F">; 7292*0fca6ea1SDimitry Andricdefm : VPatConversionWF_VI<"int_riscv_vfwcvt_f_xu_v", "PseudoVFWCVT_F_XU", 7293*0fca6ea1SDimitry Andric isSEWAware=1>; 7294*0fca6ea1SDimitry Andricdefm : VPatConversionWF_VI<"int_riscv_vfwcvt_f_x_v", "PseudoVFWCVT_F_X", 7295*0fca6ea1SDimitry Andric isSEWAware=1>; 7296*0fca6ea1SDimitry Andricdefm : VPatConversionWF_VF<"int_riscv_vfwcvt_f_f_v", "PseudoVFWCVT_F_F", 7297*0fca6ea1SDimitry Andric isSEWAware=1>; 72985f757f3fSDimitry Andricdefm : VPatConversionWF_VF_BF<"int_riscv_vfwcvtbf16_f_f_v", 7299*0fca6ea1SDimitry Andric "PseudoVFWCVTBF16_F_F", isSEWAware=1>; 7300e8d8bef9SDimitry Andric 7301e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7302bdd1243dSDimitry Andric// 13.19. Narrowing Floating-Point/Integer Type-Convert Instructions 7303e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7304*0fca6ea1SDimitry Andricdefm : VPatConversionVI_WF_RTZ<"int_riscv_vfncvt_xu_f_w", "PseudoVFNCVT_RTZ_XU_F">; 7305*0fca6ea1SDimitry Andricdefm : VPatConversionVI_WF_RTZ<"int_riscv_vfncvt_x_f_w", "PseudoVFNCVT_RTZ_X_F">; 730606c3fb27SDimitry Andricdefm : VPatConversionVI_WF_RM<"int_riscv_vfncvt_xu_f_w", "PseudoVFNCVT_XU_F">; 730706c3fb27SDimitry Andricdefm : VPatConversionVI_WF_RM<"int_riscv_vfncvt_x_f_w", "PseudoVFNCVT_X_F">; 7308fe6060f1SDimitry Andricdefm : VPatConversionVI_WF<"int_riscv_vfncvt_rtz_xu_f_w", "PseudoVFNCVT_RTZ_XU_F">; 7309fe6060f1SDimitry Andricdefm : VPatConversionVI_WF<"int_riscv_vfncvt_rtz_x_f_w", "PseudoVFNCVT_RTZ_X_F">; 7310*0fca6ea1SDimitry Andricdefm : VPatConversionVF_WI_RM<"int_riscv_vfncvt_f_xu_w", "PseudoVFNCVT_F_XU", 7311*0fca6ea1SDimitry Andric isSEWAware=1>; 7312*0fca6ea1SDimitry Andricdefm : VPatConversionVF_WI_RM<"int_riscv_vfncvt_f_x_w", "PseudoVFNCVT_F_X", 7313*0fca6ea1SDimitry Andric isSEWAware=1>; 73145f757f3fSDimitry Andricdefvar WidenableFloatVectorsExceptF16 = !filter(fvtiToFWti, AllWidenableFloatVectors, 73155f757f3fSDimitry Andric !ne(fvtiToFWti.Vti.Scalar, f16)); 73165f757f3fSDimitry Andricdefm : VPatConversionVF_WF_RM<"int_riscv_vfncvt_f_f_w", "PseudoVFNCVT_F_F", 7317*0fca6ea1SDimitry Andric WidenableFloatVectorsExceptF16, isSEWAware=1>; 73185f757f3fSDimitry Andric// Define vfncvt.f.f.w for f16 when Zvfhmin is enable. 73195f757f3fSDimitry Andricdefvar F16WidenableFloatVectors = !filter(fvtiToFWti, AllWidenableFloatVectors, 73205f757f3fSDimitry Andric !eq(fvtiToFWti.Vti.Scalar, f16)); 73215f757f3fSDimitry Andriclet Predicates = [HasVInstructionsF16Minimal] in 73225f757f3fSDimitry Andricdefm : VPatConversionVF_WF_RM<"int_riscv_vfncvt_f_f_w", "PseudoVFNCVT_F_F", 7323*0fca6ea1SDimitry Andric F16WidenableFloatVectors, isSEWAware=1>; 73245f757f3fSDimitry Andricdefm : VPatConversionVF_WF_BF_RM<"int_riscv_vfncvtbf16_f_f_w", 7325*0fca6ea1SDimitry Andric "PseudoVFNCVTBF16_F_F", isSEWAware=1>; 7326*0fca6ea1SDimitry Andricdefm : VPatConversionVF_WF<"int_riscv_vfncvt_rod_f_f_w", "PseudoVFNCVT_ROD_F_F", 7327*0fca6ea1SDimitry Andric isSEWAware=1>; 7328e8d8bef9SDimitry Andric 7329bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 7330bdd1243dSDimitry Andric// 14. Vector Reduction Operations 7331bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 7332bdd1243dSDimitry Andric 7333e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7334bdd1243dSDimitry Andric// 14.1. Vector Single-Width Integer Reduction Instructions 7335e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7336fe6060f1SDimitry Andricdefm : VPatReductionV_VS<"int_riscv_vredsum", "PseudoVREDSUM">; 7337fe6060f1SDimitry Andricdefm : VPatReductionV_VS<"int_riscv_vredand", "PseudoVREDAND">; 7338fe6060f1SDimitry Andricdefm : VPatReductionV_VS<"int_riscv_vredor", "PseudoVREDOR">; 7339fe6060f1SDimitry Andricdefm : VPatReductionV_VS<"int_riscv_vredxor", "PseudoVREDXOR">; 7340fe6060f1SDimitry Andricdefm : VPatReductionV_VS<"int_riscv_vredminu", "PseudoVREDMINU">; 7341fe6060f1SDimitry Andricdefm : VPatReductionV_VS<"int_riscv_vredmin", "PseudoVREDMIN">; 7342fe6060f1SDimitry Andricdefm : VPatReductionV_VS<"int_riscv_vredmaxu", "PseudoVREDMAXU">; 7343fe6060f1SDimitry Andricdefm : VPatReductionV_VS<"int_riscv_vredmax", "PseudoVREDMAX">; 7344e8d8bef9SDimitry Andric 7345e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7346bdd1243dSDimitry Andric// 14.2. Vector Widening Integer Reduction Instructions 7347e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7348fe6060f1SDimitry Andricdefm : VPatReductionW_VS<"int_riscv_vwredsumu", "PseudoVWREDSUMU">; 7349fe6060f1SDimitry Andricdefm : VPatReductionW_VS<"int_riscv_vwredsum", "PseudoVWREDSUM">; 7350e8d8bef9SDimitry Andric 7351e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7352bdd1243dSDimitry Andric// 14.3. Vector Single-Width Floating-Point Reduction Instructions 7353e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 735406c3fb27SDimitry Andricdefm : VPatReductionV_VS_RM<"int_riscv_vfredosum", "PseudoVFREDOSUM", IsFloat=1>; 735506c3fb27SDimitry Andricdefm : VPatReductionV_VS_RM<"int_riscv_vfredusum", "PseudoVFREDUSUM", IsFloat=1>; 735606c3fb27SDimitry Andricdefm : VPatReductionV_VS<"int_riscv_vfredmin", "PseudoVFREDMIN", IsFloat=1>; 735706c3fb27SDimitry Andricdefm : VPatReductionV_VS<"int_riscv_vfredmax", "PseudoVFREDMAX", IsFloat=1>; 7358e8d8bef9SDimitry Andric 7359e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7360bdd1243dSDimitry Andric// 14.4. Vector Widening Floating-Point Reduction Instructions 7361e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 736206c3fb27SDimitry Andricdefm : VPatReductionW_VS_RM<"int_riscv_vfwredusum", "PseudoVFWREDUSUM", IsFloat=1>; 736306c3fb27SDimitry Andricdefm : VPatReductionW_VS_RM<"int_riscv_vfwredosum", "PseudoVFWREDOSUM", IsFloat=1>; 7364e8d8bef9SDimitry Andric 7365e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7366bdd1243dSDimitry Andric// 15. Vector Mask Instructions 7367e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7368e8d8bef9SDimitry Andric 7369e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7370bdd1243dSDimitry Andric// 15.1 Vector Mask-Register Logical Instructions 7371e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7372fe6060f1SDimitry Andricdefm : VPatBinaryM_MM<"int_riscv_vmand", "PseudoVMAND">; 7373fe6060f1SDimitry Andricdefm : VPatBinaryM_MM<"int_riscv_vmnand", "PseudoVMNAND">; 7374349cc55cSDimitry Andricdefm : VPatBinaryM_MM<"int_riscv_vmandn", "PseudoVMANDN">; 7375fe6060f1SDimitry Andricdefm : VPatBinaryM_MM<"int_riscv_vmxor", "PseudoVMXOR">; 7376fe6060f1SDimitry Andricdefm : VPatBinaryM_MM<"int_riscv_vmor", "PseudoVMOR">; 7377fe6060f1SDimitry Andricdefm : VPatBinaryM_MM<"int_riscv_vmnor", "PseudoVMNOR">; 7378349cc55cSDimitry Andricdefm : VPatBinaryM_MM<"int_riscv_vmorn", "PseudoVMORN">; 7379fe6060f1SDimitry Andricdefm : VPatBinaryM_MM<"int_riscv_vmxnor", "PseudoVMXNOR">; 7380e8d8bef9SDimitry Andric 7381e8d8bef9SDimitry Andric// pseudo instructions 7382fe6060f1SDimitry Andricdefm : VPatNullaryM<"int_riscv_vmclr", "PseudoVMCLR">; 7383fe6060f1SDimitry Andricdefm : VPatNullaryM<"int_riscv_vmset", "PseudoVMSET">; 7384e8d8bef9SDimitry Andric 7385e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7386bdd1243dSDimitry Andric// 15.2. Vector count population in mask vcpop.m 7387e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7388349cc55cSDimitry Andricdefm : VPatUnaryS_M<"int_riscv_vcpop", "PseudoVCPOP">; 7389e8d8bef9SDimitry Andric 7390e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7391bdd1243dSDimitry Andric// 15.3. vfirst find-first-set mask bit 7392e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7393fe6060f1SDimitry Andricdefm : VPatUnaryS_M<"int_riscv_vfirst", "PseudoVFIRST">; 7394e8d8bef9SDimitry Andric 7395e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7396bdd1243dSDimitry Andric// 15.4. vmsbf.m set-before-first mask bit 7397e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7398fe6060f1SDimitry Andricdefm : VPatUnaryM_M<"int_riscv_vmsbf", "PseudoVMSBF">; 7399e8d8bef9SDimitry Andric 7400e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7401bdd1243dSDimitry Andric// 15.5. vmsif.m set-including-first mask bit 7402e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7403fe6060f1SDimitry Andricdefm : VPatUnaryM_M<"int_riscv_vmsif", "PseudoVMSIF">; 7404e8d8bef9SDimitry Andric 7405e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7406bdd1243dSDimitry Andric// 15.6. vmsof.m set-only-first mask bit 7407e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7408fe6060f1SDimitry Andricdefm : VPatUnaryM_M<"int_riscv_vmsof", "PseudoVMSOF">; 7409e8d8bef9SDimitry Andric 7410e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7411bdd1243dSDimitry Andric// 15.8. Vector Iota Instruction 7412e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7413fe6060f1SDimitry Andricdefm : VPatUnaryV_M<"int_riscv_viota", "PseudoVIOTA">; 7414e8d8bef9SDimitry Andric 7415e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7416bdd1243dSDimitry Andric// 15.9. Vector Element Index Instruction 7417e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7418fe6060f1SDimitry Andricdefm : VPatNullaryV<"int_riscv_vid", "PseudoVID">; 7419e8d8bef9SDimitry Andric 7420e8d8bef9SDimitry Andric 7421e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7422bdd1243dSDimitry Andric// 16. Vector Permutation Instructions 7423e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7424e8d8bef9SDimitry Andric 7425e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7426bdd1243dSDimitry Andric// 16.1. Integer Scalar Move Instructions 7427e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7428e8d8bef9SDimitry Andric 74297a6dacacSDimitry Andricforeach vti = NoGroupIntegerVectors in { 743006c3fb27SDimitry Andric let Predicates = GetVTypePredicates<vti>.Predicates in 743106c3fb27SDimitry Andric def : Pat<(XLenVT (riscv_vmv_x_s (vti.Vector vti.RegClass:$rs2))), 74327a6dacacSDimitry Andric (PseudoVMV_X_S $rs2, vti.Log2SEW)>; 7433fe6060f1SDimitry Andric // vmv.s.x is handled with a custom node in RISCVInstrInfoVVLPatterns.td 7434e8d8bef9SDimitry Andric} 7435e8d8bef9SDimitry Andric 7436e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7437bdd1243dSDimitry Andric// 16.3. Vector Slide Instructions 7438e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7439fe6060f1SDimitry Andricdefm : VPatTernaryV_VX_VI<"int_riscv_vslideup", "PseudoVSLIDEUP", AllIntegerVectors, uimm5>; 7440fe6060f1SDimitry Andricdefm : VPatTernaryV_VX_VI<"int_riscv_vslidedown", "PseudoVSLIDEDOWN", AllIntegerVectors, uimm5>; 7441fe6060f1SDimitry Andricdefm : VPatBinaryV_VX<"int_riscv_vslide1up", "PseudoVSLIDE1UP", AllIntegerVectors>; 7442fe6060f1SDimitry Andricdefm : VPatBinaryV_VX<"int_riscv_vslide1down", "PseudoVSLIDE1DOWN", AllIntegerVectors>; 7443e8d8bef9SDimitry Andric 7444fe6060f1SDimitry Andricdefm : VPatTernaryV_VX_VI<"int_riscv_vslideup", "PseudoVSLIDEUP", AllFloatVectors, uimm5>; 7445fe6060f1SDimitry Andricdefm : VPatTernaryV_VX_VI<"int_riscv_vslidedown", "PseudoVSLIDEDOWN", AllFloatVectors, uimm5>; 7446fe6060f1SDimitry Andricdefm : VPatBinaryV_VX<"int_riscv_vfslide1up", "PseudoVFSLIDE1UP", AllFloatVectors>; 7447fe6060f1SDimitry Andricdefm : VPatBinaryV_VX<"int_riscv_vfslide1down", "PseudoVFSLIDE1DOWN", AllFloatVectors>; 7448e8d8bef9SDimitry Andric 7449e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7450bdd1243dSDimitry Andric// 16.4. Vector Register Gather Instructions 7451e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7452fe6060f1SDimitry Andricdefm : VPatBinaryV_VV_VX_VI_INT<"int_riscv_vrgather", "PseudoVRGATHER", 7453e8d8bef9SDimitry Andric AllIntegerVectors, uimm5>; 7454fe6060f1SDimitry Andricdefm : VPatBinaryV_VV_INT_EEW<"int_riscv_vrgatherei16_vv", "PseudoVRGATHEREI16", 745506c3fb27SDimitry Andric eew=16, vtilist=AllIntegerVectors>; 7456e8d8bef9SDimitry Andric 7457fe6060f1SDimitry Andricdefm : VPatBinaryV_VV_VX_VI_INT<"int_riscv_vrgather", "PseudoVRGATHER", 7458e8d8bef9SDimitry Andric AllFloatVectors, uimm5>; 7459fe6060f1SDimitry Andricdefm : VPatBinaryV_VV_INT_EEW<"int_riscv_vrgatherei16_vv", "PseudoVRGATHEREI16", 746006c3fb27SDimitry Andric eew=16, vtilist=AllFloatVectors>; 7461e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7462bdd1243dSDimitry Andric// 16.5. Vector Compress Instruction 7463e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 7464fe6060f1SDimitry Andricdefm : VPatUnaryV_V_AnyMask<"int_riscv_vcompress", "PseudoVCOMPRESS", AllIntegerVectors>; 746506c3fb27SDimitry Andricdefm : VPatUnaryV_V_AnyMask<"int_riscv_vcompress", "PseudoVCOMPRESS", AllFloatVectors>; 7466e8d8bef9SDimitry Andric 7467e8d8bef9SDimitry Andric// Include the non-intrinsic ISel patterns 7468fe6060f1SDimitry Andricinclude "RISCVInstrInfoVVLPatterns.td" 746981ad6265SDimitry Andricinclude "RISCVInstrInfoVSDPatterns.td" 7470