xref: /freebsd/contrib/llvm-project/llvm/lib/Target/VE/VEInstrVec.td (revision fcaf7f8644a9988098ac6be2165bce3ea4786e91)
1e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===//
2e8d8bef9SDimitry Andric// Vector Instructions
3e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===//
4e8d8bef9SDimitry Andric
5*fcaf7f86SDimitry Andric// Pseudo instructions for VM/VM512 spill/restore
6*fcaf7f86SDimitry Andric//
7*fcaf7f86SDimitry Andric// These pseudo instructions are used for only spill/restore since
8*fcaf7f86SDimitry Andric// InlineSpiller assumes storeRegToStackSlot/loadRegFromStackSlot
9*fcaf7f86SDimitry Andric// functions emit only single instruction.  Those functions emit a
10*fcaf7f86SDimitry Andric// single store/load instruction or one of these pseudo store/load
11*fcaf7f86SDimitry Andric// instructions.
12*fcaf7f86SDimitry Andric//
13*fcaf7f86SDimitry Andric// Specifies hasSideEffects = 0 to disable UnmodeledSideEffects.
14*fcaf7f86SDimitry Andric
15*fcaf7f86SDimitry Andriclet mayLoad = 1, hasSideEffects = 0 in {
16*fcaf7f86SDimitry Andricdef LDVMrii : Pseudo<
17*fcaf7f86SDimitry Andric    (outs VM:$vmx), (ins MEMrii:$addr),
18*fcaf7f86SDimitry Andric    "# pseudo ldvm $vmx, $addr", []>;
19*fcaf7f86SDimitry Andricdef LDVM512rii : Pseudo<
20*fcaf7f86SDimitry Andric    (outs VM512:$vmx), (ins MEMrii:$addr),
21*fcaf7f86SDimitry Andric    "# pseudo ldvm512 $vmx, $addr", []>;
22*fcaf7f86SDimitry Andric}
23*fcaf7f86SDimitry Andriclet mayStore = 1, hasSideEffects = 0 in {
24*fcaf7f86SDimitry Andricdef STVMrii : Pseudo<
25*fcaf7f86SDimitry Andric    (outs), (ins MEMrii:$addr, VM:$vmx),
26*fcaf7f86SDimitry Andric    "# pseudo stvm $addr, $vmx", []>;
27*fcaf7f86SDimitry Andricdef STVM512rii : Pseudo<
28*fcaf7f86SDimitry Andric    (outs), (ins MEMrii:$addr, VM512:$vmx),
29*fcaf7f86SDimitry Andric    "# pseudo stvm512 $addr, $vmx", []>;
30*fcaf7f86SDimitry Andric}
31*fcaf7f86SDimitry Andric
32e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===//
33e8d8bef9SDimitry Andric// Pseudo instructions for VM512 modifications
34e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===//
35e8d8bef9SDimitry Andric
36e8d8bef9SDimitry Andric// LVM/SVM instructions using VM512
37e8d8bef9SDimitry Andriclet hasSideEffects = 0, isCodeGenOnly = 1 in {
38e8d8bef9SDimitry Andric  let Constraints = "$vx = $vd", DisableEncoding = "$vd" in {
39e8d8bef9SDimitry Andric    def LVMyir_y : Pseudo<(outs VM512:$vx), (ins uimm3:$sy, I64:$sz, VM512:$vd),
40e8d8bef9SDimitry Andric                          "# pseudo LVM $vx, $sy, $sz, $vd">;
41e8d8bef9SDimitry Andric    def LVMyim_y : Pseudo<(outs VM512:$vx),
42e8d8bef9SDimitry Andric                          (ins uimm3:$sy, mimm:$sz, VM512:$vd),
43e8d8bef9SDimitry Andric                          "# pseudo LVM $vx, $sy, $sz, $vd">;
44e8d8bef9SDimitry Andric  }
45e8d8bef9SDimitry Andric  def LVMyir : Pseudo<(outs VM512:$vx), (ins uimm3:$sy, I64:$sz),
46e8d8bef9SDimitry Andric                      "# pseudo LVM $vx, $sy, $sz">;
47e8d8bef9SDimitry Andric  def LVMyim : Pseudo<(outs VM512:$vx), (ins uimm3:$sy, mimm:$sz),
48e8d8bef9SDimitry Andric                      "# pseudo LVM $vx, $sy, $sz">;
49e8d8bef9SDimitry Andric  def SVMyi : Pseudo<(outs I64:$sx), (ins VM512:$vz, uimm3:$sy),
50e8d8bef9SDimitry Andric                     "# pseudo SVM $sx, $vz, $sy">;
51e8d8bef9SDimitry Andric}
52e8d8bef9SDimitry Andric
53e8d8bef9SDimitry Andric// VFMK/VFMKW/VFMKS instructions using VM512
54e8d8bef9SDimitry Andriclet hasSideEffects = 0, isCodeGenOnly = 1, DisableEncoding = "$vl" in {
55e8d8bef9SDimitry Andric  def VFMKyal : Pseudo<(outs VM512:$vmx), (ins I32:$vl),
56e8d8bef9SDimitry Andric                       "# pseudo-vfmk.at $vmx">;
57e8d8bef9SDimitry Andric  def VFMKynal : Pseudo<(outs VM512:$vmx), (ins I32:$vl),
58e8d8bef9SDimitry Andric                        "# pseudo-vfmk.af $vmx">;
59e8d8bef9SDimitry Andric  def VFMKWyvl  : Pseudo<(outs VM512:$vmx),
60e8d8bef9SDimitry Andric                         (ins CCOp:$cf, V64:$vz, I32:$vl),
61e8d8bef9SDimitry Andric                         "# pseudo-vfmk.w.$cf $vmx, $vz">;
62e8d8bef9SDimitry Andric  def VFMKWyvyl : Pseudo<(outs VM512:$vmx),
63e8d8bef9SDimitry Andric                         (ins CCOp:$cf, V64:$vz, VM512:$vm, I32:$vl),
64e8d8bef9SDimitry Andric                         "# pseudo-vfmk.w.$cf $vmx, $vz, $vm">;
65e8d8bef9SDimitry Andric  def VFMKSyvl  : Pseudo<(outs VM512:$vmx),
66e8d8bef9SDimitry Andric                         (ins CCOp:$cf, V64:$vz, I32:$vl),
67e8d8bef9SDimitry Andric                         "# pseudo-vfmk.s.$cf $vmx, $vz">;
68e8d8bef9SDimitry Andric  def VFMKSyvyl : Pseudo<(outs VM512:$vmx),
69e8d8bef9SDimitry Andric                         (ins CCOp:$cf, V64:$vz, VM512:$vm, I32:$vl),
70e8d8bef9SDimitry Andric                         "# pseudo-vfmk.s.$cf $vmx, $vz, $vm">;
71e8d8bef9SDimitry Andric}
72e8d8bef9SDimitry Andric
73e8d8bef9SDimitry Andric// ANDM/ORM/XORM/EQVM/NNDM/NEGM instructions using VM512
74e8d8bef9SDimitry Andriclet hasSideEffects = 0, isCodeGenOnly = 1 in {
75e8d8bef9SDimitry Andric  def ANDMyy : Pseudo<(outs VM512:$vmx), (ins VM512:$vmy, VM512:$vmz),
76e8d8bef9SDimitry Andric                      "# andm $vmx, $vmy, $vmz">;
77e8d8bef9SDimitry Andric  def ORMyy : Pseudo<(outs VM512:$vmx), (ins VM512:$vmy, VM512:$vmz),
78e8d8bef9SDimitry Andric                     "# orm $vmx, $vmy, $vmz">;
79e8d8bef9SDimitry Andric  def XORMyy : Pseudo<(outs VM512:$vmx), (ins VM512:$vmy, VM512:$vmz),
80e8d8bef9SDimitry Andric                      "# xorm $vmx, $vmy, $vmz">;
81e8d8bef9SDimitry Andric  def EQVMyy : Pseudo<(outs VM512:$vmx), (ins VM512:$vmy, VM512:$vmz),
82e8d8bef9SDimitry Andric                      "# eqvm $vmx, $vmy, $vmz">;
83e8d8bef9SDimitry Andric  def NNDMyy : Pseudo<(outs VM512:$vmx), (ins VM512:$vmy, VM512:$vmz),
84e8d8bef9SDimitry Andric                      "# nndm $vmx, $vmy, $vmz">;
85e8d8bef9SDimitry Andric  def NEGMy : Pseudo<(outs VM512:$vmx), (ins VM512:$vmy),
86e8d8bef9SDimitry Andric                     "# negm $vmx, $vmy">;
87e8d8bef9SDimitry Andric}
88e8d8bef9SDimitry Andric
89e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===//
90e8d8bef9SDimitry Andric// Instructions
91e8d8bef9SDimitry Andric//
92e8d8bef9SDimitry Andric// Define all vector instructions defined in SX-Aurora TSUBASA Architecture
93e8d8bef9SDimitry Andric// Guide here.  As those mnemonics, we use mnemonics defined in Vector Engine
94e8d8bef9SDimitry Andric// Assembly Language Reference Manual.
95e8d8bef9SDimitry Andric//
96e8d8bef9SDimitry Andric// Some instructions can update existing data by following instructions
97e8d8bef9SDimitry Andric// sequence.
98e8d8bef9SDimitry Andric//
99e8d8bef9SDimitry Andric//   lea %s0, 256
100e8d8bef9SDimitry Andric//   lea %s1, 128
101e8d8bef9SDimitry Andric//   lvl %s0
102e8d8bef9SDimitry Andric//   vbrd %v0, 2 # v0 = { 2, 2, 2, ..., 2, 2, 2 }
103e8d8bef9SDimitry Andric//   lvl %s1
104e8d8bef9SDimitry Andric//   vbrd %v0, 3 # v0 = { 3, 3, 3, ..., 3, 2, 2, 2, ..., 2, 2, 2 }
105e8d8bef9SDimitry Andric//
106e8d8bef9SDimitry Andric// In order to represent above with a virtual register, we defines instructions
107e8d8bef9SDimitry Andric// with an additional base register and `_v` suffiex in mnemonic.
108e8d8bef9SDimitry Andric//
109e8d8bef9SDimitry Andric//   lea t0, 256
110e8d8bef9SDimitry Andric//   lea t1, 128
111e8d8bef9SDimitry Andric//   lea t0
112e8d8bef9SDimitry Andric//   vbrd tv0, 2
113e8d8bef9SDimitry Andric//   lvl t1
114e8d8bef9SDimitry Andric//   vbrd_v tv1, 2, tv0
115e8d8bef9SDimitry Andric//
116e8d8bef9SDimitry Andric// We also have some instructions uses VL register with an pseudo VL value
117e8d8bef9SDimitry Andric// with following suffixes in mnemonic.
118e8d8bef9SDimitry Andric//
119e8d8bef9SDimitry Andric//   l: have an additional I32 register to represent the VL value.
120e8d8bef9SDimitry Andric//   L: have an additional VL register to represent the VL value.
121e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===//
122e8d8bef9SDimitry Andric
123e8d8bef9SDimitry Andric//-----------------------------------------------------------------------------
124e8d8bef9SDimitry Andric// Section 8.9 - Vector Load/Store and Move Instructions
125e8d8bef9SDimitry Andric//-----------------------------------------------------------------------------
126e8d8bef9SDimitry Andric
127e8d8bef9SDimitry Andric// Multiclass for VLD instructions
128e8d8bef9SDimitry Andriclet mayLoad = 1, hasSideEffects = 0, Uses = [VL] in
129e8d8bef9SDimitry Andricmulticlass VLDbm<string opcStr, bits<8>opc, RegisterClass RC, dag dag_in,
130e8d8bef9SDimitry Andric                 string disEnc = ""> {
131e8d8bef9SDimitry Andric  let DisableEncoding = disEnc in
132e8d8bef9SDimitry Andric  def "" : RVM<opc, (outs RC:$vx), dag_in,
133e8d8bef9SDimitry Andric               !strconcat(opcStr, " $vx, $sy, $sz")>;
134e8d8bef9SDimitry Andric  let Constraints = "$vx = $base", DisableEncoding = disEnc#"$base",
135e8d8bef9SDimitry Andric      isCodeGenOnly = 1 in
136e8d8bef9SDimitry Andric  def _v : RVM<opc, (outs RC:$vx), !con(dag_in, (ins RC:$base)),
137e8d8bef9SDimitry Andric               !strconcat(opcStr, " $vx, $sy, $sz")>;
138e8d8bef9SDimitry Andric}
139e8d8bef9SDimitry Andricmulticlass VLDlm<string opcStr, bits<8>opc, RegisterClass RC, dag dag_in> {
140e8d8bef9SDimitry Andric  defm "" : VLDbm<opcStr, opc, RC, dag_in>;
141e8d8bef9SDimitry Andric  let isCodeGenOnly = 1, VE_VLInUse = 1 in {
142e8d8bef9SDimitry Andric    defm l : VLDbm<opcStr, opc, RC, !con(dag_in, (ins I32:$vl)), "$vl,">;
143e8d8bef9SDimitry Andric    defm L : VLDbm<opcStr, opc, RC, !con(dag_in, (ins VLS:$vl)), "$vl,">;
144e8d8bef9SDimitry Andric  }
145e8d8bef9SDimitry Andric}
146e8d8bef9SDimitry Andriclet VE_VLIndex = 3 in
147e8d8bef9SDimitry Andricmulticlass VLDtgm<string opcStr, bits<8>opc, RegisterClass RC> {
148e8d8bef9SDimitry Andric  defm rr : VLDlm<opcStr, opc, RC, (ins I64:$sy, I64:$sz)>;
149e8d8bef9SDimitry Andric  let cy = 0 in
150e8d8bef9SDimitry Andric  defm ir : VLDlm<opcStr, opc, RC, (ins simm7:$sy, I64:$sz)>;
151e8d8bef9SDimitry Andric  let cz = 0 in
152e8d8bef9SDimitry Andric  defm rz : VLDlm<opcStr, opc, RC, (ins I64:$sy, zero:$sz)>;
153e8d8bef9SDimitry Andric  let cy = 0, cz = 0 in
154e8d8bef9SDimitry Andric  defm iz : VLDlm<opcStr, opc, RC, (ins simm7:$sy, zero:$sz)>;
155e8d8bef9SDimitry Andric}
156e8d8bef9SDimitry Andricmulticlass VLDm<string opcStr, bits<8>opc, RegisterClass RC> {
157e8d8bef9SDimitry Andric  let vc = 1 in defm "" : VLDtgm<opcStr, opc, RC>;
158e8d8bef9SDimitry Andric  let vc = 0 in defm NC : VLDtgm<opcStr#".nc", opc, RC>;
159e8d8bef9SDimitry Andric}
160e8d8bef9SDimitry Andric
161e8d8bef9SDimitry Andric// Section 8.9.1 - VLD (Vector Load)
162e8d8bef9SDimitry Andricdefm VLD : VLDm<"vld", 0x81, V64>;
163e8d8bef9SDimitry Andric
164e8d8bef9SDimitry Andric// Section 8.9.2 - VLDU (Vector Load Upper)
165e8d8bef9SDimitry Andricdefm VLDU : VLDm<"vldu", 0x82, V64>;
166e8d8bef9SDimitry Andric
167e8d8bef9SDimitry Andric// Section 8.9.3 - VLDL (Vector Load Lower)
168e8d8bef9SDimitry Andricdefm VLDLSX : VLDm<"vldl.sx", 0x83, V64>;
169e8d8bef9SDimitry Andriclet cx = 1 in defm VLDLZX : VLDm<"vldl.zx", 0x83, V64>;
170e8d8bef9SDimitry Andric
171e8d8bef9SDimitry Andric// Section 8.9.4 - VLD2D (Vector Load 2D)
172e8d8bef9SDimitry Andricdefm VLD2D : VLDm<"vld2d", 0xc1, V64>;
173e8d8bef9SDimitry Andric
174e8d8bef9SDimitry Andric// Section 8.9.5 - VLDU2D (Vector Load Upper 2D)
175e8d8bef9SDimitry Andricdefm VLDU2D : VLDm<"vldu2d", 0xc2, V64>;
176e8d8bef9SDimitry Andric
177e8d8bef9SDimitry Andric// Section 8.9.6 - VLDL2D (Vector Load Lower 2D)
178e8d8bef9SDimitry Andricdefm VLDL2DSX : VLDm<"vldl2d.sx", 0xc3, V64>;
179e8d8bef9SDimitry Andriclet cx = 1 in defm VLDL2DZX : VLDm<"vldl2d.zx", 0xc3, V64>;
180e8d8bef9SDimitry Andric
181e8d8bef9SDimitry Andric// Multiclass for VST instructions
182e8d8bef9SDimitry Andriclet mayStore = 1, hasSideEffects = 0, Uses = [VL] in
183e8d8bef9SDimitry Andricmulticlass VSTbm<string opcStr, string argStr, bits<8>opc, dag dag_in> {
184e8d8bef9SDimitry Andric  def "" : RVM<opc, (outs), dag_in, !strconcat(opcStr, argStr)>;
185e8d8bef9SDimitry Andric  let DisableEncoding = "$vl", isCodeGenOnly = 1, VE_VLInUse = 1 in {
186e8d8bef9SDimitry Andric    def l : RVM<opc, (outs), !con(dag_in, (ins I32:$vl)),
187e8d8bef9SDimitry Andric                !strconcat(opcStr, argStr)>;
188e8d8bef9SDimitry Andric    def L : RVM<opc, (outs), !con(dag_in, (ins VLS:$vl)),
189e8d8bef9SDimitry Andric                !strconcat(opcStr, argStr)>;
190e8d8bef9SDimitry Andric  }
191e8d8bef9SDimitry Andric}
192e8d8bef9SDimitry Andricmulticlass VSTmm<string opcStr, bits<8>opc, dag dag_in> {
193e8d8bef9SDimitry Andric  defm "" : VSTbm<opcStr, " $vx, $sy, $sz", opc, dag_in>;
194e8d8bef9SDimitry Andric  let m = ?, VE_VLWithMask = 1 in
195e8d8bef9SDimitry Andric  defm m : VSTbm<opcStr, " $vx, $sy, $sz, $m", opc, !con(dag_in, (ins VM:$m))>;
196e8d8bef9SDimitry Andric}
197e8d8bef9SDimitry Andriclet VE_VLIndex = 3 in
198e8d8bef9SDimitry Andricmulticlass VSTtgm<string opcStr, bits<8>opc, RegisterClass RC> {
199e8d8bef9SDimitry Andric  defm rrv : VSTmm<opcStr, opc, (ins I64:$sy, I64:$sz, RC:$vx)>;
200e8d8bef9SDimitry Andric  let cy = 0 in
201e8d8bef9SDimitry Andric  defm irv : VSTmm<opcStr, opc, (ins simm7:$sy, I64:$sz, RC:$vx)>;
202e8d8bef9SDimitry Andric  let cz = 0 in
203e8d8bef9SDimitry Andric  defm rzv : VSTmm<opcStr, opc, (ins I64:$sy, zero:$sz, RC:$vx)>;
204e8d8bef9SDimitry Andric  let cy = 0, cz = 0 in
205e8d8bef9SDimitry Andric  defm izv : VSTmm<opcStr, opc, (ins simm7:$sy, zero:$sz, RC:$vx)>;
206e8d8bef9SDimitry Andric}
207e8d8bef9SDimitry Andricmulticlass VSTm<string opcStr, bits<8>opc, RegisterClass RC> {
208e8d8bef9SDimitry Andric  let vc = 1, cx = 0 in defm "" : VSTtgm<opcStr, opc, RC>;
209e8d8bef9SDimitry Andric  let vc = 0, cx = 0 in defm NC : VSTtgm<opcStr#".nc", opc, RC>;
210e8d8bef9SDimitry Andric  let vc = 1, cx = 1 in defm OT : VSTtgm<opcStr#".ot", opc, RC>;
211e8d8bef9SDimitry Andric  let vc = 0, cx = 1 in defm NCOT : VSTtgm<opcStr#".nc.ot", opc, RC>;
212e8d8bef9SDimitry Andric}
213e8d8bef9SDimitry Andric
214e8d8bef9SDimitry Andric// Section 8.9.7 - VST (Vector Store)
215e8d8bef9SDimitry Andricdefm VST : VSTm<"vst", 0x91, V64>;
216e8d8bef9SDimitry Andric
217e8d8bef9SDimitry Andric// Section 8.9.8 - VST (Vector Store Upper)
218e8d8bef9SDimitry Andricdefm VSTU : VSTm<"vstu", 0x92, V64>;
219e8d8bef9SDimitry Andric
220e8d8bef9SDimitry Andric// Section 8.9.9 - VSTL (Vector Store Lower)
221e8d8bef9SDimitry Andricdefm VSTL : VSTm<"vstl", 0x93, V64>;
222e8d8bef9SDimitry Andric
223e8d8bef9SDimitry Andric// Section 8.9.10 - VST2D (Vector Store 2D)
224e8d8bef9SDimitry Andricdefm VST2D : VSTm<"vst2d", 0xd1, V64>;
225e8d8bef9SDimitry Andric
226e8d8bef9SDimitry Andric// Section 8.9.11 - VSTU2D (Vector Store Upper 2D)
227e8d8bef9SDimitry Andricdefm VSTU2D : VSTm<"vstu2d", 0xd2, V64>;
228e8d8bef9SDimitry Andric
229e8d8bef9SDimitry Andric// Section 8.9.12 - VSTL2D (Vector Store Lower 2D)
230e8d8bef9SDimitry Andricdefm VSTL2D : VSTm<"vstl2d", 0xd3, V64>;
231e8d8bef9SDimitry Andric
232e8d8bef9SDimitry Andric// Multiclass for VGT instructions
233e8d8bef9SDimitry Andriclet mayLoad = 1, hasSideEffects = 0, Uses = [VL] in
234e8d8bef9SDimitry Andricmulticlass VGTbm<string opcStr, string argStr, bits<8>opc, RegisterClass RC,
235e8d8bef9SDimitry Andric                 dag dag_in, string disEnc = ""> {
236e8d8bef9SDimitry Andric  let DisableEncoding = disEnc in
237e8d8bef9SDimitry Andric  def "" : RVM<opc, (outs RC:$vx), dag_in,
238e8d8bef9SDimitry Andric               !strconcat(opcStr, " $vx, ", argStr)>;
239e8d8bef9SDimitry Andric  let Constraints = "$vx = $base", DisableEncoding = disEnc#"$base",
240e8d8bef9SDimitry Andric      isCodeGenOnly = 1 in
241e8d8bef9SDimitry Andric  def _v : RVM<opc, (outs RC:$vx), !con(dag_in, (ins RC:$base)),
242e8d8bef9SDimitry Andric               !strconcat(opcStr, " $vx, ", argStr)>;
243e8d8bef9SDimitry Andric}
244e8d8bef9SDimitry Andricmulticlass VGTlm<string opcStr, string argStr, bits<8>opc, RegisterClass RC,
245e8d8bef9SDimitry Andric                 dag dag_in> {
246e8d8bef9SDimitry Andric  defm "" : VGTbm<opcStr, argStr, opc, RC, dag_in>;
247e8d8bef9SDimitry Andric  let isCodeGenOnly = 1, VE_VLInUse = 1 in {
248e8d8bef9SDimitry Andric    defm l : VGTbm<opcStr, argStr, opc, RC, !con(dag_in, (ins I32:$vl)),
249e8d8bef9SDimitry Andric                   "$vl,">;
250e8d8bef9SDimitry Andric    defm L : VGTbm<opcStr, argStr, opc, RC, !con(dag_in, (ins VLS:$vl)),
251e8d8bef9SDimitry Andric                   "$vl,">;
252e8d8bef9SDimitry Andric  }
253e8d8bef9SDimitry Andric}
254e8d8bef9SDimitry Andricmulticlass VGTmm<string opcStr, string argStr, bits<8>opc, RegisterClass RC,
255e8d8bef9SDimitry Andric                 dag dag_in> {
256e8d8bef9SDimitry Andric  defm "" : VGTlm<opcStr, argStr, opc, RC, dag_in>;
257e8d8bef9SDimitry Andric  let m = ?, VE_VLWithMask = 1 in
258e8d8bef9SDimitry Andric  defm m : VGTlm<opcStr, argStr#", $m", opc, RC, !con(dag_in, (ins VM:$m))>;
259e8d8bef9SDimitry Andric}
260e8d8bef9SDimitry Andriclet VE_VLIndex = 4 in
261e8d8bef9SDimitry Andricmulticlass VGTlhm<string opcStr, string argStr, bits<8>opc, RegisterClass RC,
262e8d8bef9SDimitry Andric                  dag dag_in> {
263e8d8bef9SDimitry Andric  defm rr : VGTmm<opcStr, argStr#", $sy, $sz", opc, RC,
264e8d8bef9SDimitry Andric                  !con(dag_in, (ins I64:$sy, I64:$sz))>;
265e8d8bef9SDimitry Andric  let cy = 0 in
266e8d8bef9SDimitry Andric  defm ir : VGTmm<opcStr, argStr#", $sy, $sz", opc, RC,
267e8d8bef9SDimitry Andric                  !con(dag_in, (ins simm7:$sy, I64:$sz))>;
268e8d8bef9SDimitry Andric  let cz = 0 in
269e8d8bef9SDimitry Andric  defm rz : VGTmm<opcStr, argStr#", $sy, $sz", opc, RC,
270e8d8bef9SDimitry Andric                  !con(dag_in, (ins I64:$sy, zero:$sz))>;
271e8d8bef9SDimitry Andric  let cy = 0, cz = 0 in
272e8d8bef9SDimitry Andric  defm iz : VGTmm<opcStr, argStr#", $sy, $sz", opc, RC,
273e8d8bef9SDimitry Andric                  !con(dag_in, (ins simm7:$sy, zero:$sz))>;
274e8d8bef9SDimitry Andric}
275e8d8bef9SDimitry Andricmulticlass VGTtgm<string opcStr, bits<8>opc, RegisterClass RC> {
276e8d8bef9SDimitry Andric  let vy = ? in defm v : VGTlhm<opcStr, "$vy", opc, RC, (ins V64:$vy)>;
277e8d8bef9SDimitry Andric  let cs = 1, sw = ? in defm s : VGTlhm<opcStr, "$sw", opc, RC, (ins I64:$sw)>;
278e8d8bef9SDimitry Andric}
279e8d8bef9SDimitry Andricmulticlass VGTm<string opcStr, bits<8>opc, RegisterClass RC> {
280e8d8bef9SDimitry Andric  let vc = 1 in defm "" : VGTtgm<opcStr, opc, RC>;
281e8d8bef9SDimitry Andric  let vc = 0 in defm NC : VGTtgm<opcStr#".nc", opc, RC>;
282e8d8bef9SDimitry Andric}
283e8d8bef9SDimitry Andric
284e8d8bef9SDimitry Andric// Section 8.9.13 - VGT (Vector Gather)
285e8d8bef9SDimitry Andricdefm VGT : VGTm<"vgt", 0xa1, V64>;
286e8d8bef9SDimitry Andric
287e8d8bef9SDimitry Andric// Section 8.9.14 - VGTU (Vector Gather Upper)
288e8d8bef9SDimitry Andricdefm VGTU : VGTm<"vgtu", 0xa2, V64>;
289e8d8bef9SDimitry Andric
290e8d8bef9SDimitry Andric// Section 8.9.15 - VGTL (Vector Gather Lower)
291e8d8bef9SDimitry Andricdefm VGTLSX : VGTm<"vgtl.sx", 0xa3, V64>;
292e8d8bef9SDimitry Andriclet cx = 1 in defm VGTLZX : VGTm<"vgtl.zx", 0xa3, V64>;
293e8d8bef9SDimitry Andricdef : MnemonicAlias<"vgtl", "vgtl.zx">;
294e8d8bef9SDimitry Andricdef : MnemonicAlias<"vgtl.nc", "vgtl.zx.nc">;
295e8d8bef9SDimitry Andric
296e8d8bef9SDimitry Andric// Multiclass for VSC instructions
297e8d8bef9SDimitry Andriclet mayStore = 1, hasSideEffects = 0, Uses = [VL] in
298e8d8bef9SDimitry Andricmulticlass VSCbm<string opcStr, string argStr, bits<8>opc, dag dag_in> {
299e8d8bef9SDimitry Andric  def "" : RVM<opc, (outs), dag_in, !strconcat(opcStr, argStr)>;
300e8d8bef9SDimitry Andric  let DisableEncoding = "$vl", isCodeGenOnly = 1, VE_VLInUse = 1 in {
301e8d8bef9SDimitry Andric    def l : RVM<opc, (outs), !con(dag_in, (ins I32:$vl)),
302e8d8bef9SDimitry Andric                !strconcat(opcStr, argStr)>;
303e8d8bef9SDimitry Andric    def L : RVM<opc, (outs), !con(dag_in, (ins VLS:$vl)),
304e8d8bef9SDimitry Andric                !strconcat(opcStr, argStr)>;
305e8d8bef9SDimitry Andric  }
306e8d8bef9SDimitry Andric}
307e8d8bef9SDimitry Andricmulticlass VSCmm<string opcStr, string argStr, bits<8>opc, dag dag_in> {
308e8d8bef9SDimitry Andric  defm "" : VSCbm<opcStr, argStr, opc, dag_in>;
309e8d8bef9SDimitry Andric  let m = ?, VE_VLWithMask = 1 in
310e8d8bef9SDimitry Andric  defm m : VSCbm<opcStr, argStr#", $m", opc, !con(dag_in, (ins VM:$m))>;
311e8d8bef9SDimitry Andric}
312e8d8bef9SDimitry Andriclet VE_VLIndex = 4 in
313e8d8bef9SDimitry Andricmulticlass VSClhm<string opcStr, string argStr, bits<8>opc, RegisterClass RC,
314e8d8bef9SDimitry Andric                  dag dag_in> {
315e8d8bef9SDimitry Andric  defm rrv : VSCmm<opcStr, " $vx, "#argStr#", $sy, $sz", opc,
316e8d8bef9SDimitry Andric                   !con(dag_in, (ins I64:$sy, I64:$sz, RC:$vx))>;
317e8d8bef9SDimitry Andric  let cy = 0 in
318e8d8bef9SDimitry Andric  defm irv : VSCmm<opcStr, " $vx, "#argStr#", $sy, $sz", opc,
319e8d8bef9SDimitry Andric                   !con(dag_in, (ins simm7:$sy, I64:$sz, RC:$vx))>;
320e8d8bef9SDimitry Andric  let cz = 0 in
321e8d8bef9SDimitry Andric  defm rzv : VSCmm<opcStr, " $vx, "#argStr#", $sy, $sz", opc,
322e8d8bef9SDimitry Andric                   !con(dag_in, (ins I64:$sy, zero:$sz, RC:$vx))>;
323e8d8bef9SDimitry Andric  let cy = 0, cz = 0 in
324e8d8bef9SDimitry Andric  defm izv : VSCmm<opcStr, " $vx, "#argStr#", $sy, $sz", opc,
325e8d8bef9SDimitry Andric                   !con(dag_in, (ins simm7:$sy, zero:$sz, RC:$vx))>;
326e8d8bef9SDimitry Andric}
327e8d8bef9SDimitry Andricmulticlass VSCtgm<string opcStr, bits<8>opc, RegisterClass RC> {
328e8d8bef9SDimitry Andric  let vy = ? in defm v : VSClhm<opcStr, "$vy", opc, RC, (ins V64:$vy)>;
329e8d8bef9SDimitry Andric  let cs = 1, sw = ? in defm s : VSClhm<opcStr, "$sw", opc, RC, (ins I64:$sw)>;
330e8d8bef9SDimitry Andric}
331e8d8bef9SDimitry Andricmulticlass VSCm<string opcStr, bits<8>opc, RegisterClass RC> {
332e8d8bef9SDimitry Andric  let vc = 1, cx = 0 in defm "" : VSCtgm<opcStr, opc, RC>;
333e8d8bef9SDimitry Andric  let vc = 0, cx = 0 in defm NC : VSCtgm<opcStr#".nc", opc, RC>;
334e8d8bef9SDimitry Andric  let vc = 1, cx = 1 in defm OT : VSCtgm<opcStr#".ot", opc, RC>;
335e8d8bef9SDimitry Andric  let vc = 0, cx = 1 in defm NCOT : VSCtgm<opcStr#".nc.ot", opc, RC>;
336e8d8bef9SDimitry Andric}
337e8d8bef9SDimitry Andric
338e8d8bef9SDimitry Andric// Section 8.9.16 - VSC (Vector Scatter)
339e8d8bef9SDimitry Andricdefm VSC : VSCm<"vsc", 0xb1, V64>;
340e8d8bef9SDimitry Andric
341e8d8bef9SDimitry Andric// Section 8.9.17 - VSCU (Vector Scatter Upper)
342e8d8bef9SDimitry Andricdefm VSCU : VSCm<"vscu", 0xb2, V64>;
343e8d8bef9SDimitry Andric
344e8d8bef9SDimitry Andric// Section 8.9.18 - VSCL (Vector Scatter Lower)
345e8d8bef9SDimitry Andricdefm VSCL : VSCm<"vscl", 0xb3, V64>;
346e8d8bef9SDimitry Andric
347e8d8bef9SDimitry Andric// Section 8.9.19 - PFCHV (Prefetch Vector)
348e8d8bef9SDimitry Andriclet Uses = [VL] in
349e8d8bef9SDimitry Andricmulticlass PFCHVbm<string opcStr, string argStr, bits<8>opc, dag dag_in> {
350e8d8bef9SDimitry Andric  def "" : RVM<opc, (outs), dag_in, !strconcat(opcStr, argStr)>;
351e8d8bef9SDimitry Andric  let DisableEncoding = "$vl", isCodeGenOnly = 1, VE_VLInUse = 1 in {
352e8d8bef9SDimitry Andric    def l : RVM<opc, (outs), !con(dag_in, (ins I32:$vl)),
353e8d8bef9SDimitry Andric                !strconcat(opcStr, argStr)>;
354e8d8bef9SDimitry Andric    def L : RVM<opc, (outs), !con(dag_in, (ins VLS:$vl)),
355e8d8bef9SDimitry Andric                !strconcat(opcStr, argStr)>;
356e8d8bef9SDimitry Andric  }
357e8d8bef9SDimitry Andric}
358e8d8bef9SDimitry Andriclet VE_VLIndex = 2 in
359e8d8bef9SDimitry Andricmulticlass PFCHVm<string opcStr, bits<8>opc> {
360e8d8bef9SDimitry Andric  defm rr : PFCHVbm<opcStr, " $sy, $sz", opc, (ins I64:$sy, I64:$sz)>;
361e8d8bef9SDimitry Andric  let cy = 0 in
362e8d8bef9SDimitry Andric  defm ir : PFCHVbm<opcStr, " $sy, $sz", opc, (ins simm7:$sy, I64:$sz)>;
363e8d8bef9SDimitry Andric  let cz = 0 in
364e8d8bef9SDimitry Andric  defm rz : PFCHVbm<opcStr, " $sy, $sz", opc, (ins I64:$sy, zero:$sz)>;
365e8d8bef9SDimitry Andric  let cy = 0, cz = 0 in
366e8d8bef9SDimitry Andric  defm iz : PFCHVbm<opcStr, " $sy, $sz", opc, (ins simm7:$sy, zero:$sz)>;
367e8d8bef9SDimitry Andric}
368e8d8bef9SDimitry Andriclet vc = 1, vx = 0 in defm PFCHV : PFCHVm<"pfchv", 0x80>;
369e8d8bef9SDimitry Andriclet vc = 0, vx = 0 in defm PFCHVNC : PFCHVm<"pfchv.nc", 0x80>;
370e8d8bef9SDimitry Andric
371e8d8bef9SDimitry Andric// Section 8.9.20 - LSV (Load S to V)
372e8d8bef9SDimitry Andriclet sx = 0, vx = ?, hasSideEffects = 0 in
373e8d8bef9SDimitry Andricmulticlass LSVbm<string opcStr, string argStr, bits<8>opc, RegisterClass RC,
374e8d8bef9SDimitry Andric                 dag dag_in> {
375e8d8bef9SDimitry Andric  def "" : RR<opc, (outs RC:$vx), dag_in, !strconcat(opcStr, " ${vx}", argStr)>;
376e8d8bef9SDimitry Andric  let Constraints = "$vx = $base", DisableEncoding = "$base",
377e8d8bef9SDimitry Andric      isCodeGenOnly = 1 in
378e8d8bef9SDimitry Andric  def _v : RR<opc, (outs RC:$vx), !con(dag_in, (ins RC:$base)),
379e8d8bef9SDimitry Andric               !strconcat(opcStr, " ${vx}", argStr)>;
380e8d8bef9SDimitry Andric}
381e8d8bef9SDimitry Andricmulticlass LSVm<string opcStr, bits<8>opc, RegisterClass RC> {
382e8d8bef9SDimitry Andric  defm rr : LSVbm<opcStr, "(${sy}), $sz", opc, RC, (ins I64:$sy, I64:$sz)>;
383e8d8bef9SDimitry Andric  let cy = 0 in
384e8d8bef9SDimitry Andric  defm ir : LSVbm<opcStr, "(${sy}), $sz", opc, RC, (ins uimm7:$sy, I64:$sz)>;
385e8d8bef9SDimitry Andric  let cz = 0 in
386e8d8bef9SDimitry Andric  defm rm : LSVbm<opcStr, "(${sy}), $sz", opc, RC, (ins I64:$sy, mimm:$sz)>;
387e8d8bef9SDimitry Andric  let cy = 0, cz = 0 in
388e8d8bef9SDimitry Andric  defm im : LSVbm<opcStr, "(${sy}), $sz", opc, RC, (ins uimm7:$sy, mimm:$sz)>;
389e8d8bef9SDimitry Andric}
390e8d8bef9SDimitry Andricdefm LSV : LSVm<"lsv", 0x8e, V64>;
391e8d8bef9SDimitry Andric
392e8d8bef9SDimitry Andric// Section 8.9.21 - LVS (Load V to S)
393e8d8bef9SDimitry Andriclet cz = 0, sz = 0, vx = ?, hasSideEffects = 0 in
394e8d8bef9SDimitry Andricmulticlass LVSm<string opcStr, bits<8>opc, RegisterClass RC> {
395e8d8bef9SDimitry Andric  def vr : RR<opc, (outs I64:$sx), (ins RC:$vx, I64:$sy),
396e8d8bef9SDimitry Andric              opcStr#" $sx, ${vx}(${sy})">;
397e8d8bef9SDimitry Andric  let cy = 0 in
398e8d8bef9SDimitry Andric  def vi : RR<opc, (outs I64:$sx), (ins RC:$vx, uimm7:$sy),
399e8d8bef9SDimitry Andric              opcStr#" $sx, ${vx}(${sy})">;
400e8d8bef9SDimitry Andric}
401e8d8bef9SDimitry Andricdefm LVS : LVSm<"lvs", 0x9e, V64>;
402e8d8bef9SDimitry Andric
403e8d8bef9SDimitry Andric// Section 8.9.22 - LVM (Load VM)
404e8d8bef9SDimitry Andriclet sx = 0, vx = ?, hasSideEffects = 0 in
405e8d8bef9SDimitry Andricmulticlass LVMbm<string opcStr, string argStr, bits<8>opc, RegisterClass RCM,
406e8d8bef9SDimitry Andric                 dag dag_in> {
407e8d8bef9SDimitry Andric  def "" : RR<opc, (outs RCM:$vx), dag_in,
408e8d8bef9SDimitry Andric              !strconcat(opcStr, " $vx, ", argStr)>;
409e8d8bef9SDimitry Andric  let Constraints = "$vx = $base", DisableEncoding = "$base",
410e8d8bef9SDimitry Andric      isCodeGenOnly = 1 in {
411e8d8bef9SDimitry Andric    def _m : RR<opc, (outs RCM:$vx), !con(dag_in, (ins RCM:$base)),
412e8d8bef9SDimitry Andric                !strconcat(opcStr, " $vx, ", argStr)>;
413e8d8bef9SDimitry Andric  }
414e8d8bef9SDimitry Andric}
415e8d8bef9SDimitry Andricmulticlass LVMom<string opcStr, bits<8>opc, RegisterClass RCM> {
416e8d8bef9SDimitry Andric  defm rr : LVMbm<opcStr, "$sy, $sz", opc, RCM, (ins I64:$sy, I64:$sz)>;
417e8d8bef9SDimitry Andric  let cy = 0 in
418e8d8bef9SDimitry Andric  defm ir : LVMbm<opcStr, "$sy, $sz", opc, RCM, (ins uimm2:$sy, I64:$sz)>;
419e8d8bef9SDimitry Andric  let cz = 0 in
420e8d8bef9SDimitry Andric  defm rm : LVMbm<opcStr, "$sy, $sz", opc, RCM, (ins I64:$sy, mimm:$sz)>;
421e8d8bef9SDimitry Andric  let cy = 0, cz = 0 in
422e8d8bef9SDimitry Andric  defm im : LVMbm<opcStr, "$sy, $sz", opc, RCM, (ins uimm2:$sy, mimm:$sz)>;
423e8d8bef9SDimitry Andric}
424e8d8bef9SDimitry Andricmulticlass LVMm<string opcStr, bits<8>opc, RegisterClass RCM> {
425e8d8bef9SDimitry Andric  defm "" : LVMom<opcStr, opc, RCM>;
426e8d8bef9SDimitry Andric}
427e8d8bef9SDimitry Andricdefm LVM : LVMm<"lvm", 0xb7, VM>;
428e8d8bef9SDimitry Andric
429e8d8bef9SDimitry Andric// Section 8.9.23 - SVM (Save VM)
430e8d8bef9SDimitry Andriclet cz = 0, sz = 0, vz = ?, hasSideEffects = 0 in
431e8d8bef9SDimitry Andricmulticlass SVMm<string opcStr, bits<8>opc, RegisterClass RCM> {
432e8d8bef9SDimitry Andric  def mr : RR<opc, (outs I64:$sx), (ins RCM:$vz, I64:$sy),
433e8d8bef9SDimitry Andric              opcStr#" $sx, $vz, $sy">;
434e8d8bef9SDimitry Andric  let cy = 0 in
435e8d8bef9SDimitry Andric  def mi : RR<opc, (outs I64:$sx), (ins RCM:$vz, uimm2:$sy),
436e8d8bef9SDimitry Andric              opcStr#" $sx, $vz, $sy">;
437e8d8bef9SDimitry Andric}
438e8d8bef9SDimitry Andricdefm SVM : SVMm<"svm", 0xa7, VM>;
439e8d8bef9SDimitry Andric
440e8d8bef9SDimitry Andric// Section 8.9.24 - VBRD (Vector Broadcast)
441e8d8bef9SDimitry Andriclet vx = ?, hasSideEffects = 0, Uses = [VL] in
442e8d8bef9SDimitry Andricmulticlass VBRDbm<string opcStr, string argStr, bits<8>opc, RegisterClass RC,
443e8d8bef9SDimitry Andric                  dag dag_in, string disEnc = ""> {
444e8d8bef9SDimitry Andric  let DisableEncoding = disEnc in
445e8d8bef9SDimitry Andric  def "" : RV<opc, (outs RC:$vx), dag_in,
446e8d8bef9SDimitry Andric              !strconcat(opcStr, " $vx, ", argStr)>;
447e8d8bef9SDimitry Andric  let Constraints = "$vx = $base", DisableEncoding = disEnc#"$base",
448e8d8bef9SDimitry Andric      isCodeGenOnly = 1 in
449e8d8bef9SDimitry Andric  def _v : RV<opc, (outs RC:$vx), !con(dag_in, (ins RC:$base)),
450e8d8bef9SDimitry Andric              !strconcat(opcStr, " $vx, ", argStr)>;
451e8d8bef9SDimitry Andric}
452e8d8bef9SDimitry Andricmulticlass VBRDlm<string opcStr, string argStr, bits<8>opc, RegisterClass RC,
453e8d8bef9SDimitry Andric                  dag dag_in> {
454e8d8bef9SDimitry Andric  defm "" : VBRDbm<opcStr, argStr, opc, RC, dag_in>;
455e8d8bef9SDimitry Andric  let isCodeGenOnly = 1, VE_VLInUse = 1 in {
456e8d8bef9SDimitry Andric    defm l : VBRDbm<opcStr, argStr, opc, RC, !con(dag_in, (ins I32:$vl)),
457e8d8bef9SDimitry Andric                   "$vl,">;
458e8d8bef9SDimitry Andric    defm L : VBRDbm<opcStr, argStr, opc, RC, !con(dag_in, (ins VLS:$vl)),
459e8d8bef9SDimitry Andric                   "$vl,">;
460e8d8bef9SDimitry Andric  }
461e8d8bef9SDimitry Andric}
462e8d8bef9SDimitry Andricmulticlass VBRDmm<string opcStr, string argStr, bits<8>opc, RegisterClass RC,
463e8d8bef9SDimitry Andric                  RegisterClass RCM, dag dag_in> {
464e8d8bef9SDimitry Andric  defm "" : VBRDlm<opcStr, argStr, opc, RC, dag_in>;
465e8d8bef9SDimitry Andric  let m = ?, VE_VLWithMask = 1 in
466e8d8bef9SDimitry Andric  defm m : VBRDlm<opcStr, argStr#", $m", opc, RC, !con(dag_in, (ins RCM:$m))>;
467e8d8bef9SDimitry Andric}
468e8d8bef9SDimitry Andriclet VE_VLIndex = 2 in
469e8d8bef9SDimitry Andricmulticlass VBRDm<string opcStr, bits<8>opc, RegisterClass VRC, RegisterClass RC,
470e8d8bef9SDimitry Andric                 RegisterClass RCM> {
471e8d8bef9SDimitry Andric  defm r : VBRDmm<opcStr, "$sy", opc, VRC, RCM, (ins RC:$sy)>;
472e8d8bef9SDimitry Andric  let cy = 0 in
473e8d8bef9SDimitry Andric  defm i : VBRDmm<opcStr, "$sy", opc, VRC, RCM, (ins simm7:$sy)>;
474e8d8bef9SDimitry Andric}
475e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in
476e8d8bef9SDimitry Andricdefm VBRD : VBRDm<"vbrd", 0x8c, V64, I64, VM>;
477e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in
478e8d8bef9SDimitry Andricdefm VBRDL : VBRDm<"vbrdl", 0x8c, V64, I32, VM>;
479e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in
480e8d8bef9SDimitry Andricdefm VBRDU : VBRDm<"vbrdu", 0x8c, V64, F32, VM>;
481e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in
482e8d8bef9SDimitry Andricdefm PVBRD : VBRDm<"pvbrd", 0x8c, V64, I64, VM512>;
483e8d8bef9SDimitry Andric
484e8d8bef9SDimitry Andric// Section 8.9.25 - VMV (Vector Move)
485e8d8bef9SDimitry Andriclet vx = ?, vz = ?, hasSideEffects = 0, Uses = [VL] in
486e8d8bef9SDimitry Andricmulticlass VMVbm<string opcStr, string argStr, bits<8>opc, RegisterClass RC,
487e8d8bef9SDimitry Andric                 dag dag_in, string disEnc = ""> {
488e8d8bef9SDimitry Andric  let DisableEncoding = disEnc in
489e8d8bef9SDimitry Andric  def "" : RV<opc, (outs RC:$vx), dag_in,
490e8d8bef9SDimitry Andric              !strconcat(opcStr, " $vx, ", argStr)>;
491e8d8bef9SDimitry Andric  let Constraints = "$vx = $base", DisableEncoding = disEnc#"$base",
492e8d8bef9SDimitry Andric      isCodeGenOnly = 1 in
493e8d8bef9SDimitry Andric  def _v : RV<opc, (outs RC:$vx), !con(dag_in, (ins RC:$base)),
494e8d8bef9SDimitry Andric              !strconcat(opcStr, " $vx, ", argStr)>;
495e8d8bef9SDimitry Andric}
496e8d8bef9SDimitry Andricmulticlass VMVlm<string opcStr, string argStr, bits<8>opc, RegisterClass RC,
497e8d8bef9SDimitry Andric                 dag dag_in> {
498e8d8bef9SDimitry Andric  defm "" : VMVbm<opcStr, argStr, opc, RC, dag_in>;
499e8d8bef9SDimitry Andric  let isCodeGenOnly = 1, VE_VLInUse = 1 in {
500e8d8bef9SDimitry Andric    defm l : VMVbm<opcStr, argStr, opc, RC, !con(dag_in, (ins I32:$vl)),
501e8d8bef9SDimitry Andric                   "$vl,">;
502e8d8bef9SDimitry Andric    defm L : VMVbm<opcStr, argStr, opc, RC, !con(dag_in, (ins VLS:$vl)),
503e8d8bef9SDimitry Andric                   "$vl,">;
504e8d8bef9SDimitry Andric  }
505e8d8bef9SDimitry Andric}
506e8d8bef9SDimitry Andricmulticlass VMVmm<string opcStr, bits<8>opc, RegisterClass RC,
507e8d8bef9SDimitry Andric                 RegisterClass RCM, dag dag_in> {
508e8d8bef9SDimitry Andric  defm "" : VMVlm<opcStr, "$sy, $vz", opc, RC, dag_in>;
509e8d8bef9SDimitry Andric  let m = ?, VE_VLWithMask = 1 in
510e8d8bef9SDimitry Andric  defm m : VMVlm<opcStr, "$sy, $vz, $m", opc, RC, !con(dag_in, (ins RCM:$m))>;
511e8d8bef9SDimitry Andric}
512e8d8bef9SDimitry Andriclet VE_VLIndex = 3 in
513e8d8bef9SDimitry Andricmulticlass VMVm<string opcStr, bits<8>opc, RegisterClass RC,
514e8d8bef9SDimitry Andric                RegisterClass RCM> {
515e8d8bef9SDimitry Andric  defm rv : VMVmm<opcStr, opc, RC, RCM, (ins I64:$sy, RC:$vz)>;
516e8d8bef9SDimitry Andric  let cy = 0 in
517e8d8bef9SDimitry Andric  defm iv : VMVmm<opcStr, opc, RC, RCM, (ins uimm7:$sy, RC:$vz)>;
518e8d8bef9SDimitry Andric}
519e8d8bef9SDimitry Andricdefm VMV : VMVm<"vmv", 0x9c, V64, VM>;
520e8d8bef9SDimitry Andric
521e8d8bef9SDimitry Andric//-----------------------------------------------------------------------------
522e8d8bef9SDimitry Andric// Section 8.10 - Vector Fixed-Point Arithmetic Instructions
523e8d8bef9SDimitry Andric//-----------------------------------------------------------------------------
524e8d8bef9SDimitry Andric
525e8d8bef9SDimitry Andric// Multiclass for generic vector calculation
526e8d8bef9SDimitry Andriclet vx = ?, hasSideEffects = 0, Uses = [VL] in
527e8d8bef9SDimitry Andricmulticlass RVbm<string opcStr, string argStr, bits<8>opc, RegisterClass RC,
528e8d8bef9SDimitry Andric                dag dag_in, string disEnc = ""> {
529e8d8bef9SDimitry Andric  let DisableEncoding = disEnc in
530e8d8bef9SDimitry Andric  def "" : RV<opc, (outs RC:$vx), dag_in,
531e8d8bef9SDimitry Andric              !strconcat(opcStr, " $vx", argStr)>;
532e8d8bef9SDimitry Andric  let Constraints = "$vx = $base", DisableEncoding = disEnc#"$base",
533e8d8bef9SDimitry Andric      isCodeGenOnly = 1 in
534e8d8bef9SDimitry Andric  def _v : RV<opc, (outs RC:$vx), !con(dag_in, (ins RC:$base)),
535e8d8bef9SDimitry Andric              !strconcat(opcStr, " $vx", argStr)>;
536e8d8bef9SDimitry Andric}
537e8d8bef9SDimitry Andricmulticlass RVlm<string opcStr, string argStr, bits<8>opc, RegisterClass RC,
538e8d8bef9SDimitry Andric                dag dag_in> {
539e8d8bef9SDimitry Andric  defm "" : RVbm<opcStr, argStr, opc, RC, dag_in>;
540e8d8bef9SDimitry Andric  let isCodeGenOnly = 1, VE_VLInUse = 1 in {
541e8d8bef9SDimitry Andric    defm l : RVbm<opcStr, argStr, opc, RC, !con(dag_in, (ins I32:$vl)),
542e8d8bef9SDimitry Andric                  "$vl,">;
543e8d8bef9SDimitry Andric    defm L : RVbm<opcStr, argStr, opc, RC, !con(dag_in, (ins VLS:$vl)),
544e8d8bef9SDimitry Andric                  "$vl,">;
545e8d8bef9SDimitry Andric  }
546e8d8bef9SDimitry Andric}
547e8d8bef9SDimitry Andricmulticlass RVmm<string opcStr, string argStr, bits<8>opc, RegisterClass RC,
548e8d8bef9SDimitry Andric                RegisterClass RCM, dag dag_in> {
549e8d8bef9SDimitry Andric  defm "" : RVlm<opcStr, argStr, opc, RC, dag_in>;
550e8d8bef9SDimitry Andric  let m = ?, VE_VLWithMask = 1 in
551e8d8bef9SDimitry Andric  defm m : RVlm<opcStr, argStr#", $m", opc, RC, !con(dag_in, (ins RCM:$m))>;
552e8d8bef9SDimitry Andric}
553e8d8bef9SDimitry Andric// Generic RV multiclass with 2 arguments.
554e8d8bef9SDimitry Andric//   e.g. VADD, VSUB, VMPY, and etc.
555e8d8bef9SDimitry Andriclet VE_VLIndex = 3 in
556e8d8bef9SDimitry Andricmulticlass RVm<string opcStr, bits<8>opc, RegisterClass VRC, RegisterClass RC,
557e8d8bef9SDimitry Andric               RegisterClass RCM, Operand SIMM = simm7> {
558e8d8bef9SDimitry Andric  let cy = 0, sy = 0, vy = ?, vz = ? in
559e8d8bef9SDimitry Andric  defm vv : RVmm<opcStr, ", $vy, $vz", opc, VRC, RCM, (ins VRC:$vy, VRC:$vz)>;
560e8d8bef9SDimitry Andric  let cs = 1, vz = ? in
561e8d8bef9SDimitry Andric  defm rv : RVmm<opcStr, ", $sy, $vz", opc, VRC, RCM, (ins RC:$sy, VRC:$vz)>;
562e8d8bef9SDimitry Andric  let cs = 1, cy = 0, vz = ? in
563e8d8bef9SDimitry Andric  defm iv : RVmm<opcStr, ", $sy, $vz", opc, VRC, RCM, (ins SIMM:$sy, VRC:$vz)>;
564e8d8bef9SDimitry Andric}
565e8d8bef9SDimitry Andric// Special RV multiclass with 2 arguments using cs2.
566e8d8bef9SDimitry Andric//   e.g. VDIV, VDVS, and VDVX.
567e8d8bef9SDimitry Andriclet VE_VLIndex = 3 in
568e8d8bef9SDimitry Andricmulticlass RVDIVm<string opcStr, bits<8>opc, RegisterClass VRC,
569e8d8bef9SDimitry Andric                  RegisterClass RC, RegisterClass RCM, Operand SIMM = simm7> {
570e8d8bef9SDimitry Andric  let cy = 0, sy = 0, vy = ?, vz = ? in
571e8d8bef9SDimitry Andric  defm vv : RVmm<opcStr, ", $vy, $vz", opc, VRC, RCM, (ins VRC:$vy, VRC:$vz)>;
572e8d8bef9SDimitry Andric  let cs2 = 1, vy = ? in
573e8d8bef9SDimitry Andric  defm vr : RVmm<opcStr, ", $vy, $sy", opc, VRC, RCM, (ins VRC:$vy, RC:$sy)>;
574e8d8bef9SDimitry Andric  let cs2 = 1, cy = 0, vy = ? in
575e8d8bef9SDimitry Andric  defm vi : RVmm<opcStr, ", $vy, $sy", opc, VRC, RCM, (ins VRC:$vy, SIMM:$sy)>;
576e8d8bef9SDimitry Andric  let cs = 1, vz = ? in
577e8d8bef9SDimitry Andric  defm rv : RVmm<opcStr, ", $sy, $vz", opc, VRC, RCM, (ins RC:$sy, VRC:$vz)>;
578e8d8bef9SDimitry Andric  let cs = 1, cy = 0, vz = ? in
579e8d8bef9SDimitry Andric  defm iv : RVmm<opcStr, ", $sy, $vz", opc, VRC, RCM, (ins SIMM:$sy, VRC:$vz)>;
580e8d8bef9SDimitry Andric}
581e8d8bef9SDimitry Andric// Generic RV multiclass with 2 arguments for logical operations.
582e8d8bef9SDimitry Andric//   e.g. VAND, VOR, VXOR, and etc.
583e8d8bef9SDimitry Andriclet VE_VLIndex = 3 in
584e8d8bef9SDimitry Andricmulticlass RVLm<string opcStr, bits<8>opc, RegisterClass ScaRC,
585e8d8bef9SDimitry Andric                RegisterClass RC, RegisterClass RCM> {
586e8d8bef9SDimitry Andric  let cy = 0, sy = 0, vy = ?, vz = ? in
587e8d8bef9SDimitry Andric  defm vv : RVmm<opcStr, ", $vy, $vz", opc, RC, RCM, (ins RC:$vy, RC:$vz)>;
588e8d8bef9SDimitry Andric  let cs = 1, vz = ? in
589e8d8bef9SDimitry Andric  defm rv : RVmm<opcStr, ", $sy, $vz", opc, RC, RCM, (ins ScaRC:$sy, RC:$vz)>;
590e8d8bef9SDimitry Andric  let cs = 1, cy = 0, vz = ? in
591e8d8bef9SDimitry Andric  defm mv : RVmm<opcStr, ", $sy, $vz", opc, RC, RCM, (ins mimm:$sy, RC:$vz)>;
592e8d8bef9SDimitry Andric}
593e8d8bef9SDimitry Andric// Generic RV multiclass with 1 argument.
594e8d8bef9SDimitry Andric//   e.g. VLDZ, VPCNT, and VBRV.
595e8d8bef9SDimitry Andriclet VE_VLIndex = 2 in
596e8d8bef9SDimitry Andricmulticlass RV1m<string opcStr, bits<8>opc, RegisterClass RC,
597e8d8bef9SDimitry Andric                RegisterClass RCM> {
598e8d8bef9SDimitry Andric  let cy = 0, sy = 0, vz = ? in
599e8d8bef9SDimitry Andric  defm v : RVmm<opcStr, ", $vz", opc, RC, RCM, (ins RC:$vz)>;
600e8d8bef9SDimitry Andric}
601e8d8bef9SDimitry Andric// Generic RV multiclass with no argument.
602e8d8bef9SDimitry Andric//   e.g. VSEQ.
603e8d8bef9SDimitry Andriclet VE_VLIndex = 1 in
604e8d8bef9SDimitry Andricmulticlass RV0m<string opcStr, bits<8>opc, RegisterClass RC,
605e8d8bef9SDimitry Andric                RegisterClass RCM> {
606e8d8bef9SDimitry Andric  let cy = 0, sy = 0 in
607e8d8bef9SDimitry Andric  defm "" : RVmm<opcStr, "", opc, RC, RCM, (ins)>;
608e8d8bef9SDimitry Andric}
609e8d8bef9SDimitry Andric// Generic RV multiclass with 2 arguments for shift operations.
610e8d8bef9SDimitry Andric//   e.g. VSLL, VSRL, VSLA, and etc.
611e8d8bef9SDimitry Andriclet VE_VLIndex = 3 in
612e8d8bef9SDimitry Andricmulticlass RVSm<string opcStr, bits<8>opc, RegisterClass ScaRC,
613e8d8bef9SDimitry Andric                RegisterClass RC, RegisterClass RCM> {
614e8d8bef9SDimitry Andric  let cy = 0, sy = 0, vy = ?, vz = ? in
615e8d8bef9SDimitry Andric  defm vv : RVmm<opcStr, ", $vz, $vy", opc, RC, RCM, (ins RC:$vz, RC:$vy)>;
616e8d8bef9SDimitry Andric  let cs = 1, vz = ? in
617e8d8bef9SDimitry Andric  defm vr : RVmm<opcStr, ", $vz, $sy", opc, RC, RCM, (ins RC:$vz, ScaRC:$sy)>;
618e8d8bef9SDimitry Andric  let cs = 1, cy = 0, vz = ? in
619e8d8bef9SDimitry Andric  defm vi : RVmm<opcStr, ", $vz, $sy", opc, RC, RCM, (ins RC:$vz, uimm7:$sy)>;
620e8d8bef9SDimitry Andric}
621e8d8bef9SDimitry Andric// Generic RV multiclass with 3 arguments for shift operations.
622e8d8bef9SDimitry Andric//   e.g. VSLD and VSRD.
623e8d8bef9SDimitry Andriclet VE_VLIndex = 4 in
624e8d8bef9SDimitry Andricmulticlass RVSDm<string opcStr, bits<8>opc, RegisterClass RC,
625e8d8bef9SDimitry Andric                 RegisterClass RCM> {
626e8d8bef9SDimitry Andric  let vy = ?, vz = ? in
627e8d8bef9SDimitry Andric  defm vvr : RVmm<opcStr, ", ($vy, ${vz}), $sy", opc, RC, RCM,
628e8d8bef9SDimitry Andric                 (ins RC:$vy, RC:$vz, I64:$sy)>;
629e8d8bef9SDimitry Andric  let cy = 0, vy = ?, vz = ? in
630e8d8bef9SDimitry Andric  defm vvi : RVmm<opcStr, ", ($vy, ${vz}), $sy", opc, RC, RCM,
631e8d8bef9SDimitry Andric                 (ins RC:$vy, RC:$vz, uimm7:$sy)>;
632e8d8bef9SDimitry Andric}
633e8d8bef9SDimitry Andric// Special RV multiclass with 3 arguments.
634e8d8bef9SDimitry Andric//   e.g. VSFA
635e8d8bef9SDimitry Andriclet VE_VLIndex = 4 in
636e8d8bef9SDimitry Andricmulticlass RVSAm<string opcStr, bits<8>opc, RegisterClass RC,
637e8d8bef9SDimitry Andric                 RegisterClass RCM> {
638e8d8bef9SDimitry Andric  let cz = 1, sz = ?, vz = ? in
639e8d8bef9SDimitry Andric  defm vrr : RVmm<opcStr, ", $vz, $sy, $sz", opc, RC, RCM,
640e8d8bef9SDimitry Andric                  (ins RC:$vz, I64:$sy, I64:$sz)>;
641e8d8bef9SDimitry Andric  let cz = 0, sz = ?, vz = ? in
642e8d8bef9SDimitry Andric  defm vrm : RVmm<opcStr, ", $vz, $sy, $sz", opc, RC, RCM,
643e8d8bef9SDimitry Andric                  (ins RC:$vz, I64:$sy, mimm:$sz)>;
644e8d8bef9SDimitry Andric  let cy = 0, cz = 1, sz = ?, vz = ? in
645e8d8bef9SDimitry Andric  defm vir : RVmm<opcStr, ", $vz, $sy, $sz", opc, RC, RCM,
646e8d8bef9SDimitry Andric                  (ins RC:$vz, uimm3:$sy, I64:$sz)>;
647e8d8bef9SDimitry Andric  let cy = 0, cz = 0, sz = ?, vz = ? in
648e8d8bef9SDimitry Andric  defm vim : RVmm<opcStr, ", $vz, $sy, $sz", opc, RC, RCM,
649e8d8bef9SDimitry Andric                  (ins RC:$vz, uimm3:$sy, mimm:$sz)>;
650e8d8bef9SDimitry Andric}
651e8d8bef9SDimitry Andric// Generic RV multiclass with 1 argument using vy field.
652e8d8bef9SDimitry Andric//   e.g. VFSQRT, VRCP, and VRSQRT.
653e8d8bef9SDimitry Andriclet VE_VLIndex = 2 in
654e8d8bef9SDimitry Andricmulticlass RVF1m<string opcStr, bits<8>opc, RegisterClass RC,
655e8d8bef9SDimitry Andric                 RegisterClass RCM> {
656e8d8bef9SDimitry Andric  let cy = 0, sy = 0, vy = ? in
657e8d8bef9SDimitry Andric  defm v : RVmm<opcStr, ", $vy", opc, RC, RCM, (ins RC:$vy)>;
658e8d8bef9SDimitry Andric}
659e8d8bef9SDimitry Andric// Special RV multiclass with 3 arguments using cs2.
660e8d8bef9SDimitry Andric//   e.g. VFMAD, VFMSB, VFNMAD, and etc.
661e8d8bef9SDimitry Andriclet VE_VLIndex = 4 in
662e8d8bef9SDimitry Andricmulticlass RVMm<string opcStr, bits<8>opc, RegisterClass VRC, RegisterClass RC,
663e8d8bef9SDimitry Andric                RegisterClass RCM, Operand SIMM = simm7> {
664e8d8bef9SDimitry Andric  let cy = 0, sy = 0, vy = ?, vz = ?, vw = ? in
665e8d8bef9SDimitry Andric  defm vvv : RVmm<opcStr, ", $vy, $vz, $vw", opc, VRC, RCM,
666e8d8bef9SDimitry Andric                  (ins VRC:$vy, VRC:$vz, VRC:$vw)>;
667e8d8bef9SDimitry Andric  let cs2 = 1, vy = ?, vw = ? in
668e8d8bef9SDimitry Andric  defm vrv : RVmm<opcStr, ", $vy, $sy, $vw", opc, VRC, RCM,
669e8d8bef9SDimitry Andric                  (ins VRC:$vy, RC:$sy, VRC:$vw)>;
670e8d8bef9SDimitry Andric  let cs2 = 1, cy = 0, vy = ?, vw = ? in
671e8d8bef9SDimitry Andric  defm viv : RVmm<opcStr, ", $vy, $sy, $vw", opc, VRC, RCM,
672e8d8bef9SDimitry Andric                  (ins VRC:$vy, SIMM:$sy, VRC:$vw)>;
673e8d8bef9SDimitry Andric  let cs = 1, vz = ?, vw = ? in
674e8d8bef9SDimitry Andric  defm rvv : RVmm<opcStr, ", $sy, $vz, $vw", opc, VRC, RCM,
675e8d8bef9SDimitry Andric                  (ins RC:$sy, VRC:$vz, VRC:$vw)>;
676e8d8bef9SDimitry Andric  let cs = 1, cy = 0, vz = ?, vw = ? in
677e8d8bef9SDimitry Andric  defm ivv : RVmm<opcStr, ", $sy, $vz, $vw", opc, VRC, RCM,
678e8d8bef9SDimitry Andric                  (ins SIMM:$sy, VRC:$vz, VRC:$vw)>;
679e8d8bef9SDimitry Andric}
680e8d8bef9SDimitry Andric// Special RV multiclass with 2 arguments for floating point conversions.
681e8d8bef9SDimitry Andric//   e.g. VFIX and VFIXX
682e8d8bef9SDimitry Andriclet hasSideEffects = 0, VE_VLIndex = 3 in
683e8d8bef9SDimitry Andricmulticlass RVFIXm<string opcStr, bits<8> opc, RegisterClass RC,
684e8d8bef9SDimitry Andric                  RegisterClass RCM> {
685e8d8bef9SDimitry Andric  let cy = 0, sy = 0, vy = ?, vz = ? in
686e8d8bef9SDimitry Andric  defm v : RVmm<opcStr#"$vz", ", $vy", opc, RC, RCM, (ins RDOp:$vz, RC:$vy)>;
687e8d8bef9SDimitry Andric}
688e8d8bef9SDimitry Andric// Multiclass for generic iterative vector calculation
689e8d8bef9SDimitry Andriclet vx = ?, hasSideEffects = 0, Uses = [VL] in
690e8d8bef9SDimitry Andricmulticlass RVIbm<string opcStr, string argStr, bits<8>opc, RegisterClass RC,
691e8d8bef9SDimitry Andric                dag dag_in, string disEnc = ""> {
692e8d8bef9SDimitry Andric  let DisableEncoding = disEnc in
693e8d8bef9SDimitry Andric  def "" : RV<opc, (outs RC:$vx), dag_in,
694e8d8bef9SDimitry Andric              !strconcat(opcStr, " $vx", argStr)>;
695e8d8bef9SDimitry Andric  let isCodeGenOnly = 1, Constraints = "$vx = $base", DisableEncoding = disEnc#"$base" in
696e8d8bef9SDimitry Andric  def _v : RV<opc, (outs RC:$vx), !con(dag_in, (ins RC:$base)),
697e8d8bef9SDimitry Andric              !strconcat(opcStr, " $vx", argStr)>;
698e8d8bef9SDimitry Andric}
699e8d8bef9SDimitry Andricmulticlass RVIlm<string opcStr, string argStr, bits<8>opc, RegisterClass RC,
700e8d8bef9SDimitry Andric                 dag dag_in> {
701e8d8bef9SDimitry Andric  defm "" : RVIbm<opcStr, argStr, opc, RC, dag_in>;
702e8d8bef9SDimitry Andric  let isCodeGenOnly = 1, VE_VLInUse = 1 in {
703e8d8bef9SDimitry Andric    defm l : RVIbm<opcStr, argStr, opc, RC, !con(dag_in, (ins I32:$vl)),
704e8d8bef9SDimitry Andric                   "$vl,">;
705e8d8bef9SDimitry Andric    defm L : RVIbm<opcStr, argStr, opc, RC, !con(dag_in, (ins VLS:$vl)),
706e8d8bef9SDimitry Andric                   "$vl,">;
707e8d8bef9SDimitry Andric  }
708e8d8bef9SDimitry Andric}
709e8d8bef9SDimitry Andric// Generic RV multiclass for iterative operation with 2 argument.
710e8d8bef9SDimitry Andric//   e.g. VFIA, VFIS, and VFIM
711e8d8bef9SDimitry Andriclet VE_VLIndex = 3 in
712e8d8bef9SDimitry Andricmulticlass RVI2m<string opcStr, bits<8>opc, RegisterClass VRC,
713e8d8bef9SDimitry Andric                 RegisterClass RC> {
714e8d8bef9SDimitry Andric  let vy = ? in
715e8d8bef9SDimitry Andric  defm vr : RVIlm<opcStr, ", $vy, $sy", opc, VRC, (ins VRC:$vy, RC:$sy)>;
716e8d8bef9SDimitry Andric  let cy = 0, vy = ? in
717e8d8bef9SDimitry Andric  defm vi : RVIlm<opcStr, ", $vy, $sy", opc, VRC, (ins VRC:$vy, simm7fp:$sy)>;
718e8d8bef9SDimitry Andric}
719e8d8bef9SDimitry Andric// Generic RV multiclass for iterative operation with 3 argument.
720e8d8bef9SDimitry Andric//   e.g. VFIAM, VFISM, VFIMA, and etc.
721e8d8bef9SDimitry Andriclet VE_VLIndex = 4 in
722e8d8bef9SDimitry Andricmulticlass RVI3m<string opcStr, bits<8>opc, RegisterClass VRC,
723e8d8bef9SDimitry Andric                 RegisterClass RC> {
724e8d8bef9SDimitry Andric  let vy = ?, vz = ? in
725e8d8bef9SDimitry Andric  defm vvr : RVIlm<opcStr, ", $vy, $vz, $sy", opc, VRC,
726e8d8bef9SDimitry Andric                   (ins VRC:$vy, VRC:$vz, RC:$sy)>;
727e8d8bef9SDimitry Andric  let cy = 0, vy = ?, vz = ? in
728e8d8bef9SDimitry Andric  defm vvi : RVIlm<opcStr, ", $vy, $vz, $sy", opc, VRC,
729e8d8bef9SDimitry Andric                   (ins VRC:$vy, VRC:$vz, simm7fp:$sy)>;
730e8d8bef9SDimitry Andric}
731e8d8bef9SDimitry Andric// special RV multiclass with 3 arguments for VSHF.
732e8d8bef9SDimitry Andric//   e.g. VSHF
733e8d8bef9SDimitry Andriclet vy = ?, vz = ?, VE_VLIndex = 4 in
734e8d8bef9SDimitry Andricmulticlass RVSHFm<string opcStr, bits<8>opc, RegisterClass RC,
735e8d8bef9SDimitry Andric                  Operand SIMM = uimm4> {
736e8d8bef9SDimitry Andric  defm vvr : RVlm<opcStr, ", $vy, $vz, $sy", opc, RC,
737e8d8bef9SDimitry Andric                  (ins RC:$vy, RC:$vz, I64:$sy)>;
738e8d8bef9SDimitry Andric  let cy = 0 in defm vvi : RVlm<opcStr, ", $vy, $vz, $sy", opc, RC,
739e8d8bef9SDimitry Andric                                (ins RC:$vy, RC:$vz, SIMM:$sy)>;
740e8d8bef9SDimitry Andric}
741e8d8bef9SDimitry Andric// Multiclass for generic mask calculation
742e8d8bef9SDimitry Andriclet vx = ?, hasSideEffects = 0, Uses = [VL] in
743e8d8bef9SDimitry Andricmulticlass RVMKbm<string opcStr, string argStr, bits<8>opc, dag dag_out,
744e8d8bef9SDimitry Andric                  dag dag_in> {
745e8d8bef9SDimitry Andric  def "" : RV<opc, dag_out, dag_in, !strconcat(opcStr, argStr)>;
746e8d8bef9SDimitry Andric  let DisableEncoding = "$vl", isCodeGenOnly = 1, VE_VLInUse = 1 in {
747e8d8bef9SDimitry Andric    def l : RV<opc, dag_out, !con(dag_in, (ins I32:$vl)),
748e8d8bef9SDimitry Andric               !strconcat(opcStr, argStr)>;
749e8d8bef9SDimitry Andric    def L : RV<opc, dag_out, !con(dag_in, (ins VLS:$vl)),
750e8d8bef9SDimitry Andric               !strconcat(opcStr, argStr)>;
751e8d8bef9SDimitry Andric  }
752e8d8bef9SDimitry Andric}
753e8d8bef9SDimitry Andricmulticlass RVMKlm<string opcStr, string argStr, bits<8>opc, RegisterClass RCM,
754e8d8bef9SDimitry Andric                  dag dag_in> {
755e8d8bef9SDimitry Andric  defm "" : RVMKbm<opcStr, " $vx"#argStr, opc, (outs RCM:$vx), dag_in>;
756e8d8bef9SDimitry Andric  let m = ?, VE_VLWithMask = 1 in
757e8d8bef9SDimitry Andric  defm m : RVMKbm<opcStr, " $vx"#argStr#", $m", opc, (outs RCM:$vx),
758e8d8bef9SDimitry Andric                  !con(dag_in, (ins RCM:$m))>;
759e8d8bef9SDimitry Andric}
760e8d8bef9SDimitry Andric// Generic RV multiclass for mask calculation with a condition.
761e8d8bef9SDimitry Andric//   e.g. VFMK, VFMS, and VFMF
762e8d8bef9SDimitry Andriclet cy = 0, sy = 0 in
763e8d8bef9SDimitry Andricmulticlass RVMKom<string opcStr, bits<8> opc, RegisterClass RC,
764e8d8bef9SDimitry Andric                 RegisterClass RCM> {
765e8d8bef9SDimitry Andric  let vy = ?, vz = ?, VE_VLIndex = 3 in
766e8d8bef9SDimitry Andric  defm v : RVMKlm<opcStr#"$vy", ", $vz", opc, RCM, (ins CCOp:$vy, RC:$vz)>;
767e8d8bef9SDimitry Andric  let vy = 15 /* AT */, VE_VLIndex = 1 in
768e8d8bef9SDimitry Andric  defm a : RVMKlm<opcStr#"at", "", opc, RCM, (ins)>;
769e8d8bef9SDimitry Andric  let vy = 0 /* AF */, VE_VLIndex = 1 in
770e8d8bef9SDimitry Andric  defm na : RVMKlm<opcStr#"af", "", opc, RCM, (ins)>;
771e8d8bef9SDimitry Andric}
772e8d8bef9SDimitry Andricmulticlass RVMKm<string opcStr, bits<8> opc, RegisterClass RC,
773e8d8bef9SDimitry Andric                 RegisterClass RCM> {
774e8d8bef9SDimitry Andric  defm "" : RVMKom<opcStr, opc, RC, RCM>;
775e8d8bef9SDimitry Andric}
776e8d8bef9SDimitry Andric// Generic RV multiclass for mask calculation with 2 arguments.
777e8d8bef9SDimitry Andric//   e.g. ANDM, ORM, XORM, and etc.
778e8d8bef9SDimitry Andriclet cy = 0, sy = 0, vx = ?, vy = ?, vz = ?, hasSideEffects = 0 in
779e8d8bef9SDimitry Andricmulticlass RVM2m<string opcStr, bits<8> opc, RegisterClass RCM> {
780e8d8bef9SDimitry Andric  def mm : RV<opc, (outs RCM:$vx), (ins RCM:$vy, RCM:$vz),
781e8d8bef9SDimitry Andric              !strconcat(opcStr, " $vx, $vy, $vz")>;
782e8d8bef9SDimitry Andric}
783e8d8bef9SDimitry Andric// Generic RV multiclass for mask calculation with 1 argument.
784e8d8bef9SDimitry Andric//   e.g. NEGM
785e8d8bef9SDimitry Andriclet cy = 0, sy = 0, vx = ?, vy = ?, hasSideEffects = 0 in
786e8d8bef9SDimitry Andricmulticlass RVM1m<string opcStr, bits<8> opc, RegisterClass RCM> {
787e8d8bef9SDimitry Andric  def m : RV<opc, (outs RCM:$vx), (ins RCM:$vy),
788e8d8bef9SDimitry Andric             !strconcat(opcStr, " $vx, $vy")>;
789e8d8bef9SDimitry Andric}
790e8d8bef9SDimitry Andric// Generic RV multiclass for mask calculation with 1 argument.
791e8d8bef9SDimitry Andric//   e.g. PCVM, LZVM, and TOVM
792e8d8bef9SDimitry Andriclet cy = 0, sy = 0, vy = ?, hasSideEffects = 0, Uses = [VL] in
793e8d8bef9SDimitry Andricmulticlass RVMSbm<string opcStr, string argStr, bits<8>opc, dag dag_in> {
794e8d8bef9SDimitry Andric  def "" : RV<opc, (outs I64:$sx), dag_in,
795e8d8bef9SDimitry Andric              !strconcat(opcStr, " $sx,", argStr)> {
796e8d8bef9SDimitry Andric    bits<7> sx;
797e8d8bef9SDimitry Andric    let Inst{54-48} = sx;
798e8d8bef9SDimitry Andric  }
799e8d8bef9SDimitry Andric  let DisableEncoding = "$vl", isCodeGenOnly = 1, VE_VLInUse = 1 in {
800e8d8bef9SDimitry Andric    def l : RV<opc, (outs I64:$sx), !con(dag_in, (ins I32:$vl)),
801e8d8bef9SDimitry Andric               !strconcat(opcStr, " $sx,", argStr)> {
802e8d8bef9SDimitry Andric      bits<7> sx;
803e8d8bef9SDimitry Andric      let Inst{54-48} = sx;
804e8d8bef9SDimitry Andric    }
805e8d8bef9SDimitry Andric    def L : RV<opc, (outs I64:$sx), !con(dag_in, (ins VLS:$vl)),
806e8d8bef9SDimitry Andric               !strconcat(opcStr, " $sx,", argStr)> {
807e8d8bef9SDimitry Andric      bits<7> sx;
808e8d8bef9SDimitry Andric      let Inst{54-48} = sx;
809e8d8bef9SDimitry Andric    }
810e8d8bef9SDimitry Andric  }
811e8d8bef9SDimitry Andric}
812e8d8bef9SDimitry Andriclet VE_VLIndex = 2 in
813e8d8bef9SDimitry Andricmulticlass RVMSm<string opcStr, bits<8> opc, RegisterClass RCM> {
814e8d8bef9SDimitry Andric  defm m : RVMSbm<opcStr, " $vy", opc, (ins RCM:$vy)>;
815e8d8bef9SDimitry Andric}
816e8d8bef9SDimitry Andric
817e8d8bef9SDimitry Andric// Section 8.10.1 - VADD (Vector Add)
818e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in
819e8d8bef9SDimitry Andricdefm VADDUL : RVm<"vaddu.l", 0xc8, V64, I64, VM>;
820e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in {
821e8d8bef9SDimitry Andric  defm PVADDULO : RVm<"pvaddu.lo", 0xc8, V64, I32, VM>;
822e8d8bef9SDimitry Andric  let isCodeGenOnly = 1 in
823e8d8bef9SDimitry Andric  defm VADDUW : RVm<"vaddu.w", 0xc8, V64, I32, VM>;
824e8d8bef9SDimitry Andric}
825e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in
826e8d8bef9SDimitry Andricdefm PVADDUUP : RVm<"pvaddu.up", 0xc8, V64, I64, VM>;
827e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in
828e8d8bef9SDimitry Andricdefm PVADDU : RVm<"pvaddu", 0xc8, V64, I64, VM512>;
829e8d8bef9SDimitry Andricdef : MnemonicAlias<"vaddu.w", "pvaddu.lo">;
830e8d8bef9SDimitry Andric
831e8d8bef9SDimitry Andric// Section 8.10.2 - VADS (Vector Add Single)
832e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in
833e8d8bef9SDimitry Andricdefm VADDSWSX : RVm<"vadds.w.sx", 0xca, V64, I32, VM>;
834e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in {
835e8d8bef9SDimitry Andric  defm PVADDSLO : RVm<"pvadds.lo", 0xca, V64, I32, VM>;
836e8d8bef9SDimitry Andric  let isCodeGenOnly = 1 in
837e8d8bef9SDimitry Andric  defm VADDSWZX : RVm<"vadds.w.zx", 0xca, V64, I32, VM>;
838e8d8bef9SDimitry Andric}
839e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in
840e8d8bef9SDimitry Andricdefm PVADDSUP : RVm<"pvadds.up", 0xca, V64, I64, VM>;
841e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in
842e8d8bef9SDimitry Andricdefm PVADDS : RVm<"pvadds", 0xca, V64, I64, VM512>;
843e8d8bef9SDimitry Andricdef : MnemonicAlias<"pvadds.lo.sx", "vadds.w.sx">;
844e8d8bef9SDimitry Andricdef : MnemonicAlias<"vadds.w.zx", "pvadds.lo">;
845e8d8bef9SDimitry Andricdef : MnemonicAlias<"vadds.w", "pvadds.lo">;
846e8d8bef9SDimitry Andricdef : MnemonicAlias<"pvadds.lo.zx", "pvadds.lo">;
847e8d8bef9SDimitry Andric
848e8d8bef9SDimitry Andric// Section 8.10.3 - VADX (Vector Add)
849e8d8bef9SDimitry Andricdefm VADDSL : RVm<"vadds.l", 0x8b, V64, I64, VM>;
850e8d8bef9SDimitry Andric
851e8d8bef9SDimitry Andric// Section 8.10.4 - VSUB (Vector Subtract)
852e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in
853e8d8bef9SDimitry Andricdefm VSUBUL : RVm<"vsubu.l", 0xd8, V64, I64, VM>;
854e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in {
855e8d8bef9SDimitry Andric  defm PVSUBULO : RVm<"pvsubu.lo", 0xd8, V64, I32, VM>;
856e8d8bef9SDimitry Andric  let isCodeGenOnly = 1 in
857e8d8bef9SDimitry Andric  defm VSUBUW : RVm<"vsubu.w", 0xd8, V64, I32, VM>;
858e8d8bef9SDimitry Andric}
859e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in
860e8d8bef9SDimitry Andricdefm PVSUBUUP : RVm<"pvsubu.up", 0xd8, V64, I64, VM>;
861e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in
862e8d8bef9SDimitry Andricdefm PVSUBU : RVm<"pvsubu", 0xd8, V64, I64, VM512>;
863e8d8bef9SDimitry Andricdef : MnemonicAlias<"vsubu.w", "pvsubu.lo">;
864e8d8bef9SDimitry Andric
865e8d8bef9SDimitry Andric// Section 8.10.5 - VSBS (Vector Subtract Single)
866e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in
867e8d8bef9SDimitry Andricdefm VSUBSWSX : RVm<"vsubs.w.sx", 0xda, V64, I32, VM>;
868e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in {
869e8d8bef9SDimitry Andric  defm PVSUBSLO : RVm<"pvsubs.lo", 0xda, V64, I32, VM>;
870e8d8bef9SDimitry Andric  let isCodeGenOnly = 1 in
871e8d8bef9SDimitry Andric  defm VSUBSWZX : RVm<"vsubs.w.zx", 0xda, V64, I32, VM>;
872e8d8bef9SDimitry Andric}
873e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in
874e8d8bef9SDimitry Andricdefm PVSUBSUP : RVm<"pvsubs.up", 0xda, V64, I64, VM>;
875e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in
876e8d8bef9SDimitry Andricdefm PVSUBS : RVm<"pvsubs", 0xda, V64, I64, VM512>;
877e8d8bef9SDimitry Andricdef : MnemonicAlias<"pvsubs.lo.sx", "vsubs.w.sx">;
878e8d8bef9SDimitry Andricdef : MnemonicAlias<"vsubs.w.zx", "pvsubs.lo">;
879e8d8bef9SDimitry Andricdef : MnemonicAlias<"vsubs.w", "pvsubs.lo">;
880e8d8bef9SDimitry Andricdef : MnemonicAlias<"pvsubs.lo.zx", "pvsubs.lo">;
881e8d8bef9SDimitry Andric
882e8d8bef9SDimitry Andric// Section 8.10.6 - VSBX (Vector Subtract)
883e8d8bef9SDimitry Andricdefm VSUBSL : RVm<"vsubs.l", 0x9b, V64, I64, VM>;
884e8d8bef9SDimitry Andric
885e8d8bef9SDimitry Andric// Section 8.10.7 - VMPY (Vector Multiply)
886e8d8bef9SDimitry Andriclet cx2 = 0 in
887e8d8bef9SDimitry Andricdefm VMULUL : RVm<"vmulu.l", 0xc9, V64, I64, VM>;
888e8d8bef9SDimitry Andriclet cx2 = 1 in
889e8d8bef9SDimitry Andricdefm VMULUW : RVm<"vmulu.w", 0xc9, V64, I32, VM>;
890e8d8bef9SDimitry Andric
891e8d8bef9SDimitry Andric// Section 8.10.8 - VMPS (Vector Multiply Single)
892e8d8bef9SDimitry Andriclet cx2 = 0 in
893e8d8bef9SDimitry Andricdefm VMULSWSX : RVm<"vmuls.w.sx", 0xcb, V64, I32, VM>;
894e8d8bef9SDimitry Andriclet cx2 = 1 in
895e8d8bef9SDimitry Andricdefm VMULSWZX : RVm<"vmuls.w.zx", 0xcb, V64, I32, VM>;
896e8d8bef9SDimitry Andricdef : MnemonicAlias<"vmuls.w", "vmuls.w.zx">;
897e8d8bef9SDimitry Andric
898e8d8bef9SDimitry Andric// Section 8.10.9 - VMPX (Vector Multiply)
899e8d8bef9SDimitry Andricdefm VMULSL : RVm<"vmuls.l", 0xdb, V64, I64, VM>;
900e8d8bef9SDimitry Andric
901e8d8bef9SDimitry Andric// Section 8.10.10 - VMPD (Vector Multiply)
902e8d8bef9SDimitry Andricdefm VMULSLW : RVm<"vmuls.l.w", 0xd9, V64, I32, VM>;
903e8d8bef9SDimitry Andric
904e8d8bef9SDimitry Andric// Section 8.10.11 - VDIV (Vector Divide)
905e8d8bef9SDimitry Andriclet cx2 = 0 in
906e8d8bef9SDimitry Andricdefm VDIVUL : RVDIVm<"vdivu.l", 0xe9, V64, I64, VM>;
907e8d8bef9SDimitry Andriclet cx2 = 1 in
908e8d8bef9SDimitry Andricdefm VDIVUW : RVDIVm<"vdivu.w", 0xe9, V64, I32, VM>;
909e8d8bef9SDimitry Andric
910e8d8bef9SDimitry Andric// Section 8.10.12 - VDVS (Vector Divide Single)
911e8d8bef9SDimitry Andriclet cx2 = 0 in
912e8d8bef9SDimitry Andricdefm VDIVSWSX : RVDIVm<"vdivs.w.sx", 0xeb, V64, I32, VM>;
913e8d8bef9SDimitry Andriclet cx2 = 1 in
914e8d8bef9SDimitry Andricdefm VDIVSWZX : RVDIVm<"vdivs.w.zx", 0xeb, V64, I32, VM>;
915e8d8bef9SDimitry Andricdef : MnemonicAlias<"vdivs.w", "vdivs.w.zx">;
916e8d8bef9SDimitry Andric
917e8d8bef9SDimitry Andric// Section 8.10.13 - VDVX (Vector Divide)
918e8d8bef9SDimitry Andricdefm VDIVSL : RVDIVm<"vdivs.l", 0xfb, V64, I64, VM>;
919e8d8bef9SDimitry Andric
920e8d8bef9SDimitry Andric// Section 8.10.14 - VCMP (Vector Compare)
921e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in
922e8d8bef9SDimitry Andricdefm VCMPUL : RVm<"vcmpu.l", 0xb9, V64, I64, VM>;
923e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in {
924e8d8bef9SDimitry Andric  defm PVCMPULO : RVm<"pvcmpu.lo", 0xb9, V64, I32, VM>;
925e8d8bef9SDimitry Andric  let isCodeGenOnly = 1 in
926e8d8bef9SDimitry Andric  defm VCMPUW : RVm<"vcmpu.w", 0xb9, V64, I32, VM>;
927e8d8bef9SDimitry Andric}
928e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in
929e8d8bef9SDimitry Andricdefm PVCMPUUP : RVm<"pvcmpu.up", 0xb9, V64, I64, VM>;
930e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in
931e8d8bef9SDimitry Andricdefm PVCMPU : RVm<"pvcmpu", 0xb9, V64, I64, VM512>;
932e8d8bef9SDimitry Andricdef : MnemonicAlias<"vcmpu.w", "pvcmpu.lo">;
933e8d8bef9SDimitry Andric
934e8d8bef9SDimitry Andric// Section 8.10.15 - VCPS (Vector Compare Single)
935e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in
936e8d8bef9SDimitry Andricdefm VCMPSWSX : RVm<"vcmps.w.sx", 0xfa, V64, I32, VM>;
937e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in {
938e8d8bef9SDimitry Andric  defm PVCMPSLO : RVm<"pvcmps.lo", 0xfa, V64, I32, VM>;
939e8d8bef9SDimitry Andric  let isCodeGenOnly = 1 in
940e8d8bef9SDimitry Andric  defm VCMPSWZX : RVm<"vcmps.w.zx", 0xfa, V64, I32, VM>;
941e8d8bef9SDimitry Andric}
942e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in
943e8d8bef9SDimitry Andricdefm PVCMPSUP : RVm<"pvcmps.up", 0xfa, V64, I64, VM>;
944e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in
945e8d8bef9SDimitry Andricdefm PVCMPS : RVm<"pvcmps", 0xfa, V64, I64, VM512>;
946e8d8bef9SDimitry Andricdef : MnemonicAlias<"pvcmps.lo.sx", "vcmps.w.sx">;
947e8d8bef9SDimitry Andricdef : MnemonicAlias<"vcmps.w.zx", "pvcmps.lo">;
948e8d8bef9SDimitry Andricdef : MnemonicAlias<"vcmps.w", "pvcmps.lo">;
949e8d8bef9SDimitry Andricdef : MnemonicAlias<"pvcmps.lo.zx", "pvcmps.lo">;
950e8d8bef9SDimitry Andric
951e8d8bef9SDimitry Andric// Section 8.10.16 - VCPX (Vector Compare)
952e8d8bef9SDimitry Andricdefm VCMPSL : RVm<"vcmps.l", 0xba, V64, I64, VM>;
953e8d8bef9SDimitry Andric
954e8d8bef9SDimitry Andric// Section 8.10.17 - VCMS (Vector Compare and Select Maximum/Minimum Single)
955e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in
956e8d8bef9SDimitry Andricdefm VMAXSWSX : RVm<"vmaxs.w.sx", 0x8a, V64, I32, VM>;
957e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in {
958e8d8bef9SDimitry Andric  defm PVMAXSLO : RVm<"pvmaxs.lo", 0x8a, V64, I32, VM>;
959e8d8bef9SDimitry Andric  let isCodeGenOnly = 1 in
960e8d8bef9SDimitry Andric  defm VMAXSWZX : RVm<"vmaxs.w.zx", 0x8a, V64, I32, VM>;
961e8d8bef9SDimitry Andric}
962e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in
963e8d8bef9SDimitry Andricdefm PVMAXSUP : RVm<"pvmaxs.up", 0x8a, V64, I64, VM>;
964e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in
965e8d8bef9SDimitry Andricdefm PVMAXS : RVm<"pvmaxs", 0x8a, V64, I64, VM512>;
966e8d8bef9SDimitry Andriclet cs2 = 1 in {
967e8d8bef9SDimitry Andric  let cx = 0, cx2 = 0 in
968e8d8bef9SDimitry Andric  defm VMINSWSX : RVm<"vmins.w.sx", 0x8a, V64, I32, VM>;
969e8d8bef9SDimitry Andric  let cx = 0, cx2 = 1 in {
970e8d8bef9SDimitry Andric    defm PVMINSLO : RVm<"pvmins.lo", 0x8a, V64, I32, VM>;
971e8d8bef9SDimitry Andric    let isCodeGenOnly = 1 in
972e8d8bef9SDimitry Andric    defm VMINSWZX : RVm<"vmins.w.zx", 0x8a, V64, I32, VM>;
973e8d8bef9SDimitry Andric  }
974e8d8bef9SDimitry Andric  let cx = 1, cx2 = 0 in
975e8d8bef9SDimitry Andric  defm PVMINSUP : RVm<"pvmins.up", 0x8a, V64, I64, VM>;
976e8d8bef9SDimitry Andric  let cx = 1, cx2 = 1 in
977e8d8bef9SDimitry Andric  defm PVMINS : RVm<"pvmins", 0x8a, V64, I64, VM512>;
978e8d8bef9SDimitry Andric}
979e8d8bef9SDimitry Andricdef : MnemonicAlias<"pvmaxs.lo.sx", "vmaxs.w.sx">;
980e8d8bef9SDimitry Andricdef : MnemonicAlias<"vmaxs.w.zx", "pvmaxs.lo">;
981e8d8bef9SDimitry Andricdef : MnemonicAlias<"vmaxs.w", "pvmaxs.lo">;
982e8d8bef9SDimitry Andricdef : MnemonicAlias<"pvmaxs.lo.zx", "pvmaxs.lo">;
983e8d8bef9SDimitry Andricdef : MnemonicAlias<"pvmins.lo.sx", "vmins.w.sx">;
984e8d8bef9SDimitry Andricdef : MnemonicAlias<"vmins.w.zx", "pvmins.lo">;
985e8d8bef9SDimitry Andricdef : MnemonicAlias<"vmins.w", "pvmins.lo">;
986e8d8bef9SDimitry Andricdef : MnemonicAlias<"pvmins.lo.zx", "pvmins.lo">;
987e8d8bef9SDimitry Andric
988e8d8bef9SDimitry Andric// Section 8.10.18 - VCMX (Vector Compare and Select Maximum/Minimum)
989e8d8bef9SDimitry Andricdefm VMAXSL : RVm<"vmaxs.l", 0x9a, V64, I64, VM>;
990e8d8bef9SDimitry Andriclet cs2 = 1 in
991e8d8bef9SDimitry Andricdefm VMINSL : RVm<"vmins.l", 0x9a, V64, I64, VM>;
992e8d8bef9SDimitry Andric
993e8d8bef9SDimitry Andric//-----------------------------------------------------------------------------
994e8d8bef9SDimitry Andric// Section 8.11 - Vector Logical Operation Instructions
995e8d8bef9SDimitry Andric//-----------------------------------------------------------------------------
996e8d8bef9SDimitry Andric
997e8d8bef9SDimitry Andric// Section 8.11.1 - VAND (Vector And)
998e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in defm VAND : RVLm<"vand", 0xc4, I64, V64, VM>;
999e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in defm PVANDLO : RVLm<"pvand.lo", 0xc4, I32, V64, VM>;
1000e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in defm PVANDUP : RVLm<"pvand.up", 0xc4, F32, V64, VM>;
1001e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in defm PVAND : RVLm<"pvand", 0xc4, I64, V64, VM512>;
1002e8d8bef9SDimitry Andric
1003e8d8bef9SDimitry Andric// Section 8.11.2 - VOR (Vector Or)
1004e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in defm VOR : RVLm<"vor", 0xc5, I64, V64, VM>;
1005e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in defm PVORLO : RVLm<"pvor.lo", 0xc5, I32, V64, VM>;
1006e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in defm PVORUP : RVLm<"pvor.up", 0xc5, F32, V64, VM>;
1007e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in defm PVOR : RVLm<"pvor", 0xc5, I64, V64, VM512>;
1008e8d8bef9SDimitry Andric
1009e8d8bef9SDimitry Andric// Section 8.11.3 - VXOR (Vector Exclusive Or)
1010e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in defm VXOR : RVLm<"vxor", 0xc6, I64, V64, VM>;
1011e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in defm PVXORLO : RVLm<"pvxor.lo", 0xc6, I32, V64, VM>;
1012e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in defm PVXORUP : RVLm<"pvxor.up", 0xc6, F32, V64, VM>;
1013e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in defm PVXOR : RVLm<"pvxor", 0xc6, I64, V64, VM512>;
1014e8d8bef9SDimitry Andric
1015e8d8bef9SDimitry Andric// Section 8.11.4 - VEQV (Vector Equivalence)
1016e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in defm VEQV : RVLm<"veqv", 0xc7, I64, V64, VM>;
1017e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in defm PVEQVLO : RVLm<"pveqv.lo", 0xc7, I32, V64, VM>;
1018e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in defm PVEQVUP : RVLm<"pveqv.up", 0xc7, F32, V64, VM>;
1019e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in defm PVEQV : RVLm<"pveqv", 0xc7, I64, V64, VM512>;
1020e8d8bef9SDimitry Andric
1021e8d8bef9SDimitry Andric// Section 8.11.5 - VLDZ (Vector Leading Zero Count)
1022e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in defm VLDZ : RV1m<"vldz", 0xe7, V64, VM>;
1023e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in defm PVLDZLO : RV1m<"pvldz.lo", 0xe7, V64, VM>;
1024e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in defm PVLDZUP : RV1m<"pvldz.up", 0xe7, V64, VM>;
1025e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in defm PVLDZ : RV1m<"pvldz", 0xe7, V64, VM512>;
1026e8d8bef9SDimitry Andric
1027e8d8bef9SDimitry Andric// Section 8.11.6 - VPCNT (Vector Population Count)
1028e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in defm VPCNT : RV1m<"vpcnt", 0xac, V64, VM>;
1029e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in defm PVPCNTLO : RV1m<"pvpcnt.lo", 0xac, V64, VM>;
1030e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in defm PVPCNTUP : RV1m<"pvpcnt.up", 0xac, V64, VM>;
1031e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in defm PVPCNT : RV1m<"pvpcnt", 0xac, V64, VM512>;
1032e8d8bef9SDimitry Andric
1033e8d8bef9SDimitry Andric// Section 8.11.7 - VBRV (Vector Bit Reverse)
1034e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in defm VBRV : RV1m<"vbrv", 0xf7, V64, VM>;
1035e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in defm PVBRVLO : RV1m<"pvbrv.lo", 0xf7, V64, VM>;
1036e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in defm PVBRVUP : RV1m<"pvbrv.up", 0xf7, V64, VM>;
1037e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in defm PVBRV : RV1m<"pvbrv", 0xf7, V64, VM512>;
1038e8d8bef9SDimitry Andric
1039e8d8bef9SDimitry Andric// Section 8.11.8 - VSEQ (Vector Sequential Number)
1040e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in defm VSEQ : RV0m<"vseq", 0x99, V64, VM>;
1041e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in defm PVSEQLO : RV0m<"pvseq.lo", 0x99, V64, VM>;
1042e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in defm PVSEQUP : RV0m<"pvseq.up", 0x99, V64, VM>;
1043e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in defm PVSEQ : RV0m<"pvseq", 0x99, V64, VM512>;
1044e8d8bef9SDimitry Andric
1045e8d8bef9SDimitry Andric//-----------------------------------------------------------------------------
1046e8d8bef9SDimitry Andric// Section 8.12 - Vector Shift Operation Instructions
1047e8d8bef9SDimitry Andric//-----------------------------------------------------------------------------
1048e8d8bef9SDimitry Andric
1049e8d8bef9SDimitry Andric// Section 8.12.1 - VSLL (Vector Shift Left Logical)
1050e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in defm VSLL : RVSm<"vsll", 0xe5, I64, V64, VM>;
1051e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in defm PVSLLLO : RVSm<"pvsll.lo", 0xe5, I32, V64, VM>;
1052e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in defm PVSLLUP : RVSm<"pvsll.up", 0xe5, F32, V64, VM>;
1053e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in defm PVSLL : RVSm<"pvsll", 0xe5, I64, V64, VM512>;
1054e8d8bef9SDimitry Andric
1055e8d8bef9SDimitry Andric// Section 8.12.2 - VSLD (Vector Shift Left Double)
1056e8d8bef9SDimitry Andricdefm VSLD : RVSDm<"vsld", 0xe4, V64, VM>;
1057e8d8bef9SDimitry Andric
1058e8d8bef9SDimitry Andric// Section 8.12.3 - VSRL (Vector Shift Right Logical)
1059e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in defm VSRL : RVSm<"vsrl", 0xf5, I64, V64, VM>;
1060e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in defm PVSRLLO : RVSm<"pvsrl.lo", 0xf5, I32, V64, VM>;
1061e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in defm PVSRLUP : RVSm<"pvsrl.up", 0xf5, F32, V64, VM>;
1062e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in defm PVSRL : RVSm<"pvsrl", 0xf5, I64, V64, VM512>;
1063e8d8bef9SDimitry Andric
1064e8d8bef9SDimitry Andric// Section 8.12.4 - VSRD (Vector Shift Right Double)
1065e8d8bef9SDimitry Andricdefm VSRD : RVSDm<"vsrd", 0xf4, V64, VM>;
1066e8d8bef9SDimitry Andric
1067e8d8bef9SDimitry Andric// Section 8.12.5 - VSLA (Vector Shift Left Arithmetic)
1068e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in defm VSLAWSX : RVSm<"vsla.w.sx", 0xe6, I32, V64, VM>;
1069e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in {
1070e8d8bef9SDimitry Andric  defm PVSLALO : RVSm<"pvsla.lo", 0xe6, I32, V64, VM>;
1071e8d8bef9SDimitry Andric  let isCodeGenOnly = 1 in defm VSLAWZX : RVSm<"vsla.w.zx", 0xe6, I32, V64, VM>;
1072e8d8bef9SDimitry Andric}
1073e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in defm PVSLAUP : RVSm<"pvsla.up", 0xe6, F32, V64, VM>;
1074e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in defm PVSLA : RVSm<"pvsla", 0xe6, I64, V64, VM512>;
1075e8d8bef9SDimitry Andricdef : MnemonicAlias<"pvsla.lo.sx", "vsla.w.sx">;
1076e8d8bef9SDimitry Andricdef : MnemonicAlias<"vsla.w.zx", "pvsla.lo">;
1077e8d8bef9SDimitry Andricdef : MnemonicAlias<"vsla.w", "pvsla.lo">;
1078e8d8bef9SDimitry Andricdef : MnemonicAlias<"pvsla.lo.zx", "pvsla.lo">;
1079e8d8bef9SDimitry Andric
1080e8d8bef9SDimitry Andric// Section 8.12.6 - VSLAX (Vector Shift Left Arithmetic)
1081e8d8bef9SDimitry Andricdefm VSLAL : RVSm<"vsla.l", 0xd4, I64, V64, VM>;
1082e8d8bef9SDimitry Andric
1083e8d8bef9SDimitry Andric// Section 8.12.7 - VSRA (Vector Shift Right Arithmetic)
1084e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in defm VSRAWSX : RVSm<"vsra.w.sx", 0xf6, I32, V64, VM>;
1085e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in {
1086e8d8bef9SDimitry Andric  defm PVSRALO : RVSm<"pvsra.lo", 0xf6, I32, V64, VM>;
1087e8d8bef9SDimitry Andric  let isCodeGenOnly = 1 in defm VSRAWZX : RVSm<"vsra.w.zx", 0xf6, I32, V64, VM>;
1088e8d8bef9SDimitry Andric}
1089e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in defm PVSRAUP : RVSm<"pvsra.up", 0xf6, F32, V64, VM>;
1090e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in defm PVSRA : RVSm<"pvsra", 0xf6, I64, V64, VM512>;
1091e8d8bef9SDimitry Andricdef : MnemonicAlias<"pvsra.lo.sx", "vsra.w.sx">;
1092e8d8bef9SDimitry Andricdef : MnemonicAlias<"vsra.w.zx", "pvsra.lo">;
1093e8d8bef9SDimitry Andricdef : MnemonicAlias<"vsra.w", "pvsra.lo">;
1094e8d8bef9SDimitry Andricdef : MnemonicAlias<"pvsra.lo.zx", "pvsra.lo">;
1095e8d8bef9SDimitry Andric
1096e8d8bef9SDimitry Andric// Section 8.12.8 - VSRAX (Vector Shift Right Arithmetic)
1097e8d8bef9SDimitry Andricdefm VSRAL : RVSm<"vsra.l", 0xd5, I64, V64, VM>;
1098e8d8bef9SDimitry Andric
1099e8d8bef9SDimitry Andric// Section 8.12.9 - VSFA (Vector Shift Left and Add)
1100e8d8bef9SDimitry Andricdefm VSFA : RVSAm<"vsfa", 0xd7, V64, VM>;
1101e8d8bef9SDimitry Andric
1102e8d8bef9SDimitry Andric//-----------------------------------------------------------------------------
1103e8d8bef9SDimitry Andric// Section 8.13 - Vector Floating-Point Arithmetic Instructions
1104e8d8bef9SDimitry Andric//-----------------------------------------------------------------------------
1105e8d8bef9SDimitry Andric
1106e8d8bef9SDimitry Andric// Section 8.13.1 - VFAD (Vector Floating Add)
1107e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in
1108e8d8bef9SDimitry Andricdefm VFADDD : RVm<"vfadd.d", 0xcc, V64, I64, VM, simm7fp>;
1109e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in
1110e8d8bef9SDimitry Andricdefm PVFADDLO : RVm<"pvfadd.lo", 0xcc, V64, I64, VM, simm7fp>;
1111e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in {
1112e8d8bef9SDimitry Andric  defm PVFADDUP : RVm<"pvfadd.up", 0xcc, V64, F32, VM, simm7fp>;
1113e8d8bef9SDimitry Andric  let isCodeGenOnly = 1 in
1114e8d8bef9SDimitry Andric  defm VFADDS : RVm<"vfadd.s", 0xcc, V64, F32, VM, simm7fp>;
1115e8d8bef9SDimitry Andric}
1116e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in
1117e8d8bef9SDimitry Andricdefm PVFADD : RVm<"pvfadd", 0xcc, V64, I64, VM512, simm7fp>;
1118e8d8bef9SDimitry Andricdef : MnemonicAlias<"vfadd.s", "pvfadd.up">;
1119e8d8bef9SDimitry Andric
1120e8d8bef9SDimitry Andric// Section 8.13.2 - VFSB (Vector Floating Subtract)
1121e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in
1122e8d8bef9SDimitry Andricdefm VFSUBD : RVm<"vfsub.d", 0xdc, V64, I64, VM, simm7fp>;
1123e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in
1124e8d8bef9SDimitry Andricdefm PVFSUBLO : RVm<"pvfsub.lo", 0xdc, V64, I64, VM, simm7fp>;
1125e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in {
1126e8d8bef9SDimitry Andric  defm PVFSUBUP : RVm<"pvfsub.up", 0xdc, V64, F32, VM, simm7fp>;
1127e8d8bef9SDimitry Andric  let isCodeGenOnly = 1 in
1128e8d8bef9SDimitry Andric  defm VFSUBS : RVm<"vfsub.s", 0xdc, V64, F32, VM, simm7fp>;
1129e8d8bef9SDimitry Andric}
1130e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in
1131e8d8bef9SDimitry Andricdefm PVFSUB : RVm<"pvfsub", 0xdc, V64, I64, VM512, simm7fp>;
1132e8d8bef9SDimitry Andricdef : MnemonicAlias<"vfsub.s", "pvfsub.up">;
1133e8d8bef9SDimitry Andric
1134e8d8bef9SDimitry Andric// Section 8.13.3 - VFMP (Vector Floating Multiply)
1135e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in
1136e8d8bef9SDimitry Andricdefm VFMULD : RVm<"vfmul.d", 0xcd, V64, I64, VM, simm7fp>;
1137e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in
1138e8d8bef9SDimitry Andricdefm PVFMULLO : RVm<"pvfmul.lo", 0xcd, V64, I64, VM, simm7fp>;
1139e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in {
1140e8d8bef9SDimitry Andric  defm PVFMULUP : RVm<"pvfmul.up", 0xcd, V64, F32, VM, simm7fp>;
1141e8d8bef9SDimitry Andric  let isCodeGenOnly = 1 in
1142e8d8bef9SDimitry Andric  defm VFMULS : RVm<"vfmul.s", 0xcd, V64, F32, VM, simm7fp>;
1143e8d8bef9SDimitry Andric}
1144e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in
1145e8d8bef9SDimitry Andricdefm PVFMUL : RVm<"pvfmul", 0xcd, V64, I64, VM512, simm7fp>;
1146e8d8bef9SDimitry Andricdef : MnemonicAlias<"vfmul.s", "pvfmul.up">;
1147e8d8bef9SDimitry Andric
1148e8d8bef9SDimitry Andric// Section 8.13.4 - VFDV (Vector Floating Divide)
1149e8d8bef9SDimitry Andricdefm VFDIVD : RVDIVm<"vfdiv.d", 0xdd, V64, I64, VM, simm7fp>;
1150e8d8bef9SDimitry Andriclet cx = 1 in
1151e8d8bef9SDimitry Andricdefm VFDIVS : RVDIVm<"vfdiv.s", 0xdd, V64, F32, VM, simm7fp>;
1152e8d8bef9SDimitry Andric
1153e8d8bef9SDimitry Andric// Section 8.13.5 - VFSQRT (Vector Floating Square Root)
1154e8d8bef9SDimitry Andricdefm VFSQRTD : RVF1m<"vfsqrt.d", 0xed, V64, VM>;
1155e8d8bef9SDimitry Andriclet cx = 1 in
1156e8d8bef9SDimitry Andricdefm VFSQRTS : RVF1m<"vfsqrt.s", 0xed, V64, VM>;
1157e8d8bef9SDimitry Andric
1158e8d8bef9SDimitry Andric// Section 8.13.6 - VFCP (Vector Floating Compare)
1159e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in
1160e8d8bef9SDimitry Andricdefm VFCMPD : RVm<"vfcmp.d", 0xfc, V64, I64, VM, simm7fp>;
1161e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in
1162e8d8bef9SDimitry Andricdefm PVFCMPLO : RVm<"pvfcmp.lo", 0xfc, V64, I64, VM, simm7fp>;
1163e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in {
1164e8d8bef9SDimitry Andric  defm PVFCMPUP : RVm<"pvfcmp.up", 0xfc, V64, F32, VM, simm7fp>;
1165e8d8bef9SDimitry Andric  let isCodeGenOnly = 1 in
1166e8d8bef9SDimitry Andric  defm VFCMPS : RVm<"vfcmp.s", 0xfc, V64, F32, VM, simm7fp>;
1167e8d8bef9SDimitry Andric}
1168e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in
1169e8d8bef9SDimitry Andricdefm PVFCMP : RVm<"pvfcmp", 0xfc, V64, I64, VM512, simm7fp>;
1170e8d8bef9SDimitry Andricdef : MnemonicAlias<"vfcmp.s", "pvfcmp.up">;
1171e8d8bef9SDimitry Andric
1172e8d8bef9SDimitry Andric// Section 8.13.7 - VFCM (Vector Floating Compare and Select Maximum/Minimum)
1173e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in
1174e8d8bef9SDimitry Andricdefm VFMAXD : RVm<"vfmax.d", 0xbd, V64, I64, VM, simm7fp>;
1175e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in
1176e8d8bef9SDimitry Andricdefm PVFMAXLO : RVm<"pvfmax.lo", 0xbd, V64, I64, VM, simm7fp>;
1177e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in {
1178e8d8bef9SDimitry Andric  defm PVFMAXUP : RVm<"pvfmax.up", 0xbd, V64, F32, VM, simm7fp>;
1179e8d8bef9SDimitry Andric  let isCodeGenOnly = 1 in
1180e8d8bef9SDimitry Andric  defm VFMAXS : RVm<"vfmax.s", 0xbd, V64, F32, VM, simm7fp>;
1181e8d8bef9SDimitry Andric}
1182e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in
1183e8d8bef9SDimitry Andricdefm PVFMAX : RVm<"pvfmax", 0xbd, V64, I64, VM512, simm7fp>;
1184e8d8bef9SDimitry Andriclet cs2 = 1 in {
1185e8d8bef9SDimitry Andric  let cx = 0, cx2 = 0 in
1186e8d8bef9SDimitry Andric  defm VFMIND : RVm<"vfmin.d", 0xbd, V64, I64, VM, simm7fp>;
1187e8d8bef9SDimitry Andric  let cx = 0, cx2 = 1 in
1188e8d8bef9SDimitry Andric  defm PVFMINLO : RVm<"pvfmin.lo", 0xbd, V64, I64, VM, simm7fp>;
1189e8d8bef9SDimitry Andric  let cx = 1, cx2 = 0 in {
1190e8d8bef9SDimitry Andric    defm PVFMINUP : RVm<"pvfmin.up", 0xbd, V64, F32, VM, simm7fp>;
1191e8d8bef9SDimitry Andric    let isCodeGenOnly = 1 in
1192e8d8bef9SDimitry Andric    defm VFMINS : RVm<"vfmin.s", 0xbd, V64, F32, VM, simm7fp>;
1193e8d8bef9SDimitry Andric  }
1194e8d8bef9SDimitry Andric  let cx = 1, cx2 = 1 in
1195e8d8bef9SDimitry Andric  defm PVFMIN : RVm<"pvfmin", 0xbd, V64, I64, VM512, simm7fp>;
1196e8d8bef9SDimitry Andric}
1197e8d8bef9SDimitry Andricdef : MnemonicAlias<"vfmax.s", "pvfmax.up">;
1198e8d8bef9SDimitry Andricdef : MnemonicAlias<"vfmin.s", "pvfmin.up">;
1199e8d8bef9SDimitry Andric
1200e8d8bef9SDimitry Andric// Section 8.13.8 - VFMAD (Vector Floating Fused Multiply Add)
1201e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in
1202e8d8bef9SDimitry Andricdefm VFMADD : RVMm<"vfmad.d", 0xe2, V64, I64, VM, simm7fp>;
1203e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in
1204e8d8bef9SDimitry Andricdefm PVFMADLO : RVMm<"pvfmad.lo", 0xe2, V64, I64, VM, simm7fp>;
1205e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in {
1206e8d8bef9SDimitry Andric  defm PVFMADUP : RVMm<"pvfmad.up", 0xe2, V64, F32, VM, simm7fp>;
1207e8d8bef9SDimitry Andric  let isCodeGenOnly = 1 in
1208e8d8bef9SDimitry Andric  defm VFMADS : RVMm<"vfmad.s", 0xe2, V64, F32, VM, simm7fp>;
1209e8d8bef9SDimitry Andric}
1210e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in
1211e8d8bef9SDimitry Andricdefm PVFMAD : RVMm<"pvfmad", 0xe2, V64, I64, VM512, simm7fp>;
1212e8d8bef9SDimitry Andricdef : MnemonicAlias<"vfmad.s", "pvfmad.up">;
1213e8d8bef9SDimitry Andric
1214e8d8bef9SDimitry Andric// Section 8.13.9 - VFMSB (Vector Floating Fused Multiply Subtract)
1215e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in
1216e8d8bef9SDimitry Andricdefm VFMSBD : RVMm<"vfmsb.d", 0xf2, V64, I64, VM, simm7fp>;
1217e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in
1218e8d8bef9SDimitry Andricdefm PVFMSBLO : RVMm<"pvfmsb.lo", 0xf2, V64, I64, VM, simm7fp>;
1219e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in {
1220e8d8bef9SDimitry Andric  defm PVFMSBUP : RVMm<"pvfmsb.up", 0xf2, V64, F32, VM, simm7fp>;
1221e8d8bef9SDimitry Andric  let isCodeGenOnly = 1 in
1222e8d8bef9SDimitry Andric  defm VFMSBS : RVMm<"vfmsb.s", 0xf2, V64, F32, VM, simm7fp>;
1223e8d8bef9SDimitry Andric}
1224e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in
1225e8d8bef9SDimitry Andricdefm PVFMSB : RVMm<"pvfmsb", 0xf2, V64, I64, VM512, simm7fp>;
1226e8d8bef9SDimitry Andricdef : MnemonicAlias<"vfmsb.s", "pvfmsb.up">;
1227e8d8bef9SDimitry Andric
1228e8d8bef9SDimitry Andric// Section 8.13.10 - VFNMAD (Vector Floating Fused Negative Multiply Add)
1229e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in
1230e8d8bef9SDimitry Andricdefm VFNMADD : RVMm<"vfnmad.d", 0xe3, V64, I64, VM, simm7fp>;
1231e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in
1232e8d8bef9SDimitry Andricdefm PVFNMADLO : RVMm<"pvfnmad.lo", 0xe3, V64, I64, VM, simm7fp>;
1233e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in {
1234e8d8bef9SDimitry Andric  defm PVFNMADUP : RVMm<"pvfnmad.up", 0xe3, V64, F32, VM, simm7fp>;
1235e8d8bef9SDimitry Andric  let isCodeGenOnly = 1 in
1236e8d8bef9SDimitry Andric  defm VFNMADS : RVMm<"vfnmad.s", 0xe3, V64, F32, VM, simm7fp>;
1237e8d8bef9SDimitry Andric}
1238e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in
1239e8d8bef9SDimitry Andricdefm PVFNMAD : RVMm<"pvfnmad", 0xe3, V64, I64, VM512, simm7fp>;
1240e8d8bef9SDimitry Andricdef : MnemonicAlias<"vfnmad.s", "pvfnmad.up">;
1241e8d8bef9SDimitry Andric
1242e8d8bef9SDimitry Andric// Section 8.13.11 - VFNMSB (Vector Floating Fused Negative Multiply Subtract)
1243e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in
1244e8d8bef9SDimitry Andricdefm VFNMSBD : RVMm<"vfnmsb.d", 0xf3, V64, I64, VM, simm7fp>;
1245e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in
1246e8d8bef9SDimitry Andricdefm PVFNMSBLO : RVMm<"pvfnmsb.lo", 0xf3, V64, I64, VM, simm7fp>;
1247e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in {
1248e8d8bef9SDimitry Andric  defm PVFNMSBUP : RVMm<"pvfnmsb.up", 0xf3, V64, F32, VM, simm7fp>;
1249e8d8bef9SDimitry Andric  let isCodeGenOnly = 1 in
1250e8d8bef9SDimitry Andric  defm VFNMSBS : RVMm<"vfnmsb.s", 0xf3, V64, F32, VM, simm7fp>;
1251e8d8bef9SDimitry Andric}
1252e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in
1253e8d8bef9SDimitry Andricdefm PVFNMSB : RVMm<"pvfnmsb", 0xf3, V64, I64, VM512, simm7fp>;
1254e8d8bef9SDimitry Andricdef : MnemonicAlias<"vfnmsb.s", "pvfnmsb.up">;
1255e8d8bef9SDimitry Andric
1256e8d8bef9SDimitry Andric// Section 8.13.12 - VRCP (Vector Floating Reciprocal)
1257e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in defm VRCPD : RVF1m<"vrcp.d", 0xe1, V64, VM>;
1258e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in defm PVRCPLO : RVF1m<"pvrcp.lo", 0xe1, V64, VM>;
1259e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in {
1260e8d8bef9SDimitry Andric  defm PVRCPUP : RVF1m<"pvrcp.up", 0xe1, V64, VM>;
1261e8d8bef9SDimitry Andric  let isCodeGenOnly = 1 in defm VRCPS : RVF1m<"vrcp.s", 0xe1, V64, VM>;
1262e8d8bef9SDimitry Andric}
1263e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in defm PVRCP : RVF1m<"pvrcp", 0xe1, V64, VM512>;
1264e8d8bef9SDimitry Andricdef : MnemonicAlias<"vrcp.s", "pvrcp.up">;
1265e8d8bef9SDimitry Andric
1266e8d8bef9SDimitry Andric// Section 8.13.13 - VRSQRT (Vector Floating Reciprocal Square Root)
1267e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0 in defm VRSQRTD : RVF1m<"vrsqrt.d", 0xf1, V64, VM>;
1268e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1 in defm PVRSQRTLO : RVF1m<"pvrsqrt.lo", 0xf1, V64, VM>;
1269e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0 in {
1270e8d8bef9SDimitry Andric  defm PVRSQRTUP : RVF1m<"pvrsqrt.up", 0xf1, V64, VM>;
1271e8d8bef9SDimitry Andric  let isCodeGenOnly = 1 in
1272e8d8bef9SDimitry Andric  defm VRSQRTS : RVF1m<"vrsqrt.s", 0xf1, V64, VM>;
1273e8d8bef9SDimitry Andric}
1274e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1 in
1275e8d8bef9SDimitry Andricdefm PVRSQRT : RVF1m<"pvrsqrt", 0xf1, V64, VM512>;
1276e8d8bef9SDimitry Andriclet cs2 = 1 in {
1277e8d8bef9SDimitry Andric    let cx = 0, cx2 = 0 in
1278e8d8bef9SDimitry Andric    defm VRSQRTDNEX : RVF1m<"vrsqrt.d.nex", 0xf1, V64, VM>;
1279e8d8bef9SDimitry Andric    let cx = 0, cx2 = 1 in
1280e8d8bef9SDimitry Andric    defm PVRSQRTLONEX : RVF1m<"pvrsqrt.lo.nex", 0xf1, V64, VM>;
1281e8d8bef9SDimitry Andric    let cx = 1, cx2 = 0 in {
1282e8d8bef9SDimitry Andric      defm PVRSQRTUPNEX : RVF1m<"pvrsqrt.up.nex", 0xf1, V64, VM>;
1283e8d8bef9SDimitry Andric      let isCodeGenOnly = 1 in
1284e8d8bef9SDimitry Andric      defm VRSQRTSNEX : RVF1m<"vrsqrt.s.nex", 0xf1, V64, VM>;
1285e8d8bef9SDimitry Andric    }
1286e8d8bef9SDimitry Andric    let cx = 1, cx2 = 1 in
1287e8d8bef9SDimitry Andric    defm PVRSQRTNEX : RVF1m<"pvrsqrt.nex", 0xf1, V64, VM512>;
1288e8d8bef9SDimitry Andric}
1289e8d8bef9SDimitry Andricdef : MnemonicAlias<"vrsqrt.s", "pvrsqrt.up">;
1290e8d8bef9SDimitry Andricdef : MnemonicAlias<"vrsqrt.s.nex", "pvrsqrt.up.nex">;
1291e8d8bef9SDimitry Andric
1292e8d8bef9SDimitry Andric// Section 8.13.14 - VFIX (Vector Convert to Fixed Pointer)
1293e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0, cs2 = 0 in
1294e8d8bef9SDimitry Andricdefm VCVTWDSX : RVFIXm<"vcvt.w.d.sx", 0xe8, V64, VM>;
1295e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1, cs2 = 0 in
1296e8d8bef9SDimitry Andricdefm VCVTWDZX : RVFIXm<"vcvt.w.d.zx", 0xe8, V64, VM>;
1297e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0, cs2 = 0 in
1298e8d8bef9SDimitry Andricdefm VCVTWSSX : RVFIXm<"vcvt.w.s.sx", 0xe8, V64, VM>;
1299e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1, cs2 = 0 in
1300e8d8bef9SDimitry Andricdefm VCVTWSZX : RVFIXm<"vcvt.w.s.zx", 0xe8, V64, VM>;
1301e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1, cs2 = 1 in
1302e8d8bef9SDimitry Andricdefm PVCVTWSLO : RVFIXm<"pvcvt.w.s.lo", 0xe8, V64, VM>;
1303e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0, cs2 = 1 in
1304e8d8bef9SDimitry Andricdefm PVCVTWSUP : RVFIXm<"pvcvt.w.s.up", 0xe8, V64, VM>;
1305e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1, cs2 = 1 in
1306e8d8bef9SDimitry Andricdefm PVCVTWS : RVFIXm<"pvcvt.w.s", 0xe8, V64, VM512>;
1307e8d8bef9SDimitry Andric
1308e8d8bef9SDimitry Andric// Section 8.13.15 - VFIXX (Vector Convert to Fixed Pointer)
1309e8d8bef9SDimitry Andricdefm VCVTLD : RVFIXm<"vcvt.l.d", 0xa8, V64, VM>;
1310e8d8bef9SDimitry Andric
1311e8d8bef9SDimitry Andric// Section 8.13.16 - VFLT (Vector Convert to Floating Pointer)
1312e8d8bef9SDimitry Andriclet cx = 0, cx2 = 0, cs2 = 0 in
1313e8d8bef9SDimitry Andricdefm VCVTDW : RVF1m<"vcvt.d.w", 0xf8, V64, VM>;
1314e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0, cs2 = 0 in
1315e8d8bef9SDimitry Andricdefm VCVTSW : RVF1m<"vcvt.s.w", 0xf8, V64, VM>;
1316e8d8bef9SDimitry Andriclet cx = 0, cx2 = 1, cs2 = 1 in
1317e8d8bef9SDimitry Andricdefm PVCVTSWLO : RVF1m<"pvcvt.s.w.lo", 0xf8, V64, VM>;
1318e8d8bef9SDimitry Andriclet cx = 1, cx2 = 0, cs2 = 1 in
1319e8d8bef9SDimitry Andricdefm PVCVTSWUP : RVF1m<"pvcvt.s.w.up", 0xf8, V64, VM>;
1320e8d8bef9SDimitry Andriclet cx = 1, cx2 = 1, cs2 = 1 in
1321e8d8bef9SDimitry Andricdefm PVCVTSW : RVF1m<"pvcvt.s.w", 0xf8, V64, VM512>;
1322e8d8bef9SDimitry Andric
1323e8d8bef9SDimitry Andric// Section 8.13.17 - VFLTX (Vector Convert to Floating Pointer)
1324e8d8bef9SDimitry Andricdefm VCVTDL : RVF1m<"vcvt.d.l", 0xb8, V64, VM>;
1325e8d8bef9SDimitry Andric
1326e8d8bef9SDimitry Andric// Section 8.13.18 - VCVS (Vector Convert to Single-format)
1327e8d8bef9SDimitry Andricdefm VCVTSD : RVF1m<"vcvt.s.d", 0x9f, V64, VM>;
1328e8d8bef9SDimitry Andric
1329e8d8bef9SDimitry Andric// Section 8.13.19 - VCVD (Vector Convert to Double-format)
1330e8d8bef9SDimitry Andricdefm VCVTDS : RVF1m<"vcvt.d.s", 0x8f, V64, VM>;
1331e8d8bef9SDimitry Andric
1332e8d8bef9SDimitry Andric//-----------------------------------------------------------------------------
1333e8d8bef9SDimitry Andric// Section 8.14 - Vector Reduction Instructions
1334e8d8bef9SDimitry Andric//-----------------------------------------------------------------------------
1335e8d8bef9SDimitry Andric
1336e8d8bef9SDimitry Andric// Section 8.14.1 - VSUMS (Vector Sum Single)
1337e8d8bef9SDimitry Andricdefm VSUMWSX : RVF1m<"vsum.w.sx", 0xea, V64, VM>;
1338e8d8bef9SDimitry Andriclet cx2 = 1 in defm VSUMWZX : RVF1m<"vsum.w.zx", 0xea, V64, VM>;
1339e8d8bef9SDimitry Andric
1340e8d8bef9SDimitry Andric// Section 8.14.2 - VSUMX (Vector Sum)
1341e8d8bef9SDimitry Andricdefm VSUML : RVF1m<"vsum.l", 0xaa, V64, VM>;
1342e8d8bef9SDimitry Andric
1343e8d8bef9SDimitry Andric// Section 8.14.3 - VFSUM (Vector Floating Sum)
1344e8d8bef9SDimitry Andricdefm VFSUMD : RVF1m<"vfsum.d", 0xec, V64, VM>;
1345e8d8bef9SDimitry Andriclet cx = 1 in defm VFSUMS : RVF1m<"vfsum.s", 0xec, V64, VM>;
1346e8d8bef9SDimitry Andric
1347e8d8bef9SDimitry Andric// Section 8.14.4 - VMAXS (Vector Maximum/Minimum Single)
1348e8d8bef9SDimitry Andriclet cx2 = 0 in defm VRMAXSWFSTSX : RVF1m<"vrmaxs.w.fst.sx", 0xbb, V64, VM>;
1349e8d8bef9SDimitry Andriclet cx2 = 1 in defm VRMAXSWFSTZX : RVF1m<"vrmaxs.w.fst.zx", 0xbb, V64, VM>;
1350e8d8bef9SDimitry Andriclet cs = 1 in {
1351e8d8bef9SDimitry Andric  let cx2 = 0 in
1352e8d8bef9SDimitry Andric  defm VRMAXSWLSTSX : RVF1m<"vrmaxs.w.lst.sx", 0xbb, V64, VM>;
1353e8d8bef9SDimitry Andric  let cx2 = 1 in
1354e8d8bef9SDimitry Andric  defm VRMAXSWLSTZX : RVF1m<"vrmaxs.w.lst.zx", 0xbb, V64, VM>;
1355e8d8bef9SDimitry Andric}
1356e8d8bef9SDimitry Andriclet cs2 = 1 in {
1357e8d8bef9SDimitry Andric  let cx2 = 0 in
1358e8d8bef9SDimitry Andric  defm VRMINSWFSTSX : RVF1m<"vrmins.w.fst.sx", 0xbb, V64, VM>;
1359e8d8bef9SDimitry Andric  let cx2 = 1 in
1360e8d8bef9SDimitry Andric  defm VRMINSWFSTZX : RVF1m<"vrmins.w.fst.zx", 0xbb, V64, VM>;
1361e8d8bef9SDimitry Andric  let cs = 1 in {
1362e8d8bef9SDimitry Andric    let cx2 = 0 in
1363e8d8bef9SDimitry Andric    defm VRMINSWLSTSX : RVF1m<"vrmins.w.lst.sx", 0xbb, V64, VM>;
1364e8d8bef9SDimitry Andric    let cx2 = 1 in
1365e8d8bef9SDimitry Andric    defm VRMINSWLSTZX : RVF1m<"vrmins.w.lst.zx", 0xbb, V64, VM>;
1366e8d8bef9SDimitry Andric  }
1367e8d8bef9SDimitry Andric}
1368e8d8bef9SDimitry Andric
1369e8d8bef9SDimitry Andric// Section 8.14.5 - VMAXX (Vector Maximum/Minimum)
1370e8d8bef9SDimitry Andriclet cs = 0 in defm VRMAXSLFST : RVF1m<"vrmaxs.l.fst", 0xab, V64, VM>;
1371e8d8bef9SDimitry Andriclet cs = 1 in defm VRMAXSLLST : RVF1m<"vrmaxs.l.lst", 0xab, V64, VM>;
1372e8d8bef9SDimitry Andriclet cs2 = 1 in {
1373e8d8bef9SDimitry Andric  let cs = 0 in defm VRMINSLFST : RVF1m<"vrmins.l.fst", 0xab, V64, VM>;
1374e8d8bef9SDimitry Andric  let cs = 1 in defm VRMINSLLST : RVF1m<"vrmins.l.lst", 0xab, V64, VM>;
1375e8d8bef9SDimitry Andric}
1376e8d8bef9SDimitry Andric
1377e8d8bef9SDimitry Andric// Section 8.14.6 - VFMAX (Vector Floating Maximum/Minimum)
1378e8d8bef9SDimitry Andriclet cs = 0 in defm VFRMAXDFST : RVF1m<"vfrmax.d.fst", 0xad, V64, VM>;
1379e8d8bef9SDimitry Andriclet cs = 1 in defm VFRMAXDLST : RVF1m<"vfrmax.d.lst", 0xad, V64, VM>;
1380e8d8bef9SDimitry Andriclet cs2 = 1 in {
1381e8d8bef9SDimitry Andric  let cs = 0 in defm VFRMINDFST : RVF1m<"vfrmin.d.fst", 0xad, V64, VM>;
1382e8d8bef9SDimitry Andric  let cs = 1 in defm VFRMINDLST : RVF1m<"vfrmin.d.lst", 0xad, V64, VM>;
1383e8d8bef9SDimitry Andric}
1384e8d8bef9SDimitry Andriclet cx = 1 in {
1385e8d8bef9SDimitry Andric  let cs = 0 in defm VFRMAXSFST : RVF1m<"vfrmax.s.fst", 0xad, V64, VM>;
1386e8d8bef9SDimitry Andric  let cs = 1 in defm VFRMAXSLST : RVF1m<"vfrmax.s.lst", 0xad, V64, VM>;
1387e8d8bef9SDimitry Andric  let cs2 = 1 in {
1388e8d8bef9SDimitry Andric    let cs = 0 in defm VFRMINSFST : RVF1m<"vfrmin.s.fst", 0xad, V64, VM>;
1389e8d8bef9SDimitry Andric    let cs = 1 in defm VFRMINSLST : RVF1m<"vfrmin.s.lst", 0xad, V64, VM>;
1390e8d8bef9SDimitry Andric  }
1391e8d8bef9SDimitry Andric}
1392e8d8bef9SDimitry Andric
1393e8d8bef9SDimitry Andric// Section 8.14.7 - VRAND (Vector Reduction And)
1394e8d8bef9SDimitry Andricdefm VRAND : RVF1m<"vrand", 0x88, V64, VM>;
1395e8d8bef9SDimitry Andric
1396e8d8bef9SDimitry Andric// Section 8.14.8 - VROR (Vector Reduction Or)
1397e8d8bef9SDimitry Andricdefm VROR : RVF1m<"vror", 0x98, V64, VM>;
1398e8d8bef9SDimitry Andric
1399e8d8bef9SDimitry Andric// Section 8.14.9 - VRXOR (Vector Reduction Exclusive Or)
1400e8d8bef9SDimitry Andricdefm VRXOR : RVF1m<"vrxor", 0x89, V64, VM>;
1401e8d8bef9SDimitry Andric
1402e8d8bef9SDimitry Andric//-----------------------------------------------------------------------------
1403e8d8bef9SDimitry Andric// Section 8.15 - Vector Iterative Operation Instructions
1404e8d8bef9SDimitry Andric//-----------------------------------------------------------------------------
1405e8d8bef9SDimitry Andric
1406e8d8bef9SDimitry Andric// Section 8.15.1 - VFIA (Vector Floating Iteration Add)
1407e8d8bef9SDimitry Andriclet cx = 0 in defm VFIAD : RVI2m<"vfia.d", 0xce, V64, I64>;
1408e8d8bef9SDimitry Andriclet cx = 1 in defm VFIAS : RVI2m<"vfia.s", 0xce, V64, F32>;
1409e8d8bef9SDimitry Andric
1410e8d8bef9SDimitry Andric// Section 8.15.2 - VFIS (Vector Floating Iteration Subtract)
1411e8d8bef9SDimitry Andriclet cx = 0 in defm VFISD : RVI2m<"vfis.d", 0xde, V64, I64>;
1412e8d8bef9SDimitry Andriclet cx = 1 in defm VFISS : RVI2m<"vfis.s", 0xde, V64, F32>;
1413e8d8bef9SDimitry Andric
1414e8d8bef9SDimitry Andric// Section 8.15.3 - VFIM (Vector Floating Iteration Multiply)
1415e8d8bef9SDimitry Andriclet cx = 0 in defm VFIMD : RVI2m<"vfim.d", 0xcf, V64, I64>;
1416e8d8bef9SDimitry Andriclet cx = 1 in defm VFIMS : RVI2m<"vfim.s", 0xcf, V64, F32>;
1417e8d8bef9SDimitry Andric
1418e8d8bef9SDimitry Andric// Section 8.15.4 - VFIAM (Vector Floating Iteration Add and Multiply)
1419e8d8bef9SDimitry Andriclet cx = 0 in defm VFIAMD : RVI3m<"vfiam.d", 0xee, V64, I64>;
1420e8d8bef9SDimitry Andriclet cx = 1 in defm VFIAMS : RVI3m<"vfiam.s", 0xee, V64, F32>;
1421e8d8bef9SDimitry Andric
1422e8d8bef9SDimitry Andric// Section 8.15.5 - VFISM (Vector Floating Iteration Subtract and Multiply)
1423e8d8bef9SDimitry Andriclet cx = 0 in defm VFISMD : RVI3m<"vfism.d", 0xfe, V64, I64>;
1424e8d8bef9SDimitry Andriclet cx = 1 in defm VFISMS : RVI3m<"vfism.s", 0xfe, V64, F32>;
1425e8d8bef9SDimitry Andric
1426e8d8bef9SDimitry Andric// Section 8.15.6 - VFIMA (Vector Floating Iteration Multiply and Add)
1427e8d8bef9SDimitry Andriclet cx = 0 in defm VFIMAD : RVI3m<"vfima.d", 0xef, V64, I64>;
1428e8d8bef9SDimitry Andriclet cx = 1 in defm VFIMAS : RVI3m<"vfima.s", 0xef, V64, F32>;
1429e8d8bef9SDimitry Andric
1430e8d8bef9SDimitry Andric// Section 8.15.7 - VFIMS (Vector Floating Iteration Multiply and Subtract)
1431e8d8bef9SDimitry Andriclet cx = 0 in defm VFIMSD : RVI3m<"vfims.d", 0xff, V64, I64>;
1432e8d8bef9SDimitry Andriclet cx = 1 in defm VFIMSS : RVI3m<"vfims.s", 0xff, V64, F32>;
1433e8d8bef9SDimitry Andric
1434e8d8bef9SDimitry Andric//-----------------------------------------------------------------------------
1435e8d8bef9SDimitry Andric// Section 8.16 - Vector Merger Operation Instructions
1436e8d8bef9SDimitry Andric//-----------------------------------------------------------------------------
1437e8d8bef9SDimitry Andric
1438e8d8bef9SDimitry Andric// Section 8.16.1 - VMRG (Vector Merge)
1439e8d8bef9SDimitry Andriclet cx = 0 in defm VMRG : RVm<"vmrg", 0xd6, V64, I64, VM>;
1440e8d8bef9SDimitry Andric// FIXME: vmrg.w should be called as pvmrg, but following assembly manual.
1441e8d8bef9SDimitry Andriclet cx = 1 in defm VMRGW : RVm<"vmrg.w", 0xd6, V64, I64, VM512>;
1442e8d8bef9SDimitry Andricdef : MnemonicAlias<"vmrg.l", "vmrg">;
1443e8d8bef9SDimitry Andric
1444e8d8bef9SDimitry Andric// Section 8.16.2 - VSHF (Vector Shuffle)
1445e8d8bef9SDimitry Andricdefm VSHF : RVSHFm<"vshf", 0xbc, V64>;
1446e8d8bef9SDimitry Andric
1447e8d8bef9SDimitry Andric// Section 8.16.3 - VCP (Vector Compress)
1448e8d8bef9SDimitry Andricdefm VCP : RV1m<"vcp", 0x8d, V64, VM>;
1449e8d8bef9SDimitry Andric
1450e8d8bef9SDimitry Andric// Section 8.16.4 - VEX (Vector Expand)
1451e8d8bef9SDimitry Andricdefm VEX : RV1m<"vex", 0x9d, V64, VM>;
1452e8d8bef9SDimitry Andric
1453e8d8bef9SDimitry Andric//-----------------------------------------------------------------------------
1454e8d8bef9SDimitry Andric// Section 8.17 - Vector Mask Operation Instructions
1455e8d8bef9SDimitry Andric//-----------------------------------------------------------------------------
1456e8d8bef9SDimitry Andric
1457e8d8bef9SDimitry Andric// Section 8.17.1 - VFMK (Vector Form Mask)
1458e8d8bef9SDimitry Andricdefm VFMKL : RVMKm<"vfmk.l.", 0xb4, V64, VM>;
1459e8d8bef9SDimitry Andricdef : MnemonicAlias<"vfmk.l", "vfmk.l.at">;
1460e8d8bef9SDimitry Andric
1461e8d8bef9SDimitry Andric// Section 8.17.2 - VFMS (Vector Form Mask Single)
1462e8d8bef9SDimitry Andricdefm VFMKW : RVMKm<"vfmk.w.", 0xb5, V64, VM>;
1463e8d8bef9SDimitry Andriclet isCodeGenOnly = 1 in defm PVFMKWLO : RVMKm<"vfmk.w.", 0xb5, V64, VM>;
1464e8d8bef9SDimitry Andriclet cx = 1 in defm PVFMKWUP : RVMKm<"pvfmk.w.up.", 0xb5, V64, VM>;
1465e8d8bef9SDimitry Andricdef : MnemonicAlias<"vfmk.w", "vfmk.w.at">;
1466e8d8bef9SDimitry Andricdef : MnemonicAlias<"pvfmk.w.up", "pvfmk.w.up.at">;
1467e8d8bef9SDimitry Andricdef : MnemonicAlias<"pvfmk.w.lo", "vfmk.w.at">;
1468e8d8bef9SDimitry Andricforeach CC = [ "af", "gt", "lt", "ne", "eq", "ge", "le", "at" ] in {
1469e8d8bef9SDimitry Andric  def : MnemonicAlias<"pvfmk.w.lo."#CC, "vfmk.w."#CC>;
1470e8d8bef9SDimitry Andric}
1471e8d8bef9SDimitry Andric
1472e8d8bef9SDimitry Andric// Section 8.17.3 - VFMF (Vector Form Mask Floating Point)
1473e8d8bef9SDimitry Andricdefm VFMKD : RVMKm<"vfmk.d.", 0xb6, V64, VM>;
1474e8d8bef9SDimitry Andriclet cx2 = 1 in defm PVFMKSLO : RVMKm<"pvfmk.s.lo.", 0xb6, V64, VM>;
1475e8d8bef9SDimitry Andriclet cx = 1 in {
1476e8d8bef9SDimitry Andric  defm PVFMKSUP : RVMKm<"pvfmk.s.up.", 0xb6, V64, VM>;
1477e8d8bef9SDimitry Andric  let isCodeGenOnly = 1 in defm VFMKS : RVMKm<"vfmk.s.", 0xb6, V64, VM>;
1478e8d8bef9SDimitry Andric}
1479e8d8bef9SDimitry Andricdef : MnemonicAlias<"vfmk.d", "vfmk.d.at">;
1480e8d8bef9SDimitry Andricdef : MnemonicAlias<"pvfmk.s.lo", "pvfmk.s.lo.at">;
1481e8d8bef9SDimitry Andricdef : MnemonicAlias<"pvfmk.s.up", "pvfmk.s.up.at">;
1482e8d8bef9SDimitry Andricdef : MnemonicAlias<"vfmk.s", "pvfmk.s.up.at">;
1483e8d8bef9SDimitry Andricforeach CC = [ "af", "gt", "lt", "ne", "eq", "ge", "le", "at", "num", "nan",
1484e8d8bef9SDimitry Andric               "gtnan", "ltnan", "nenan", "eqnan", "genan", "lenan" ] in {
1485e8d8bef9SDimitry Andric  def : MnemonicAlias<"vfmk.s."#CC, "pvfmk.s.up."#CC>;
1486e8d8bef9SDimitry Andric}
1487e8d8bef9SDimitry Andric
1488e8d8bef9SDimitry Andric// Section 8.17.4 - ANDM (And VM)
1489e8d8bef9SDimitry Andricdefm ANDM : RVM2m<"andm", 0x84, VM>;
1490e8d8bef9SDimitry Andric
1491e8d8bef9SDimitry Andric// Section 8.17.5 - ORM (Or VM)
1492e8d8bef9SDimitry Andricdefm ORM : RVM2m<"orm", 0x85, VM>;
1493e8d8bef9SDimitry Andric
1494e8d8bef9SDimitry Andric// Section 8.17.6 - XORM (Exclusive Or VM)
1495e8d8bef9SDimitry Andricdefm XORM : RVM2m<"xorm", 0x86, VM>;
1496e8d8bef9SDimitry Andric
1497e8d8bef9SDimitry Andric// Section 8.17.7 - EQVM (Equivalence VM)
1498e8d8bef9SDimitry Andricdefm EQVM : RVM2m<"eqvm", 0x87, VM>;
1499e8d8bef9SDimitry Andric
1500e8d8bef9SDimitry Andric// Section 8.17.8 - NNDM (Negate And VM)
1501e8d8bef9SDimitry Andricdefm NNDM : RVM2m<"nndm", 0x94, VM>;
1502e8d8bef9SDimitry Andric
1503e8d8bef9SDimitry Andric// Section 8.17.9 - NEGM (Negate VM)
1504e8d8bef9SDimitry Andricdefm NEGM : RVM1m<"negm", 0x95, VM>;
1505e8d8bef9SDimitry Andric
1506e8d8bef9SDimitry Andric// Section 8.17.10 - PCVM (Population Count of VM)
1507e8d8bef9SDimitry Andricdefm PCVM : RVMSm<"pcvm", 0xa4, VM>;
1508e8d8bef9SDimitry Andric
1509e8d8bef9SDimitry Andric// Section 8.17.11 - LZVM (Leading Zero of VM)
1510e8d8bef9SDimitry Andricdefm LZVM : RVMSm<"lzvm", 0xa5, VM>;
1511e8d8bef9SDimitry Andric
1512e8d8bef9SDimitry Andric// Section 8.17.12 - TOVM (Trailing One of VM)
1513e8d8bef9SDimitry Andricdefm TOVM : RVMSm<"tovm", 0xa6, VM>;
1514e8d8bef9SDimitry Andric
1515e8d8bef9SDimitry Andric//-----------------------------------------------------------------------------
1516e8d8bef9SDimitry Andric// Section 8.18 - Vector Control Instructions
1517e8d8bef9SDimitry Andric//-----------------------------------------------------------------------------
1518e8d8bef9SDimitry Andric
1519e8d8bef9SDimitry Andric// Section 8.18.1 - LVL (Load VL)
1520e8d8bef9SDimitry Andriclet sx = 0, cz = 0, sz = 0, hasSideEffects = 0, Defs = [VL] in {
1521e8d8bef9SDimitry Andric  def LVLr : RR<0xbf, (outs), (ins I64:$sy), "lvl $sy">;
1522e8d8bef9SDimitry Andric  let cy = 0 in def LVLi : RR<0xbf, (outs), (ins simm7:$sy), "lvl $sy">;
1523e8d8bef9SDimitry Andric}
1524e8d8bef9SDimitry Andric
1525e8d8bef9SDimitry Andric// Section 8.18.2 - SVL (Save VL)
1526e8d8bef9SDimitry Andriclet cy = 0, sy = 0, cz = 0, sz = 0, hasSideEffects = 0, Uses = [VL] in
1527e8d8bef9SDimitry Andricdef SVL : RR<0x2f, (outs I64:$sx), (ins), "svl $sx">;
1528e8d8bef9SDimitry Andric
1529e8d8bef9SDimitry Andric// Section 8.18.3 - SMVL (Save Maximum Vector Length)
1530e8d8bef9SDimitry Andriclet cy = 0, sy = 0, cz = 0, sz = 0, hasSideEffects = 0 in
1531e8d8bef9SDimitry Andricdef SMVL : RR<0x2e, (outs I64:$sx), (ins), "smvl $sx">;
1532e8d8bef9SDimitry Andric
1533e8d8bef9SDimitry Andric// Section 8.18.4 - LVIX (Load Vector Data Index)
1534e8d8bef9SDimitry Andriclet sx = 0, cz = 0, sz = 0, hasSideEffects = 0, Defs = [VIX] in {
1535e8d8bef9SDimitry Andric  def LVIXr : RR<0xaf, (outs), (ins I64:$sy), "lvix $sy">;
1536e8d8bef9SDimitry Andric  let cy = 0 in def LVIXi : RR<0xaf, (outs), (ins uimm6:$sy), "lvix $sy">;
1537e8d8bef9SDimitry Andric}
1538