1//===-- RISCVInstrInfoV.td - RISC-V 'V' instructions -------*- tablegen -*-===// 2// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6// 7//===----------------------------------------------------------------------===// 8/// 9/// This file describes the RISC-V instructions from the standard 'V' Vector 10/// extension, version 0.10. 11/// This version is still experimental as the 'V' extension hasn't been 12/// ratified yet. 13/// 14//===----------------------------------------------------------------------===// 15 16include "RISCVInstrFormatsV.td" 17 18//===----------------------------------------------------------------------===// 19// Operand and SDNode transformation definitions. 20//===----------------------------------------------------------------------===// 21 22def VTypeIAsmOperand : AsmOperandClass { 23 let Name = "VTypeI"; 24 let ParserMethod = "parseVTypeI"; 25 let DiagnosticType = "InvalidVTypeI"; 26} 27 28def VTypeIOp : Operand<XLenVT> { 29 let ParserMatchClass = VTypeIAsmOperand; 30 let PrintMethod = "printVTypeI"; 31 let DecoderMethod = "decodeUImmOperand<11>"; 32} 33 34def VMaskAsmOperand : AsmOperandClass { 35 let Name = "RVVMaskRegOpOperand"; 36 let RenderMethod = "addRegOperands"; 37 let PredicateMethod = "isV0Reg"; 38 let ParserMethod = "parseMaskReg"; 39 let IsOptional = 1; 40 let DefaultMethod = "defaultMaskRegOp"; 41 let DiagnosticType = "InvalidVMaskRegister"; 42} 43 44def VMaskOp : RegisterOperand<VMV0> { 45 let ParserMatchClass = VMaskAsmOperand; 46 let PrintMethod = "printVMaskReg"; 47 let EncoderMethod = "getVMaskReg"; 48 let DecoderMethod = "decodeVMaskReg"; 49} 50 51def simm5 : Operand<XLenVT>, ImmLeaf<XLenVT, [{return isInt<5>(Imm);}]> { 52 let ParserMatchClass = SImmAsmOperand<5>; 53 let EncoderMethod = "getImmOpValue"; 54 let DecoderMethod = "decodeSImmOperand<5>"; 55 let MCOperandPredicate = [{ 56 int64_t Imm; 57 if (MCOp.evaluateAsConstantImm(Imm)) 58 return isInt<5>(Imm); 59 return MCOp.isBareSymbolRef(); 60 }]; 61} 62 63def SImm5Plus1AsmOperand : AsmOperandClass { 64 let Name = "SImm5Plus1"; 65 let RenderMethod = "addImmOperands"; 66 let DiagnosticType = "InvalidSImm5Plus1"; 67} 68 69def simm5_plus1 : Operand<XLenVT>, ImmLeaf<XLenVT, 70 [{return (isInt<5>(Imm) && Imm != -16) || Imm == 16;}]> { 71 let ParserMatchClass = SImm5Plus1AsmOperand; 72 let MCOperandPredicate = [{ 73 int64_t Imm; 74 if (MCOp.evaluateAsConstantImm(Imm)) 75 return (isInt<5>(Imm) && Imm != -16) || Imm == 16; 76 return MCOp.isBareSymbolRef(); 77 }]; 78} 79 80//===----------------------------------------------------------------------===// 81// Scheduling definitions. 82//===----------------------------------------------------------------------===// 83 84class VMVRSched<int n>: Sched <[!cast<SchedReadWrite>("WriteVMov" # n # "V"), 85 !cast<SchedReadWrite>("ReadVMov" # n # "V")]>; 86 87class VLESched<int n> : Sched <[!cast<SchedReadWrite>("WriteVLDE" # n), 88 ReadVLDX, ReadVMask]>; 89 90class VSESched<int n> : Sched <[!cast<SchedReadWrite>("WriteVSTE" # n), 91 !cast<SchedReadWrite>("ReadVSTE" # n # "V"), 92 ReadVSTX, ReadVMask]>; 93 94class VLSSched<int n> : Sched <[!cast<SchedReadWrite>("WriteVLDS" # n), 95 ReadVLDX, ReadVLDSX, ReadVMask]>; 96 97class VSSSched<int n> : Sched <[!cast<SchedReadWrite>("WriteVSTS" # n), 98 !cast<SchedReadWrite>("ReadVSTS" # n # "V"), 99 ReadVSTX, ReadVSTSX, ReadVMask]>; 100 101class VLXSched<int n, string o> : 102 Sched <[!cast<SchedReadWrite>("WriteVLD" # o # "X" # n), 103 ReadVLDX, !cast<SchedReadWrite>("ReadVLD" # o # "XV"), ReadVMask]>; 104 105class VSXSched<int n, string o> : 106 Sched <[!cast<SchedReadWrite>("WriteVST" # o # "X" # n), 107 !cast<SchedReadWrite>("ReadVST" # o # "X" # n), 108 ReadVSTX, !cast<SchedReadWrite>("ReadVST" # o # "XV"), ReadVMask]>; 109 110class VLFSched<int n> : Sched <[!cast<SchedReadWrite>("WriteVLDFF" # n), 111 ReadVLDX, ReadVMask]>; 112 113//===----------------------------------------------------------------------===// 114// Instruction class templates 115//===----------------------------------------------------------------------===// 116 117let hasSideEffects = 0, mayLoad = 1, mayStore = 0 in { 118// load vd, (rs1) 119class VUnitStrideLoadMask<string opcodestr> 120 : RVInstVLU<0b000, LSWidth8.Value{3}, LUMOPUnitStrideMask, LSWidth8.Value{2-0}, 121 (outs VR:$vd), 122 (ins GPR:$rs1), opcodestr, "$vd, (${rs1})"> { 123 let vm = 1; 124 let RVVConstraint = NoConstraint; 125} 126 127// load vd, (rs1), vm 128class VUnitStrideLoad<RISCVLSUMOP lumop, RISCVWidth width, 129 string opcodestr> 130 : RVInstVLU<0b000, width.Value{3}, lumop, width.Value{2-0}, 131 (outs VR:$vd), 132 (ins GPR:$rs1, VMaskOp:$vm), opcodestr, "$vd, (${rs1})$vm">; 133 134// load vd, (rs1), rs2, vm 135class VStridedLoad<RISCVWidth width, string opcodestr> 136 : RVInstVLS<0b000, width.Value{3}, width.Value{2-0}, 137 (outs VR:$vd), 138 (ins GPR:$rs1, GPR:$rs2, VMaskOp:$vm), opcodestr, 139 "$vd, (${rs1}), $rs2$vm">; 140 141// load vd, (rs1), vs2, vm 142class VIndexedLoad<RISCVMOP mop, RISCVWidth width, string opcodestr> 143 : RVInstVLX<0b000, width.Value{3}, mop, width.Value{2-0}, 144 (outs VR:$vd), 145 (ins GPR:$rs1, VR:$vs2, VMaskOp:$vm), opcodestr, 146 "$vd, (${rs1}), $vs2$vm">; 147 148// vl<nf>r.v vd, (rs1) 149class VWholeLoad<bits<3> nf, RISCVWidth width, string opcodestr, RegisterClass VRC> 150 : RVInstVLU<nf, width.Value{3}, LUMOPUnitStrideWholeReg, 151 width.Value{2-0}, (outs VRC:$vd), (ins GPR:$rs1), 152 opcodestr, "$vd, (${rs1})"> { 153 let vm = 1; 154 let Uses = []; 155 let RVVConstraint = NoConstraint; 156} 157 158// segment load vd, (rs1), vm 159class VUnitStrideSegmentLoad<bits<3> nf, RISCVLSUMOP lumop, 160 RISCVWidth width, string opcodestr> 161 : RVInstVLU<nf, width.Value{3}, lumop, width.Value{2-0}, 162 (outs VR:$vd), 163 (ins GPR:$rs1, VMaskOp:$vm), opcodestr, "$vd, (${rs1})$vm">; 164 165// segment load vd, (rs1), rs2, vm 166class VStridedSegmentLoad<bits<3> nf, RISCVWidth width, string opcodestr> 167 : RVInstVLS<nf, width.Value{3}, width.Value{2-0}, 168 (outs VR:$vd), 169 (ins GPR:$rs1, GPR:$rs2, VMaskOp:$vm), opcodestr, 170 "$vd, (${rs1}), $rs2$vm">; 171 172// segment load vd, (rs1), vs2, vm 173class VIndexedSegmentLoad<bits<3> nf, RISCVMOP mop, RISCVWidth width, 174 string opcodestr> 175 : RVInstVLX<nf, width.Value{3}, mop, width.Value{2-0}, 176 (outs VR:$vd), 177 (ins GPR:$rs1, VR:$vs2, VMaskOp:$vm), opcodestr, 178 "$vd, (${rs1}), $vs2$vm">; 179} // hasSideEffects = 0, mayLoad = 1, mayStore = 0 180 181let hasSideEffects = 0, mayLoad = 0, mayStore = 1 in { 182// store vd, vs3, (rs1) 183class VUnitStrideStoreMask<string opcodestr> 184 : RVInstVSU<0b000, LSWidth8.Value{3}, SUMOPUnitStrideMask, LSWidth8.Value{2-0}, 185 (outs), (ins VR:$vs3, GPR:$rs1), opcodestr, 186 "$vs3, (${rs1})"> { 187 let vm = 1; 188} 189 190// store vd, vs3, (rs1), vm 191class VUnitStrideStore<RISCVLSUMOP sumop, RISCVWidth width, 192 string opcodestr> 193 : RVInstVSU<0b000, width.Value{3}, sumop, width.Value{2-0}, 194 (outs), (ins VR:$vs3, GPR:$rs1, VMaskOp:$vm), opcodestr, 195 "$vs3, (${rs1})$vm">; 196 197// store vd, vs3, (rs1), rs2, vm 198class VStridedStore<RISCVWidth width, string opcodestr> 199 : RVInstVSS<0b000, width.Value{3}, width.Value{2-0}, (outs), 200 (ins VR:$vs3, GPR:$rs1, GPR:$rs2, VMaskOp:$vm), 201 opcodestr, "$vs3, (${rs1}), $rs2$vm">; 202 203// store vd, vs3, (rs1), vs2, vm 204class VIndexedStore<RISCVMOP mop, RISCVWidth width, string opcodestr> 205 : RVInstVSX<0b000, width.Value{3}, mop, width.Value{2-0}, (outs), 206 (ins VR:$vs3, GPR:$rs1, VR:$vs2, VMaskOp:$vm), 207 opcodestr, "$vs3, (${rs1}), $vs2$vm">; 208 209// vs<nf>r.v vd, (rs1) 210class VWholeStore<bits<3> nf, string opcodestr, RegisterClass VRC> 211 : RVInstVSU<nf, 0, SUMOPUnitStrideWholeReg, 212 0b000, (outs), (ins VRC:$vs3, GPR:$rs1), 213 opcodestr, "$vs3, (${rs1})"> { 214 let vm = 1; 215 let Uses = []; 216} 217 218// segment store vd, vs3, (rs1), vm 219class VUnitStrideSegmentStore<bits<3> nf, RISCVWidth width, string opcodestr> 220 : RVInstVSU<nf, width.Value{3}, SUMOPUnitStride, width.Value{2-0}, 221 (outs), (ins VR:$vs3, GPR:$rs1, VMaskOp:$vm), opcodestr, 222 "$vs3, (${rs1})$vm">; 223 224// segment store vd, vs3, (rs1), rs2, vm 225class VStridedSegmentStore<bits<3> nf, RISCVWidth width, string opcodestr> 226 : RVInstVSS<nf, width.Value{3}, width.Value{2-0}, (outs), 227 (ins VR:$vs3, GPR:$rs1, GPR:$rs2, VMaskOp:$vm), 228 opcodestr, "$vs3, (${rs1}), $rs2$vm">; 229 230// segment store vd, vs3, (rs1), vs2, vm 231class VIndexedSegmentStore<bits<3> nf, RISCVMOP mop, RISCVWidth width, 232 string opcodestr> 233 : RVInstVSX<nf, width.Value{3}, mop, width.Value{2-0}, (outs), 234 (ins VR:$vs3, GPR:$rs1, VR:$vs2, VMaskOp:$vm), 235 opcodestr, "$vs3, (${rs1}), $vs2$vm">; 236} // hasSideEffects = 0, mayLoad = 0, mayStore = 1 237 238let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in { 239// op vd, vs2, vs1, vm 240class VALUVV<bits<6> funct6, RISCVVFormat opv, string opcodestr> 241 : RVInstVV<funct6, opv, (outs VR:$vd), 242 (ins VR:$vs2, VR:$vs1, VMaskOp:$vm), 243 opcodestr, "$vd, $vs2, $vs1$vm">; 244 245// op vd, vs2, vs1, v0 (without mask, use v0 as carry input) 246class VALUmVV<bits<6> funct6, RISCVVFormat opv, string opcodestr> 247 : RVInstVV<funct6, opv, (outs VR:$vd), 248 (ins VR:$vs2, VR:$vs1, VMV0:$v0), 249 opcodestr, "$vd, $vs2, $vs1, v0"> { 250 let vm = 0; 251} 252 253// op vd, vs1, vs2, vm (reverse the order of vs1 and vs2) 254class VALUrVV<bits<6> funct6, RISCVVFormat opv, string opcodestr> 255 : RVInstVV<funct6, opv, (outs VR:$vd), 256 (ins VR:$vs1, VR:$vs2, VMaskOp:$vm), 257 opcodestr, "$vd, $vs1, $vs2$vm">; 258 259// op vd, vs2, vs1 260class VALUVVNoVm<bits<6> funct6, RISCVVFormat opv, string opcodestr> 261 : RVInstVV<funct6, opv, (outs VR:$vd), 262 (ins VR:$vs2, VR:$vs1), 263 opcodestr, "$vd, $vs2, $vs1"> { 264 let vm = 1; 265} 266 267// op vd, vs2, rs1, vm 268class VALUVX<bits<6> funct6, RISCVVFormat opv, string opcodestr> 269 : RVInstVX<funct6, opv, (outs VR:$vd), 270 (ins VR:$vs2, GPR:$rs1, VMaskOp:$vm), 271 opcodestr, "$vd, $vs2, $rs1$vm">; 272 273// op vd, vs2, rs1, v0 (without mask, use v0 as carry input) 274class VALUmVX<bits<6> funct6, RISCVVFormat opv, string opcodestr> 275 : RVInstVX<funct6, opv, (outs VR:$vd), 276 (ins VR:$vs2, GPR:$rs1, VMV0:$v0), 277 opcodestr, "$vd, $vs2, $rs1, v0"> { 278 let vm = 0; 279} 280 281// op vd, rs1, vs2, vm (reverse the order of rs1 and vs2) 282class VALUrVX<bits<6> funct6, RISCVVFormat opv, string opcodestr> 283 : RVInstVX<funct6, opv, (outs VR:$vd), 284 (ins GPR:$rs1, VR:$vs2, VMaskOp:$vm), 285 opcodestr, "$vd, $rs1, $vs2$vm">; 286 287// op vd, vs1, vs2 288class VALUVXNoVm<bits<6> funct6, RISCVVFormat opv, string opcodestr> 289 : RVInstVX<funct6, opv, (outs VR:$vd), 290 (ins VR:$vs2, GPR:$rs1), 291 opcodestr, "$vd, $vs2, $rs1"> { 292 let vm = 1; 293} 294 295// op vd, vs2, imm, vm 296class VALUVI<bits<6> funct6, string opcodestr, Operand optype = simm5> 297 : RVInstIVI<funct6, (outs VR:$vd), 298 (ins VR:$vs2, optype:$imm, VMaskOp:$vm), 299 opcodestr, "$vd, $vs2, $imm$vm">; 300 301// op vd, vs2, imm, v0 (without mask, use v0 as carry input) 302class VALUmVI<bits<6> funct6, string opcodestr, Operand optype = simm5> 303 : RVInstIVI<funct6, (outs VR:$vd), 304 (ins VR:$vs2, optype:$imm, VMV0:$v0), 305 opcodestr, "$vd, $vs2, $imm, v0"> { 306 let vm = 0; 307} 308 309// op vd, vs2, imm, vm 310class VALUVINoVm<bits<6> funct6, string opcodestr, Operand optype = simm5> 311 : RVInstIVI<funct6, (outs VR:$vd), 312 (ins VR:$vs2, optype:$imm), 313 opcodestr, "$vd, $vs2, $imm"> { 314 let vm = 1; 315} 316 317// op vd, vs2, rs1, vm (Float) 318class VALUVF<bits<6> funct6, RISCVVFormat opv, string opcodestr> 319 : RVInstVX<funct6, opv, (outs VR:$vd), 320 (ins VR:$vs2, FPR32:$rs1, VMaskOp:$vm), 321 opcodestr, "$vd, $vs2, $rs1$vm">; 322 323// op vd, rs1, vs2, vm (Float) (with mask, reverse the order of rs1 and vs2) 324class VALUrVF<bits<6> funct6, RISCVVFormat opv, string opcodestr> 325 : RVInstVX<funct6, opv, (outs VR:$vd), 326 (ins FPR32:$rs1, VR:$vs2, VMaskOp:$vm), 327 opcodestr, "$vd, $rs1, $vs2$vm">; 328 329// op vd, vs2, vm (use vs1 as instruction encoding) 330class VALUVs2<bits<6> funct6, bits<5> vs1, RISCVVFormat opv, string opcodestr> 331 : RVInstV<funct6, vs1, opv, (outs VR:$vd), 332 (ins VR:$vs2, VMaskOp:$vm), 333 opcodestr, "$vd, $vs2$vm">; 334} // hasSideEffects = 0, mayLoad = 0, mayStore = 0 335 336let hasSideEffects = 0, mayLoad = 1, mayStore = 1 in { 337// vamo vd, (rs1), vs2, vd, vm 338class VAMOWd<RISCVAMOOP amoop, RISCVWidth width, string opcodestr> 339 : RVInstVAMO<amoop, width.Value{2-0}, (outs VR:$vd_wd), 340 (ins GPR:$rs1, VR:$vs2, VR:$vd, VMaskOp:$vm), 341 opcodestr, "$vd_wd, (${rs1}), $vs2, $vd$vm"> { 342 let Constraints = "$vd_wd = $vd"; 343 let wd = 1; 344 bits<5> vd; 345 let Inst{11-7} = vd; 346} 347 348// vamo x0, (rs1), vs2, vs3, vm 349class VAMONoWd<RISCVAMOOP amoop, RISCVWidth width, string opcodestr> 350 : RVInstVAMO<amoop, width.Value{2-0}, (outs), 351 (ins GPR:$rs1, VR:$vs2, VR:$vs3, VMaskOp:$vm), 352 opcodestr, "x0, (${rs1}), $vs2, $vs3$vm"> { 353 bits<5> vs3; 354 let Inst{11-7} = vs3; 355} 356 357} // hasSideEffects = 0, mayLoad = 1, mayStore = 1 358 359//===----------------------------------------------------------------------===// 360// Combination of instruction classes. 361// Use these multiclasses to define instructions more easily. 362//===----------------------------------------------------------------------===// 363multiclass VALU_IV_V_X_I<string opcodestr, bits<6> funct6, Operand optype = simm5, string vw = "v"> { 364 def V : VALUVV<funct6, OPIVV, opcodestr # "." # vw # "v">, 365 Sched<[WriteVIALUV, ReadVIALUV, ReadVIALUV, ReadVMask]>; 366 def X : VALUVX<funct6, OPIVX, opcodestr # "." # vw # "x">, 367 Sched<[WriteVIALUX, ReadVIALUV, ReadVIALUX, ReadVMask]>; 368 def I : VALUVI<funct6, opcodestr # "." # vw # "i", optype>, 369 Sched<[WriteVIALUI, ReadVIALUV, ReadVMask]>; 370} 371 372multiclass VALU_IV_V_X<string opcodestr, bits<6> funct6, string vw = "v"> { 373 def V : VALUVV<funct6, OPIVV, opcodestr # "." # vw # "v">, 374 Sched<[WriteVIALUV, ReadVIALUV, ReadVIALUV, ReadVMask]>; 375 def X : VALUVX<funct6, OPIVX, opcodestr # "." # vw # "x">, 376 Sched<[WriteVIALUX, ReadVIALUV, ReadVIALUX, ReadVMask]>; 377} 378 379multiclass VALU_IV_X_I<string opcodestr, bits<6> funct6, Operand optype = simm5, string vw = "v"> { 380 def X : VALUVX<funct6, OPIVX, opcodestr # "." # vw # "x">, 381 Sched<[WriteVIALUV, ReadVIALUV, ReadVIALUX, ReadVMask]>; 382 def I : VALUVI<funct6, opcodestr # "." # vw # "i", optype>, 383 Sched<[WriteVIALUI, ReadVIALUV, ReadVMask]>; 384} 385 386multiclass VALU_MV_V_X<string opcodestr, bits<6> funct6, string vw = "v"> { 387 def V : VALUVV<funct6, OPMVV, opcodestr # "." # vw # "v">, 388 Sched<[WriteVIWALUV, ReadVIWALUV, ReadVIWALUV, ReadVMask]>; 389 def X : VALUVX<funct6, OPMVX, opcodestr # "." # vw # "x">, 390 Sched<[WriteVIWALUX, ReadVIWALUV, ReadVIWALUX, ReadVMask]>; 391} 392 393multiclass VMAC_MV_V_X<string opcodestr, bits<6> funct6, string vw = "v"> { 394 def V : VALUrVV<funct6, OPMVV, opcodestr # "." # vw # "v">, 395 Sched<[WriteVIMulAddV, ReadVIMulAddV, ReadVIMulAddV, ReadVMask]>; 396 def X : VALUrVX<funct6, OPMVX, opcodestr # "." # vw # "x">, 397 Sched<[WriteVIMulAddX, ReadVIMulAddV, ReadVIMulAddX, ReadVMask]>; 398} 399 400multiclass VWMAC_MV_V_X<string opcodestr, bits<6> funct6, string vw = "v"> { 401 def V : VALUrVV<funct6, OPMVV, opcodestr # "." # vw # "v">, 402 Sched<[WriteVIWMulAddV, ReadVIWMulAddV, ReadVIWMulAddV, ReadVMask]>; 403 def X : VALUrVX<funct6, OPMVX, opcodestr # "." # vw # "x">, 404 Sched<[WriteVIWMulAddX, ReadVIWMulAddV, ReadVIWMulAddX, ReadVMask]>; 405} 406 407multiclass VWMAC_MV_X<string opcodestr, bits<6> funct6, string vw = "v"> { 408 def X : VALUrVX<funct6, OPMVX, opcodestr # "." # vw # "x">, 409 Sched<[WriteVIWMulAddX, ReadVIWMulAddV, ReadVIWMulAddX, ReadVMask]>; 410} 411 412multiclass VALU_MV_VS2<string opcodestr, bits<6> funct6, bits<5> vs1> { 413 def "" : VALUVs2<funct6, vs1, OPMVV, opcodestr>, 414 Sched<[WriteVExtV, ReadVExtV, ReadVMask]>; 415} 416 417multiclass VALUm_IV_V_X_I<string opcodestr, bits<6> funct6> { 418 def VM : VALUmVV<funct6, OPIVV, opcodestr # ".vvm">, 419 Sched<[WriteVICALUV, ReadVIALUCV, ReadVIALUCV, ReadVMask]>; 420 def XM : VALUmVX<funct6, OPIVX, opcodestr # ".vxm">, 421 Sched<[WriteVICALUX, ReadVIALUCV, ReadVIALUCX, ReadVMask]>; 422 def IM : VALUmVI<funct6, opcodestr # ".vim">, 423 Sched<[WriteVICALUI, ReadVIALUCV, ReadVMask]>; 424} 425 426multiclass VMRG_IV_V_X_I<string opcodestr, bits<6> funct6> { 427 def VM : VALUmVV<funct6, OPIVV, opcodestr # ".vvm">, 428 Sched<[WriteVIMergeV, ReadVIMergeV, ReadVIMergeV, ReadVMask]>; 429 def XM : VALUmVX<funct6, OPIVX, opcodestr # ".vxm">, 430 Sched<[WriteVIMergeX, ReadVIMergeV, ReadVIMergeX, ReadVMask]>; 431 def IM : VALUmVI<funct6, opcodestr # ".vim">, 432 Sched<[WriteVIMergeI, ReadVIMergeV, ReadVMask]>; 433} 434 435multiclass VALUm_IV_V_X<string opcodestr, bits<6> funct6> { 436 def VM : VALUmVV<funct6, OPIVV, opcodestr # ".vvm">, 437 Sched<[WriteVICALUV, ReadVIALUCV, ReadVIALUCV, ReadVMask]>; 438 def XM : VALUmVX<funct6, OPIVX, opcodestr # ".vxm">, 439 Sched<[WriteVICALUX, ReadVIALUCV, ReadVIALUCX, ReadVMask]>; 440} 441 442multiclass VALUNoVm_IV_V_X_I<string opcodestr, bits<6> funct6, Operand optype = simm5> { 443 def V : VALUVVNoVm<funct6, OPIVV, opcodestr # ".vv">, 444 Sched<[WriteVICALUV, ReadVIALUCV, ReadVIALUCV]>; 445 def X : VALUVXNoVm<funct6, OPIVX, opcodestr # ".vx">, 446 Sched<[WriteVICALUX, ReadVIALUCV, ReadVIALUCX]>; 447 def I : VALUVINoVm<funct6, opcodestr # ".vi", optype>, 448 Sched<[WriteVICALUI, ReadVIALUCV]>; 449} 450 451multiclass VALUNoVm_IV_V_X<string opcodestr, bits<6> funct6> { 452 def V : VALUVVNoVm<funct6, OPIVV, opcodestr # ".vv">, 453 Sched<[WriteVICALUV, ReadVIALUCV, ReadVIALUCV]>; 454 def X : VALUVXNoVm<funct6, OPIVX, opcodestr # ".vx">, 455 Sched<[WriteVICALUX, ReadVIALUCV, ReadVIALUCX]>; 456} 457 458multiclass VALU_FV_V_F<string opcodestr, bits<6> funct6, string vw = "v"> { 459 def V : VALUVV<funct6, OPFVV, opcodestr # "." # vw # "v">, 460 Sched<[WriteVFALUV, ReadVFALUV, ReadVFALUV, ReadVMask]>; 461 def F : VALUVF<funct6, OPFVF, opcodestr # "." # vw # "f">, 462 Sched<[WriteVFALUF, ReadVFALUV, ReadVFALUF, ReadVMask]>; 463} 464 465multiclass VALU_FV_F<string opcodestr, bits<6> funct6, string vw = "v"> { 466 def F : VALUVF<funct6, OPFVF, opcodestr # "." # vw # "f">, 467 Sched<[WriteVFALUF, ReadVFALUV, ReadVFALUF, ReadVMask]>; 468} 469 470multiclass VWALU_FV_V_F<string opcodestr, bits<6> funct6, string vw = "v"> { 471 def V : VALUVV<funct6, OPFVV, opcodestr # "." # vw # "v">, 472 Sched<[WriteVFWALUV, ReadVFWALUV, ReadVFWALUV, ReadVMask]>; 473 def F : VALUVF<funct6, OPFVF, opcodestr # "." # vw # "f">, 474 Sched<[WriteVFWALUF, ReadVFWALUV, ReadVFWALUF, ReadVMask]>; 475} 476 477multiclass VMUL_FV_V_F<string opcodestr, bits<6> funct6, string vw = "v"> { 478 def V : VALUVV<funct6, OPFVV, opcodestr # "." # vw # "v">, 479 Sched<[WriteVFMulV, ReadVFMulV, ReadVFMulV, ReadVMask]>; 480 def F : VALUVF<funct6, OPFVF, opcodestr # "." # vw # "f">, 481 Sched<[WriteVFMulF, ReadVFMulV, ReadVFMulF, ReadVMask]>; 482} 483 484multiclass VDIV_FV_V_F<string opcodestr, bits<6> funct6, string vw = "v"> { 485 def V : VALUVV<funct6, OPFVV, opcodestr # "." # vw # "v">, 486 Sched<[WriteVFDivV, ReadVFDivV, ReadVFDivV, ReadVMask]>; 487 def F : VALUVF<funct6, OPFVF, opcodestr # "." # vw # "f">, 488 Sched<[WriteVFDivF, ReadVFDivV, ReadVFDivF, ReadVMask]>; 489} 490 491multiclass VRDIV_FV_F<string opcodestr, bits<6> funct6, string vw = "v"> { 492 def F : VALUVF<funct6, OPFVF, opcodestr # "." # vw # "f">, 493 Sched<[WriteVFDivF, ReadVFDivV, ReadVFDivF, ReadVMask]>; 494} 495 496multiclass VWMUL_FV_V_F<string opcodestr, bits<6> funct6, string vw = "v"> { 497 def V : VALUVV<funct6, OPFVV, opcodestr # "." # vw # "v">, 498 Sched<[WriteVFWMulV, ReadVFWMulV, ReadVFWMulV, ReadVMask]>; 499 def F : VALUVF<funct6, OPFVF, opcodestr # "." # vw # "f">, 500 Sched<[WriteVFWMulF, ReadVFWMulV, ReadVFWMulF, ReadVMask]>; 501} 502 503multiclass VMAC_FV_V_F<string opcodestr, bits<6> funct6, string vw = "v"> { 504 def V : VALUrVV<funct6, OPFVV, opcodestr # "." # vw # "v">, 505 Sched<[WriteVFMulAddV, ReadVFMulAddV, ReadVFMulAddV, ReadVMask]>; 506 def F : VALUrVF<funct6, OPFVF, opcodestr # "." # vw # "f">, 507 Sched<[WriteVFMulAddF, ReadVFMulAddV, ReadVFMulAddF, ReadVMask]>; 508} 509 510multiclass VWMAC_FV_V_F<string opcodestr, bits<6> funct6, string vw = "v"> { 511 def V : VALUrVV<funct6, OPFVV, opcodestr # "." # vw # "v">, 512 Sched<[WriteVFWMulAddV, ReadVFWMulAddV, ReadVFWMulAddV, ReadVMask]>; 513 def F : VALUrVF<funct6, OPFVF, opcodestr # "." # vw # "f">, 514 Sched<[WriteVFWMulAddF, ReadVFWMulAddV, ReadVFWMulAddF, ReadVMask]>; 515} 516 517multiclass VSQR_FV_VS2<string opcodestr, bits<6> funct6, bits<5> vs1> { 518 def "" : VALUVs2<funct6, vs1, OPFVV, opcodestr>, 519 Sched<[WriteVFSqrtV, ReadVFSqrtV, ReadVMask]>; 520} 521 522multiclass VRCP_FV_VS2<string opcodestr, bits<6> funct6, bits<5> vs1> { 523 def "" : VALUVs2<funct6, vs1, OPFVV, opcodestr>, 524 Sched<[WriteVFRecpV, ReadVFRecpV, ReadVMask]>; 525} 526 527multiclass VCMP_FV_V_F<string opcodestr, bits<6> funct6, string vw = "v"> { 528 def V : VALUVV<funct6, OPFVV, opcodestr # "." # vw # "v">, 529 Sched<[WriteVFCmpV, ReadVFCmpV, ReadVFCmpV, ReadVMask]>; 530 def F : VALUVF<funct6, OPFVF, opcodestr # "." # vw # "f">, 531 Sched<[WriteVFCmpF, ReadVFCmpV, ReadVFCmpF, ReadVMask]>; 532} 533 534multiclass VCMP_FV_F<string opcodestr, bits<6> funct6, string vw = "v"> { 535 def F : VALUVF<funct6, OPFVF, opcodestr # "." # vw # "f">, 536 Sched<[WriteVFCmpF, ReadVFCmpV, ReadVFCmpF, ReadVMask]>; 537} 538 539multiclass VSGNJ_FV_V_F<string opcodestr, bits<6> funct6, string vw = "v"> { 540 def V : VALUVV<funct6, OPFVV, opcodestr # "." # vw # "v">, 541 Sched<[WriteVFSgnjV, ReadVFSgnjV, ReadVFSgnjV, ReadVMask]>; 542 def F : VALUVF<funct6, OPFVF, opcodestr # "." # vw # "f">, 543 Sched<[WriteVFSgnjF, ReadVFSgnjV, ReadVFSgnjF, ReadVMask]>; 544} 545 546multiclass VCLS_FV_VS2<string opcodestr, bits<6> funct6, bits<5> vs1> { 547 def "" : VALUVs2<funct6, vs1, OPFVV, opcodestr>, 548 Sched<[WriteVFClassV, ReadVFClassV, ReadVMask]>; 549} 550 551multiclass VCVTF_IV_VS2<string opcodestr, bits<6> funct6, bits<5> vs1> { 552 def "" : VALUVs2<funct6, vs1, OPFVV, opcodestr>, 553 Sched<[WriteVFCvtIToFV, ReadVFCvtIToFV, ReadVMask]>; 554} 555 556multiclass VCVTI_FV_VS2<string opcodestr, bits<6> funct6, bits<5> vs1> { 557 def "" : VALUVs2<funct6, vs1, OPFVV, opcodestr>, 558 Sched<[WriteVFCvtFToIV, ReadVFCvtFToIV, ReadVMask]>; 559} 560 561multiclass VWCVTF_IV_VS2<string opcodestr, bits<6> funct6, bits<5> vs1> { 562 def "" : VALUVs2<funct6, vs1, OPFVV, opcodestr>, 563 Sched<[WriteVFWCvtIToFV, ReadVFWCvtIToFV, ReadVMask]>; 564} 565 566multiclass VWCVTI_FV_VS2<string opcodestr, bits<6> funct6, bits<5> vs1> { 567 def "" : VALUVs2<funct6, vs1, OPFVV, opcodestr>, 568 Sched<[WriteVFWCvtFToIV, ReadVFWCvtFToIV, ReadVMask]>; 569} 570 571multiclass VWCVTF_FV_VS2<string opcodestr, bits<6> funct6, bits<5> vs1> { 572 def "" : VALUVs2<funct6, vs1, OPFVV, opcodestr>, 573 Sched<[WriteVFWCvtFToFV, ReadVFWCvtFToFV, ReadVMask]>; 574} 575 576multiclass VNCVTF_IV_VS2<string opcodestr, bits<6> funct6, bits<5> vs1> { 577 def "" : VALUVs2<funct6, vs1, OPFVV, opcodestr>, 578 Sched<[WriteVFNCvtIToFV, ReadVFNCvtIToFV, ReadVMask]>; 579} 580 581multiclass VNCVTI_FV_VS2<string opcodestr, bits<6> funct6, bits<5> vs1> { 582 def "" : VALUVs2<funct6, vs1, OPFVV, opcodestr>, 583 Sched<[WriteVFNCvtFToIV, ReadVFNCvtFToIV, ReadVMask]>; 584} 585 586multiclass VNCVTF_FV_VS2<string opcodestr, bits<6> funct6, bits<5> vs1> { 587 def "" : VALUVs2<funct6, vs1, OPFVV, opcodestr>, 588 Sched<[WriteVFNCvtFToFV, ReadVFNCvtFToFV, ReadVMask]>; 589} 590 591multiclass VRED_MV_V<string opcodestr, bits<6> funct6> { 592 def _VS : VALUVV<funct6, OPMVV, opcodestr # ".vs">, 593 Sched<[WriteVIRedV, ReadVIRedV, ReadVIRedV0, ReadVMask]>; 594} 595 596multiclass VWRED_IV_V<string opcodestr, bits<6> funct6> { 597 def _VS : VALUVV<funct6, OPIVV, opcodestr # ".vs">, 598 Sched<[WriteVIWRedV, ReadVIWRedV, ReadVIWRedV0, ReadVMask]>; 599} 600 601multiclass VRED_FV_V<string opcodestr, bits<6> funct6> { 602 def _VS : VALUVV<funct6, OPFVV, opcodestr # ".vs">, 603 Sched<[WriteVFRedV, ReadVFRedV, ReadVFRedV0, ReadVMask]>; 604} 605 606multiclass VREDO_FV_V<string opcodestr, bits<6> funct6> { 607 def _VS : VALUVV<funct6, OPFVV, opcodestr # ".vs">, 608 Sched<[WriteVFRedOV, ReadVFRedOV, ReadVFRedOV0, ReadVMask]>; 609} 610 611multiclass VWRED_FV_V<string opcodestr, bits<6> funct6> { 612 def _VS : VALUVV<funct6, OPFVV, opcodestr # ".vs">, 613 Sched<[WriteVFWRedV, ReadVFWRedV, ReadVFWRedV0, ReadVMask]>; 614} 615 616multiclass VWREDO_FV_V<string opcodestr, bits<6> funct6> { 617 def _VS : VALUVV<funct6, OPFVV, opcodestr # ".vs">, 618 Sched<[WriteVFWRedOV, ReadVFWRedOV, ReadVFWRedOV0, ReadVMask]>; 619} 620 621multiclass VMALU_MV_Mask<string opcodestr, bits<6> funct6, string vm = "v"> { 622 def M : VALUVVNoVm<funct6, OPMVV, opcodestr # "." # vm # "m">, 623 Sched<[WriteVMALUV, ReadVMALUV, ReadVMALUV]>; 624} 625 626multiclass VMSFS_MV_V<string opcodestr, bits<6> funct6, bits<5> vs1> { 627 def "" : VALUVs2<funct6, vs1, OPMVV, opcodestr>, 628 Sched<[WriteVMSFSV, ReadVMSFSV, ReadVMask]>; 629} 630 631multiclass VMIOT_MV_V<string opcodestr, bits<6> funct6, bits<5> vs1> { 632 def "" : VALUVs2<funct6, vs1, OPMVV, opcodestr>, 633 Sched<[WriteVMIotV, ReadVMIotV, ReadVMask]>; 634} 635 636multiclass VSHT_IV_V_X_I<string opcodestr, bits<6> funct6, Operand optype = simm5, string vw = "v"> { 637 def V : VALUVV<funct6, OPIVV, opcodestr # "." # vw # "v">, 638 Sched<[WriteVShiftV, ReadVShiftV, ReadVShiftV, ReadVMask]>; 639 def X : VALUVX<funct6, OPIVX, opcodestr # "." # vw # "x">, 640 Sched<[WriteVShiftX, ReadVShiftV, ReadVShiftX, ReadVMask]>; 641 def I : VALUVI<funct6, opcodestr # "." # vw # "i", optype>, 642 Sched<[WriteVShiftI, ReadVShiftV, ReadVMask]>; 643} 644 645multiclass VNSHT_IV_V_X_I<string opcodestr, bits<6> funct6, Operand optype = simm5, string vw = "v"> { 646 def V : VALUVV<funct6, OPIVV, opcodestr # "." # vw # "v">, 647 Sched<[WriteVNShiftV, ReadVNShiftV, ReadVNShiftV, ReadVMask]>; 648 def X : VALUVX<funct6, OPIVX, opcodestr # "." # vw # "x">, 649 Sched<[WriteVNShiftX, ReadVNShiftV, ReadVNShiftX, ReadVMask]>; 650 def I : VALUVI<funct6, opcodestr # "." # vw # "i", optype>, 651 Sched<[WriteVNShiftI, ReadVNShiftV, ReadVMask]>; 652} 653 654multiclass VCMP_IV_V_X_I<string opcodestr, bits<6> funct6, Operand optype = simm5, string vw = "v"> { 655 def V : VALUVV<funct6, OPIVV, opcodestr # "." # vw # "v">, 656 Sched<[WriteVICmpV, ReadVICmpV, ReadVICmpV, ReadVMask]>; 657 def X : VALUVX<funct6, OPIVX, opcodestr # "." # vw # "x">, 658 Sched<[WriteVICmpX, ReadVICmpV, ReadVICmpX, ReadVMask]>; 659 def I : VALUVI<funct6, opcodestr # "." # vw # "i", optype>, 660 Sched<[WriteVICmpI, ReadVICmpV, ReadVMask]>; 661} 662 663multiclass VCMP_IV_X_I<string opcodestr, bits<6> funct6, Operand optype = simm5, string vw = "v"> { 664 def X : VALUVX<funct6, OPIVX, opcodestr # "." # vw # "x">, 665 Sched<[WriteVICmpV, ReadVICmpV, ReadVICmpX, ReadVMask]>; 666 def I : VALUVI<funct6, opcodestr # "." # vw # "i", optype>, 667 Sched<[WriteVICmpI, ReadVICmpV, ReadVMask]>; 668} 669 670multiclass VCMP_IV_V_X<string opcodestr, bits<6> funct6, Operand optype = simm5, string vw = "v"> { 671 def V : VALUVV<funct6, OPIVV, opcodestr # "." # vw # "v">, 672 Sched<[WriteVICmpV, ReadVICmpV, ReadVICmpV, ReadVMask]>; 673 def X : VALUVX<funct6, OPIVX, opcodestr # "." # vw # "x">, 674 Sched<[WriteVICmpX, ReadVICmpV, ReadVICmpX, ReadVMask]>; 675} 676 677multiclass VMUL_MV_V_X<string opcodestr, bits<6> funct6, string vw = "v"> { 678 def V : VALUVV<funct6, OPMVV, opcodestr # "." # vw # "v">, 679 Sched<[WriteVIMulV, ReadVIMulV, ReadVIMulV, ReadVMask]>; 680 def X : VALUVX<funct6, OPMVX, opcodestr # "." # vw # "x">, 681 Sched<[WriteVIMulX, ReadVIMulV, ReadVIMulX, ReadVMask]>; 682} 683 684multiclass VWMUL_MV_V_X<string opcodestr, bits<6> funct6, string vw = "v"> { 685 def V : VALUVV<funct6, OPMVV, opcodestr # "." # vw # "v">, 686 Sched<[WriteVIWMulV, ReadVIWMulV, ReadVIWMulV, ReadVMask]>; 687 def X : VALUVX<funct6, OPMVX, opcodestr # "." # vw # "x">, 688 Sched<[WriteVIWMulX, ReadVIWMulV, ReadVIWMulX, ReadVMask]>; 689} 690 691multiclass VDIV_MV_V_X<string opcodestr, bits<6> funct6, string vw = "v"> { 692 def V : VALUVV<funct6, OPMVV, opcodestr # "." # vw # "v">, 693 Sched<[WriteVIDivV, ReadVIDivV, ReadVIDivV, ReadVMask]>; 694 def X : VALUVX<funct6, OPMVX, opcodestr # "." # vw # "x">, 695 Sched<[WriteVIDivX, ReadVIDivV, ReadVIDivX, ReadVMask]>; 696} 697 698multiclass VSALU_IV_V_X_I<string opcodestr, bits<6> funct6, Operand optype = simm5, string vw = "v"> { 699 def V : VALUVV<funct6, OPIVV, opcodestr # "." # vw # "v">, 700 Sched<[WriteVSALUV, ReadVSALUV, ReadVSALUV, ReadVMask]>; 701 def X : VALUVX<funct6, OPIVX, opcodestr # "." # vw # "x">, 702 Sched<[WriteVSALUX, ReadVSALUV, ReadVSALUX, ReadVMask]>; 703 def I : VALUVI<funct6, opcodestr # "." # vw # "i", optype>, 704 Sched<[WriteVSALUI, ReadVSALUV, ReadVMask]>; 705} 706 707multiclass VSALU_IV_V_X<string opcodestr, bits<6> funct6, string vw = "v"> { 708 def V : VALUVV<funct6, OPIVV, opcodestr # "." # vw # "v">, 709 Sched<[WriteVSALUV, ReadVSALUV, ReadVSALUV, ReadVMask]>; 710 def X : VALUVX<funct6, OPIVX, opcodestr # "." # vw # "x">, 711 Sched<[WriteVSALUX, ReadVSALUV, ReadVSALUX, ReadVMask]>; 712} 713 714multiclass VAALU_MV_V_X<string opcodestr, bits<6> funct6, string vw = "v"> { 715 def V : VALUVV<funct6, OPMVV, opcodestr # "." # vw # "v">, 716 Sched<[WriteVAALUV, ReadVAALUV, ReadVAALUV, ReadVMask]>; 717 def X : VALUVX<funct6, OPMVX, opcodestr # "." # vw # "x">, 718 Sched<[WriteVAALUX, ReadVAALUV, ReadVAALUX, ReadVMask]>; 719} 720 721multiclass VSMUL_IV_V_X<string opcodestr, bits<6> funct6, string vw = "v"> { 722 def V : VALUVV<funct6, OPIVV, opcodestr # "." # vw # "v">, 723 Sched<[WriteVSMulV, ReadVSMulV, ReadVSMulV, ReadVMask]>; 724 def X : VALUVX<funct6, OPIVX, opcodestr # "." # vw # "x">, 725 Sched<[WriteVSMulX, ReadVSMulV, ReadVSMulX, ReadVMask]>; 726} 727 728multiclass VSSHF_IV_V_X_I<string opcodestr, bits<6> funct6, Operand optype = simm5, string vw = "v"> { 729 def V : VALUVV<funct6, OPIVV, opcodestr # "." # vw # "v">, 730 Sched<[WriteVSShiftV, ReadVSShiftV, ReadVSShiftV, ReadVMask]>; 731 def X : VALUVX<funct6, OPIVX, opcodestr # "." # vw # "x">, 732 Sched<[WriteVSShiftX, ReadVSShiftV, ReadVSShiftX, ReadVMask]>; 733 def I : VALUVI<funct6, opcodestr # "." # vw # "i", optype>, 734 Sched<[WriteVSShiftI, ReadVSShiftV, ReadVMask]>; 735} 736 737multiclass VNCLP_IV_V_X_I<string opcodestr, bits<6> funct6, Operand optype = simm5, string vw = "v"> { 738 def V : VALUVV<funct6, OPIVV, opcodestr # "." # vw # "v">, 739 Sched<[WriteVNClipV, ReadVNClipV, ReadVNClipV, ReadVMask]>; 740 def X : VALUVX<funct6, OPIVX, opcodestr # "." # vw # "x">, 741 Sched<[WriteVNClipX, ReadVNClipV, ReadVNClipX, ReadVMask]>; 742 def I : VALUVI<funct6, opcodestr # "." # vw # "i", optype>, 743 Sched<[WriteVNClipI, ReadVNClipV, ReadVMask]>; 744} 745 746multiclass VSLD_IV_X_I<string opcodestr, bits<6> funct6, Operand optype = simm5, string vw = "v"> { 747 def X : VALUVX<funct6, OPIVX, opcodestr # "." # vw # "x">, 748 Sched<[WriteVISlideX, ReadVISlideV, ReadVISlideX, ReadVMask]>; 749 def I : VALUVI<funct6, opcodestr # "." # vw # "i", optype>, 750 Sched<[WriteVISlideI, ReadVISlideV, ReadVMask]>; 751} 752 753multiclass VSLD1_MV_X<string opcodestr, bits<6> funct6, string vw = "v"> { 754 def X : VALUVX<funct6, OPMVX, opcodestr # "." # vw # "x">, 755 Sched<[WriteVISlide1X, ReadVISlideV, ReadVISlideX, ReadVMask]>; 756} 757 758multiclass VSLD1_FV_F<string opcodestr, bits<6> funct6, string vw = "v"> { 759 def F : VALUVF<funct6, OPFVF, opcodestr # "." # vw # "f">, 760 Sched<[WriteVFSlide1F, ReadVFSlideV, ReadVFSlideF, ReadVMask]>; 761} 762 763multiclass VGTR_IV_V_X_I<string opcodestr, bits<6> funct6, Operand optype = simm5, string vw = "v"> { 764 def V : VALUVV<funct6, OPIVV, opcodestr # "." # vw # "v">, 765 Sched<[WriteVGatherV, ReadVGatherV, ReadVGatherV, ReadVMask]>; 766 def X : VALUVX<funct6, OPIVX, opcodestr # "." # vw # "x">, 767 Sched<[WriteVGatherX, ReadVGatherV, ReadVGatherX, ReadVMask]>; 768 def I : VALUVI<funct6, opcodestr # "." # vw # "i", optype>, 769 Sched<[WriteVGatherI, ReadVGatherV, ReadVMask]>; 770} 771 772multiclass VCPR_MV_Mask<string opcodestr, bits<6> funct6, string vm = "v"> { 773 def M : VALUVVNoVm<funct6, OPMVV, opcodestr # "." # vm # "m">, 774 Sched<[WriteVCompressV, ReadVCompressV, ReadVCompressV]>; 775} 776 777multiclass VAMO<RISCVAMOOP amoop, RISCVWidth width, string opcodestr> { 778 def _WD : VAMOWd<amoop, width, opcodestr>; 779 def _UNWD : VAMONoWd<amoop, width, opcodestr>; 780} 781 782multiclass VWholeLoad1<string opcodestr, RegisterClass VRC> { 783 def E8_V : VWholeLoad<0, LSWidth8, opcodestr # "e8.v", VRC>, 784 Sched<[WriteVLD1R8, ReadVLDX]>; 785 def E16_V : VWholeLoad<0, LSWidth16, opcodestr # "e16.v", VRC>, 786 Sched<[WriteVLD1R16, ReadVLDX]>; 787 def E32_V : VWholeLoad<0, LSWidth32, opcodestr # "e32.v", VRC>, 788 Sched<[WriteVLD1R32, ReadVLDX]>; 789 def E64_V : VWholeLoad<0, LSWidth64, opcodestr # "e64.v", VRC>, 790 Sched<[WriteVLD1R64, ReadVLDX]>; 791} 792 793multiclass VWholeLoad2<string opcodestr, RegisterClass VRC> { 794 def E8_V : VWholeLoad<1, LSWidth8, opcodestr # "e8.v", VRC>, 795 Sched<[WriteVLD2R8, ReadVLDX]>; 796 def E16_V : VWholeLoad<1, LSWidth16, opcodestr # "e16.v", VRC>, 797 Sched<[WriteVLD2R16, ReadVLDX]>; 798 def E32_V : VWholeLoad<1, LSWidth32, opcodestr # "e32.v", VRC>, 799 Sched<[WriteVLD2R32, ReadVLDX]>; 800 def E64_V : VWholeLoad<1, LSWidth64, opcodestr # "e64.v", VRC>, 801 Sched<[WriteVLD2R64, ReadVLDX]>; 802} 803 804multiclass VWholeLoad4<string opcodestr, RegisterClass VRC> { 805 def E8_V : VWholeLoad<3, LSWidth8, opcodestr # "e8.v", VRC>, 806 Sched<[WriteVLD4R8, ReadVLDX]>; 807 def E16_V : VWholeLoad<3, LSWidth16, opcodestr # "e16.v", VRC>, 808 Sched<[WriteVLD4R16, ReadVLDX]>; 809 def E32_V : VWholeLoad<3, LSWidth32, opcodestr # "e32.v", VRC>, 810 Sched<[WriteVLD4R32, ReadVLDX]>; 811 def E64_V : VWholeLoad<3, LSWidth64, opcodestr # "e64.v", VRC>, 812 Sched<[WriteVLD1R64, ReadVLDX]>; 813} 814 815multiclass VWholeLoad8<string opcodestr, RegisterClass VRC> { 816 def E8_V : VWholeLoad<7, LSWidth8, opcodestr # "e8.v", VRC>, 817 Sched<[WriteVLD8R8, ReadVLDX]>; 818 def E16_V : VWholeLoad<7, LSWidth16, opcodestr # "e16.v", VRC>, 819 Sched<[WriteVLD8R16, ReadVLDX]>; 820 def E32_V : VWholeLoad<7, LSWidth32, opcodestr # "e32.v", VRC>, 821 Sched<[WriteVLD8R32, ReadVLDX]>; 822 def E64_V : VWholeLoad<7, LSWidth64, opcodestr # "e64.v", VRC>, 823 Sched<[WriteVLD8R64, ReadVLDX]>; 824} 825 826//===----------------------------------------------------------------------===// 827// Instructions 828//===----------------------------------------------------------------------===// 829 830let Predicates = [HasStdExtV] in { 831let hasSideEffects = 1, mayLoad = 0, mayStore = 0 in { 832def VSETVLI : RVInstSetVLi<(outs GPR:$rd), (ins GPR:$rs1, VTypeIOp:$vtypei), 833 "vsetvli", "$rd, $rs1, $vtypei">; 834 835def VSETIVLI : RVInstSetiVLi<(outs GPR:$rd), (ins uimm5:$uimm, VTypeIOp:$vtypei), 836 "vsetivli", "$rd, $uimm, $vtypei">; 837 838def VSETVL : RVInstSetVL<(outs GPR:$rd), (ins GPR:$rs1, GPR:$rs2), 839 "vsetvl", "$rd, $rs1, $rs2">; 840} // hasSideEffects = 1, mayLoad = 0, mayStore = 0 841 842// Vector Unit-Stride Instructions 843def VLE8_V : VUnitStrideLoad<LUMOPUnitStride, LSWidth8, "vle8.v">, 844 VLESched<8>; 845def VLE16_V : VUnitStrideLoad<LUMOPUnitStride, LSWidth16, "vle16.v">, 846 VLESched<16>; 847def VLE32_V : VUnitStrideLoad<LUMOPUnitStride, LSWidth32, "vle32.v">, 848 VLESched<32>; 849def VLE64_V : VUnitStrideLoad<LUMOPUnitStride, LSWidth64, "vle64.v">, 850 VLESched<64>; 851 852def VLE8FF_V : VUnitStrideLoad<LUMOPUnitStrideFF, LSWidth8, "vle8ff.v">, 853 VLFSched<8>; 854def VLE16FF_V : VUnitStrideLoad<LUMOPUnitStrideFF, LSWidth16, "vle16ff.v">, 855 VLFSched<16>; 856def VLE32FF_V : VUnitStrideLoad<LUMOPUnitStrideFF, LSWidth32, "vle32ff.v">, 857 VLFSched<32>; 858def VLE64FF_V : VUnitStrideLoad<LUMOPUnitStrideFF, LSWidth64, "vle64ff.v">, 859 VLFSched<64>; 860 861def VLE1_V : VUnitStrideLoadMask<"vle1.v">, 862 Sched<[WriteVLDM, ReadVLDX]>; 863def VSE1_V : VUnitStrideStoreMask<"vse1.v">, 864 Sched<[WriteVSTM, ReadVSTM, ReadVSTX]>; 865 866def VSE8_V : VUnitStrideStore<SUMOPUnitStride, LSWidth8, "vse8.v">, 867 VSESched<8>; 868def VSE16_V : VUnitStrideStore<SUMOPUnitStride, LSWidth16, "vse16.v">, 869 VSESched<16>; 870def VSE32_V : VUnitStrideStore<SUMOPUnitStride, LSWidth32, "vse32.v">, 871 VSESched<32>; 872def VSE64_V : VUnitStrideStore<SUMOPUnitStride, LSWidth64, "vse64.v">, 873 VSESched<64>; 874 875// Vector Strided Instructions 876def VLSE8_V : VStridedLoad<LSWidth8, "vlse8.v">, 877 VLSSched<8>; 878def VLSE16_V : VStridedLoad<LSWidth16, "vlse16.v">, 879 VLSSched<16>; 880def VLSE32_V : VStridedLoad<LSWidth32, "vlse32.v">, 881 VLSSched<32>; 882def VLSE64_V : VStridedLoad<LSWidth64, "vlse64.v">, 883 VLSSched<32>; 884 885def VSSE8_V : VStridedStore<LSWidth8, "vsse8.v">, 886 VSSSched<8>; 887def VSSE16_V : VStridedStore<LSWidth16, "vsse16.v">, 888 VSSSched<16>; 889def VSSE32_V : VStridedStore<LSWidth32, "vsse32.v">, 890 VSSSched<32>; 891def VSSE64_V : VStridedStore<LSWidth64, "vsse64.v">, 892 VSSSched<64>; 893 894// Vector Indexed Instructions 895foreach n = [8, 16, 32, 64] in { 896defvar w = !cast<RISCVWidth>("LSWidth" # n); 897 898def VLUXEI # n # _V : 899 VIndexedLoad<MOPLDIndexedUnord, w, "vluxei" # n # ".v">, 900 VLXSched<n, "U">; 901def VLOXEI # n # _V : 902 VIndexedLoad<MOPLDIndexedOrder, w, "vloxei" # n # ".v">, 903 VLXSched<n, "O">; 904 905def VSUXEI # n # _V : 906 VIndexedStore<MOPSTIndexedUnord, w, "vsuxei" # n # ".v">, 907 VSXSched<n, "U">; 908def VSOXEI # n # _V : 909 VIndexedStore<MOPSTIndexedOrder, w, "vsoxei" # n # ".v">, 910 VSXSched<n, "O">; 911} 912 913defm VL1R : VWholeLoad1<"vl1r", VR>; 914defm VL2R : VWholeLoad2<"vl2r", VRM2>; 915defm VL4R : VWholeLoad4<"vl4r", VRM4>; 916defm VL8R : VWholeLoad8<"vl8r", VRM8>; 917 918def : InstAlias<"vl1r.v $vd, (${rs1})", (VL1RE8_V VR:$vd, GPR:$rs1)>; 919def : InstAlias<"vl2r.v $vd, (${rs1})", (VL2RE8_V VRM2:$vd, GPR:$rs1)>; 920def : InstAlias<"vl4r.v $vd, (${rs1})", (VL4RE8_V VRM4:$vd, GPR:$rs1)>; 921def : InstAlias<"vl8r.v $vd, (${rs1})", (VL8RE8_V VRM8:$vd, GPR:$rs1)>; 922 923def VS1R_V : VWholeStore<0, "vs1r.v", VR>, 924 Sched<[WriteVST1R, ReadVST1R, ReadVSTX]>; 925def VS2R_V : VWholeStore<1, "vs2r.v", VRM2>, 926 Sched<[WriteVST2R, ReadVST2R, ReadVSTX]>; 927def VS4R_V : VWholeStore<3, "vs4r.v", VRM4>, 928 Sched<[WriteVST4R, ReadVST4R, ReadVSTX]>; 929def VS8R_V : VWholeStore<7, "vs8r.v", VRM8>, 930 Sched<[WriteVST8R, ReadVST8R, ReadVSTX]>; 931 932// Vector Single-Width Integer Add and Subtract 933defm VADD_V : VALU_IV_V_X_I<"vadd", 0b000000>; 934defm VSUB_V : VALU_IV_V_X<"vsub", 0b000010>; 935defm VRSUB_V : VALU_IV_X_I<"vrsub", 0b000011>; 936 937def : InstAlias<"vneg.v $vd, $vs$vm", (VRSUB_VX VR:$vd, VR:$vs, X0, VMaskOp:$vm)>; 938 939// Vector Widening Integer Add/Subtract 940// Refer to 11.2 Widening Vector Arithmetic Instructions 941// The destination vector register group cannot overlap a source vector 942// register group of a different element width (including the mask register 943// if masked), otherwise an illegal instruction exception is raised. 944let Constraints = "@earlyclobber $vd" in { 945let RVVConstraint = WidenV in { 946defm VWADDU_V : VALU_MV_V_X<"vwaddu", 0b110000>; 947defm VWSUBU_V : VALU_MV_V_X<"vwsubu", 0b110010>; 948defm VWADD_V : VALU_MV_V_X<"vwadd", 0b110001>; 949defm VWSUB_V : VALU_MV_V_X<"vwsub", 0b110011>; 950} // RVVConstraint = WidenV 951// Set earlyclobber for following instructions for second and mask operands. 952// This has the downside that the earlyclobber constraint is too coarse and 953// will impose unnecessary restrictions by not allowing the destination to 954// overlap with the first (wide) operand. 955let RVVConstraint = WidenW in { 956defm VWADDU_W : VALU_MV_V_X<"vwaddu", 0b110100, "w">; 957defm VWSUBU_W : VALU_MV_V_X<"vwsubu", 0b110110, "w">; 958defm VWADD_W : VALU_MV_V_X<"vwadd", 0b110101, "w">; 959defm VWSUB_W : VALU_MV_V_X<"vwsub", 0b110111, "w">; 960} // RVVConstraint = WidenW 961} // Constraints = "@earlyclobber $vd" 962 963def : InstAlias<"vwcvt.x.x.v $vd, $vs$vm", 964 (VWADD_VX VR:$vd, VR:$vs, X0, VMaskOp:$vm)>; 965def : InstAlias<"vwcvtu.x.x.v $vd, $vs$vm", 966 (VWADDU_VX VR:$vd, VR:$vs, X0, VMaskOp:$vm)>; 967 968// Vector Integer Extension 969defm VZEXT_VF8 : VALU_MV_VS2<"vzext.vf8", 0b010010, 0b00010>; 970defm VSEXT_VF8 : VALU_MV_VS2<"vsext.vf8", 0b010010, 0b00011>; 971defm VZEXT_VF4 : VALU_MV_VS2<"vzext.vf4", 0b010010, 0b00100>; 972defm VSEXT_VF4 : VALU_MV_VS2<"vsext.vf4", 0b010010, 0b00101>; 973defm VZEXT_VF2 : VALU_MV_VS2<"vzext.vf2", 0b010010, 0b00110>; 974defm VSEXT_VF2 : VALU_MV_VS2<"vsext.vf2", 0b010010, 0b00111>; 975 976// Vector Integer Add-with-Carry / Subtract-with-Borrow Instructions 977defm VADC_V : VALUm_IV_V_X_I<"vadc", 0b010000>; 978let Constraints = "@earlyclobber $vd", RVVConstraint = NoConstraint in { 979defm VMADC_V : VALUm_IV_V_X_I<"vmadc", 0b010001>; 980defm VMADC_V : VALUNoVm_IV_V_X_I<"vmadc", 0b010001>; 981} // Constraints = "@earlyclobber $vd", RVVConstraint = NoConstraint 982defm VSBC_V : VALUm_IV_V_X<"vsbc", 0b010010>; 983let Constraints = "@earlyclobber $vd", RVVConstraint = NoConstraint in { 984defm VMSBC_V : VALUm_IV_V_X<"vmsbc", 0b010011>; 985defm VMSBC_V : VALUNoVm_IV_V_X<"vmsbc", 0b010011>; 986} // Constraints = "@earlyclobber $vd", RVVConstraint = NoConstraint 987 988// Vector Bitwise Logical Instructions 989defm VAND_V : VALU_IV_V_X_I<"vand", 0b001001>; 990defm VOR_V : VALU_IV_V_X_I<"vor", 0b001010>; 991defm VXOR_V : VALU_IV_V_X_I<"vxor", 0b001011>; 992 993def : InstAlias<"vnot.v $vd, $vs$vm", 994 (VXOR_VI VR:$vd, VR:$vs, -1, VMaskOp:$vm)>; 995 996// Vector Single-Width Bit Shift Instructions 997defm VSLL_V : VSHT_IV_V_X_I<"vsll", 0b100101, uimm5>; 998defm VSRL_V : VSHT_IV_V_X_I<"vsrl", 0b101000, uimm5>; 999defm VSRA_V : VSHT_IV_V_X_I<"vsra", 0b101001, uimm5>; 1000 1001// Vector Narrowing Integer Right Shift Instructions 1002// Refer to 11.3. Narrowing Vector Arithmetic Instructions 1003// The destination vector register group cannot overlap the first source 1004// vector register group (specified by vs2). The destination vector register 1005// group cannot overlap the mask register if used, unless LMUL=1. 1006let Constraints = "@earlyclobber $vd" in { 1007defm VNSRL_W : VNSHT_IV_V_X_I<"vnsrl", 0b101100, uimm5, "w">; 1008defm VNSRA_W : VNSHT_IV_V_X_I<"vnsra", 0b101101, uimm5, "w">; 1009} // Constraints = "@earlyclobber $vd" 1010 1011def : InstAlias<"vncvt.x.x.w $vd, $vs$vm", 1012 (VNSRL_WX VR:$vd, VR:$vs, X0, VMaskOp:$vm)>; 1013 1014// Vector Integer Comparison Instructions 1015let RVVConstraint = NoConstraint in { 1016defm VMSEQ_V : VCMP_IV_V_X_I<"vmseq", 0b011000>; 1017defm VMSNE_V : VCMP_IV_V_X_I<"vmsne", 0b011001>; 1018defm VMSLTU_V : VCMP_IV_V_X<"vmsltu", 0b011010>; 1019defm VMSLT_V : VCMP_IV_V_X<"vmslt", 0b011011>; 1020defm VMSLEU_V : VCMP_IV_V_X_I<"vmsleu", 0b011100>; 1021defm VMSLE_V : VCMP_IV_V_X_I<"vmsle", 0b011101>; 1022defm VMSGTU_V : VCMP_IV_X_I<"vmsgtu", 0b011110>; 1023defm VMSGT_V : VCMP_IV_X_I<"vmsgt", 0b011111>; 1024} // RVVConstraint = NoConstraint 1025 1026def : InstAlias<"vmsgtu.vv $vd, $va, $vb$vm", 1027 (VMSLTU_VV VR:$vd, VR:$vb, VR:$va, VMaskOp:$vm), 0>; 1028def : InstAlias<"vmsgt.vv $vd, $va, $vb$vm", 1029 (VMSLT_VV VR:$vd, VR:$vb, VR:$va, VMaskOp:$vm), 0>; 1030def : InstAlias<"vmsgeu.vv $vd, $va, $vb$vm", 1031 (VMSLEU_VV VR:$vd, VR:$vb, VR:$va, VMaskOp:$vm), 0>; 1032def : InstAlias<"vmsge.vv $vd, $va, $vb$vm", 1033 (VMSLE_VV VR:$vd, VR:$vb, VR:$va, VMaskOp:$vm), 0>; 1034 1035let isCodeGenOnly = 0, isAsmParserOnly = 1, hasSideEffects = 0, mayLoad = 0, 1036 mayStore = 0 in { 1037// For unsigned comparisons we need to special case 0 immediate to maintain 1038// the always true/false semantics we would invert if we just decremented the 1039// immediate like we do for signed. To match the GNU assembler we will use 1040// vmseq/vmsne.vv with the same register for both operands which we can't do 1041// from an InstAlias. 1042def PseudoVMSGEU_VI : Pseudo<(outs VR:$vd), 1043 (ins VR:$vs2, simm5_plus1:$imm, VMaskOp:$vm), 1044 [], "vmsgeu.vi", "$vd, $vs2, $imm$vm">; 1045def PseudoVMSLTU_VI : Pseudo<(outs VR:$vd), 1046 (ins VR:$vs2, simm5_plus1:$imm, VMaskOp:$vm), 1047 [], "vmsltu.vi", "$vd, $vs2, $imm$vm">; 1048// Handle signed with pseudos as well for more consistency in the 1049// implementation. 1050def PseudoVMSGE_VI : Pseudo<(outs VR:$vd), 1051 (ins VR:$vs2, simm5_plus1:$imm, VMaskOp:$vm), 1052 [], "vmsge.vi", "$vd, $vs2, $imm$vm">; 1053def PseudoVMSLT_VI : Pseudo<(outs VR:$vd), 1054 (ins VR:$vs2, simm5_plus1:$imm, VMaskOp:$vm), 1055 [], "vmslt.vi", "$vd, $vs2, $imm$vm">; 1056} 1057 1058let isCodeGenOnly = 0, isAsmParserOnly = 1, hasSideEffects = 0, mayLoad = 0, 1059 mayStore = 0 in { 1060def PseudoVMSGEU_VX : Pseudo<(outs VR:$vd), 1061 (ins VR:$vs2, GPR:$rs1), 1062 [], "vmsgeu.vx", "$vd, $vs2, $rs1">; 1063def PseudoVMSGE_VX : Pseudo<(outs VR:$vd), 1064 (ins VR:$vs2, GPR:$rs1), 1065 [], "vmsge.vx", "$vd, $vs2, $rs1">; 1066def PseudoVMSGEU_VX_M : Pseudo<(outs VRNoV0:$vd), 1067 (ins VR:$vs2, GPR:$rs1, VMaskOp:$vm), 1068 [], "vmsgeu.vx", "$vd, $vs2, $rs1$vm">; 1069def PseudoVMSGE_VX_M : Pseudo<(outs VRNoV0:$vd), 1070 (ins VR:$vs2, GPR:$rs1, VMaskOp:$vm), 1071 [], "vmsge.vx", "$vd, $vs2, $rs1$vm">; 1072def PseudoVMSGEU_VX_M_T : Pseudo<(outs VR:$vd, VRNoV0:$scratch), 1073 (ins VR:$vs2, GPR:$rs1, VMaskOp:$vm), 1074 [], "vmsgeu.vx", "$vd, $vs2, $rs1$vm, $scratch">; 1075def PseudoVMSGE_VX_M_T : Pseudo<(outs VR:$vd, VRNoV0:$scratch), 1076 (ins VR:$vs2, GPR:$rs1, VMaskOp:$vm), 1077 [], "vmsge.vx", "$vd, $vs2, $rs1$vm, $scratch">; 1078} 1079 1080// Vector Integer Min/Max Instructions 1081defm VMINU_V : VCMP_IV_V_X<"vminu", 0b000100>; 1082defm VMIN_V : VCMP_IV_V_X<"vmin", 0b000101>; 1083defm VMAXU_V : VCMP_IV_V_X<"vmaxu", 0b000110>; 1084defm VMAX_V : VCMP_IV_V_X<"vmax", 0b000111>; 1085 1086// Vector Single-Width Integer Multiply Instructions 1087defm VMUL_V : VMUL_MV_V_X<"vmul", 0b100101>; 1088defm VMULH_V : VMUL_MV_V_X<"vmulh", 0b100111>; 1089defm VMULHU_V : VMUL_MV_V_X<"vmulhu", 0b100100>; 1090defm VMULHSU_V : VMUL_MV_V_X<"vmulhsu", 0b100110>; 1091 1092// Vector Integer Divide Instructions 1093defm VDIVU_V : VDIV_MV_V_X<"vdivu", 0b100000>; 1094defm VDIV_V : VDIV_MV_V_X<"vdiv", 0b100001>; 1095defm VREMU_V : VDIV_MV_V_X<"vremu", 0b100010>; 1096defm VREM_V : VDIV_MV_V_X<"vrem", 0b100011>; 1097 1098// Vector Widening Integer Multiply Instructions 1099let Constraints = "@earlyclobber $vd", RVVConstraint = WidenV in { 1100defm VWMUL_V : VWMUL_MV_V_X<"vwmul", 0b111011>; 1101defm VWMULU_V : VWMUL_MV_V_X<"vwmulu", 0b111000>; 1102defm VWMULSU_V : VWMUL_MV_V_X<"vwmulsu", 0b111010>; 1103} // Constraints = "@earlyclobber $vd", RVVConstraint = WidenV 1104 1105// Vector Single-Width Integer Multiply-Add Instructions 1106defm VMACC_V : VMAC_MV_V_X<"vmacc", 0b101101>; 1107defm VNMSAC_V : VMAC_MV_V_X<"vnmsac", 0b101111>; 1108defm VMADD_V : VMAC_MV_V_X<"vmadd", 0b101001>; 1109defm VNMSUB_V : VMAC_MV_V_X<"vnmsub", 0b101011>; 1110 1111// Vector Widening Integer Multiply-Add Instructions 1112let Constraints = "@earlyclobber $vd", RVVConstraint = WidenV in { 1113defm VWMACCU_V : VWMAC_MV_V_X<"vwmaccu", 0b111100>; 1114defm VWMACC_V : VWMAC_MV_V_X<"vwmacc", 0b111101>; 1115defm VWMACCSU_V : VWMAC_MV_V_X<"vwmaccsu", 0b111111>; 1116defm VWMACCUS_V : VWMAC_MV_X<"vwmaccus", 0b111110>; 1117} // Constraints = "@earlyclobber $vd", RVVConstraint = WidenV 1118 1119// Vector Integer Merge Instructions 1120defm VMERGE_V : VMRG_IV_V_X_I<"vmerge", 0b010111>; 1121 1122// Vector Integer Move Instructions 1123let hasSideEffects = 0, mayLoad = 0, mayStore = 0, vs2 = 0, vm = 1, 1124 RVVConstraint = NoConstraint in { 1125// op vd, vs1 1126def VMV_V_V : RVInstVV<0b010111, OPIVV, (outs VR:$vd), 1127 (ins VR:$vs1), "vmv.v.v", "$vd, $vs1">, 1128 Sched<[WriteVIMovV, ReadVIMovV]>; 1129// op vd, rs1 1130def VMV_V_X : RVInstVX<0b010111, OPIVX, (outs VR:$vd), 1131 (ins GPR:$rs1), "vmv.v.x", "$vd, $rs1">, 1132 Sched<[WriteVIMovX, ReadVIMovX]>; 1133// op vd, imm 1134def VMV_V_I : RVInstIVI<0b010111, (outs VR:$vd), 1135 (ins simm5:$imm), "vmv.v.i", "$vd, $imm">, 1136 Sched<[WriteVIMovI]>; 1137} // hasSideEffects = 0, mayLoad = 0, mayStore = 0 1138 1139// Vector Fixed-Point Arithmetic Instructions 1140defm VSADDU_V : VSALU_IV_V_X_I<"vsaddu", 0b100000>; 1141defm VSADD_V : VSALU_IV_V_X_I<"vsadd", 0b100001>; 1142defm VSSUBU_V : VSALU_IV_V_X<"vssubu", 0b100010>; 1143defm VSSUB_V : VSALU_IV_V_X<"vssub", 0b100011>; 1144 1145// Vector Single-Width Averaging Add and Subtract 1146defm VAADDU_V : VAALU_MV_V_X<"vaaddu", 0b001000>; 1147defm VAADD_V : VAALU_MV_V_X<"vaadd", 0b001001>; 1148defm VASUBU_V : VAALU_MV_V_X<"vasubu", 0b001010>; 1149defm VASUB_V : VAALU_MV_V_X<"vasub", 0b001011>; 1150 1151// Vector Single-Width Fractional Multiply with Rounding and Saturation 1152defm VSMUL_V : VSMUL_IV_V_X<"vsmul", 0b100111>; 1153 1154// Vector Single-Width Scaling Shift Instructions 1155defm VSSRL_V : VSSHF_IV_V_X_I<"vssrl", 0b101010, uimm5>; 1156defm VSSRA_V : VSSHF_IV_V_X_I<"vssra", 0b101011, uimm5>; 1157 1158// Vector Narrowing Fixed-Point Clip Instructions 1159let Constraints = "@earlyclobber $vd" in { 1160defm VNCLIPU_W : VNCLP_IV_V_X_I<"vnclipu", 0b101110, uimm5, "w">; 1161defm VNCLIP_W : VNCLP_IV_V_X_I<"vnclip", 0b101111, uimm5, "w">; 1162} // Constraints = "@earlyclobber $vd" 1163} // Predicates = [HasStdExtV] 1164 1165let Predicates = [HasStdExtV, HasStdExtF] in { 1166// Vector Single-Width Floating-Point Add/Subtract Instructions 1167defm VFADD_V : VALU_FV_V_F<"vfadd", 0b000000>; 1168defm VFSUB_V : VALU_FV_V_F<"vfsub", 0b000010>; 1169defm VFRSUB_V : VALU_FV_F<"vfrsub", 0b100111>; 1170 1171// Vector Widening Floating-Point Add/Subtract Instructions 1172let Constraints = "@earlyclobber $vd" in { 1173let RVVConstraint = WidenV in { 1174defm VFWADD_V : VWALU_FV_V_F<"vfwadd", 0b110000>; 1175defm VFWSUB_V : VWALU_FV_V_F<"vfwsub", 0b110010>; 1176} // RVVConstraint = WidenV 1177// Set earlyclobber for following instructions for second and mask operands. 1178// This has the downside that the earlyclobber constraint is too coarse and 1179// will impose unnecessary restrictions by not allowing the destination to 1180// overlap with the first (wide) operand. 1181let RVVConstraint = WidenW in { 1182defm VFWADD_W : VWALU_FV_V_F<"vfwadd", 0b110100, "w">; 1183defm VFWSUB_W : VWALU_FV_V_F<"vfwsub", 0b110110, "w">; 1184} // RVVConstraint = WidenW 1185} // Constraints = "@earlyclobber $vd" 1186 1187// Vector Single-Width Floating-Point Multiply/Divide Instructions 1188defm VFMUL_V : VMUL_FV_V_F<"vfmul", 0b100100>; 1189defm VFDIV_V : VDIV_FV_V_F<"vfdiv", 0b100000>; 1190defm VFRDIV_V : VRDIV_FV_F<"vfrdiv", 0b100001>; 1191 1192// Vector Widening Floating-Point Multiply 1193let Constraints = "@earlyclobber $vd", RVVConstraint = WidenV in { 1194defm VFWMUL_V : VWMUL_FV_V_F<"vfwmul", 0b111000>; 1195} // Constraints = "@earlyclobber $vd", RVVConstraint = WidenV 1196 1197// Vector Single-Width Floating-Point Fused Multiply-Add Instructions 1198defm VFMACC_V : VMAC_FV_V_F<"vfmacc", 0b101100>; 1199defm VFNMACC_V : VMAC_FV_V_F<"vfnmacc", 0b101101>; 1200defm VFMSAC_V : VMAC_FV_V_F<"vfmsac", 0b101110>; 1201defm VFNMSAC_V : VMAC_FV_V_F<"vfnmsac", 0b101111>; 1202defm VFMADD_V : VMAC_FV_V_F<"vfmadd", 0b101000>; 1203defm VFNMADD_V : VMAC_FV_V_F<"vfnmadd", 0b101001>; 1204defm VFMSUB_V : VMAC_FV_V_F<"vfmsub", 0b101010>; 1205defm VFNMSUB_V : VMAC_FV_V_F<"vfnmsub", 0b101011>; 1206 1207// Vector Widening Floating-Point Fused Multiply-Add Instructions 1208let Constraints = "@earlyclobber $vd", RVVConstraint = WidenV in { 1209defm VFWMACC_V : VWMAC_FV_V_F<"vfwmacc", 0b111100>; 1210defm VFWNMACC_V : VWMAC_FV_V_F<"vfwnmacc", 0b111101>; 1211defm VFWMSAC_V : VWMAC_FV_V_F<"vfwmsac", 0b111110>; 1212defm VFWNMSAC_V : VWMAC_FV_V_F<"vfwnmsac", 0b111111>; 1213} // Constraints = "@earlyclobber $vd", RVVConstraint = WidenV 1214 1215// Vector Floating-Point Square-Root Instruction 1216defm VFSQRT_V : VSQR_FV_VS2<"vfsqrt.v", 0b010011, 0b00000>; 1217defm VFRSQRT7_V : VRCP_FV_VS2<"vfrsqrt7.v", 0b010011, 0b00100>; 1218defm VFREC7_V : VRCP_FV_VS2<"vfrec7.v", 0b010011, 0b00101>; 1219 1220// Vector Floating-Point MIN/MAX Instructions 1221defm VFMIN_V : VCMP_FV_V_F<"vfmin", 0b000100>; 1222defm VFMAX_V : VCMP_FV_V_F<"vfmax", 0b000110>; 1223 1224// Vector Floating-Point Sign-Injection Instructions 1225defm VFSGNJ_V : VSGNJ_FV_V_F<"vfsgnj", 0b001000>; 1226defm VFSGNJN_V : VSGNJ_FV_V_F<"vfsgnjn", 0b001001>; 1227defm VFSGNJX_V : VSGNJ_FV_V_F<"vfsgnjx", 0b001010>; 1228 1229def : InstAlias<"vfneg.v $vd, $vs$vm", 1230 (VFSGNJN_VV VR:$vd, VR:$vs, VR:$vs, VMaskOp:$vm)>; 1231def : InstAlias<"vfabs.v $vd, $vs$vm", 1232 (VFSGNJX_VV VR:$vd, VR:$vs, VR:$vs, VMaskOp:$vm)>; 1233 1234// Vector Floating-Point Compare Instructions 1235let RVVConstraint = NoConstraint in { 1236defm VMFEQ_V : VCMP_FV_V_F<"vmfeq", 0b011000>; 1237defm VMFNE_V : VCMP_FV_V_F<"vmfne", 0b011100>; 1238defm VMFLT_V : VCMP_FV_V_F<"vmflt", 0b011011>; 1239defm VMFLE_V : VCMP_FV_V_F<"vmfle", 0b011001>; 1240defm VMFGT_V : VCMP_FV_F<"vmfgt", 0b011101>; 1241defm VMFGE_V : VCMP_FV_F<"vmfge", 0b011111>; 1242} // RVVConstraint = NoConstraint 1243 1244def : InstAlias<"vmfgt.vv $vd, $va, $vb$vm", 1245 (VMFLT_VV VR:$vd, VR:$vb, VR:$va, VMaskOp:$vm), 0>; 1246def : InstAlias<"vmfge.vv $vd, $va, $vb$vm", 1247 (VMFLE_VV VR:$vd, VR:$vb, VR:$va, VMaskOp:$vm), 0>; 1248 1249// Vector Floating-Point Classify Instruction 1250defm VFCLASS_V : VCLS_FV_VS2<"vfclass.v", 0b010011, 0b10000>; 1251 1252let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in { 1253 1254// Vector Floating-Point Merge Instruction 1255let vm = 0 in 1256def VFMERGE_VFM : RVInstVX<0b010111, OPFVF, (outs VR:$vd), 1257 (ins VR:$vs2, FPR32:$rs1, VMV0:$v0), 1258 "vfmerge.vfm", "$vd, $vs2, $rs1, v0">, 1259 Sched<[WriteVFMergeV, ReadVFMergeV, ReadVFMergeF, ReadVMask]>; 1260 1261// Vector Floating-Point Move Instruction 1262let RVVConstraint = NoConstraint in 1263let vm = 1, vs2 = 0 in 1264def VFMV_V_F : RVInstVX<0b010111, OPFVF, (outs VR:$vd), 1265 (ins FPR32:$rs1), "vfmv.v.f", "$vd, $rs1">, 1266 Sched<[WriteVFMovV, ReadVFMovF]>; 1267 1268} // hasSideEffects = 0, mayLoad = 0, mayStore = 0 1269 1270// Single-Width Floating-Point/Integer Type-Convert Instructions 1271defm VFCVT_XU_F_V : VCVTI_FV_VS2<"vfcvt.xu.f.v", 0b010010, 0b00000>; 1272defm VFCVT_X_F_V : VCVTI_FV_VS2<"vfcvt.x.f.v", 0b010010, 0b00001>; 1273defm VFCVT_RTZ_XU_F_V : VCVTI_FV_VS2<"vfcvt.rtz.xu.f.v", 0b010010, 0b00110>; 1274defm VFCVT_RTZ_X_F_V : VCVTI_FV_VS2<"vfcvt.rtz.x.f.v", 0b010010, 0b00111>; 1275defm VFCVT_F_XU_V : VCVTF_IV_VS2<"vfcvt.f.xu.v", 0b010010, 0b00010>; 1276defm VFCVT_F_X_V : VCVTF_IV_VS2<"vfcvt.f.x.v", 0b010010, 0b00011>; 1277 1278// Widening Floating-Point/Integer Type-Convert Instructions 1279let Constraints = "@earlyclobber $vd", RVVConstraint = WidenCvt in { 1280defm VFWCVT_XU_F_V : VWCVTI_FV_VS2<"vfwcvt.xu.f.v", 0b010010, 0b01000>; 1281defm VFWCVT_X_F_V : VWCVTI_FV_VS2<"vfwcvt.x.f.v", 0b010010, 0b01001>; 1282defm VFWCVT_RTZ_XU_F_V : VWCVTI_FV_VS2<"vfwcvt.rtz.xu.f.v", 0b010010, 0b01110>; 1283defm VFWCVT_RTZ_X_F_V : VWCVTI_FV_VS2<"vfwcvt.rtz.x.f.v", 0b010010, 0b01111>; 1284defm VFWCVT_F_XU_V : VWCVTF_IV_VS2<"vfwcvt.f.xu.v", 0b010010, 0b01010>; 1285defm VFWCVT_F_X_V : VWCVTF_IV_VS2<"vfwcvt.f.x.v", 0b010010, 0b01011>; 1286defm VFWCVT_F_F_V : VWCVTF_FV_VS2<"vfwcvt.f.f.v", 0b010010, 0b01100>; 1287} // Constraints = "@earlyclobber $vd", RVVConstraint = WidenCvt 1288 1289// Narrowing Floating-Point/Integer Type-Convert Instructions 1290let Constraints = "@earlyclobber $vd" in { 1291defm VFNCVT_XU_F_W : VNCVTI_FV_VS2<"vfncvt.xu.f.w", 0b010010, 0b10000>; 1292defm VFNCVT_X_F_W : VNCVTI_FV_VS2<"vfncvt.x.f.w", 0b010010, 0b10001>; 1293defm VFNCVT_RTZ_XU_F_W : VNCVTI_FV_VS2<"vfncvt.rtz.xu.f.w", 0b010010, 0b10110>; 1294defm VFNCVT_RTZ_X_F_W : VNCVTI_FV_VS2<"vfncvt.rtz.x.f.w", 0b010010, 0b10111>; 1295defm VFNCVT_F_XU_W : VNCVTF_IV_VS2<"vfncvt.f.xu.w", 0b010010, 0b10010>; 1296defm VFNCVT_F_X_W : VNCVTF_IV_VS2<"vfncvt.f.x.w", 0b010010, 0b10011>; 1297defm VFNCVT_F_F_W : VNCVTF_FV_VS2<"vfncvt.f.f.w", 0b010010, 0b10100>; 1298defm VFNCVT_ROD_F_F_W : VNCVTF_FV_VS2<"vfncvt.rod.f.f.w", 0b010010, 0b10101>; 1299} // Constraints = "@earlyclobber $vd" 1300} // Predicates = [HasStdExtV, HasStdExtF] 1301 1302let Predicates = [HasStdExtV] in { 1303 1304// Vector Single-Width Integer Reduction Instructions 1305let RVVConstraint = NoConstraint in { 1306defm VREDSUM : VRED_MV_V<"vredsum", 0b000000>; 1307defm VREDMAXU : VRED_MV_V<"vredmaxu", 0b000110>; 1308defm VREDMAX : VRED_MV_V<"vredmax", 0b000111>; 1309defm VREDMINU : VRED_MV_V<"vredminu", 0b000100>; 1310defm VREDMIN : VRED_MV_V<"vredmin", 0b000101>; 1311defm VREDAND : VRED_MV_V<"vredand", 0b000001>; 1312defm VREDOR : VRED_MV_V<"vredor", 0b000010>; 1313defm VREDXOR : VRED_MV_V<"vredxor", 0b000011>; 1314} // RVVConstraint = NoConstraint 1315 1316// Vector Widening Integer Reduction Instructions 1317let Constraints = "@earlyclobber $vd", RVVConstraint = NoConstraint in { 1318// Set earlyclobber for following instructions for second and mask operands. 1319// This has the downside that the earlyclobber constraint is too coarse and 1320// will impose unnecessary restrictions by not allowing the destination to 1321// overlap with the first (wide) operand. 1322defm VWREDSUMU : VWRED_IV_V<"vwredsumu", 0b110000>; 1323defm VWREDSUM : VWRED_IV_V<"vwredsum", 0b110001>; 1324} // Constraints = "@earlyclobber $vd", RVVConstraint = NoConstraint 1325 1326} // Predicates = [HasStdExtV] 1327 1328let Predicates = [HasStdExtV, HasStdExtF] in { 1329// Vector Single-Width Floating-Point Reduction Instructions 1330let RVVConstraint = NoConstraint in { 1331defm VFREDOSUM : VREDO_FV_V<"vfredosum", 0b000011>; 1332defm VFREDSUM : VRED_FV_V<"vfredsum", 0b000001>; 1333defm VFREDMAX : VRED_FV_V<"vfredmax", 0b000111>; 1334defm VFREDMIN : VRED_FV_V<"vfredmin", 0b000101>; 1335} // RVVConstraint = NoConstraint 1336 1337// Vector Widening Floating-Point Reduction Instructions 1338let Constraints = "@earlyclobber $vd", RVVConstraint = NoConstraint in { 1339// Set earlyclobber for following instructions for second and mask operands. 1340// This has the downside that the earlyclobber constraint is too coarse and 1341// will impose unnecessary restrictions by not allowing the destination to 1342// overlap with the first (wide) operand. 1343defm VFWREDOSUM : VWREDO_FV_V<"vfwredosum", 0b110011>; 1344defm VFWREDSUM : VWRED_FV_V<"vfwredsum", 0b110001>; 1345} // Constraints = "@earlyclobber $vd", RVVConstraint = NoConstraint 1346} // Predicates = [HasStdExtV, HasStdExtF] 1347 1348let Predicates = [HasStdExtV] in { 1349// Vector Mask-Register Logical Instructions 1350let RVVConstraint = NoConstraint in { 1351defm VMAND_M : VMALU_MV_Mask<"vmand", 0b011001, "m">; 1352defm VMNAND_M : VMALU_MV_Mask<"vmnand", 0b011101, "m">; 1353defm VMANDNOT_M : VMALU_MV_Mask<"vmandnot", 0b011000, "m">; 1354defm VMXOR_M : VMALU_MV_Mask<"vmxor", 0b011011, "m">; 1355defm VMOR_M : VMALU_MV_Mask<"vmor", 0b011010, "m">; 1356defm VMNOR_M : VMALU_MV_Mask<"vmnor", 0b011110, "m">; 1357defm VMORNOT_M : VMALU_MV_Mask<"vmornot", 0b011100, "m">; 1358defm VMXNOR_M : VMALU_MV_Mask<"vmxnor", 0b011111, "m">; 1359} 1360 1361def : InstAlias<"vmmv.m $vd, $vs", 1362 (VMAND_MM VR:$vd, VR:$vs, VR:$vs)>; 1363def : InstAlias<"vmclr.m $vd", 1364 (VMXOR_MM VR:$vd, VR:$vd, VR:$vd)>; 1365def : InstAlias<"vmset.m $vd", 1366 (VMXNOR_MM VR:$vd, VR:$vd, VR:$vd)>; 1367def : InstAlias<"vmnot.m $vd, $vs", 1368 (VMNAND_MM VR:$vd, VR:$vs, VR:$vs)>; 1369 1370let hasSideEffects = 0, mayLoad = 0, mayStore = 0, 1371 RVVConstraint = NoConstraint in { 1372 1373// Vector mask population count vpopc 1374def VPOPC_M : RVInstV<0b010000, 0b10000, OPMVV, (outs GPR:$vd), 1375 (ins VR:$vs2, VMaskOp:$vm), 1376 "vpopc.m", "$vd, $vs2$vm">, 1377 Sched<[WriteVMPopV, ReadVMPopV, ReadVMask]>; 1378 1379// vfirst find-first-set mask bit 1380def VFIRST_M : RVInstV<0b010000, 0b10001, OPMVV, (outs GPR:$vd), 1381 (ins VR:$vs2, VMaskOp:$vm), 1382 "vfirst.m", "$vd, $vs2$vm">, 1383 Sched<[WriteVMFFSV, ReadVMFFSV, ReadVMask]>; 1384 1385} // hasSideEffects = 0, mayLoad = 0, mayStore = 0 1386 1387let Constraints = "@earlyclobber $vd", RVVConstraint = Iota in { 1388 1389// vmsbf.m set-before-first mask bit 1390defm VMSBF_M : VMSFS_MV_V<"vmsbf.m", 0b010100, 0b00001>; 1391// vmsif.m set-including-first mask bit 1392defm VMSIF_M : VMSFS_MV_V<"vmsif.m", 0b010100, 0b00011>; 1393// vmsof.m set-only-first mask bit 1394defm VMSOF_M : VMSFS_MV_V<"vmsof.m", 0b010100, 0b00010>; 1395// Vector Iota Instruction 1396defm VIOTA_M : VMIOT_MV_V<"viota.m", 0b010100, 0b10000>; 1397 1398} // Constraints = "@earlyclobber $vd", RVVConstraint = Iota 1399 1400// Vector Element Index Instruction 1401let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in { 1402 1403let vs2 = 0 in 1404def VID_V : RVInstV<0b010100, 0b10001, OPMVV, (outs VR:$vd), 1405 (ins VMaskOp:$vm), "vid.v", "$vd$vm">, 1406 Sched<[WriteVMIdxV, ReadVMask]>; 1407 1408// Integer Scalar Move Instructions 1409let vm = 1, RVVConstraint = NoConstraint in { 1410def VMV_X_S : RVInstV<0b010000, 0b00000, OPMVV, (outs GPR:$vd), 1411 (ins VR:$vs2), "vmv.x.s", "$vd, $vs2">, 1412 Sched<[WriteVIMovVX, ReadVIMovVX]>; 1413let Constraints = "$vd = $vd_wb" in 1414def VMV_S_X : RVInstV2<0b010000, 0b00000, OPMVX, (outs VR:$vd_wb), 1415 (ins VR:$vd, GPR:$rs1), "vmv.s.x", "$vd, $rs1">, 1416 Sched<[WriteVIMovXV, ReadVIMovXV, ReadVIMovXX]>; 1417} 1418 1419} // hasSideEffects = 0, mayLoad = 0, mayStore = 0 1420 1421} // Predicates = [HasStdExtV] 1422 1423let Predicates = [HasStdExtV, HasStdExtF] in { 1424 1425let hasSideEffects = 0, mayLoad = 0, mayStore = 0, vm = 1, 1426 RVVConstraint = NoConstraint in { 1427// Floating-Point Scalar Move Instructions 1428def VFMV_F_S : RVInstV<0b010000, 0b00000, OPFVV, (outs FPR32:$vd), 1429 (ins VR:$vs2), "vfmv.f.s", "$vd, $vs2">, 1430 Sched<[WriteVFMovVF, ReadVFMovVF]>; 1431let Constraints = "$vd = $vd_wb" in 1432def VFMV_S_F : RVInstV2<0b010000, 0b00000, OPFVF, (outs VR:$vd_wb), 1433 (ins VR:$vd, FPR32:$rs1), "vfmv.s.f", "$vd, $rs1">, 1434 Sched<[WriteVFMovFV, ReadVFMovFV, ReadVFMovFX]>; 1435 1436} // hasSideEffects = 0, mayLoad = 0, mayStore = 0, vm = 1 1437 1438} // Predicates = [HasStdExtV, HasStdExtF] 1439 1440let Predicates = [HasStdExtV] in { 1441// Vector Slide Instructions 1442let Constraints = "@earlyclobber $vd", RVVConstraint = SlideUp in { 1443defm VSLIDEUP_V : VSLD_IV_X_I<"vslideup", 0b001110, uimm5>; 1444defm VSLIDE1UP_V : VSLD1_MV_X<"vslide1up", 0b001110>; 1445} // Constraints = "@earlyclobber $vd", RVVConstraint = SlideUp 1446defm VSLIDEDOWN_V : VSLD_IV_X_I<"vslidedown", 0b001111, uimm5>; 1447defm VSLIDE1DOWN_V : VSLD1_MV_X<"vslide1down", 0b001111>; 1448} // Predicates = [HasStdExtV] 1449 1450let Predicates = [HasStdExtV, HasStdExtF] in { 1451let Constraints = "@earlyclobber $vd", RVVConstraint = SlideUp in { 1452defm VFSLIDE1UP_V : VSLD1_FV_F<"vfslide1up", 0b001110>; 1453} // Constraints = "@earlyclobber $vd", RVVConstraint = SlideUp 1454defm VFSLIDE1DOWN_V : VSLD1_FV_F<"vfslide1down", 0b001111>; 1455} // Predicates = [HasStdExtV, HasStdExtF] 1456 1457let Predicates = [HasStdExtV] in { 1458// Vector Register Gather Instruction 1459let Constraints = "@earlyclobber $vd", RVVConstraint = Vrgather in { 1460defm VRGATHER_V : VGTR_IV_V_X_I<"vrgather", 0b001100, uimm5>; 1461def VRGATHEREI16_VV : VALUVV<0b001110, OPIVV, "vrgatherei16.vv">, 1462 Sched<[WriteVGatherV, ReadVGatherV, ReadVGatherV]>; 1463} // Constraints = "@earlyclobber $vd", RVVConstraint = Vrgather 1464 1465// Vector Compress Instruction 1466let Constraints = "@earlyclobber $vd", RVVConstraint = Vcompress in { 1467defm VCOMPRESS_V : VCPR_MV_Mask<"vcompress", 0b010111>; 1468} // Constraints = "@earlyclobber $vd", RVVConstraint = Vcompress 1469 1470let hasSideEffects = 0, mayLoad = 0, mayStore = 0, 1471 RVVConstraint = NoConstraint in { 1472foreach n = [1, 2, 4, 8] in { 1473 def VMV#n#R_V : RVInstV<0b100111, !add(n, -1), OPIVI, (outs VR:$vd), 1474 (ins VR:$vs2), "vmv" # n # "r.v", "$vd, $vs2">, 1475 VMVRSched<n> { 1476 let Uses = []; 1477 let vm = 1; 1478} 1479} 1480} // hasSideEffects = 0, mayLoad = 0, mayStore = 0 1481} // Predicates = [HasStdExtV] 1482 1483let Predicates = [HasStdExtZvlsseg] in { 1484 foreach nf=2-8 in { 1485 def VLSEG#nf#E8_V : VUnitStrideSegmentLoad<!add(nf, -1), LUMOPUnitStride, LSWidth8, "vlseg"#nf#"e8.v">; 1486 def VLSEG#nf#E16_V : VUnitStrideSegmentLoad<!add(nf, -1), LUMOPUnitStride, LSWidth16, "vlseg"#nf#"e16.v">; 1487 def VLSEG#nf#E32_V : VUnitStrideSegmentLoad<!add(nf, -1), LUMOPUnitStride, LSWidth32, "vlseg"#nf#"e32.v">; 1488 def VLSEG#nf#E64_V : VUnitStrideSegmentLoad<!add(nf, -1), LUMOPUnitStride, LSWidth64, "vlseg"#nf#"e64.v">; 1489 1490 def VLSEG#nf#E8FF_V : VUnitStrideSegmentLoad<!add(nf, -1), LUMOPUnitStrideFF, LSWidth8, "vlseg"#nf#"e8ff.v">; 1491 def VLSEG#nf#E16FF_V : VUnitStrideSegmentLoad<!add(nf, -1), LUMOPUnitStrideFF, LSWidth16, "vlseg"#nf#"e16ff.v">; 1492 def VLSEG#nf#E32FF_V : VUnitStrideSegmentLoad<!add(nf, -1), LUMOPUnitStrideFF, LSWidth32, "vlseg"#nf#"e32ff.v">; 1493 def VLSEG#nf#E64FF_V : VUnitStrideSegmentLoad<!add(nf, -1), LUMOPUnitStrideFF, LSWidth64, "vlseg"#nf#"e64ff.v">; 1494 1495 def VSSEG#nf#E8_V : VUnitStrideSegmentStore<!add(nf, -1), LSWidth8, "vsseg"#nf#"e8.v">; 1496 def VSSEG#nf#E16_V : VUnitStrideSegmentStore<!add(nf, -1), LSWidth16, "vsseg"#nf#"e16.v">; 1497 def VSSEG#nf#E32_V : VUnitStrideSegmentStore<!add(nf, -1), LSWidth32, "vsseg"#nf#"e32.v">; 1498 def VSSEG#nf#E64_V : VUnitStrideSegmentStore<!add(nf, -1), LSWidth64, "vsseg"#nf#"e64.v">; 1499 1500 // Vector Strided Instructions 1501 def VLSSEG#nf#E8_V : VStridedSegmentLoad<!add(nf, -1), LSWidth8, "vlsseg"#nf#"e8.v">; 1502 def VLSSEG#nf#E16_V : VStridedSegmentLoad<!add(nf, -1), LSWidth16, "vlsseg"#nf#"e16.v">; 1503 def VLSSEG#nf#E32_V : VStridedSegmentLoad<!add(nf, -1), LSWidth32, "vlsseg"#nf#"e32.v">; 1504 def VLSSEG#nf#E64_V : VStridedSegmentLoad<!add(nf, -1), LSWidth64, "vlsseg"#nf#"e64.v">; 1505 1506 def VSSSEG#nf#E8_V : VStridedSegmentStore<!add(nf, -1), LSWidth8, "vssseg"#nf#"e8.v">; 1507 def VSSSEG#nf#E16_V : VStridedSegmentStore<!add(nf, -1), LSWidth16, "vssseg"#nf#"e16.v">; 1508 def VSSSEG#nf#E32_V : VStridedSegmentStore<!add(nf, -1), LSWidth32, "vssseg"#nf#"e32.v">; 1509 def VSSSEG#nf#E64_V : VStridedSegmentStore<!add(nf, -1), LSWidth64, "vssseg"#nf#"e64.v">; 1510 1511 // Vector Indexed Instructions 1512 def VLUXSEG#nf#EI8_V : VIndexedSegmentLoad<!add(nf, -1), MOPLDIndexedUnord, 1513 LSWidth8, "vluxseg"#nf#"ei8.v">; 1514 def VLUXSEG#nf#EI16_V : VIndexedSegmentLoad<!add(nf, -1), MOPLDIndexedUnord, 1515 LSWidth16, "vluxseg"#nf#"ei16.v">; 1516 def VLUXSEG#nf#EI32_V : VIndexedSegmentLoad<!add(nf, -1), MOPLDIndexedUnord, 1517 LSWidth32, "vluxseg"#nf#"ei32.v">; 1518 def VLUXSEG#nf#EI64_V : VIndexedSegmentLoad<!add(nf, -1), MOPLDIndexedUnord, 1519 LSWidth64, "vluxseg"#nf#"ei64.v">; 1520 1521 def VLOXSEG#nf#EI8_V : VIndexedSegmentLoad<!add(nf, -1), MOPLDIndexedOrder, 1522 LSWidth8, "vloxseg"#nf#"ei8.v">; 1523 def VLOXSEG#nf#EI16_V : VIndexedSegmentLoad<!add(nf, -1), MOPLDIndexedOrder, 1524 LSWidth16, "vloxseg"#nf#"ei16.v">; 1525 def VLOXSEG#nf#EI32_V : VIndexedSegmentLoad<!add(nf, -1), MOPLDIndexedOrder, 1526 LSWidth32, "vloxseg"#nf#"ei32.v">; 1527 def VLOXSEG#nf#EI64_V : VIndexedSegmentLoad<!add(nf, -1), MOPLDIndexedOrder, 1528 LSWidth64, "vloxseg"#nf#"ei64.v">; 1529 1530 def VSUXSEG#nf#EI8_V : VIndexedSegmentStore<!add(nf, -1), MOPSTIndexedUnord, 1531 LSWidth8, "vsuxseg"#nf#"ei8.v">; 1532 def VSUXSEG#nf#EI16_V : VIndexedSegmentStore<!add(nf, -1), MOPSTIndexedUnord, 1533 LSWidth16, "vsuxseg"#nf#"ei16.v">; 1534 def VSUXSEG#nf#EI32_V : VIndexedSegmentStore<!add(nf, -1), MOPSTIndexedUnord, 1535 LSWidth32, "vsuxseg"#nf#"ei32.v">; 1536 def VSUXSEG#nf#EI64_V : VIndexedSegmentStore<!add(nf, -1), MOPSTIndexedUnord, 1537 LSWidth64, "vsuxseg"#nf#"ei64.v">; 1538 1539 def VSOXSEG#nf#EI8_V : VIndexedSegmentStore<!add(nf, -1), MOPSTIndexedOrder, 1540 LSWidth8, "vsoxseg"#nf#"ei8.v">; 1541 def VSOXSEG#nf#EI16_V : VIndexedSegmentStore<!add(nf, -1), MOPSTIndexedOrder, 1542 LSWidth16, "vsoxseg"#nf#"ei16.v">; 1543 def VSOXSEG#nf#EI32_V : VIndexedSegmentStore<!add(nf, -1), MOPSTIndexedOrder, 1544 LSWidth32, "vsoxseg"#nf#"ei32.v">; 1545 def VSOXSEG#nf#EI64_V : VIndexedSegmentStore<!add(nf, -1), MOPSTIndexedOrder, 1546 LSWidth64, "vsoxseg"#nf#"ei64.v">; 1547 } 1548} // Predicates = [HasStdExtZvlsseg] 1549 1550let Predicates = [HasStdExtZvamo, HasStdExtA] in { 1551 defm VAMOSWAPEI8 : VAMO<AMOOPVamoSwap, LSWidth8, "vamoswapei8.v">; 1552 defm VAMOSWAPEI16 : VAMO<AMOOPVamoSwap, LSWidth16, "vamoswapei16.v">; 1553 defm VAMOSWAPEI32 : VAMO<AMOOPVamoSwap, LSWidth32, "vamoswapei32.v">; 1554 1555 defm VAMOADDEI8 : VAMO<AMOOPVamoAdd, LSWidth8, "vamoaddei8.v">; 1556 defm VAMOADDEI16 : VAMO<AMOOPVamoAdd, LSWidth16, "vamoaddei16.v">; 1557 defm VAMOADDEI32 : VAMO<AMOOPVamoAdd, LSWidth32, "vamoaddei32.v">; 1558 1559 defm VAMOXOREI8 : VAMO<AMOOPVamoXor, LSWidth8, "vamoxorei8.v">; 1560 defm VAMOXOREI16 : VAMO<AMOOPVamoXor, LSWidth16, "vamoxorei16.v">; 1561 defm VAMOXOREI32 : VAMO<AMOOPVamoXor, LSWidth32, "vamoxorei32.v">; 1562 1563 defm VAMOANDEI8 : VAMO<AMOOPVamoAnd, LSWidth8, "vamoandei8.v">; 1564 defm VAMOANDEI16 : VAMO<AMOOPVamoAnd, LSWidth16, "vamoandei16.v">; 1565 defm VAMOANDEI32 : VAMO<AMOOPVamoAnd, LSWidth32, "vamoandei32.v">; 1566 1567 defm VAMOOREI8 : VAMO<AMOOPVamoOr, LSWidth8, "vamoorei8.v">; 1568 defm VAMOOREI16 : VAMO<AMOOPVamoOr, LSWidth16, "vamoorei16.v">; 1569 defm VAMOOREI32 : VAMO<AMOOPVamoOr, LSWidth32, "vamoorei32.v">; 1570 1571 defm VAMOMINEI8 : VAMO<AMOOPVamoMin, LSWidth8, "vamominei8.v">; 1572 defm VAMOMINEI16 : VAMO<AMOOPVamoMin, LSWidth16, "vamominei16.v">; 1573 defm VAMOMINEI32 : VAMO<AMOOPVamoMin, LSWidth32, "vamominei32.v">; 1574 1575 defm VAMOMAXEI8 : VAMO<AMOOPVamoMax, LSWidth8, "vamomaxei8.v">; 1576 defm VAMOMAXEI16 : VAMO<AMOOPVamoMax, LSWidth16, "vamomaxei16.v">; 1577 defm VAMOMAXEI32 : VAMO<AMOOPVamoMax, LSWidth32, "vamomaxei32.v">; 1578 1579 defm VAMOMINUEI8 : VAMO<AMOOPVamoMinu, LSWidth8, "vamominuei8.v">; 1580 defm VAMOMINUEI16 : VAMO<AMOOPVamoMinu, LSWidth16, "vamominuei16.v">; 1581 defm VAMOMINUEI32 : VAMO<AMOOPVamoMinu, LSWidth32, "vamominuei32.v">; 1582 1583 defm VAMOMAXUEI8 : VAMO<AMOOPVamoMaxu, LSWidth8, "vamomaxuei8.v">; 1584 defm VAMOMAXUEI16 : VAMO<AMOOPVamoMaxu, LSWidth16, "vamomaxuei16.v">; 1585 defm VAMOMAXUEI32 : VAMO<AMOOPVamoMaxu, LSWidth32, "vamomaxuei32.v">; 1586} // Predicates = [HasStdExtZvamo, HasStdExtA] 1587 1588let Predicates = [HasStdExtZvamo, HasStdExtA, IsRV64] in { 1589 defm VAMOSWAPEI64 : VAMO<AMOOPVamoSwap, LSWidth64, "vamoswapei64.v">; 1590 defm VAMOADDEI64 : VAMO<AMOOPVamoAdd, LSWidth64, "vamoaddei64.v">; 1591 defm VAMOXOREI64 : VAMO<AMOOPVamoXor, LSWidth64, "vamoxorei64.v">; 1592 defm VAMOANDEI64 : VAMO<AMOOPVamoAnd, LSWidth64, "vamoandei64.v">; 1593 defm VAMOOREI64 : VAMO<AMOOPVamoOr, LSWidth64, "vamoorei64.v">; 1594 defm VAMOMINEI64 : VAMO<AMOOPVamoMin, LSWidth64, "vamominei64.v">; 1595 defm VAMOMAXEI64 : VAMO<AMOOPVamoMax, LSWidth64, "vamomaxei64.v">; 1596 defm VAMOMINUEI64 : VAMO<AMOOPVamoMinu, LSWidth64, "vamominuei64.v">; 1597 defm VAMOMAXUEI64 : VAMO<AMOOPVamoMaxu, LSWidth64, "vamomaxuei64.v">; 1598} // Predicates = [HasStdExtZvamo, HasStdExtA, IsRV64] 1599 1600include "RISCVInstrInfoVPseudos.td" 1601