1 //===-- VOPInstructions.td - Vector Instruction Defintions ----------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // dummies for outer let
12 bit isConvertibleToThreeAddress;
14 bit isReMaterializable;
16 bit VOPAsmPrefer32Bit;
18 Predicate SubtargetPredicate;
20 string DisableEncoding;
21 list<SchedReadWrite> SchedRW;
26 class VOP <string opName> {
27 string OpName = opName;
30 class VOPAnyCommon <dag outs, dag ins, string asm, list<dag> pattern> :
31 InstSI <outs, ins, asm, pattern> {
35 let hasSideEffects = 0;
36 let UseNamedOperandTable = 1;
41 class VOP_Pseudo <string opName, string suffix, VOPProfile P, dag outs, dag ins,
42 string asm, list<dag> pattern> :
43 InstSI <outs, ins, asm, pattern>,
45 SIMCInstr <opName#suffix, SIEncodingFamily.NONE> {
47 let isCodeGenOnly = 1;
48 let UseNamedOperandTable = 1;
50 string Mnemonic = opName;
56 class VOP3Common <dag outs, dag ins, string asm = "",
57 list<dag> pattern = [], bit HasMods = 0,
59 VOPAnyCommon <outs, ins, asm, pattern> {
61 // Using complex patterns gives VOP3 patterns a very high complexity rating,
62 // but standalone patterns are almost always preferred, so we need to adjust the
63 // priority lower. The goal is to use a high number to reduce complexity to
64 // zero (or less than zero).
65 let AddedComplexity = -1000;
69 let AsmVariantName = AMDGPUAsmVariants.VOP3;
70 let AsmMatchConverter = !if(!eq(HasMods,1), "cvtVOP3", "");
72 let isCodeGenOnly = 0;
76 // Because SGPRs may be allowed if there are multiple operands, we
77 // need a post-isel hook to insert copies in order to avoid
78 // violating constant bus requirements.
79 let hasPostISelHook = 1;
82 class VOP3_Pseudo <string opName, VOPProfile P, list<dag> pattern = [],
83 bit VOP3Only = 0, bit isVOP3P = 0, bit isVop3OpSel = 0> :
84 VOP_Pseudo <opName, "_e64", P, P.Outs64,
87 !if(!and(isVOP3P, P.IsPacked), P.InsVOP3P, P.Ins64)),
90 let VOP3_OPSEL = isVop3OpSel;
91 let IsPacked = P.IsPacked;
94 let AsmOperands = !if(isVop3OpSel,
96 !if(!and(isVOP3P, P.IsPacked), P.AsmVOP3P, P.Asm64));
101 let hasSideEffects = 0;
103 // Because SGPRs may be allowed if there are multiple operands, we
104 // need a post-isel hook to insert copies in order to avoid
105 // violating constant bus requirements.
106 let hasPostISelHook = 1;
108 // Using complex patterns gives VOP3 patterns a very high complexity rating,
109 // but standalone patterns are almost always preferred, so we need to adjust the
110 // priority lower. The goal is to use a high number to reduce complexity to
111 // zero (or less than zero).
112 let AddedComplexity = -1000;
116 let FPClamp = P.HasFPClamp;
117 let IntClamp = P.HasIntClamp;
118 let ClampLo = P.HasClampLo;
119 let ClampHi = P.HasClampHi;
123 let AsmVariantName = AMDGPUAsmVariants.VOP3;
124 let AsmMatchConverter =
127 !if(!or(P.HasModifiers, !or(P.HasOMod, P.HasIntClamp)),
132 class VOP3P_Pseudo <string opName, VOPProfile P, list<dag> pattern = []> :
133 VOP3_Pseudo<opName, P, pattern, 1, 1> {
137 class VOP3_Real <VOP_Pseudo ps, int EncodingFamily> :
138 InstSI <ps.OutOperandList, ps.InOperandList, ps.Mnemonic # ps.AsmOperands, []>,
139 SIMCInstr <ps.PseudoInstr, EncodingFamily> {
142 let isCodeGenOnly = 0;
143 let UseNamedOperandTable = 1;
145 let Constraints = ps.Constraints;
146 let DisableEncoding = ps.DisableEncoding;
148 // copy relevant pseudo op flags
149 let SubtargetPredicate = ps.SubtargetPredicate;
150 let OtherPredicates = ps.OtherPredicates;
151 let AsmMatchConverter = ps.AsmMatchConverter;
152 let AsmVariantName = ps.AsmVariantName;
153 let Constraints = ps.Constraints;
154 let DisableEncoding = ps.DisableEncoding;
155 let TSFlags = ps.TSFlags;
156 let UseNamedOperandTable = ps.UseNamedOperandTable;
160 VOPProfile Pfl = ps.Pfl;
163 // XXX - Is there any reason to distingusih this from regular VOP3
165 class VOP3P_Real<VOP_Pseudo ps, int EncodingFamily> :
166 VOP3_Real<ps, EncodingFamily>;
168 class VOP3a<VOPProfile P> : Enc64 {
169 bits<4> src0_modifiers;
171 bits<3> src1_modifiers;
173 bits<3> src2_modifiers;
178 let Inst{8} = !if(P.HasSrc0Mods, src0_modifiers{1}, 0);
179 let Inst{9} = !if(P.HasSrc1Mods, src1_modifiers{1}, 0);
180 let Inst{10} = !if(P.HasSrc2Mods, src2_modifiers{1}, 0);
182 let Inst{31-26} = 0x34; //encoding
183 let Inst{40-32} = !if(P.HasSrc0, src0, 0);
184 let Inst{49-41} = !if(P.HasSrc1, src1, 0);
185 let Inst{58-50} = !if(P.HasSrc2, src2, 0);
186 let Inst{60-59} = !if(P.HasOMod, omod, 0);
187 let Inst{61} = !if(P.HasSrc0Mods, src0_modifiers{0}, 0);
188 let Inst{62} = !if(P.HasSrc1Mods, src1_modifiers{0}, 0);
189 let Inst{63} = !if(P.HasSrc2Mods, src2_modifiers{0}, 0);
192 class VOP3a_gfx6_gfx7<bits<9> op, VOPProfile p> : VOP3a<p> {
193 let Inst{11} = !if(p.HasClamp, clamp{0}, 0);
194 let Inst{25-17} = op;
197 class VOP3a_gfx10<bits<10> op, VOPProfile p> : VOP3a<p> {
198 let Inst{15} = !if(p.HasClamp, clamp{0}, 0);
199 let Inst{25-16} = op;
200 let Inst{31-26} = 0x35;
203 class VOP3a_vi <bits<10> op, VOPProfile P> : VOP3a<P> {
204 let Inst{25-16} = op;
205 let Inst{15} = !if(P.HasClamp, clamp{0}, 0);
208 class VOP3e_gfx6_gfx7<bits<9> op, VOPProfile p> : VOP3a_gfx6_gfx7<op, p> {
210 let Inst{7-0} = !if(p.EmitDst, vdst{7-0}, 0);
213 class VOP3e_gfx10<bits<10> op, VOPProfile p> : VOP3a_gfx10<op, p> {
215 let Inst{7-0} = !if(p.EmitDst, vdst{7-0}, 0);
218 class VOP3e_vi <bits<10> op, VOPProfile P> : VOP3a_vi <op, P> {
220 let Inst{7-0} = !if(P.EmitDst, vdst{7-0}, 0);
223 class VOP3OpSel_gfx9 <bits<10> op, VOPProfile P> : VOP3e_vi <op, P> {
224 let Inst{11} = !if(P.HasSrc0, src0_modifiers{2}, 0);
225 let Inst{12} = !if(P.HasSrc1, src1_modifiers{2}, 0);
226 let Inst{13} = !if(P.HasSrc2, src2_modifiers{2}, 0);
227 let Inst{14} = !if(P.HasDst, src0_modifiers{3}, 0);
230 class VOP3OpSel_gfx10<bits<10> op, VOPProfile p> : VOP3e_gfx10<op, p> {
231 let Inst{11} = !if(p.HasSrc0, src0_modifiers{2}, 0);
232 let Inst{12} = !if(p.HasSrc1, src1_modifiers{2}, 0);
233 let Inst{13} = !if(p.HasSrc2, src2_modifiers{2}, 0);
234 let Inst{14} = !if(p.HasDst, src0_modifiers{3}, 0);
237 // NB: For V_INTERP* opcodes, src0 is encoded as src1 and vice versa
238 class VOP3Interp_vi <bits<10> op, VOPProfile P> : VOP3e_vi <op, P> {
243 let Inst{8} = 0; // No modifiers for src0
246 let Inst{9} = !if(P.HasSrc0Mods, src0_modifiers{1}, 0);
247 let Inst{62} = !if(P.HasSrc0Mods, src0_modifiers{0}, 0);
249 let Inst{37-32} = attr;
250 let Inst{39-38} = attrchan;
251 let Inst{40} = !if(P.HasHigh, high, 0);
253 let Inst{49-41} = src0;
256 class VOP3Interp_gfx10<bits<10> op, VOPProfile p> : VOP3e_gfx10<op, p> {
262 let Inst{9} = !if(p.HasSrc0Mods, src0_modifiers{1}, 0);
263 let Inst{37-32} = attr;
264 let Inst{39-38} = attrchan;
265 let Inst{40} = !if(p.HasHigh, high, 0);
266 let Inst{49-41} = src0;
268 let Inst{62} = !if(p.HasSrc0Mods, src0_modifiers{0}, 0);
271 class VOP3be <VOPProfile P> : Enc64 {
273 bits<2> src0_modifiers;
275 bits<2> src1_modifiers;
277 bits<2> src2_modifiers;
282 let Inst{7-0} = vdst;
283 let Inst{14-8} = sdst;
284 let Inst{31-26} = 0x34; //encoding
285 let Inst{40-32} = !if(P.HasSrc0, src0, 0);
286 let Inst{49-41} = !if(P.HasSrc1, src1, 0);
287 let Inst{58-50} = !if(P.HasSrc2, src2, 0);
288 let Inst{60-59} = !if(P.HasOMod, omod, 0);
289 let Inst{61} = !if(P.HasSrc0Mods, src0_modifiers{0}, 0);
290 let Inst{62} = !if(P.HasSrc1Mods, src1_modifiers{0}, 0);
291 let Inst{63} = !if(P.HasSrc2Mods, src2_modifiers{0}, 0);
294 class VOP3Pe <bits<10> op, VOPProfile P> : Enc64 {
296 // neg, neg_hi, op_sel put in srcN_modifiers
297 bits<4> src0_modifiers;
299 bits<4> src1_modifiers;
301 bits<4> src2_modifiers;
305 let Inst{7-0} = vdst;
306 let Inst{8} = !if(P.HasSrc0Mods, src0_modifiers{1}, 0); // neg_hi src0
307 let Inst{9} = !if(P.HasSrc1Mods, src1_modifiers{1}, 0); // neg_hi src1
308 let Inst{10} = !if(P.HasSrc2Mods, src2_modifiers{1}, 0); // neg_hi src2
310 let Inst{11} = !if(!and(P.HasSrc0, P.HasOpSel), src0_modifiers{2}, 0); // op_sel(0)
311 let Inst{12} = !if(!and(P.HasSrc1, P.HasOpSel), src1_modifiers{2}, 0); // op_sel(1)
312 let Inst{13} = !if(!and(P.HasSrc2, P.HasOpSel), src2_modifiers{2}, 0); // op_sel(2)
314 let Inst{14} = !if(!and(P.HasSrc2, P.HasOpSel), src2_modifiers{3}, 0); // op_sel_hi(2)
316 let Inst{15} = !if(P.HasClamp, clamp{0}, 0);
318 let Inst{25-16} = op;
319 let Inst{31-26} = 0x34; //encoding
320 let Inst{40-32} = !if(P.HasSrc0, src0, 0);
321 let Inst{49-41} = !if(P.HasSrc1, src1, 0);
322 let Inst{58-50} = !if(P.HasSrc2, src2, 0);
323 let Inst{59} = !if(!and(P.HasSrc0, P.HasOpSel), src0_modifiers{3}, 0); // op_sel_hi(0)
324 let Inst{60} = !if(!and(P.HasSrc1, P.HasOpSel), src1_modifiers{3}, 0); // op_sel_hi(1)
325 let Inst{61} = !if(P.HasSrc0Mods, src0_modifiers{0}, 0); // neg (lo)
326 let Inst{62} = !if(P.HasSrc1Mods, src1_modifiers{0}, 0); // neg (lo)
327 let Inst{63} = !if(P.HasSrc2Mods, src2_modifiers{0}, 0); // neg (lo)
330 class VOP3Pe_MAI <bits<10> op, VOPProfile P> : Enc64 {
340 let Inst{7-0} = vdst;
342 let Inst{10-8} = !if(P.HasSrc1, cbsz, 0);
343 let Inst{14-11} = !if(P.HasSrc1, abid, 0);
345 let Inst{15} = !if(P.HasClamp, clamp{0}, 0);
347 let Inst{25-16} = op;
348 let Inst{31-26} = 0x34; //encoding
349 let Inst{40-32} = !if(P.HasSrc0, src0{8-0}, 0);
350 let Inst{49-41} = !if(P.HasSrc1, src1{8-0}, 0);
351 let Inst{58-50} = !if(P.HasSrc2, src2, 0);
353 let Inst{59} = !if(P.HasSrc0, src0{9}, 0); // acc(0)
354 let Inst{60} = !if(P.HasSrc1, src1{9}, 0); // acc(1)
356 let Inst{63-61} = !if(P.HasSrc1, blgp, 0);
360 class VOP3Pe_gfx10 <bits<10> op, VOPProfile P> : VOP3Pe<op, P> {
361 let Inst{31-26} = 0x33; //encoding
364 class VOP3be_gfx6_gfx7<bits<9> op, VOPProfile p> : VOP3be<p> {
365 let Inst{25-17} = op;
368 class VOP3be_gfx10<bits<10> op, VOPProfile p> : VOP3be<p> {
370 let Inst{15} = !if(p.HasClamp, clamp{0}, 0);
371 let Inst{25-16} = op;
372 let Inst{31-26} = 0x35;
375 class VOP3be_vi <bits<10> op, VOPProfile P> : VOP3be<P> {
377 let Inst{25-16} = op;
378 let Inst{15} = !if(P.HasClamp, clamp{0}, 0);
394 int UNUSED_PRESERVE = 2;
397 class VOP_SDWAe<VOPProfile P> : Enc64 {
400 bits<2> src0_modifiers; // float: {abs,neg}, int {sext}
402 bits<2> src1_modifiers;
407 let Inst{39-32} = !if(P.HasSrc0, src0{7-0}, 0);
408 let Inst{42-40} = !if(P.EmitDst, dst_sel{2-0}, 0);
409 let Inst{44-43} = !if(P.EmitDst, dst_unused{1-0}, 0);
410 let Inst{45} = !if(P.HasSDWAClamp, clamp{0}, 0);
411 let Inst{50-48} = !if(P.HasSrc0, src0_sel{2-0}, 0);
412 let Inst{51} = !if(P.HasSrc0IntMods, src0_modifiers{0}, 0);
413 let Inst{53-52} = !if(P.HasSrc0FloatMods, src0_modifiers{1-0}, 0);
414 let Inst{58-56} = !if(P.HasSrc1, src1_sel{2-0}, 0);
415 let Inst{59} = !if(P.HasSrc1IntMods, src1_modifiers{0}, 0);
416 let Inst{61-60} = !if(P.HasSrc1FloatMods, src1_modifiers{1-0}, 0);
419 // GFX9 adds two features to SDWA:
420 // 1. Add 3 fields to the SDWA microcode word: S0, S1 and OMOD.
421 // a. S0 and S1 indicate that source 0 and 1 respectively are SGPRs rather
422 // than VGPRs (at most 1 can be an SGPR);
423 // b. OMOD is the standard output modifier (result *2, *4, /2)
424 // 2. Add a new version of the SDWA microcode word for VOPC: SDWAB. This
425 // replaces OMOD and the dest fields with SD and SDST (SGPR destination)
427 // a. When SD=1, the SDST is used as the destination for the compare result;
428 // b. When SD=0, VCC is used.
430 // In GFX9, V_MAC_F16, V_MAC_F32 opcodes cannot be used with SDWA
432 // gfx9 SDWA basic encoding
433 class VOP_SDWA9e<VOPProfile P> : Enc64 {
434 bits<9> src0; // {src0_sgpr{0}, src0{7-0}}
436 bits<2> src0_modifiers; // float: {abs,neg}, int {sext}
438 bits<2> src1_modifiers;
441 let Inst{39-32} = !if(P.HasSrc0, src0{7-0}, 0);
442 let Inst{50-48} = !if(P.HasSrc0, src0_sel{2-0}, 0);
443 let Inst{51} = !if(P.HasSrc0IntMods, src0_modifiers{0}, 0);
444 let Inst{53-52} = !if(P.HasSrc0FloatMods, src0_modifiers{1-0}, 0);
445 let Inst{55} = !if(P.HasSrc0, src0{8}, 0);
446 let Inst{58-56} = !if(P.HasSrc1, src1_sel{2-0}, 0);
447 let Inst{59} = !if(P.HasSrc1IntMods, src1_modifiers{0}, 0);
448 let Inst{61-60} = !if(P.HasSrc1FloatMods, src1_modifiers{1-0}, 0);
449 let Inst{63} = 0; // src1_sgpr - should be specified in subclass
453 class VOP_SDWA9Ae<VOPProfile P> : VOP_SDWA9e<P> {
459 let Inst{42-40} = !if(P.EmitDst, dst_sel{2-0}, 0);
460 let Inst{44-43} = !if(P.EmitDst, dst_unused{1-0}, 0);
461 let Inst{45} = !if(P.HasSDWAClamp, clamp{0}, 0);
462 let Inst{47-46} = !if(P.HasSDWAOMod, omod{1-0}, 0);
466 class VOP_SDWA9Be<VOPProfile P> : VOP_SDWA9e<P> {
467 bits<8> sdst; // {vcc_sdst{0}, sdst{6-0}}
469 let Inst{46-40} = !if(P.EmitDst, sdst{6-0}, ?);
470 let Inst{47} = !if(P.EmitDst, sdst{7}, 0);
473 class VOP_SDWA_Pseudo <string opName, VOPProfile P, list<dag> pattern=[]> :
474 InstSI <P.OutsSDWA, P.InsSDWA, "", pattern>,
476 SIMCInstr <opName#"_sdwa", SIEncodingFamily.NONE> {
479 let isCodeGenOnly = 1;
480 let UseNamedOperandTable = 1;
482 string Mnemonic = opName;
483 string AsmOperands = P.AsmSDWA;
484 string AsmOperands9 = P.AsmSDWA9;
489 let hasSideEffects = 0;
495 let SubtargetPredicate = !if(P.HasExtSDWA, HasSDWA, DisableInst);
496 let AssemblerPredicate = !if(P.HasExtSDWA, HasSDWA, DisableInst);
497 let AsmVariantName = !if(P.HasExtSDWA, AMDGPUAsmVariants.SDWA,
498 AMDGPUAsmVariants.Disable);
499 let DecoderNamespace = "SDWA";
504 class VOP_SDWA_Real <VOP_SDWA_Pseudo ps> :
505 InstSI <ps.OutOperandList, ps.InOperandList, ps.Mnemonic # ps.AsmOperands, []>,
506 SIMCInstr <ps.PseudoInstr, SIEncodingFamily.SDWA> {
509 let isCodeGenOnly = 0;
513 let SchedRW = ps.SchedRW;
514 let hasSideEffects = ps.hasSideEffects;
516 let Constraints = ps.Constraints;
517 let DisableEncoding = ps.DisableEncoding;
519 // Copy relevant pseudo op flags
520 let SubtargetPredicate = ps.SubtargetPredicate;
521 let AssemblerPredicate = ps.AssemblerPredicate;
522 let AsmMatchConverter = ps.AsmMatchConverter;
523 let AsmVariantName = ps.AsmVariantName;
524 let UseNamedOperandTable = ps.UseNamedOperandTable;
525 let DecoderNamespace = ps.DecoderNamespace;
526 let Constraints = ps.Constraints;
527 let DisableEncoding = ps.DisableEncoding;
528 let TSFlags = ps.TSFlags;
531 class Base_VOP_SDWA9_Real <VOP_SDWA_Pseudo ps> :
532 InstSI <ps.OutOperandList, ps.InOperandList, ps.Mnemonic # ps.AsmOperands9, []> {
535 let isCodeGenOnly = 0;
539 let SchedRW = ps.SchedRW;
540 let hasSideEffects = ps.hasSideEffects;
542 let Constraints = ps.Constraints;
543 let DisableEncoding = ps.DisableEncoding;
545 let SubtargetPredicate = !if(ps.Pfl.HasExtSDWA9, HasSDWA9, DisableInst);
546 let AssemblerPredicate = !if(ps.Pfl.HasExtSDWA9, HasSDWA9, DisableInst);
547 let AsmVariantName = !if(ps.Pfl.HasExtSDWA9, AMDGPUAsmVariants.SDWA9,
548 AMDGPUAsmVariants.Disable);
549 let DecoderNamespace = "SDWA9";
551 // Copy relevant pseudo op flags
552 let AsmMatchConverter = ps.AsmMatchConverter;
553 let UseNamedOperandTable = ps.UseNamedOperandTable;
554 let Constraints = ps.Constraints;
555 let DisableEncoding = ps.DisableEncoding;
556 let TSFlags = ps.TSFlags;
559 class VOP_SDWA9_Real <VOP_SDWA_Pseudo ps> :
560 Base_VOP_SDWA9_Real <ps >,
561 SIMCInstr <ps.PseudoInstr, SIEncodingFamily.SDWA9>;
563 class Base_VOP_SDWA10_Real<VOP_SDWA_Pseudo ps> : Base_VOP_SDWA9_Real<ps> {
564 let SubtargetPredicate = !if(ps.Pfl.HasExtSDWA9, HasSDWA10, DisableInst);
565 let AssemblerPredicate = !if(ps.Pfl.HasExtSDWA9, HasSDWA10, DisableInst);
566 let DecoderNamespace = "SDWA10";
569 class VOP_SDWA10_Real<VOP_SDWA_Pseudo ps> :
570 Base_VOP_SDWA10_Real<ps>, SIMCInstr<ps.PseudoInstr, SIEncodingFamily.SDWA10>;
572 class VOP_DPPe<VOPProfile P, bit IsDPP16=0> : Enc64 {
573 bits<2> src0_modifiers;
575 bits<2> src1_modifiers;
582 let Inst{39-32} = !if(P.HasSrc0, src0{7-0}, 0);
583 let Inst{48-40} = dpp_ctrl;
584 let Inst{50} = !if(IsDPP16, fi, ?);
585 let Inst{51} = bound_ctrl;
586 let Inst{52} = !if(P.HasSrc0Mods, src0_modifiers{0}, 0); // src0_neg
587 let Inst{53} = !if(P.HasSrc0Mods, src0_modifiers{1}, 0); // src0_abs
588 let Inst{54} = !if(P.HasSrc1Mods, src1_modifiers{0}, 0); // src1_neg
589 let Inst{55} = !if(P.HasSrc1Mods, src1_modifiers{1}, 0); // src1_abs
590 let Inst{59-56} = bank_mask;
591 let Inst{63-60} = row_mask;
594 class VOP_DPP_Pseudo <string OpName, VOPProfile P, list<dag> pattern=[]> :
595 InstSI <P.OutsDPP, P.InsDPP, OpName#P.AsmDPP, pattern>,
597 SIMCInstr <OpName#"_dpp", SIEncodingFamily.NONE> {
600 let isCodeGenOnly = 1;
604 let hasSideEffects = 0;
605 let UseNamedOperandTable = 1;
611 let isConvergent = 1;
613 string Mnemonic = OpName;
614 string AsmOperands = P.AsmDPP;
616 let AsmMatchConverter = !if(!eq(P.HasModifiers,1), "cvtDPP", "");
617 let SubtargetPredicate = HasDPP;
618 let AssemblerPredicate = !if(P.HasExtDPP, HasDPP, DisableInst);
619 let AsmVariantName = !if(P.HasExtDPP, AMDGPUAsmVariants.DPP,
620 AMDGPUAsmVariants.Disable);
621 let Constraints = !if(P.NumSrcArgs, P.TieRegDPP # " = $vdst", "");
622 let DisableEncoding = !if(P.NumSrcArgs, P.TieRegDPP, "");
623 let DecoderNamespace = "DPP";
628 class VOP_DPP_Real <VOP_DPP_Pseudo ps, int EncodingFamily> :
629 InstSI <ps.OutOperandList, ps.InOperandList, ps.Mnemonic # ps.AsmOperands, []>,
630 SIMCInstr <ps.PseudoInstr, EncodingFamily> {
633 let isCodeGenOnly = 0;
637 let SchedRW = ps.SchedRW;
638 let hasSideEffects = ps.hasSideEffects;
640 let Constraints = ps.Constraints;
641 let DisableEncoding = ps.DisableEncoding;
643 // Copy relevant pseudo op flags
644 let isConvergent = ps.isConvergent;
645 let SubtargetPredicate = ps.SubtargetPredicate;
646 let AssemblerPredicate = ps.AssemblerPredicate;
647 let AsmMatchConverter = ps.AsmMatchConverter;
648 let AsmVariantName = ps.AsmVariantName;
649 let UseNamedOperandTable = ps.UseNamedOperandTable;
650 let DecoderNamespace = ps.DecoderNamespace;
651 let Constraints = ps.Constraints;
652 let DisableEncoding = ps.DisableEncoding;
653 let TSFlags = ps.TSFlags;
656 class VOP_DPP <string OpName, VOPProfile P, bit IsDPP16,
657 dag InsDPP = !if(IsDPP16, P.InsDPP16, P.InsDPP),
658 string AsmDPP = !if(IsDPP16, P.AsmDPP16, P.AsmDPP)> :
659 InstSI <P.OutsDPP, InsDPP, OpName#AsmDPP, []>,
660 VOP_DPPe<P, IsDPP16> {
664 let hasSideEffects = 0;
665 let UseNamedOperandTable = 1;
671 let AsmMatchConverter = !if(!eq(P.HasModifiers,1), "cvtDPP", "");
672 let SubtargetPredicate = HasDPP;
673 let AssemblerPredicate = !if(P.HasExtDPP, HasDPP, DisableInst);
674 let AsmVariantName = !if(P.HasExtDPP, AMDGPUAsmVariants.DPP,
675 AMDGPUAsmVariants.Disable);
676 let Constraints = !if(P.NumSrcArgs, P.TieRegDPP # " = $vdst", "");
677 let DisableEncoding = !if(P.NumSrcArgs, P.TieRegDPP, "");
678 let DecoderNamespace = "DPP";
681 class VOP_DPP8e<VOPProfile P> : Enc64 {
686 let Inst{39-32} = !if(P.HasSrc0, src0{7-0}, 0);
687 let Inst{63-40} = dpp8{23-0};
690 class VOP_DPP8<string OpName, VOPProfile P> :
691 InstSI<P.OutsDPP8, P.InsDPP8, OpName#P.AsmDPP8, []>,
696 let hasSideEffects = 0;
697 let UseNamedOperandTable = 1;
703 let AsmMatchConverter = "cvtDPP8";
704 let SubtargetPredicate = HasDPP8;
705 let AssemblerPredicate = !if(P.HasExt, HasDPP8, DisableInst);
706 let AsmVariantName = !if(P.HasExt, AMDGPUAsmVariants.DPP,
707 AMDGPUAsmVariants.Disable);
708 let Constraints = !if(P.NumSrcArgs, P.TieRegDPP # " = $vdst", "");
709 let DisableEncoding = !if(P.NumSrcArgs, P.TieRegDPP, "");
717 class getNumNodeArgs<SDPatternOperator Op> {
718 SDNode N = !cast<SDNode>(Op);
719 SDTypeProfile TP = N.TypeProfile;
720 int ret = TP.NumOperands;
724 class getDivergentFrag<SDPatternOperator Op> {
726 int NumSrcArgs = getNumNodeArgs<Op>.ret;
727 PatFrag ret = PatFrag <
728 !if(!eq(NumSrcArgs, 1),
730 !if(!eq(NumSrcArgs, 2),
731 (ops node:$src0, node:$src1),
732 (ops node:$src0, node:$src1, node:$src2))),
733 !if(!eq(NumSrcArgs, 1),
735 !if(!eq(NumSrcArgs, 2),
737 (Op $src0, $src1, $src2))),
738 [{ return N->isDivergent(); }]
742 class VOPPatGen<SDPatternOperator Op, VOPProfile P> {
744 PatFrag Operator = getDivergentFrag < Op >.ret;
746 dag Ins = !foreach(tmp, P.Ins32, !subst(ins, Operator,
747 !subst(P.Src0RC32, P.Src0VT,
748 !subst(P.Src1RC32, P.Src1VT, tmp))));
751 dag Outs = !foreach(tmp, P.Outs32, !subst(outs, set,
752 !subst(P.DstRC, P.DstVT, tmp)));
754 list<dag> ret = [!con(Outs, (set Ins))];
757 class VOPPatOrNull<SDPatternOperator Op, VOPProfile P> {
758 list<dag> ret = !if(!ne(P.NeedPatGen,PatGenMode.NoPattern), VOPPatGen<Op, P>.ret, []);
761 class DivergentFragOrOp<SDPatternOperator Op, VOPProfile P> {
762 SDPatternOperator ret = !if(!eq(P.NeedPatGen,PatGenMode.Pattern),
763 !if(!isa<SDNode>(Op), getDivergentFrag<Op>.ret, Op), Op);
766 include "VOPCInstructions.td"
767 include "VOP1Instructions.td"
768 include "VOP2Instructions.td"
769 include "VOP3Instructions.td"
770 include "VOP3PInstructions.td"