xref: /freebsd/contrib/llvm-project/llvm/lib/Target/AMDGPU/VOP1Instructions.td (revision 81ad626541db97eb356e2c1d4a20eb2a26a766ab)
15ffd83dbSDimitry Andric//===-- VOP1Instructions.td - Vector Instruction Definitions --------------===//
20b57cec5SDimitry Andric//
30b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric//
70b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric
90b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
100b57cec5SDimitry Andric// VOP1 Classes
110b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
120b57cec5SDimitry Andric
130b57cec5SDimitry Andricclass VOP1e <bits<8> op, VOPProfile P> : Enc32 {
140b57cec5SDimitry Andric  bits<8> vdst;
150b57cec5SDimitry Andric  bits<9> src0;
160b57cec5SDimitry Andric
170b57cec5SDimitry Andric  let Inst{8-0}   = !if(P.HasSrc0, src0{8-0}, ?);
180b57cec5SDimitry Andric  let Inst{16-9}  = op;
190b57cec5SDimitry Andric  let Inst{24-17} = !if(P.EmitDst, vdst{7-0}, 0);
200b57cec5SDimitry Andric  let Inst{31-25} = 0x3f; //encoding
210b57cec5SDimitry Andric}
220b57cec5SDimitry Andric
230b57cec5SDimitry Andricclass VOP1_SDWAe <bits<8> op, VOPProfile P> : VOP_SDWAe <P> {
240b57cec5SDimitry Andric  bits<8> vdst;
250b57cec5SDimitry Andric
260b57cec5SDimitry Andric  let Inst{8-0}   = 0xf9; // sdwa
270b57cec5SDimitry Andric  let Inst{16-9}  = op;
280b57cec5SDimitry Andric  let Inst{24-17} = !if(P.EmitDst, vdst{7-0}, 0);
290b57cec5SDimitry Andric  let Inst{31-25} = 0x3f; // encoding
300b57cec5SDimitry Andric}
310b57cec5SDimitry Andric
320b57cec5SDimitry Andricclass VOP1_SDWA9Ae <bits<8> op, VOPProfile P> : VOP_SDWA9Ae <P> {
330b57cec5SDimitry Andric  bits<8> vdst;
340b57cec5SDimitry Andric
350b57cec5SDimitry Andric  let Inst{8-0}   = 0xf9; // sdwa
360b57cec5SDimitry Andric  let Inst{16-9}  = op;
370b57cec5SDimitry Andric  let Inst{24-17} = !if(P.EmitDst, vdst{7-0}, 0);
380b57cec5SDimitry Andric  let Inst{31-25} = 0x3f; // encoding
390b57cec5SDimitry Andric}
400b57cec5SDimitry Andric
410b57cec5SDimitry Andricclass VOP1_Pseudo <string opName, VOPProfile P, list<dag> pattern=[], bit VOP1Only = 0> :
420b57cec5SDimitry Andric  VOP_Pseudo <opName, !if(VOP1Only, "", "_e32"), P, P.Outs32, P.Ins32, "", pattern> {
430b57cec5SDimitry Andric
440b57cec5SDimitry Andric  let AsmOperands = P.Asm32;
450b57cec5SDimitry Andric
460b57cec5SDimitry Andric  let Size = 4;
470b57cec5SDimitry Andric  let mayLoad = 0;
480b57cec5SDimitry Andric  let mayStore = 0;
490b57cec5SDimitry Andric  let hasSideEffects = 0;
500b57cec5SDimitry Andric
515ffd83dbSDimitry Andric  let ReadsModeReg = !or(isFloatType<P.DstVT>.ret, isFloatType<P.Src0VT>.ret);
525ffd83dbSDimitry Andric
535ffd83dbSDimitry Andric  let mayRaiseFPException = ReadsModeReg;
545ffd83dbSDimitry Andric
550b57cec5SDimitry Andric  let VOP1 = 1;
560b57cec5SDimitry Andric  let VALU = 1;
575ffd83dbSDimitry Andric  let Uses = !if(ReadsModeReg, [MODE, EXEC], [EXEC]);
580b57cec5SDimitry Andric
590b57cec5SDimitry Andric  let AsmVariantName = AMDGPUAsmVariants.Default;
600b57cec5SDimitry Andric}
610b57cec5SDimitry Andric
62*81ad6265SDimitry Andricclass VOP1_Real <VOP1_Pseudo ps, int EncodingFamily, string real_name = ps.Mnemonic > :
63fe6060f1SDimitry Andric  VOP_Real <ps>,
64*81ad6265SDimitry Andric  InstSI <ps.OutOperandList, ps.InOperandList, real_name # ps.AsmOperands, []>,
650b57cec5SDimitry Andric  SIMCInstr <ps.PseudoInstr, EncodingFamily> {
660b57cec5SDimitry Andric
67fe6060f1SDimitry Andric  let VALU = 1;
68fe6060f1SDimitry Andric  let VOP1 = 1;
690b57cec5SDimitry Andric  let isPseudo = 0;
700b57cec5SDimitry Andric  let isCodeGenOnly = 0;
710b57cec5SDimitry Andric
720b57cec5SDimitry Andric  let Constraints     = ps.Constraints;
730b57cec5SDimitry Andric  let DisableEncoding = ps.DisableEncoding;
740b57cec5SDimitry Andric
750b57cec5SDimitry Andric  // copy relevant pseudo op flags
760b57cec5SDimitry Andric  let SubtargetPredicate = ps.SubtargetPredicate;
770b57cec5SDimitry Andric  let AsmMatchConverter  = ps.AsmMatchConverter;
780b57cec5SDimitry Andric  let AsmVariantName     = ps.AsmVariantName;
790b57cec5SDimitry Andric  let Constraints        = ps.Constraints;
800b57cec5SDimitry Andric  let DisableEncoding    = ps.DisableEncoding;
810b57cec5SDimitry Andric  let TSFlags            = ps.TSFlags;
820b57cec5SDimitry Andric  let UseNamedOperandTable = ps.UseNamedOperandTable;
830b57cec5SDimitry Andric  let Uses                 = ps.Uses;
840b57cec5SDimitry Andric  let Defs                 = ps.Defs;
85fe6060f1SDimitry Andric  let SchedRW              = ps.SchedRW;
86fe6060f1SDimitry Andric  let mayLoad              = ps.mayLoad;
87fe6060f1SDimitry Andric  let mayStore             = ps.mayStore;
88fe6060f1SDimitry Andric  let TRANS                = ps.TRANS;
890b57cec5SDimitry Andric}
900b57cec5SDimitry Andric
910b57cec5SDimitry Andricclass VOP1_SDWA_Pseudo <string OpName, VOPProfile P, list<dag> pattern=[]> :
920b57cec5SDimitry Andric  VOP_SDWA_Pseudo <OpName, P, pattern> {
930b57cec5SDimitry Andric  let AsmMatchConverter = "cvtSdwaVOP1";
940b57cec5SDimitry Andric}
950b57cec5SDimitry Andric
960b57cec5SDimitry Andricclass VOP1_DPP_Pseudo <string OpName, VOPProfile P, list<dag> pattern=[]> :
970b57cec5SDimitry Andric  VOP_DPP_Pseudo <OpName, P, pattern> {
980b57cec5SDimitry Andric}
990b57cec5SDimitry Andric
1000b57cec5SDimitry Andricclass getVOP1Pat64 <SDPatternOperator node, VOPProfile P> : LetDummies {
1010b57cec5SDimitry Andric  list<dag> ret =
1020b57cec5SDimitry Andric    !if(P.HasModifiers,
1035ffd83dbSDimitry Andric        [(set P.DstVT:$vdst, (node (P.Src0VT (VOP3Mods P.Src0VT:$src0, i32:$src0_modifiers))))],
1040b57cec5SDimitry Andric        !if(P.HasOMod,
1050b57cec5SDimitry Andric            [(set P.DstVT:$vdst, (node (P.Src0VT (VOP3OMods P.Src0VT:$src0,
1060b57cec5SDimitry Andric                                                  i1:$clamp, i32:$omod))))],
1070b57cec5SDimitry Andric            [(set P.DstVT:$vdst, (node P.Src0VT:$src0))]
1080b57cec5SDimitry Andric        )
1090b57cec5SDimitry Andric    );
1100b57cec5SDimitry Andric}
1110b57cec5SDimitry Andric
1120b57cec5SDimitry Andricmulticlass VOP1Inst <string opName, VOPProfile P,
113*81ad6265SDimitry Andric                     SDPatternOperator node = null_frag, int VOPDOp = -1> {
1145ffd83dbSDimitry Andric  // We only want to set this on the basic, non-SDWA or DPP forms.
115*81ad6265SDimitry Andric  defvar should_mov_imm = !or(!eq(opName, "v_mov_b32"),
116*81ad6265SDimitry Andric                              !eq(opName, "v_mov_b64"));
1175ffd83dbSDimitry Andric
1185ffd83dbSDimitry Andric  let isMoveImm = should_mov_imm in {
119*81ad6265SDimitry Andric    if !eq(VOPDOp, -1) then
1200b57cec5SDimitry Andric      def _e32 : VOP1_Pseudo <opName, P>;
121*81ad6265SDimitry Andric    else
122*81ad6265SDimitry Andric      // Only for V_MOV_B32
123*81ad6265SDimitry Andric      def _e32 : VOP1_Pseudo <opName, P>, VOPD_Component<VOPDOp, "v_mov_b32">;
124*81ad6265SDimitry Andric    def _e64 : VOP3InstBase <opName, P, node>;
1255ffd83dbSDimitry Andric  }
1268bcb0991SDimitry Andric
1278bcb0991SDimitry Andric  foreach _ = BoolToList<P.HasExtSDWA>.ret in
1280b57cec5SDimitry Andric    def _sdwa : VOP1_SDWA_Pseudo <opName, P>;
1298bcb0991SDimitry Andric
1300b57cec5SDimitry Andric  foreach _ = BoolToList<P.HasExtDPP>.ret in
1310b57cec5SDimitry Andric    def _dpp : VOP1_DPP_Pseudo <opName, P>;
1328bcb0991SDimitry Andric
133*81ad6265SDimitry Andric  let SubtargetPredicate = isGFX11Plus in {
134*81ad6265SDimitry Andric    foreach _ = BoolToList<P.HasExtVOP3DPP>.ret in
135*81ad6265SDimitry Andric      def _e64_dpp  : VOP3_DPP_Pseudo <opName, P>;
136*81ad6265SDimitry Andric  } // End SubtargetPredicate = isGFX11Plus
137*81ad6265SDimitry Andric
1388bcb0991SDimitry Andric  def : MnemonicAlias<opName#"_e32", opName>, LetDummies;
1398bcb0991SDimitry Andric  def : MnemonicAlias<opName#"_e64", opName>, LetDummies;
1408bcb0991SDimitry Andric
1418bcb0991SDimitry Andric  foreach _ = BoolToList<P.HasExtSDWA>.ret in
1428bcb0991SDimitry Andric    def : MnemonicAlias<opName#"_sdwa", opName>, LetDummies;
1438bcb0991SDimitry Andric
1448bcb0991SDimitry Andric  foreach _ = BoolToList<P.HasExtDPP>.ret in
1458bcb0991SDimitry Andric    def : MnemonicAlias<opName#"_dpp", opName>, LetDummies;
1460b57cec5SDimitry Andric}
1470b57cec5SDimitry Andric
1480b57cec5SDimitry Andric// Special profile for instructions which have clamp
1490b57cec5SDimitry Andric// and output modifiers (but have no input modifiers)
1500b57cec5SDimitry Andricclass VOPProfileI2F<ValueType dstVt, ValueType srcVt> :
1510b57cec5SDimitry Andric  VOPProfile<[dstVt, srcVt, untyped, untyped]> {
1520b57cec5SDimitry Andric
1530b57cec5SDimitry Andric  let Ins64 = (ins Src0RC64:$src0, clampmod:$clamp, omod:$omod);
154*81ad6265SDimitry Andric  let InsVOP3Base = (ins Src0DPP:$src0, clampmod:$clamp, omod:$omod);
1550b57cec5SDimitry Andric  let Asm64 = "$vdst, $src0$clamp$omod";
156*81ad6265SDimitry Andric  let AsmVOP3DPPBase = Asm64;
1570b57cec5SDimitry Andric
1580b57cec5SDimitry Andric  let HasModifiers = 0;
1590b57cec5SDimitry Andric  let HasClamp = 1;
1600b57cec5SDimitry Andric}
1610b57cec5SDimitry Andric
1620b57cec5SDimitry Andricdef VOP1_F64_I32 : VOPProfileI2F <f64, i32>;
1630b57cec5SDimitry Andricdef VOP1_F32_I32 : VOPProfileI2F <f32, i32>;
1640b57cec5SDimitry Andricdef VOP1_F16_I16 : VOPProfileI2F <f16, i16>;
1650b57cec5SDimitry Andric
166*81ad6265SDimitry Andricdef VOP_NOP_PROFILE : VOPProfile <[untyped, untyped, untyped, untyped]>{
167*81ad6265SDimitry Andric  let HasExtVOP3DPP = 0;
168*81ad6265SDimitry Andric}
169*81ad6265SDimitry Andric
170*81ad6265SDimitry Andric// OMod clears exceptions when set. OMod was always an operand, but its
171*81ad6265SDimitry Andric// now explicitly set.
172fe6060f1SDimitry Andricclass VOP_SPECIAL_OMOD_PROF<ValueType dstVt, ValueType srcVt> :
173fe6060f1SDimitry Andric  VOPProfile<[dstVt, srcVt, untyped, untyped]> {
174fe6060f1SDimitry Andric
175fe6060f1SDimitry Andric  let HasOMod = 1;
176fe6060f1SDimitry Andric}
177fe6060f1SDimitry Andricdef VOP_I32_F32_SPECIAL_OMOD : VOP_SPECIAL_OMOD_PROF<i32, f32>;
178fe6060f1SDimitry Andricdef VOP_I32_F64_SPECIAL_OMOD : VOP_SPECIAL_OMOD_PROF<i32, f64>;
179fe6060f1SDimitry Andricdef VOP_I16_F16_SPECIAL_OMOD : VOP_SPECIAL_OMOD_PROF<i16, f16>;
180fe6060f1SDimitry Andric
1810b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
1820b57cec5SDimitry Andric// VOP1 Instructions
1830b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
1840b57cec5SDimitry Andric
1850b57cec5SDimitry Andriclet VOPAsmPrefer32Bit = 1 in {
186*81ad6265SDimitry Andricdefm V_NOP : VOP1Inst <"v_nop", VOP_NOP_PROFILE>;
187*81ad6265SDimitry Andric}
188*81ad6265SDimitry Andric
189*81ad6265SDimitry Andricdef VOPProfile_MOV : VOPProfile <[i32, i32, untyped, untyped]> {
190*81ad6265SDimitry Andric  let InsVOPDX = (ins Src0RC32:$src0X);
191*81ad6265SDimitry Andric  let InsVOPDXDeferred = (ins VSrc_f32_Deferred:$src0X);
192*81ad6265SDimitry Andric  let InsVOPDY = (ins Src0RC32:$src0Y);
193*81ad6265SDimitry Andric  let InsVOPDYDeferred = (ins VSrc_f32_Deferred:$src0Y);
1940b57cec5SDimitry Andric}
1950b57cec5SDimitry Andric
1965ffd83dbSDimitry Andriclet isReMaterializable = 1, isAsCheapAsAMove = 1 in {
197*81ad6265SDimitry Andricdefm V_MOV_B32 : VOP1Inst <"v_mov_b32", VOPProfile_MOV, null_frag, 0x8>;
198*81ad6265SDimitry Andric
199*81ad6265SDimitry Andriclet SubtargetPredicate = isGFX940Plus in
200*81ad6265SDimitry Andricdefm V_MOV_B64 : VOP1Inst <"v_mov_b64", VOP_I64_I64>;
2010b57cec5SDimitry Andric} // End isMoveImm = 1
2020b57cec5SDimitry Andric
2030b57cec5SDimitry Andric// FIXME: Specify SchedRW for READFIRSTLANE_B32
2040b57cec5SDimitry Andric// TODO: Make profile for this, there is VOP3 encoding also
2050b57cec5SDimitry Andricdef V_READFIRSTLANE_B32 :
2060b57cec5SDimitry Andric  InstSI <(outs SReg_32:$vdst),
2070b57cec5SDimitry Andric    (ins VRegOrLds_32:$src0),
2080b57cec5SDimitry Andric    "v_readfirstlane_b32 $vdst, $src0",
209480093f4SDimitry Andric    [(set i32:$vdst, (int_amdgcn_readfirstlane (i32 VRegOrLds_32:$src0)))]>,
2100b57cec5SDimitry Andric  Enc32 {
2110b57cec5SDimitry Andric
2120b57cec5SDimitry Andric  let isCodeGenOnly = 0;
2130b57cec5SDimitry Andric  let UseNamedOperandTable = 1;
2140b57cec5SDimitry Andric
2150b57cec5SDimitry Andric  let Size = 4;
2160b57cec5SDimitry Andric  let mayLoad = 0;
2170b57cec5SDimitry Andric  let mayStore = 0;
2180b57cec5SDimitry Andric  let hasSideEffects = 0;
2190b57cec5SDimitry Andric
2200b57cec5SDimitry Andric  let VOP1 = 1;
2210b57cec5SDimitry Andric  let VALU = 1;
2220b57cec5SDimitry Andric  let Uses = [EXEC];
2230b57cec5SDimitry Andric  let isConvergent = 1;
2240b57cec5SDimitry Andric
2250b57cec5SDimitry Andric  bits<8> vdst;
2260b57cec5SDimitry Andric  bits<9> src0;
2270b57cec5SDimitry Andric
2280b57cec5SDimitry Andric  let Inst{8-0}   = src0;
2290b57cec5SDimitry Andric  let Inst{16-9}  = 0x2;
2300b57cec5SDimitry Andric  let Inst{24-17} = vdst;
2310b57cec5SDimitry Andric  let Inst{31-25} = 0x3f; //encoding
2320b57cec5SDimitry Andric}
2330b57cec5SDimitry Andric
234fe6060f1SDimitry Andriclet isReMaterializable = 1 in {
2350b57cec5SDimitry Andriclet SchedRW = [WriteDoubleCvt] in {
236fe6060f1SDimitry Andric// OMod clears exceptions when set in this instruction
237fe6060f1SDimitry Andricdefm V_CVT_I32_F64 : VOP1Inst <"v_cvt_i32_f64", VOP_I32_F64_SPECIAL_OMOD,  fp_to_sint>;
2385ffd83dbSDimitry Andric
2395ffd83dbSDimitry Andriclet mayRaiseFPException = 0 in {
2400b57cec5SDimitry Andricdefm V_CVT_F64_I32 : VOP1Inst <"v_cvt_f64_i32", VOP1_F64_I32, sint_to_fp>;
2415ffd83dbSDimitry Andric}
2425ffd83dbSDimitry Andric
2430b57cec5SDimitry Andricdefm V_CVT_F32_F64 : VOP1Inst <"v_cvt_f32_f64", VOP_F32_F64,  fpround>;
2440b57cec5SDimitry Andricdefm V_CVT_F64_F32 : VOP1Inst <"v_cvt_f64_f32", VOP_F64_F32,  fpextend>;
245fe6060f1SDimitry Andric// OMod clears exceptions when set in this instruction
246fe6060f1SDimitry Andricdefm V_CVT_U32_F64 : VOP1Inst <"v_cvt_u32_f64", VOP_I32_F64_SPECIAL_OMOD,  fp_to_uint>;
2475ffd83dbSDimitry Andric
2485ffd83dbSDimitry Andriclet mayRaiseFPException = 0 in {
2490b57cec5SDimitry Andricdefm V_CVT_F64_U32 : VOP1Inst <"v_cvt_f64_u32", VOP1_F64_I32, uint_to_fp>;
2505ffd83dbSDimitry Andric}
2515ffd83dbSDimitry Andric
2520b57cec5SDimitry Andric} // End SchedRW = [WriteDoubleCvt]
2530b57cec5SDimitry Andric
2545ffd83dbSDimitry Andriclet SchedRW = [WriteFloatCvt] in {
2555ffd83dbSDimitry Andric
2565ffd83dbSDimitry Andric// XXX: Does this really not raise exceptions? The manual claims the
2575ffd83dbSDimitry Andric// 16-bit ones can.
2585ffd83dbSDimitry Andriclet mayRaiseFPException = 0 in {
2590b57cec5SDimitry Andricdefm V_CVT_F32_I32 : VOP1Inst <"v_cvt_f32_i32", VOP1_F32_I32, sint_to_fp>;
2600b57cec5SDimitry Andricdefm V_CVT_F32_U32 : VOP1Inst <"v_cvt_f32_u32", VOP1_F32_I32, uint_to_fp>;
2615ffd83dbSDimitry Andric}
2625ffd83dbSDimitry Andric
263fe6060f1SDimitry Andric// OMod clears exceptions when set in these 2 instructions
264fe6060f1SDimitry Andricdefm V_CVT_U32_F32 : VOP1Inst <"v_cvt_u32_f32", VOP_I32_F32_SPECIAL_OMOD, fp_to_uint>;
265fe6060f1SDimitry Andricdefm V_CVT_I32_F32 : VOP1Inst <"v_cvt_i32_f32", VOP_I32_F32_SPECIAL_OMOD, fp_to_sint>;
266fe6060f1SDimitry Andriclet FPDPRounding = 1, isReMaterializable = 0 in {
2670b57cec5SDimitry Andricdefm V_CVT_F16_F32 : VOP1Inst <"v_cvt_f16_f32", VOP_F16_F32, fpround>;
268fe6060f1SDimitry Andric} // End FPDPRounding = 1, isReMaterializable = 0
2695ffd83dbSDimitry Andric
2700b57cec5SDimitry Andricdefm V_CVT_F32_F16 : VOP1Inst <"v_cvt_f32_f16", VOP_F32_F16, fpextend>;
2715ffd83dbSDimitry Andric
2725ffd83dbSDimitry Andriclet ReadsModeReg = 0, mayRaiseFPException = 0 in {
2730b57cec5SDimitry Andricdefm V_CVT_RPI_I32_F32 : VOP1Inst <"v_cvt_rpi_i32_f32", VOP_I32_F32, cvt_rpi_i32_f32>;
2740b57cec5SDimitry Andricdefm V_CVT_FLR_I32_F32 : VOP1Inst <"v_cvt_flr_i32_f32", VOP_I32_F32, cvt_flr_i32_f32>;
2750b57cec5SDimitry Andricdefm V_CVT_OFF_F32_I4 : VOP1Inst  <"v_cvt_off_f32_i4", VOP1_F32_I32>;
2765ffd83dbSDimitry Andric} // End ReadsModeReg = 0, mayRaiseFPException = 0
2775ffd83dbSDimitry Andric} // End SchedRW = [WriteFloatCvt]
2780b57cec5SDimitry Andric
2795ffd83dbSDimitry Andriclet ReadsModeReg = 0, mayRaiseFPException = 0 in {
2800b57cec5SDimitry Andricdefm V_CVT_F32_UBYTE0 : VOP1Inst <"v_cvt_f32_ubyte0", VOP1_F32_I32, AMDGPUcvt_f32_ubyte0>;
2810b57cec5SDimitry Andricdefm V_CVT_F32_UBYTE1 : VOP1Inst <"v_cvt_f32_ubyte1", VOP1_F32_I32, AMDGPUcvt_f32_ubyte1>;
2820b57cec5SDimitry Andricdefm V_CVT_F32_UBYTE2 : VOP1Inst <"v_cvt_f32_ubyte2", VOP1_F32_I32, AMDGPUcvt_f32_ubyte2>;
2830b57cec5SDimitry Andricdefm V_CVT_F32_UBYTE3 : VOP1Inst <"v_cvt_f32_ubyte3", VOP1_F32_I32, AMDGPUcvt_f32_ubyte3>;
2845ffd83dbSDimitry Andric} // ReadsModeReg = 0, mayRaiseFPException = 0
2850b57cec5SDimitry Andric
2860b57cec5SDimitry Andricdefm V_FRACT_F32 : VOP1Inst <"v_fract_f32", VOP_F32_F32, AMDGPUfract>;
2870b57cec5SDimitry Andricdefm V_TRUNC_F32 : VOP1Inst <"v_trunc_f32", VOP_F32_F32, ftrunc>;
2880b57cec5SDimitry Andricdefm V_CEIL_F32 : VOP1Inst <"v_ceil_f32", VOP_F32_F32, fceil>;
2890b57cec5SDimitry Andricdefm V_RNDNE_F32 : VOP1Inst <"v_rndne_f32", VOP_F32_F32, frint>;
2900b57cec5SDimitry Andricdefm V_FLOOR_F32 : VOP1Inst <"v_floor_f32", VOP_F32_F32, ffloor>;
2910b57cec5SDimitry Andric
292e8d8bef9SDimitry Andriclet TRANS = 1, SchedRW = [WriteTrans32] in {
2930b57cec5SDimitry Andricdefm V_EXP_F32 : VOP1Inst <"v_exp_f32", VOP_F32_F32, fexp2>;
2940b57cec5SDimitry Andricdefm V_LOG_F32 : VOP1Inst <"v_log_f32", VOP_F32_F32, flog2>;
2950b57cec5SDimitry Andricdefm V_RCP_F32 : VOP1Inst <"v_rcp_f32", VOP_F32_F32, AMDGPUrcp>;
2960b57cec5SDimitry Andricdefm V_RCP_IFLAG_F32 : VOP1Inst <"v_rcp_iflag_f32", VOP_F32_F32, AMDGPUrcp_iflag>;
2970b57cec5SDimitry Andricdefm V_RSQ_F32 : VOP1Inst <"v_rsq_f32", VOP_F32_F32, AMDGPUrsq>;
2985ffd83dbSDimitry Andricdefm V_SQRT_F32 : VOP1Inst <"v_sqrt_f32", VOP_F32_F32, any_amdgcn_sqrt>;
299e8d8bef9SDimitry Andric} // End TRANS = 1, SchedRW = [WriteTrans32]
3000b57cec5SDimitry Andric
301e8d8bef9SDimitry Andriclet TRANS = 1, SchedRW = [WriteTrans64] in {
3020b57cec5SDimitry Andricdefm V_RCP_F64 : VOP1Inst <"v_rcp_f64", VOP_F64_F64, AMDGPUrcp>;
3030b57cec5SDimitry Andricdefm V_RSQ_F64 : VOP1Inst <"v_rsq_f64", VOP_F64_F64, AMDGPUrsq>;
3045ffd83dbSDimitry Andricdefm V_SQRT_F64 : VOP1Inst <"v_sqrt_f64", VOP_F64_F64, any_amdgcn_sqrt>;
305e8d8bef9SDimitry Andric} // End TRANS = 1, SchedRW = [WriteTrans64]
3060b57cec5SDimitry Andric
307e8d8bef9SDimitry Andriclet TRANS = 1, SchedRW = [WriteTrans32] in {
3080b57cec5SDimitry Andricdefm V_SIN_F32 : VOP1Inst <"v_sin_f32", VOP_F32_F32, AMDGPUsin>;
3090b57cec5SDimitry Andricdefm V_COS_F32 : VOP1Inst <"v_cos_f32", VOP_F32_F32, AMDGPUcos>;
310e8d8bef9SDimitry Andric} // End TRANS = 1, SchedRW = [WriteTrans32]
3110b57cec5SDimitry Andric
3120b57cec5SDimitry Andricdefm V_NOT_B32 : VOP1Inst <"v_not_b32", VOP_I32_I32>;
313*81ad6265SDimitry Andricdefm V_BFREV_B32 : VOP1Inst <"v_bfrev_b32", VOP_I32_I32, DivergentUnaryFrag<bitreverse>>;
3148bcb0991SDimitry Andricdefm V_FFBH_U32 : VOP1Inst <"v_ffbh_u32", VOP_I32_I32, AMDGPUffbh_u32>;
3155ffd83dbSDimitry Andricdefm V_FFBL_B32 : VOP1Inst <"v_ffbl_b32", VOP_I32_I32, AMDGPUffbl_b32>;
3168bcb0991SDimitry Andricdefm V_FFBH_I32 : VOP1Inst <"v_ffbh_i32", VOP_I32_I32, AMDGPUffbh_i32>;
3170b57cec5SDimitry Andric
3180b57cec5SDimitry Andriclet SchedRW = [WriteDoubleAdd] in {
319fe6060f1SDimitry Andricdefm V_FREXP_EXP_I32_F64 : VOP1Inst <"v_frexp_exp_i32_f64", VOP_I32_F64_SPECIAL_OMOD, int_amdgcn_frexp_exp>;
3200b57cec5SDimitry Andricdefm V_FREXP_MANT_F64 : VOP1Inst <"v_frexp_mant_f64", VOP_F64_F64, int_amdgcn_frexp_mant>;
3210b57cec5SDimitry Andriclet FPDPRounding = 1 in {
3220b57cec5SDimitry Andricdefm V_FRACT_F64 : VOP1Inst <"v_fract_f64", VOP_F64_F64, AMDGPUfract>;
3230b57cec5SDimitry Andric} // End FPDPRounding = 1
3240b57cec5SDimitry Andric} // End SchedRW = [WriteDoubleAdd]
3250b57cec5SDimitry Andric
3260b57cec5SDimitry Andricdefm V_FREXP_EXP_I32_F32 : VOP1Inst <"v_frexp_exp_i32_f32", VOP_I32_F32, int_amdgcn_frexp_exp>;
3270b57cec5SDimitry Andricdefm V_FREXP_MANT_F32 : VOP1Inst <"v_frexp_mant_f32", VOP_F32_F32, int_amdgcn_frexp_mant>;
328fe6060f1SDimitry Andric} // End isReMaterializable = 1
3290b57cec5SDimitry Andric
3300b57cec5SDimitry Andriclet VOPAsmPrefer32Bit = 1 in {
3310b57cec5SDimitry Andricdefm V_CLREXCP : VOP1Inst <"v_clrexcp", VOP_NO_EXT<VOP_NONE>>;
3320b57cec5SDimitry Andric}
3330b57cec5SDimitry Andric
3340b57cec5SDimitry Andric// Restrict src0 to be VGPR
335480093f4SDimitry Andricdef VOP_MOVRELS : VOPProfile<[i32, i32, untyped, untyped]> {
3360b57cec5SDimitry Andric  let Src0RC32 = VRegSrc_32;
3370b57cec5SDimitry Andric  let Src0RC64 = VRegSrc_32;
3380b57cec5SDimitry Andric}
3390b57cec5SDimitry Andric
3400b57cec5SDimitry Andric// Special case because there are no true output operands.  Hack vdst
3410b57cec5SDimitry Andric// to be a src operand. The custom inserter must add a tied implicit
3420b57cec5SDimitry Andric// def and use of the super register since there seems to be no way to
3430b57cec5SDimitry Andric// add an implicit def of a virtual register in tablegen.
344480093f4SDimitry Andricclass VOP_MOVREL<RegisterOperand Src1RC> : VOPProfile<[untyped, i32, untyped, untyped]> {
3450b57cec5SDimitry Andric  let Src0RC32 = VOPDstOperand<VGPR_32>;
3460b57cec5SDimitry Andric  let Src0RC64 = VOPDstOperand<VGPR_32>;
3470b57cec5SDimitry Andric
3480b57cec5SDimitry Andric  let Outs = (outs);
349480093f4SDimitry Andric  let Ins32 = (ins Src0RC32:$vdst, Src1RC:$src0);
350480093f4SDimitry Andric  let Ins64 = (ins Src0RC64:$vdst, Src1RC:$src0);
3510b57cec5SDimitry Andric  let Asm32 = getAsm32<1, 1>.ret;
3520b57cec5SDimitry Andric  let Asm64 = getAsm64<1, 1, 0, 0, 1>.ret;
353480093f4SDimitry Andric
354480093f4SDimitry Andric  let OutsSDWA = (outs Src0RC32:$vdst);
355480093f4SDimitry Andric  let InsSDWA = (ins Src0ModSDWA:$src0_modifiers, Src0SDWA:$src0,
356480093f4SDimitry Andric                     clampmod:$clamp, dst_sel:$dst_sel, dst_unused:$dst_unused,
357480093f4SDimitry Andric                     src0_sel:$src0_sel);
3580b57cec5SDimitry Andric  let AsmSDWA9 = getAsmSDWA9<1, 0, 1>.ret;
3590b57cec5SDimitry Andric
360480093f4SDimitry Andric  let OutsDPP = (outs Src0RC32:$vdst);
361480093f4SDimitry Andric  let InsDPP16 = (ins Src0RC32:$old, Src0RC32:$src0,
362480093f4SDimitry Andric                      dpp_ctrl:$dpp_ctrl, row_mask:$row_mask,
363480093f4SDimitry Andric                      bank_mask:$bank_mask, bound_ctrl:$bound_ctrl, FI:$fi);
364480093f4SDimitry Andric  let AsmDPP16 = getAsmDPP16<1, 1, 0>.ret;
365480093f4SDimitry Andric
366480093f4SDimitry Andric  let OutsDPP8 = (outs Src0RC32:$vdst);
367480093f4SDimitry Andric  let InsDPP8 = (ins Src0RC32:$old, Src0RC32:$src0, dpp8:$dpp8, FI:$fi);
368480093f4SDimitry Andric  let AsmDPP8 = getAsmDPP8<1, 1, 0>.ret;
3690b57cec5SDimitry Andric
3700b57cec5SDimitry Andric  let HasDst = 0;
3710b57cec5SDimitry Andric  let EmitDst = 1; // force vdst emission
3720b57cec5SDimitry Andric}
3730b57cec5SDimitry Andric
374480093f4SDimitry Andricdef VOP_MOVRELD : VOP_MOVREL<VSrc_b32>;
375480093f4SDimitry Andricdef VOP_MOVRELSD : VOP_MOVREL<VRegSrc_32>;
376480093f4SDimitry Andric
3770b57cec5SDimitry Andriclet SubtargetPredicate = HasMovrel, Uses = [M0, EXEC] in {
3780b57cec5SDimitry Andric // v_movreld_b32 is a special case because the destination output
3790b57cec5SDimitry Andric // register is really a source. It isn't actually read (but may be
3800b57cec5SDimitry Andric // written), and is only to provide the base register to start
3810b57cec5SDimitry Andric // indexing from. Tablegen seems to not let you define an implicit
3820b57cec5SDimitry Andric // virtual register output for the super register being written into,
3830b57cec5SDimitry Andric // so this must have an implicit def of the register added to it.
3840b57cec5SDimitry Andricdefm V_MOVRELD_B32 : VOP1Inst <"v_movreld_b32", VOP_MOVRELD>;
385480093f4SDimitry Andricdefm V_MOVRELS_B32 : VOP1Inst <"v_movrels_b32", VOP_MOVRELS>;
386480093f4SDimitry Andricdefm V_MOVRELSD_B32 : VOP1Inst <"v_movrelsd_b32", VOP_MOVRELSD>;
3870b57cec5SDimitry Andric} // End Uses = [M0, EXEC]
3880b57cec5SDimitry Andric
389fe6060f1SDimitry Andriclet isReMaterializable = 1 in {
3900b57cec5SDimitry Andriclet SubtargetPredicate = isGFX6GFX7 in {
391e8d8bef9SDimitry Andric  let TRANS = 1, SchedRW = [WriteTrans32] in {
3920b57cec5SDimitry Andric    defm V_LOG_CLAMP_F32 :
3930b57cec5SDimitry Andric      VOP1Inst<"v_log_clamp_f32", VOP_F32_F32, int_amdgcn_log_clamp>;
3940b57cec5SDimitry Andric    defm V_RCP_CLAMP_F32 :
3950b57cec5SDimitry Andric      VOP1Inst<"v_rcp_clamp_f32", VOP_F32_F32>;
3960b57cec5SDimitry Andric    defm V_RCP_LEGACY_F32 :
3970b57cec5SDimitry Andric      VOP1Inst<"v_rcp_legacy_f32", VOP_F32_F32, AMDGPUrcp_legacy>;
3980b57cec5SDimitry Andric    defm V_RSQ_CLAMP_F32 :
3990b57cec5SDimitry Andric      VOP1Inst<"v_rsq_clamp_f32", VOP_F32_F32, AMDGPUrsq_clamp>;
4000b57cec5SDimitry Andric    defm V_RSQ_LEGACY_F32 :
4015ffd83dbSDimitry Andric      VOP1Inst<"v_rsq_legacy_f32", VOP_F32_F32, int_amdgcn_rsq_legacy>;
402e8d8bef9SDimitry Andric  } // End TRANS = 1, SchedRW = [WriteTrans32]
4030b57cec5SDimitry Andric
404fe6060f1SDimitry Andric  let SchedRW = [WriteTrans64] in {
4050b57cec5SDimitry Andric    defm V_RCP_CLAMP_F64 :
4060b57cec5SDimitry Andric      VOP1Inst<"v_rcp_clamp_f64", VOP_F64_F64>;
4070b57cec5SDimitry Andric    defm V_RSQ_CLAMP_F64 :
4080b57cec5SDimitry Andric      VOP1Inst<"v_rsq_clamp_f64", VOP_F64_F64, AMDGPUrsq_clamp>;
409fe6060f1SDimitry Andric  } // End SchedRW = [WriteTrans64]
4100b57cec5SDimitry Andric} // End SubtargetPredicate = isGFX6GFX7
4110b57cec5SDimitry Andric
4120b57cec5SDimitry Andriclet SubtargetPredicate = isGFX7GFX8GFX9 in {
413e8d8bef9SDimitry Andric  let TRANS = 1, SchedRW = [WriteTrans32] in {
4140b57cec5SDimitry Andric    defm V_LOG_LEGACY_F32 : VOP1Inst<"v_log_legacy_f32", VOP_F32_F32>;
4150b57cec5SDimitry Andric    defm V_EXP_LEGACY_F32 : VOP1Inst<"v_exp_legacy_f32", VOP_F32_F32>;
416e8d8bef9SDimitry Andric  } // End TRANS = 1, SchedRW = [WriteTrans32]
4170b57cec5SDimitry Andric} // End SubtargetPredicate = isGFX7GFX8GFX9
4180b57cec5SDimitry Andric
4190b57cec5SDimitry Andriclet SubtargetPredicate = isGFX7Plus in {
4200b57cec5SDimitry Andric  let SchedRW = [WriteDoubleAdd] in {
4210b57cec5SDimitry Andric    defm V_TRUNC_F64 : VOP1Inst<"v_trunc_f64", VOP_F64_F64, ftrunc>;
4220b57cec5SDimitry Andric    defm V_CEIL_F64  : VOP1Inst<"v_ceil_f64", VOP_F64_F64, fceil>;
4230b57cec5SDimitry Andric    defm V_RNDNE_F64 : VOP1Inst<"v_rndne_f64", VOP_F64_F64, frint>;
4240b57cec5SDimitry Andric    defm V_FLOOR_F64 : VOP1Inst<"v_floor_f64", VOP_F64_F64, ffloor>;
4250b57cec5SDimitry Andric  } // End SchedRW = [WriteDoubleAdd]
4260b57cec5SDimitry Andric} // End SubtargetPredicate = isGFX7Plus
427fe6060f1SDimitry Andric} // End isReMaterializable = 1
4280b57cec5SDimitry Andric
4290b57cec5SDimitry Andriclet SubtargetPredicate = Has16BitInsts in {
4300b57cec5SDimitry Andric
4310b57cec5SDimitry Andriclet FPDPRounding = 1 in {
4320b57cec5SDimitry Andricdefm V_CVT_F16_U16 : VOP1Inst <"v_cvt_f16_u16", VOP1_F16_I16, uint_to_fp>;
4330b57cec5SDimitry Andricdefm V_CVT_F16_I16 : VOP1Inst <"v_cvt_f16_i16", VOP1_F16_I16, sint_to_fp>;
4340b57cec5SDimitry Andric} // End FPDPRounding = 1
435fe6060f1SDimitry Andric// OMod clears exceptions when set in these two instructions
436fe6060f1SDimitry Andricdefm V_CVT_U16_F16 : VOP1Inst <"v_cvt_u16_f16", VOP_I16_F16_SPECIAL_OMOD, fp_to_uint>;
437fe6060f1SDimitry Andricdefm V_CVT_I16_F16 : VOP1Inst <"v_cvt_i16_f16", VOP_I16_F16_SPECIAL_OMOD, fp_to_sint>;
438e8d8bef9SDimitry Andriclet TRANS = 1, SchedRW = [WriteTrans32] in {
4390b57cec5SDimitry Andricdefm V_RCP_F16 : VOP1Inst <"v_rcp_f16", VOP_F16_F16, AMDGPUrcp>;
4405ffd83dbSDimitry Andricdefm V_SQRT_F16 : VOP1Inst <"v_sqrt_f16", VOP_F16_F16, any_amdgcn_sqrt>;
4410b57cec5SDimitry Andricdefm V_RSQ_F16 : VOP1Inst <"v_rsq_f16", VOP_F16_F16, AMDGPUrsq>;
4420b57cec5SDimitry Andricdefm V_LOG_F16 : VOP1Inst <"v_log_f16", VOP_F16_F16, flog2>;
4430b57cec5SDimitry Andricdefm V_EXP_F16 : VOP1Inst <"v_exp_f16", VOP_F16_F16, fexp2>;
4440b57cec5SDimitry Andricdefm V_SIN_F16 : VOP1Inst <"v_sin_f16", VOP_F16_F16, AMDGPUsin>;
4450b57cec5SDimitry Andricdefm V_COS_F16 : VOP1Inst <"v_cos_f16", VOP_F16_F16, AMDGPUcos>;
446e8d8bef9SDimitry Andric} // End TRANS = 1, SchedRW = [WriteTrans32]
4470b57cec5SDimitry Andricdefm V_FREXP_MANT_F16 : VOP1Inst <"v_frexp_mant_f16", VOP_F16_F16, int_amdgcn_frexp_mant>;
448fe6060f1SDimitry Andricdefm V_FREXP_EXP_I16_F16 : VOP1Inst <"v_frexp_exp_i16_f16", VOP_I16_F16_SPECIAL_OMOD, int_amdgcn_frexp_exp>;
4490b57cec5SDimitry Andricdefm V_FLOOR_F16 : VOP1Inst <"v_floor_f16", VOP_F16_F16, ffloor>;
4500b57cec5SDimitry Andricdefm V_CEIL_F16 : VOP1Inst <"v_ceil_f16", VOP_F16_F16, fceil>;
4510b57cec5SDimitry Andricdefm V_TRUNC_F16 : VOP1Inst <"v_trunc_f16", VOP_F16_F16, ftrunc>;
4520b57cec5SDimitry Andricdefm V_RNDNE_F16 : VOP1Inst <"v_rndne_f16", VOP_F16_F16, frint>;
4530b57cec5SDimitry Andriclet FPDPRounding = 1 in {
4540b57cec5SDimitry Andricdefm V_FRACT_F16 : VOP1Inst <"v_fract_f16", VOP_F16_F16, AMDGPUfract>;
4550b57cec5SDimitry Andric} // End FPDPRounding = 1
4560b57cec5SDimitry Andric
4570b57cec5SDimitry Andric}
4580b57cec5SDimitry Andric
4590b57cec5SDimitry Andriclet OtherPredicates = [Has16BitInsts] in {
4600b57cec5SDimitry Andric
4610b57cec5SDimitry Andricdef : GCNPat<
4620b57cec5SDimitry Andric    (f32 (f16_to_fp i16:$src)),
4630b57cec5SDimitry Andric    (V_CVT_F32_F16_e32 $src)
4640b57cec5SDimitry Andric>;
4650b57cec5SDimitry Andric
4660b57cec5SDimitry Andricdef : GCNPat<
4670b57cec5SDimitry Andric    (i16 (AMDGPUfp_to_f16 f32:$src)),
4680b57cec5SDimitry Andric    (V_CVT_F16_F32_e32 $src)
4690b57cec5SDimitry Andric>;
4700b57cec5SDimitry Andric
4710b57cec5SDimitry Andric}
4720b57cec5SDimitry Andric
4730b57cec5SDimitry Andricdef VOP_SWAP_I32 : VOPProfile<[i32, i32, i32, untyped]> {
4740b57cec5SDimitry Andric  let Outs32 = (outs VGPR_32:$vdst, VGPR_32:$vdst1);
4750b57cec5SDimitry Andric  let Ins32 = (ins VGPR_32:$src0, VGPR_32:$src1);
4760b57cec5SDimitry Andric  let Outs64 = Outs32;
4770b57cec5SDimitry Andric  let Asm32 = " $vdst, $src0";
4780b57cec5SDimitry Andric  let Asm64 = "";
4790b57cec5SDimitry Andric  let Ins64 = (ins);
4800b57cec5SDimitry Andric}
4810b57cec5SDimitry Andric
4820b57cec5SDimitry Andriclet SubtargetPredicate = isGFX9Plus in {
4830b57cec5SDimitry Andric  def V_SWAP_B32 : VOP1_Pseudo<"v_swap_b32", VOP_SWAP_I32, [], 1> {
4840b57cec5SDimitry Andric    let Constraints = "$vdst = $src1, $vdst1 = $src0";
4850b57cec5SDimitry Andric    let DisableEncoding = "$vdst1,$src1";
4860b57cec5SDimitry Andric    let SchedRW = [Write64Bit, Write64Bit];
4870b57cec5SDimitry Andric  }
4880b57cec5SDimitry Andric
489fe6060f1SDimitry Andric  let isReMaterializable = 1 in
4900b57cec5SDimitry Andric  defm V_SAT_PK_U8_I16    : VOP1Inst<"v_sat_pk_u8_i16", VOP_I32_I32>;
4915ffd83dbSDimitry Andric
4925ffd83dbSDimitry Andric  let mayRaiseFPException = 0 in {
493fe6060f1SDimitry Andric    defm V_CVT_NORM_I16_F16 : VOP1Inst<"v_cvt_norm_i16_f16", VOP_I16_F16_SPECIAL_OMOD>;
494fe6060f1SDimitry Andric    defm V_CVT_NORM_U16_F16 : VOP1Inst<"v_cvt_norm_u16_f16", VOP_I16_F16_SPECIAL_OMOD>;
4955ffd83dbSDimitry Andric  } // End mayRaiseFPException = 0
4960b57cec5SDimitry Andric} // End SubtargetPredicate = isGFX9Plus
4970b57cec5SDimitry Andric
4980b57cec5SDimitry Andriclet SubtargetPredicate = isGFX9Only in {
4990b57cec5SDimitry Andric  defm V_SCREEN_PARTITION_4SE_B32 : VOP1Inst <"v_screen_partition_4se_b32", VOP_I32_I32>;
5000b57cec5SDimitry Andric} // End SubtargetPredicate = isGFX9Only
5010b57cec5SDimitry Andric
5020b57cec5SDimitry Andriclet SubtargetPredicate = isGFX10Plus in {
503*81ad6265SDimitry Andric  defm V_PIPEFLUSH        : VOP1Inst<"v_pipeflush", VOP_NO_EXT<VOP_NONE>>;
5040b57cec5SDimitry Andric
5050b57cec5SDimitry Andric  let Uses = [M0] in {
5060b57cec5SDimitry Andric    defm V_MOVRELSD_2_B32 :
507480093f4SDimitry Andric      VOP1Inst<"v_movrelsd_2_b32", VOP_MOVRELSD>;
5080b57cec5SDimitry Andric
5090b57cec5SDimitry Andric    def V_SWAPREL_B32 : VOP1_Pseudo<"v_swaprel_b32", VOP_SWAP_I32, [], 1> {
5100b57cec5SDimitry Andric      let Constraints = "$vdst = $src1, $vdst1 = $src0";
5110b57cec5SDimitry Andric      let DisableEncoding = "$vdst1,$src1";
5120b57cec5SDimitry Andric      let SchedRW = [Write64Bit, Write64Bit];
5130b57cec5SDimitry Andric    }
5140b57cec5SDimitry Andric  } // End Uses = [M0]
5150b57cec5SDimitry Andric} // End SubtargetPredicate = isGFX10Plus
5160b57cec5SDimitry Andric
517fe6060f1SDimitry Andricdef VOPProfileAccMov : VOP_NO_EXT<VOP_I32_I32> {
518fe6060f1SDimitry Andric  let DstRC = RegisterOperand<AGPR_32>;
519fe6060f1SDimitry Andric  let Src0RC32 = RegisterOperand<AGPR_32>;
520fe6060f1SDimitry Andric  let Asm32 = " $vdst, $src0";
521fe6060f1SDimitry Andric}
522fe6060f1SDimitry Andric
523fe6060f1SDimitry Andricdef V_ACCVGPR_MOV_B32 : VOP1_Pseudo<"v_accvgpr_mov_b32", VOPProfileAccMov, [], 1> {
524fe6060f1SDimitry Andric  let SubtargetPredicate = isGFX90APlus;
525fe6060f1SDimitry Andric  let isReMaterializable = 1;
526fe6060f1SDimitry Andric  let isAsCheapAsAMove = 1;
527fe6060f1SDimitry Andric}
528fe6060f1SDimitry Andric
529*81ad6265SDimitry Andriclet SubtargetPredicate = isGFX11Plus in {
530*81ad6265SDimitry Andric  // Restrict src0 to be VGPR
531*81ad6265SDimitry Andric  def V_PERMLANE64_B32 : VOP1_Pseudo<"v_permlane64_b32", VOP_MOVRELS,
532*81ad6265SDimitry Andric                                      getVOP1Pat64<int_amdgcn_permlane64,
533*81ad6265SDimitry Andric                                                   VOP_MOVRELS>.ret,
534*81ad6265SDimitry Andric                                      /*VOP1Only=*/ 1>;
535*81ad6265SDimitry Andric  defm V_NOT_B16        : VOP1Inst<"v_not_b16", VOP_I16_I16>;
536*81ad6265SDimitry Andric  defm V_CVT_I32_I16    : VOP1Inst<"v_cvt_i32_i16", VOP_I32_I16>;
537*81ad6265SDimitry Andric  defm V_CVT_U32_U16    : VOP1Inst<"v_cvt_u32_u16", VOP_I16_I16>;
538*81ad6265SDimitry Andric} // End SubtargetPredicate = isGFX11Plus
539*81ad6265SDimitry Andric
5400b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
5410b57cec5SDimitry Andric// Target-specific instruction encodings.
5420b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
5430b57cec5SDimitry Andric
5448bcb0991SDimitry Andricclass VOP1_DPP<bits<8> op, VOP1_DPP_Pseudo ps, VOPProfile p = ps.Pfl, bit isDPP16 = 0> :
5450b57cec5SDimitry Andric    VOP_DPP<ps.OpName, p, isDPP16> {
5460b57cec5SDimitry Andric  let hasSideEffects = ps.hasSideEffects;
5470b57cec5SDimitry Andric  let Defs = ps.Defs;
5480b57cec5SDimitry Andric  let SchedRW = ps.SchedRW;
5490b57cec5SDimitry Andric  let Uses = ps.Uses;
550fe6060f1SDimitry Andric  let TRANS = ps.TRANS;
5510b57cec5SDimitry Andric
5520b57cec5SDimitry Andric  bits<8> vdst;
5530b57cec5SDimitry Andric  let Inst{8-0}   = 0xfa;
5540b57cec5SDimitry Andric  let Inst{16-9}  = op;
5550b57cec5SDimitry Andric  let Inst{24-17} = !if(p.EmitDst, vdst{7-0}, 0);
5560b57cec5SDimitry Andric  let Inst{31-25} = 0x3f;
5570b57cec5SDimitry Andric}
5580b57cec5SDimitry Andric
559*81ad6265SDimitry Andricclass VOP1_DPP16<bits<8> op, VOP1_DPP_Pseudo ps, int subtarget, VOPProfile p = ps.Pfl> :
5608bcb0991SDimitry Andric    VOP1_DPP<op, ps, p, 1>,
561*81ad6265SDimitry Andric    SIMCInstr <ps.PseudoInstr, subtarget> {
5625ffd83dbSDimitry Andric  let AssemblerPredicate = HasDPP16;
5630b57cec5SDimitry Andric  let SubtargetPredicate = HasDPP16;
5640b57cec5SDimitry Andric}
5650b57cec5SDimitry Andric
5660b57cec5SDimitry Andricclass VOP1_DPP8<bits<8> op, VOP1_Pseudo ps, VOPProfile p = ps.Pfl> :
5670b57cec5SDimitry Andric    VOP_DPP8<ps.OpName, p> {
5680b57cec5SDimitry Andric  let hasSideEffects = ps.hasSideEffects;
5690b57cec5SDimitry Andric  let Defs = ps.Defs;
5700b57cec5SDimitry Andric  let SchedRW = ps.SchedRW;
5710b57cec5SDimitry Andric  let Uses = ps.Uses;
5720b57cec5SDimitry Andric
5730b57cec5SDimitry Andric  bits<8> vdst;
5740b57cec5SDimitry Andric  let Inst{8-0}   = fi;
5750b57cec5SDimitry Andric  let Inst{16-9}  = op;
5760b57cec5SDimitry Andric  let Inst{24-17} = !if(p.EmitDst, vdst{7-0}, 0);
5770b57cec5SDimitry Andric  let Inst{31-25} = 0x3f;
5780b57cec5SDimitry Andric}
5790b57cec5SDimitry Andric
5800b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
581*81ad6265SDimitry Andric// GFX11.
582*81ad6265SDimitry Andric//===----------------------------------------------------------------------===//
583*81ad6265SDimitry Andric
584*81ad6265SDimitry Andriclet AssemblerPredicate = isGFX11Only, DecoderNamespace = "GFX11" in {
585*81ad6265SDimitry Andric  multiclass VOP1Only_Real_gfx11<bits<9> op> {
586*81ad6265SDimitry Andric    let IsSingle = 1 in
587*81ad6265SDimitry Andric      def _gfx11 :
588*81ad6265SDimitry Andric        VOP1_Real<!cast<VOP1_Pseudo>(NAME), SIEncodingFamily.GFX11>,
589*81ad6265SDimitry Andric        VOP1e<op{7-0}, !cast<VOP1_Pseudo>(NAME).Pfl>;
590*81ad6265SDimitry Andric  }
591*81ad6265SDimitry Andric  multiclass VOP1_Real_e32_gfx11<bits<9> op, string opName = NAME> {
592*81ad6265SDimitry Andric    defvar ps = !cast<VOP1_Pseudo>(opName#"_e32");
593*81ad6265SDimitry Andric    def _e32_gfx11 :
594*81ad6265SDimitry Andric      VOP1_Real<ps, SIEncodingFamily.GFX11>,
595*81ad6265SDimitry Andric      VOP1e<op{7-0}, ps.Pfl>;
596*81ad6265SDimitry Andric  }
597*81ad6265SDimitry Andric  multiclass VOP1_Real_e32_with_name_gfx11<bits<9> op, string opName,
598*81ad6265SDimitry Andric                                       string asmName> {
599*81ad6265SDimitry Andric    defvar ps = !cast<VOP1_Pseudo>(opName#"_e32");
600*81ad6265SDimitry Andric    let AsmString = asmName # ps.AsmOperands in {
601*81ad6265SDimitry Andric      defm NAME : VOP1_Real_e32_gfx11<op, opName>,
602*81ad6265SDimitry Andric         MnemonicAlias<ps.Mnemonic, asmName>, Requires<[isGFX11Plus]>;
603*81ad6265SDimitry Andric    }
604*81ad6265SDimitry Andric  }
605*81ad6265SDimitry Andric  multiclass VOP1_Real_e64_gfx11<bits<9> op> {
606*81ad6265SDimitry Andric    def _e64_gfx11 :
607*81ad6265SDimitry Andric      VOP3_Real<!cast<VOP3_Pseudo>(NAME#"_e64"), SIEncodingFamily.GFX11>,
608*81ad6265SDimitry Andric      VOP3e_gfx11<{0, 1, 1, op{6-0}}, !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>;
609*81ad6265SDimitry Andric  }
610*81ad6265SDimitry Andric  multiclass VOP1_Real_dpp_gfx11<bits<9> op, string opName = NAME> {
611*81ad6265SDimitry Andric    defvar ps = !cast<VOP1_Pseudo>(opName#"_e32");
612*81ad6265SDimitry Andric    def _dpp_gfx11 : VOP1_DPP16<op{7-0}, !cast<VOP1_DPP_Pseudo>(opName#"_dpp"), SIEncodingFamily.GFX11> {
613*81ad6265SDimitry Andric      let DecoderNamespace = "DPPGFX11";
614*81ad6265SDimitry Andric    }
615*81ad6265SDimitry Andric  }
616*81ad6265SDimitry Andric  multiclass VOP1_Real_dpp_with_name_gfx11<bits<9> op, string opName,
617*81ad6265SDimitry Andric                                           string asmName> {
618*81ad6265SDimitry Andric    defvar ps = !cast<VOP1_Pseudo>(opName#"_e32");
619*81ad6265SDimitry Andric    let AsmString = asmName # ps.Pfl.AsmDPP16, DecoderNamespace = "DPPGFX11" in {
620*81ad6265SDimitry Andric      defm NAME : VOP1_Real_dpp_gfx11<op, opName>,
621*81ad6265SDimitry Andric         MnemonicAlias<ps.Mnemonic, asmName>, Requires<[isGFX11Plus]>;
622*81ad6265SDimitry Andric    }
623*81ad6265SDimitry Andric  }
624*81ad6265SDimitry Andric  multiclass VOP1_Real_dpp8_gfx11<bits<9> op, string opName = NAME> {
625*81ad6265SDimitry Andric    defvar ps = !cast<VOP1_Pseudo>(opName#"_e32");
626*81ad6265SDimitry Andric    def _dpp8_gfx11 : VOP1_DPP8<op{7-0}, ps> {
627*81ad6265SDimitry Andric      let DecoderNamespace = "DPP8GFX11";
628*81ad6265SDimitry Andric    }
629*81ad6265SDimitry Andric  }
630*81ad6265SDimitry Andric  multiclass VOP1_Real_dpp8_with_name_gfx11<bits<9> op, string opName,
631*81ad6265SDimitry Andric                                           string asmName> {
632*81ad6265SDimitry Andric    defvar ps = !cast<VOP1_Pseudo>(opName#"_e32");
633*81ad6265SDimitry Andric    let AsmString = asmName # ps.Pfl.AsmDPP8, DecoderNamespace = "DPP8GFX11" in {
634*81ad6265SDimitry Andric      defm NAME : VOP1_Real_dpp8_gfx11<op, opName>,
635*81ad6265SDimitry Andric         MnemonicAlias<ps.Mnemonic, asmName>, Requires<[isGFX11Plus]>;
636*81ad6265SDimitry Andric    }
637*81ad6265SDimitry Andric  }
638*81ad6265SDimitry Andric} // End AssemblerPredicate = isGFX11Only, DecoderNamespace = "GFX11"
639*81ad6265SDimitry Andric
640*81ad6265SDimitry Andricmulticlass VOP1_Realtriple_e64_gfx11<bits<9> op> {
641*81ad6265SDimitry Andric  defm NAME : VOP3_Realtriple_gfx11<{0, 1, 1, op{6-0}}, /*isSingle=*/ 0, NAME>;
642*81ad6265SDimitry Andric}
643*81ad6265SDimitry Andricmulticlass VOP1_Realtriple_e64_with_name_gfx11<bits<9> op, string opName,
644*81ad6265SDimitry Andric  string asmName> {
645*81ad6265SDimitry Andric  defm NAME : VOP3_Realtriple_with_name_gfx11<{0, 1, 1, op{6-0}}, opName,
646*81ad6265SDimitry Andric    asmName>;
647*81ad6265SDimitry Andric}
648*81ad6265SDimitry Andric
649*81ad6265SDimitry Andricmulticlass VOP1_Real_FULL_gfx11<bits<9> op> :
650*81ad6265SDimitry Andric  VOP1_Real_e32_gfx11<op>, VOP1_Realtriple_e64_gfx11<op>,
651*81ad6265SDimitry Andric  VOP1_Real_dpp_gfx11<op>, VOP1_Real_dpp8_gfx11<op>;
652*81ad6265SDimitry Andric
653*81ad6265SDimitry Andricmulticlass VOP1_Real_NO_VOP3_with_name_gfx11<bits<9> op, string opName,
654*81ad6265SDimitry Andric                                           string asmName> :
655*81ad6265SDimitry Andric  VOP1_Real_e32_with_name_gfx11<op, opName, asmName>,
656*81ad6265SDimitry Andric  VOP1_Real_dpp_with_name_gfx11<op, opName, asmName>,
657*81ad6265SDimitry Andric  VOP1_Real_dpp8_with_name_gfx11<op, opName, asmName>;
658*81ad6265SDimitry Andric
659*81ad6265SDimitry Andricmulticlass VOP1_Real_FULL_with_name_gfx11<bits<9> op, string opName,
660*81ad6265SDimitry Andric                                         string asmName> :
661*81ad6265SDimitry Andric  VOP1_Real_NO_VOP3_with_name_gfx11<op, opName, asmName>,
662*81ad6265SDimitry Andric  VOP1_Realtriple_e64_with_name_gfx11<op, opName, asmName>;
663*81ad6265SDimitry Andric
664*81ad6265SDimitry Andricmulticlass VOP1_Real_NO_DPP_gfx11<bits<9> op> :
665*81ad6265SDimitry Andric  VOP1_Real_e32_gfx11<op>, VOP1_Real_e64_gfx11<op>;
666*81ad6265SDimitry Andric
667*81ad6265SDimitry Andricdefm V_CVT_NEAREST_I32_F32 : VOP1_Real_FULL_with_name_gfx11<0x00c,
668*81ad6265SDimitry Andric  "V_CVT_RPI_I32_F32", "v_cvt_nearest_i32_f32">;
669*81ad6265SDimitry Andricdefm V_CVT_FLOOR_I32_F32   : VOP1_Real_FULL_with_name_gfx11<0x00d,
670*81ad6265SDimitry Andric  "V_CVT_FLR_I32_F32", "v_cvt_floor_i32_f32">;
671*81ad6265SDimitry Andricdefm V_CLZ_I32_U32         : VOP1_Real_FULL_with_name_gfx11<0x039,
672*81ad6265SDimitry Andric  "V_FFBH_U32", "v_clz_i32_u32">;
673*81ad6265SDimitry Andricdefm V_CTZ_I32_B32         : VOP1_Real_FULL_with_name_gfx11<0x03a,
674*81ad6265SDimitry Andric  "V_FFBL_B32", "v_ctz_i32_b32">;
675*81ad6265SDimitry Andricdefm V_CLS_I32             : VOP1_Real_FULL_with_name_gfx11<0x03b,
676*81ad6265SDimitry Andric  "V_FFBH_I32", "v_cls_i32">;
677*81ad6265SDimitry Andricdefm V_PERMLANE64_B32      : VOP1Only_Real_gfx11<0x067>;
678*81ad6265SDimitry Andricdefm V_NOT_B16             : VOP1_Real_FULL_gfx11<0x069>;
679*81ad6265SDimitry Andricdefm V_CVT_I32_I16         : VOP1_Real_FULL_gfx11<0x06a>;
680*81ad6265SDimitry Andricdefm V_CVT_U32_U16         : VOP1_Real_FULL_gfx11<0x06b>;
681*81ad6265SDimitry Andric
682*81ad6265SDimitry Andric//===----------------------------------------------------------------------===//
6830b57cec5SDimitry Andric// GFX10.
6840b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
6850b57cec5SDimitry Andric
686*81ad6265SDimitry Andriclet AssemblerPredicate = isGFX10Only, DecoderNamespace = "GFX10" in {
6870b57cec5SDimitry Andric  multiclass VOP1Only_Real_gfx10<bits<9> op> {
6880b57cec5SDimitry Andric    def _gfx10 :
6890b57cec5SDimitry Andric      VOP1_Real<!cast<VOP1_Pseudo>(NAME), SIEncodingFamily.GFX10>,
6900b57cec5SDimitry Andric      VOP1e<op{7-0}, !cast<VOP1_Pseudo>(NAME).Pfl>;
6910b57cec5SDimitry Andric  }
6920b57cec5SDimitry Andric  multiclass VOP1_Real_e32_gfx10<bits<9> op> {
6930b57cec5SDimitry Andric    def _e32_gfx10 :
6940b57cec5SDimitry Andric      VOP1_Real<!cast<VOP1_Pseudo>(NAME#"_e32"), SIEncodingFamily.GFX10>,
6950b57cec5SDimitry Andric      VOP1e<op{7-0}, !cast<VOP1_Pseudo>(NAME#"_e32").Pfl>;
6960b57cec5SDimitry Andric  }
6970b57cec5SDimitry Andric  multiclass VOP1_Real_e64_gfx10<bits<9> op> {
6980b57cec5SDimitry Andric    def _e64_gfx10 :
6990b57cec5SDimitry Andric      VOP3_Real<!cast<VOP3_Pseudo>(NAME#"_e64"), SIEncodingFamily.GFX10>,
7000b57cec5SDimitry Andric      VOP3e_gfx10<{0, 1, 1, op{6-0}}, !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>;
7010b57cec5SDimitry Andric  }
7020b57cec5SDimitry Andric  multiclass VOP1_Real_sdwa_gfx10<bits<9> op> {
7038bcb0991SDimitry Andric    foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA9>.ret in
7040b57cec5SDimitry Andric    def _sdwa_gfx10 :
7050b57cec5SDimitry Andric      VOP_SDWA10_Real<!cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa")>,
7060b57cec5SDimitry Andric      VOP1_SDWA9Ae<op{7-0}, !cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa").Pfl> {
7070b57cec5SDimitry Andric      let DecoderNamespace = "SDWA10";
7080b57cec5SDimitry Andric    }
7090b57cec5SDimitry Andric  }
7100b57cec5SDimitry Andric  multiclass VOP1_Real_dpp_gfx10<bits<9> op> {
711*81ad6265SDimitry Andric    foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExt32BitDPP>.ret in
712*81ad6265SDimitry Andric    def _dpp_gfx10 : VOP1_DPP16<op{7-0}, !cast<VOP1_DPP_Pseudo>(NAME#"_dpp"), SIEncodingFamily.GFX10> {
7130b57cec5SDimitry Andric      let DecoderNamespace = "SDWA10";
7140b57cec5SDimitry Andric    }
7150b57cec5SDimitry Andric  }
7160b57cec5SDimitry Andric  multiclass VOP1_Real_dpp8_gfx10<bits<9> op> {
717*81ad6265SDimitry Andric    foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExt32BitDPP>.ret in
7180b57cec5SDimitry Andric    def _dpp8_gfx10 : VOP1_DPP8<op{7-0}, !cast<VOP1_Pseudo>(NAME#"_e32")> {
7190b57cec5SDimitry Andric      let DecoderNamespace = "DPP8";
7200b57cec5SDimitry Andric    }
7210b57cec5SDimitry Andric  }
722*81ad6265SDimitry Andric} // End AssemblerPredicate = isGFX10Only, DecoderNamespace = "GFX10"
7230b57cec5SDimitry Andric
7240b57cec5SDimitry Andricmulticlass VOP1_Real_gfx10<bits<9> op> :
725480093f4SDimitry Andric  VOP1_Real_e32_gfx10<op>, VOP1_Real_e64_gfx10<op>,
726480093f4SDimitry Andric  VOP1_Real_sdwa_gfx10<op>, VOP1_Real_dpp_gfx10<op>,
727480093f4SDimitry Andric  VOP1_Real_dpp8_gfx10<op>;
7280b57cec5SDimitry Andric
729*81ad6265SDimitry Andricmulticlass VOP1_Real_gfx10_FULL_gfx11<bits<9> op> :
730*81ad6265SDimitry Andric  VOP1_Real_gfx10<op>, VOP1_Real_FULL_gfx11<op>;
7310b57cec5SDimitry Andric
732*81ad6265SDimitry Andricmulticlass VOP1_Real_gfx10_NO_DPP_gfx11<bits<9> op> :
733*81ad6265SDimitry Andric  VOP1_Real_gfx10<op>, VOP1_Real_NO_DPP_gfx11<op>;
734*81ad6265SDimitry Andric
735*81ad6265SDimitry Andricmulticlass VOP1Only_Real_gfx10_gfx11<bits<9> op> :
736*81ad6265SDimitry Andric  VOP1Only_Real_gfx10<op>, VOP1Only_Real_gfx11<op>;
737*81ad6265SDimitry Andric
738*81ad6265SDimitry Andricdefm V_PIPEFLUSH         : VOP1_Real_gfx10_NO_DPP_gfx11<0x01b>;
739*81ad6265SDimitry Andricdefm V_MOVRELSD_2_B32    : VOP1_Real_gfx10_FULL_gfx11<0x048>;
740*81ad6265SDimitry Andricdefm V_CVT_F16_U16       : VOP1_Real_gfx10_FULL_gfx11<0x050>;
741*81ad6265SDimitry Andricdefm V_CVT_F16_I16       : VOP1_Real_gfx10_FULL_gfx11<0x051>;
742*81ad6265SDimitry Andricdefm V_CVT_U16_F16       : VOP1_Real_gfx10_FULL_gfx11<0x052>;
743*81ad6265SDimitry Andricdefm V_CVT_I16_F16       : VOP1_Real_gfx10_FULL_gfx11<0x053>;
744*81ad6265SDimitry Andricdefm V_RCP_F16           : VOP1_Real_gfx10_FULL_gfx11<0x054>;
745*81ad6265SDimitry Andricdefm V_SQRT_F16          : VOP1_Real_gfx10_FULL_gfx11<0x055>;
746*81ad6265SDimitry Andricdefm V_RSQ_F16           : VOP1_Real_gfx10_FULL_gfx11<0x056>;
747*81ad6265SDimitry Andricdefm V_LOG_F16           : VOP1_Real_gfx10_FULL_gfx11<0x057>;
748*81ad6265SDimitry Andricdefm V_EXP_F16           : VOP1_Real_gfx10_FULL_gfx11<0x058>;
749*81ad6265SDimitry Andricdefm V_FREXP_MANT_F16    : VOP1_Real_gfx10_FULL_gfx11<0x059>;
750*81ad6265SDimitry Andricdefm V_FREXP_EXP_I16_F16 : VOP1_Real_gfx10_FULL_gfx11<0x05a>;
751*81ad6265SDimitry Andricdefm V_FLOOR_F16         : VOP1_Real_gfx10_FULL_gfx11<0x05b>;
752*81ad6265SDimitry Andricdefm V_CEIL_F16          : VOP1_Real_gfx10_FULL_gfx11<0x05c>;
753*81ad6265SDimitry Andricdefm V_TRUNC_F16         : VOP1_Real_gfx10_FULL_gfx11<0x05d>;
754*81ad6265SDimitry Andricdefm V_RNDNE_F16         : VOP1_Real_gfx10_FULL_gfx11<0x05e>;
755*81ad6265SDimitry Andricdefm V_FRACT_F16         : VOP1_Real_gfx10_FULL_gfx11<0x05f>;
756*81ad6265SDimitry Andricdefm V_SIN_F16           : VOP1_Real_gfx10_FULL_gfx11<0x060>;
757*81ad6265SDimitry Andricdefm V_COS_F16           : VOP1_Real_gfx10_FULL_gfx11<0x061>;
758*81ad6265SDimitry Andricdefm V_SAT_PK_U8_I16     : VOP1_Real_gfx10_FULL_gfx11<0x062>;
759*81ad6265SDimitry Andricdefm V_CVT_NORM_I16_F16  : VOP1_Real_gfx10_FULL_gfx11<0x063>;
760*81ad6265SDimitry Andricdefm V_CVT_NORM_U16_F16  : VOP1_Real_gfx10_FULL_gfx11<0x064>;
761*81ad6265SDimitry Andric
762*81ad6265SDimitry Andricdefm V_SWAP_B32          : VOP1Only_Real_gfx10_gfx11<0x065>;
763*81ad6265SDimitry Andricdefm V_SWAPREL_B32       : VOP1Only_Real_gfx10_gfx11<0x068>;
7640b57cec5SDimitry Andric
7650b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
7660b57cec5SDimitry Andric// GFX7, GFX10.
7670b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
7680b57cec5SDimitry Andric
7690b57cec5SDimitry Andriclet AssemblerPredicate = isGFX7Only, DecoderNamespace = "GFX7" in {
7700b57cec5SDimitry Andric  multiclass VOP1_Real_e32_gfx7<bits<9> op> {
7710b57cec5SDimitry Andric    def _e32_gfx7 :
7720b57cec5SDimitry Andric      VOP1_Real<!cast<VOP1_Pseudo>(NAME#"_e32"), SIEncodingFamily.SI>,
7730b57cec5SDimitry Andric      VOP1e<op{7-0}, !cast<VOP1_Pseudo>(NAME#"_e32").Pfl>;
7740b57cec5SDimitry Andric  }
7750b57cec5SDimitry Andric  multiclass VOP1_Real_e64_gfx7<bits<9> op> {
7760b57cec5SDimitry Andric    def _e64_gfx7 :
7770b57cec5SDimitry Andric      VOP3_Real<!cast<VOP3_Pseudo>(NAME#"_e64"), SIEncodingFamily.SI>,
7780b57cec5SDimitry Andric      VOP3e_gfx6_gfx7<{1, 1, op{6-0}}, !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>;
7790b57cec5SDimitry Andric  }
7800b57cec5SDimitry Andric} // End AssemblerPredicate = isGFX7Only, DecoderNamespace = "GFX7"
7810b57cec5SDimitry Andric
7820b57cec5SDimitry Andricmulticlass VOP1_Real_gfx7<bits<9> op> :
7830b57cec5SDimitry Andric  VOP1_Real_e32_gfx7<op>, VOP1_Real_e64_gfx7<op>;
7840b57cec5SDimitry Andric
7850b57cec5SDimitry Andricmulticlass VOP1_Real_gfx7_gfx10<bits<9> op> :
7860b57cec5SDimitry Andric  VOP1_Real_gfx7<op>, VOP1_Real_gfx10<op>;
7870b57cec5SDimitry Andric
788*81ad6265SDimitry Andricmulticlass VOP1_Real_gfx7_gfx10_NO_DPP_gfx11<bits<9> op> :
789*81ad6265SDimitry Andric  VOP1_Real_gfx7_gfx10<op>, VOP1_Real_NO_DPP_gfx11<op>;
790*81ad6265SDimitry Andric
7910b57cec5SDimitry Andricdefm V_LOG_LEGACY_F32 : VOP1_Real_gfx7<0x045>;
7920b57cec5SDimitry Andricdefm V_EXP_LEGACY_F32 : VOP1_Real_gfx7<0x046>;
7930b57cec5SDimitry Andric
794*81ad6265SDimitry Andricdefm V_TRUNC_F64      : VOP1_Real_gfx7_gfx10_NO_DPP_gfx11<0x017>;
795*81ad6265SDimitry Andricdefm V_CEIL_F64       : VOP1_Real_gfx7_gfx10_NO_DPP_gfx11<0x018>;
796*81ad6265SDimitry Andricdefm V_RNDNE_F64      : VOP1_Real_gfx7_gfx10_NO_DPP_gfx11<0x019>;
797*81ad6265SDimitry Andricdefm V_FLOOR_F64      : VOP1_Real_gfx7_gfx10_NO_DPP_gfx11<0x01a>;
7980b57cec5SDimitry Andric
7990b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
800*81ad6265SDimitry Andric// GFX6, GFX7, GFX10, GFX11.
8010b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
8020b57cec5SDimitry Andric
8030b57cec5SDimitry Andriclet AssemblerPredicate = isGFX6GFX7, DecoderNamespace = "GFX6GFX7" in {
8040b57cec5SDimitry Andric  multiclass VOP1_Real_e32_gfx6_gfx7<bits<9> op> {
8050b57cec5SDimitry Andric    def _e32_gfx6_gfx7 :
8060b57cec5SDimitry Andric      VOP1_Real<!cast<VOP1_Pseudo>(NAME#"_e32"), SIEncodingFamily.SI>,
8070b57cec5SDimitry Andric      VOP1e<op{7-0}, !cast<VOP1_Pseudo>(NAME#"_e32").Pfl>;
8080b57cec5SDimitry Andric  }
8090b57cec5SDimitry Andric  multiclass VOP1_Real_e64_gfx6_gfx7<bits<9> op> {
8100b57cec5SDimitry Andric    def _e64_gfx6_gfx7 :
8110b57cec5SDimitry Andric      VOP3_Real<!cast<VOP3_Pseudo>(NAME#"_e64"), SIEncodingFamily.SI>,
8120b57cec5SDimitry Andric      VOP3e_gfx6_gfx7<{1, 1, op{6-0}}, !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>;
8130b57cec5SDimitry Andric  }
8140b57cec5SDimitry Andric} // End AssemblerPredicate = isGFX6GFX7, DecoderNamespace = "GFX6GFX7"
8150b57cec5SDimitry Andric
8160b57cec5SDimitry Andricmulticlass VOP1_Real_gfx6_gfx7<bits<9> op> :
8170b57cec5SDimitry Andric  VOP1_Real_e32_gfx6_gfx7<op>, VOP1_Real_e64_gfx6_gfx7<op>;
8180b57cec5SDimitry Andric
8190b57cec5SDimitry Andricmulticlass VOP1_Real_gfx6_gfx7_gfx10<bits<9> op> :
8200b57cec5SDimitry Andric  VOP1_Real_gfx6_gfx7<op>, VOP1_Real_gfx10<op>;
8210b57cec5SDimitry Andric
822*81ad6265SDimitry Andricmulticlass VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<bits<9> op> :
823*81ad6265SDimitry Andric  VOP1_Real_gfx6_gfx7_gfx10<op>, VOP1_Real_FULL_gfx11<op>;
824*81ad6265SDimitry Andric
825*81ad6265SDimitry Andricmulticlass VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11<bits<9> op> :
826*81ad6265SDimitry Andric  VOP1_Real_gfx6_gfx7_gfx10<op>, VOP1_Real_NO_DPP_gfx11<op>;
827*81ad6265SDimitry Andric
8280b57cec5SDimitry Andricdefm V_LOG_CLAMP_F32     : VOP1_Real_gfx6_gfx7<0x026>;
8290b57cec5SDimitry Andricdefm V_RCP_CLAMP_F32     : VOP1_Real_gfx6_gfx7<0x028>;
8300b57cec5SDimitry Andricdefm V_RCP_LEGACY_F32    : VOP1_Real_gfx6_gfx7<0x029>;
8310b57cec5SDimitry Andricdefm V_RSQ_CLAMP_F32     : VOP1_Real_gfx6_gfx7<0x02c>;
8320b57cec5SDimitry Andricdefm V_RSQ_LEGACY_F32    : VOP1_Real_gfx6_gfx7<0x02d>;
8330b57cec5SDimitry Andricdefm V_RCP_CLAMP_F64     : VOP1_Real_gfx6_gfx7<0x030>;
8340b57cec5SDimitry Andricdefm V_RSQ_CLAMP_F64     : VOP1_Real_gfx6_gfx7<0x032>;
8350b57cec5SDimitry Andric
836*81ad6265SDimitry Andricdefm V_NOP               : VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11<0x000>;
837*81ad6265SDimitry Andricdefm V_MOV_B32           : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x001>;
838*81ad6265SDimitry Andricdefm V_CVT_I32_F64       : VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11<0x003>;
839*81ad6265SDimitry Andricdefm V_CVT_F64_I32       : VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11<0x004>;
840*81ad6265SDimitry Andricdefm V_CVT_F32_I32       : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x005>;
841*81ad6265SDimitry Andricdefm V_CVT_F32_U32       : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x006>;
842*81ad6265SDimitry Andricdefm V_CVT_U32_F32       : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x007>;
843*81ad6265SDimitry Andricdefm V_CVT_I32_F32       : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x008>;
844*81ad6265SDimitry Andricdefm V_CVT_F16_F32       : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x00a>;
845*81ad6265SDimitry Andricdefm V_CVT_F32_F16       : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x00b>;
8460b57cec5SDimitry Andricdefm V_CVT_RPI_I32_F32   : VOP1_Real_gfx6_gfx7_gfx10<0x00c>;
8470b57cec5SDimitry Andricdefm V_CVT_FLR_I32_F32   : VOP1_Real_gfx6_gfx7_gfx10<0x00d>;
848*81ad6265SDimitry Andricdefm V_CVT_OFF_F32_I4    : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x00e>;
849*81ad6265SDimitry Andricdefm V_CVT_F32_F64       : VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11<0x00f>;
850*81ad6265SDimitry Andricdefm V_CVT_F64_F32       : VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11<0x010>;
851*81ad6265SDimitry Andricdefm V_CVT_F32_UBYTE0    : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x011>;
852*81ad6265SDimitry Andricdefm V_CVT_F32_UBYTE1    : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x012>;
853*81ad6265SDimitry Andricdefm V_CVT_F32_UBYTE2    : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x013>;
854*81ad6265SDimitry Andricdefm V_CVT_F32_UBYTE3    : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x014>;
855*81ad6265SDimitry Andricdefm V_CVT_U32_F64       : VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11<0x015>;
856*81ad6265SDimitry Andricdefm V_CVT_F64_U32       : VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11<0x016>;
857*81ad6265SDimitry Andricdefm V_FRACT_F32         : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x020>;
858*81ad6265SDimitry Andricdefm V_TRUNC_F32         : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x021>;
859*81ad6265SDimitry Andricdefm V_CEIL_F32          : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x022>;
860*81ad6265SDimitry Andricdefm V_RNDNE_F32         : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x023>;
861*81ad6265SDimitry Andricdefm V_FLOOR_F32         : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x024>;
862*81ad6265SDimitry Andricdefm V_EXP_F32           : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x025>;
863*81ad6265SDimitry Andricdefm V_LOG_F32           : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x027>;
864*81ad6265SDimitry Andricdefm V_RCP_F32           : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x02a>;
865*81ad6265SDimitry Andricdefm V_RCP_IFLAG_F32     : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x02b>;
866*81ad6265SDimitry Andricdefm V_RSQ_F32           : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x02e>;
867*81ad6265SDimitry Andricdefm V_RCP_F64           : VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11<0x02f>;
868*81ad6265SDimitry Andricdefm V_RSQ_F64           : VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11<0x031>;
869*81ad6265SDimitry Andricdefm V_SQRT_F32          : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x033>;
870*81ad6265SDimitry Andricdefm V_SQRT_F64          : VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11<0x034>;
871*81ad6265SDimitry Andricdefm V_SIN_F32           : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x035>;
872*81ad6265SDimitry Andricdefm V_COS_F32           : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x036>;
873*81ad6265SDimitry Andricdefm V_NOT_B32           : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x037>;
874*81ad6265SDimitry Andricdefm V_BFREV_B32         : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x038>;
8750b57cec5SDimitry Andricdefm V_FFBH_U32          : VOP1_Real_gfx6_gfx7_gfx10<0x039>;
8760b57cec5SDimitry Andricdefm V_FFBL_B32          : VOP1_Real_gfx6_gfx7_gfx10<0x03a>;
8770b57cec5SDimitry Andricdefm V_FFBH_I32          : VOP1_Real_gfx6_gfx7_gfx10<0x03b>;
878*81ad6265SDimitry Andricdefm V_FREXP_EXP_I32_F64 : VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11<0x03c>;
879*81ad6265SDimitry Andricdefm V_FREXP_MANT_F64    : VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11<0x03d>;
880*81ad6265SDimitry Andricdefm V_FRACT_F64         : VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11<0x03e>;
881*81ad6265SDimitry Andricdefm V_FREXP_EXP_I32_F32 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x03f>;
882*81ad6265SDimitry Andricdefm V_FREXP_MANT_F32    : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x040>;
8830b57cec5SDimitry Andricdefm V_CLREXCP           : VOP1_Real_gfx6_gfx7_gfx10<0x041>;
884*81ad6265SDimitry Andricdefm V_MOVRELD_B32       : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x042>;
885*81ad6265SDimitry Andricdefm V_MOVRELS_B32       : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x043>;
886*81ad6265SDimitry Andricdefm V_MOVRELSD_B32      : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11<0x044>;
8870b57cec5SDimitry Andric
8880b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
8890b57cec5SDimitry Andric// GFX8, GFX9 (VI).
8900b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
8910b57cec5SDimitry Andric
8920b57cec5SDimitry Andricclass VOP1_DPPe <bits<8> op, VOP1_DPP_Pseudo ps, VOPProfile P = ps.Pfl> :
8930b57cec5SDimitry Andric  VOP_DPPe <P> {
8940b57cec5SDimitry Andric  bits<8> vdst;
8950b57cec5SDimitry Andric  let Inst{8-0}   = 0xfa; // dpp
8960b57cec5SDimitry Andric  let Inst{16-9}  = op;
8970b57cec5SDimitry Andric  let Inst{24-17} = !if(P.EmitDst, vdst{7-0}, 0);
8980b57cec5SDimitry Andric  let Inst{31-25} = 0x3f; //encoding
8990b57cec5SDimitry Andric}
9000b57cec5SDimitry Andric
9010b57cec5SDimitry Andricmulticlass VOP1Only_Real_vi <bits<10> op> {
902480093f4SDimitry Andric  let AssemblerPredicate = isGFX8GFX9, DecoderNamespace = "GFX8" in {
9030b57cec5SDimitry Andric    def _vi :
9040b57cec5SDimitry Andric      VOP1_Real<!cast<VOP1_Pseudo>(NAME), SIEncodingFamily.VI>,
9050b57cec5SDimitry Andric      VOP1e<op{7-0}, !cast<VOP1_Pseudo>(NAME).Pfl>;
9060b57cec5SDimitry Andric  }
9070b57cec5SDimitry Andric}
9080b57cec5SDimitry Andric
9090b57cec5SDimitry Andricmulticlass VOP1_Real_e32e64_vi <bits<10> op> {
910480093f4SDimitry Andric  let AssemblerPredicate = isGFX8GFX9, DecoderNamespace = "GFX8" in {
9110b57cec5SDimitry Andric    def _e32_vi :
9120b57cec5SDimitry Andric      VOP1_Real<!cast<VOP1_Pseudo>(NAME#"_e32"), SIEncodingFamily.VI>,
9130b57cec5SDimitry Andric      VOP1e<op{7-0}, !cast<VOP1_Pseudo>(NAME#"_e32").Pfl>;
9140b57cec5SDimitry Andric    def _e64_vi :
9150b57cec5SDimitry Andric      VOP3_Real<!cast<VOP3_Pseudo>(NAME#"_e64"), SIEncodingFamily.VI>,
9160b57cec5SDimitry Andric      VOP3e_vi <!add(0x140, op), !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>;
9170b57cec5SDimitry Andric  }
9180b57cec5SDimitry Andric}
9190b57cec5SDimitry Andric
9200b57cec5SDimitry Andricmulticlass VOP1_Real_vi <bits<10> op> {
9210b57cec5SDimitry Andric  defm NAME : VOP1_Real_e32e64_vi <op>;
9220b57cec5SDimitry Andric
9238bcb0991SDimitry Andric  foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA>.ret in
9240b57cec5SDimitry Andric  def _sdwa_vi :
9250b57cec5SDimitry Andric    VOP_SDWA_Real <!cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa")>,
9260b57cec5SDimitry Andric    VOP1_SDWAe <op{7-0}, !cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa").Pfl>;
9270b57cec5SDimitry Andric
9288bcb0991SDimitry Andric  foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA9>.ret in
9290b57cec5SDimitry Andric  def _sdwa_gfx9 :
9300b57cec5SDimitry Andric    VOP_SDWA9_Real <!cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa")>,
9310b57cec5SDimitry Andric    VOP1_SDWA9Ae <op{7-0}, !cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa").Pfl>;
9320b57cec5SDimitry Andric
9330b57cec5SDimitry Andric  foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtDPP>.ret in
9340b57cec5SDimitry Andric    def _dpp_vi :
9350b57cec5SDimitry Andric      VOP_DPP_Real<!cast<VOP1_DPP_Pseudo>(NAME#"_dpp"), SIEncodingFamily.VI>,
9360b57cec5SDimitry Andric      VOP1_DPPe<op{7-0}, !cast<VOP1_DPP_Pseudo>(NAME#"_dpp")>;
9370b57cec5SDimitry Andric}
9380b57cec5SDimitry Andric
9390b57cec5SDimitry Andricdefm V_NOP               : VOP1_Real_vi <0x0>;
9400b57cec5SDimitry Andricdefm V_MOV_B32           : VOP1_Real_vi <0x1>;
9410b57cec5SDimitry Andricdefm V_CVT_I32_F64       : VOP1_Real_vi <0x3>;
9420b57cec5SDimitry Andricdefm V_CVT_F64_I32       : VOP1_Real_vi <0x4>;
9430b57cec5SDimitry Andricdefm V_CVT_F32_I32       : VOP1_Real_vi <0x5>;
9440b57cec5SDimitry Andricdefm V_CVT_F32_U32       : VOP1_Real_vi <0x6>;
9450b57cec5SDimitry Andricdefm V_CVT_U32_F32       : VOP1_Real_vi <0x7>;
9460b57cec5SDimitry Andricdefm V_CVT_I32_F32       : VOP1_Real_vi <0x8>;
9470b57cec5SDimitry Andricdefm V_CVT_F16_F32       : VOP1_Real_vi <0xa>;
9480b57cec5SDimitry Andricdefm V_CVT_F32_F16       : VOP1_Real_vi <0xb>;
9490b57cec5SDimitry Andricdefm V_CVT_RPI_I32_F32   : VOP1_Real_vi <0xc>;
9500b57cec5SDimitry Andricdefm V_CVT_FLR_I32_F32   : VOP1_Real_vi <0xd>;
9510b57cec5SDimitry Andricdefm V_CVT_OFF_F32_I4    : VOP1_Real_vi <0xe>;
9520b57cec5SDimitry Andricdefm V_CVT_F32_F64       : VOP1_Real_vi <0xf>;
9530b57cec5SDimitry Andricdefm V_CVT_F64_F32       : VOP1_Real_vi <0x10>;
9540b57cec5SDimitry Andricdefm V_CVT_F32_UBYTE0    : VOP1_Real_vi <0x11>;
9550b57cec5SDimitry Andricdefm V_CVT_F32_UBYTE1    : VOP1_Real_vi <0x12>;
9560b57cec5SDimitry Andricdefm V_CVT_F32_UBYTE2    : VOP1_Real_vi <0x13>;
9570b57cec5SDimitry Andricdefm V_CVT_F32_UBYTE3    : VOP1_Real_vi <0x14>;
9580b57cec5SDimitry Andricdefm V_CVT_U32_F64       : VOP1_Real_vi <0x15>;
9590b57cec5SDimitry Andricdefm V_CVT_F64_U32       : VOP1_Real_vi <0x16>;
9600b57cec5SDimitry Andricdefm V_FRACT_F32         : VOP1_Real_vi <0x1b>;
9610b57cec5SDimitry Andricdefm V_TRUNC_F32         : VOP1_Real_vi <0x1c>;
9620b57cec5SDimitry Andricdefm V_CEIL_F32          : VOP1_Real_vi <0x1d>;
9630b57cec5SDimitry Andricdefm V_RNDNE_F32         : VOP1_Real_vi <0x1e>;
9640b57cec5SDimitry Andricdefm V_FLOOR_F32         : VOP1_Real_vi <0x1f>;
9650b57cec5SDimitry Andricdefm V_EXP_F32           : VOP1_Real_vi <0x20>;
9660b57cec5SDimitry Andricdefm V_LOG_F32           : VOP1_Real_vi <0x21>;
9670b57cec5SDimitry Andricdefm V_RCP_F32           : VOP1_Real_vi <0x22>;
9680b57cec5SDimitry Andricdefm V_RCP_IFLAG_F32     : VOP1_Real_vi <0x23>;
9690b57cec5SDimitry Andricdefm V_RSQ_F32           : VOP1_Real_vi <0x24>;
9700b57cec5SDimitry Andricdefm V_RCP_F64           : VOP1_Real_vi <0x25>;
9710b57cec5SDimitry Andricdefm V_RSQ_F64           : VOP1_Real_vi <0x26>;
9720b57cec5SDimitry Andricdefm V_SQRT_F32          : VOP1_Real_vi <0x27>;
9730b57cec5SDimitry Andricdefm V_SQRT_F64          : VOP1_Real_vi <0x28>;
9740b57cec5SDimitry Andricdefm V_SIN_F32           : VOP1_Real_vi <0x29>;
9750b57cec5SDimitry Andricdefm V_COS_F32           : VOP1_Real_vi <0x2a>;
9760b57cec5SDimitry Andricdefm V_NOT_B32           : VOP1_Real_vi <0x2b>;
9770b57cec5SDimitry Andricdefm V_BFREV_B32         : VOP1_Real_vi <0x2c>;
9780b57cec5SDimitry Andricdefm V_FFBH_U32          : VOP1_Real_vi <0x2d>;
9790b57cec5SDimitry Andricdefm V_FFBL_B32          : VOP1_Real_vi <0x2e>;
9800b57cec5SDimitry Andricdefm V_FFBH_I32          : VOP1_Real_vi <0x2f>;
9810b57cec5SDimitry Andricdefm V_FREXP_EXP_I32_F64 : VOP1_Real_vi <0x30>;
9820b57cec5SDimitry Andricdefm V_FREXP_MANT_F64    : VOP1_Real_vi <0x31>;
9830b57cec5SDimitry Andricdefm V_FRACT_F64         : VOP1_Real_vi <0x32>;
9840b57cec5SDimitry Andricdefm V_FREXP_EXP_I32_F32 : VOP1_Real_vi <0x33>;
9850b57cec5SDimitry Andricdefm V_FREXP_MANT_F32    : VOP1_Real_vi <0x34>;
9860b57cec5SDimitry Andricdefm V_CLREXCP           : VOP1_Real_vi <0x35>;
9870b57cec5SDimitry Andricdefm V_MOVRELD_B32       : VOP1_Real_e32e64_vi <0x36>;
9880b57cec5SDimitry Andricdefm V_MOVRELS_B32       : VOP1_Real_e32e64_vi <0x37>;
9890b57cec5SDimitry Andricdefm V_MOVRELSD_B32      : VOP1_Real_e32e64_vi <0x38>;
9900b57cec5SDimitry Andricdefm V_TRUNC_F64         : VOP1_Real_vi <0x17>;
9910b57cec5SDimitry Andricdefm V_CEIL_F64          : VOP1_Real_vi <0x18>;
9920b57cec5SDimitry Andricdefm V_FLOOR_F64         : VOP1_Real_vi <0x1A>;
9930b57cec5SDimitry Andricdefm V_RNDNE_F64         : VOP1_Real_vi <0x19>;
9940b57cec5SDimitry Andricdefm V_LOG_LEGACY_F32    : VOP1_Real_vi <0x4c>;
9950b57cec5SDimitry Andricdefm V_EXP_LEGACY_F32    : VOP1_Real_vi <0x4b>;
9960b57cec5SDimitry Andricdefm V_CVT_F16_U16       : VOP1_Real_vi <0x39>;
9970b57cec5SDimitry Andricdefm V_CVT_F16_I16       : VOP1_Real_vi <0x3a>;
9980b57cec5SDimitry Andricdefm V_CVT_U16_F16       : VOP1_Real_vi <0x3b>;
9990b57cec5SDimitry Andricdefm V_CVT_I16_F16       : VOP1_Real_vi <0x3c>;
10000b57cec5SDimitry Andricdefm V_RCP_F16           : VOP1_Real_vi <0x3d>;
10010b57cec5SDimitry Andricdefm V_SQRT_F16          : VOP1_Real_vi <0x3e>;
10020b57cec5SDimitry Andricdefm V_RSQ_F16           : VOP1_Real_vi <0x3f>;
10030b57cec5SDimitry Andricdefm V_LOG_F16           : VOP1_Real_vi <0x40>;
10040b57cec5SDimitry Andricdefm V_EXP_F16           : VOP1_Real_vi <0x41>;
10050b57cec5SDimitry Andricdefm V_FREXP_MANT_F16    : VOP1_Real_vi <0x42>;
10060b57cec5SDimitry Andricdefm V_FREXP_EXP_I16_F16 : VOP1_Real_vi <0x43>;
10070b57cec5SDimitry Andricdefm V_FLOOR_F16         : VOP1_Real_vi <0x44>;
10080b57cec5SDimitry Andricdefm V_CEIL_F16          : VOP1_Real_vi <0x45>;
10090b57cec5SDimitry Andricdefm V_TRUNC_F16         : VOP1_Real_vi <0x46>;
10100b57cec5SDimitry Andricdefm V_RNDNE_F16         : VOP1_Real_vi <0x47>;
10110b57cec5SDimitry Andricdefm V_FRACT_F16         : VOP1_Real_vi <0x48>;
10120b57cec5SDimitry Andricdefm V_SIN_F16           : VOP1_Real_vi <0x49>;
10130b57cec5SDimitry Andricdefm V_COS_F16           : VOP1_Real_vi <0x4a>;
10140b57cec5SDimitry Andricdefm V_SWAP_B32          : VOP1Only_Real_vi <0x51>;
10150b57cec5SDimitry Andric
10160b57cec5SDimitry Andricdefm V_SAT_PK_U8_I16     : VOP1_Real_vi<0x4f>;
10170b57cec5SDimitry Andricdefm V_CVT_NORM_I16_F16  : VOP1_Real_vi<0x4d>;
10180b57cec5SDimitry Andricdefm V_CVT_NORM_U16_F16  : VOP1_Real_vi<0x4e>;
10190b57cec5SDimitry Andric
1020fe6060f1SDimitry Andricdefm V_ACCVGPR_MOV_B32   : VOP1Only_Real_vi<0x52>;
1021fe6060f1SDimitry Andric
1022349cc55cSDimitry Andriclet VOP1 = 1, SubtargetPredicate = isGFX8GFX9, Uses = [EXEC, M0] in {
1023349cc55cSDimitry Andric
10240b57cec5SDimitry Andric// Copy of v_mov_b32 with $vdst as a use operand for use with VGPR
10250b57cec5SDimitry Andric// indexing mode. vdst can't be treated as a def for codegen purposes,
10260b57cec5SDimitry Andric// and an implicit use and def of the super register should be added.
1027349cc55cSDimitry Andricdef V_MOV_B32_indirect_write : VPseudoInstSI<(outs),
10280b57cec5SDimitry Andric  (ins getVALUDstForVT<i32>.ret:$vdst, getVOPSrc0ForVT<i32>.ret:$src0)>,
10290b57cec5SDimitry Andric  PseudoInstExpansion<(V_MOV_B32_e32_vi getVALUDstForVT<i32>.ret:$vdst,
1030349cc55cSDimitry Andric                                        getVOPSrc0ForVT<i32>.ret:$src0)>;
1031349cc55cSDimitry Andric
1032349cc55cSDimitry Andric// Copy of v_mov_b32 for use with VGPR indexing mode. An implicit use of the
1033349cc55cSDimitry Andric// super register should be added.
1034349cc55cSDimitry Andricdef V_MOV_B32_indirect_read : VPseudoInstSI<
1035349cc55cSDimitry Andric  (outs getVALUDstForVT<i32>.ret:$vdst),
1036349cc55cSDimitry Andric  (ins getVOPSrc0ForVT<i32>.ret:$src0)>,
1037349cc55cSDimitry Andric  PseudoInstExpansion<(V_MOV_B32_e32_vi getVALUDstForVT<i32>.ret:$vdst,
1038349cc55cSDimitry Andric                                        getVOPSrc0ForVT<i32>.ret:$src0)>;
1039349cc55cSDimitry Andric
1040349cc55cSDimitry Andric} // End VOP1 = 1, SubtargetPredicate = isGFX8GFX9, Uses = [M0]
10410b57cec5SDimitry Andric
10428bcb0991SDimitry Andriclet OtherPredicates = [isGFX8Plus] in {
10430b57cec5SDimitry Andric
10440b57cec5SDimitry Andricdef : GCNPat <
10455ffd83dbSDimitry Andric  (i32 (int_amdgcn_mov_dpp i32:$src, timm:$dpp_ctrl, timm:$row_mask,
10465ffd83dbSDimitry Andric                           timm:$bank_mask, timm:$bound_ctrl)),
10475ffd83dbSDimitry Andric  (V_MOV_B32_dpp VGPR_32:$src, VGPR_32:$src, (as_i32timm $dpp_ctrl),
10485ffd83dbSDimitry Andric                       (as_i32timm $row_mask), (as_i32timm $bank_mask),
10495ffd83dbSDimitry Andric                       (as_i1timm $bound_ctrl))
10500b57cec5SDimitry Andric>;
10510b57cec5SDimitry Andric
10520b57cec5SDimitry Andricdef : GCNPat <
10535ffd83dbSDimitry Andric  (i32 (int_amdgcn_update_dpp i32:$old, i32:$src, timm:$dpp_ctrl,
10545ffd83dbSDimitry Andric                              timm:$row_mask, timm:$bank_mask,
10555ffd83dbSDimitry Andric                              timm:$bound_ctrl)),
10565ffd83dbSDimitry Andric  (V_MOV_B32_dpp VGPR_32:$old, VGPR_32:$src, (as_i32timm $dpp_ctrl),
10575ffd83dbSDimitry Andric                 (as_i32timm $row_mask), (as_i32timm $bank_mask),
10585ffd83dbSDimitry Andric                 (as_i1timm $bound_ctrl))
10590b57cec5SDimitry Andric>;
10600b57cec5SDimitry Andric
10618bcb0991SDimitry Andric} // End OtherPredicates = [isGFX8Plus]
10620b57cec5SDimitry Andric
10630b57cec5SDimitry Andriclet OtherPredicates = [isGFX8Plus] in {
10640b57cec5SDimitry Andricdef : GCNPat<
10650b57cec5SDimitry Andric  (i32 (anyext i16:$src)),
10660b57cec5SDimitry Andric  (COPY $src)
10670b57cec5SDimitry Andric>;
10680b57cec5SDimitry Andric
10690b57cec5SDimitry Andricdef : GCNPat<
10700b57cec5SDimitry Andric   (i64 (anyext i16:$src)),
10710b57cec5SDimitry Andric   (REG_SEQUENCE VReg_64,
10720b57cec5SDimitry Andric     (i32 (COPY $src)), sub0,
10730b57cec5SDimitry Andric     (V_MOV_B32_e32 (i32 0)), sub1)
10740b57cec5SDimitry Andric>;
10750b57cec5SDimitry Andric
10760b57cec5SDimitry Andricdef : GCNPat<
10770b57cec5SDimitry Andric  (i16 (trunc i32:$src)),
10780b57cec5SDimitry Andric  (COPY $src)
10790b57cec5SDimitry Andric>;
10800b57cec5SDimitry Andric
10810b57cec5SDimitry Andricdef : GCNPat <
10820b57cec5SDimitry Andric  (i16 (trunc i64:$src)),
10830b57cec5SDimitry Andric  (EXTRACT_SUBREG $src, sub0)
10840b57cec5SDimitry Andric>;
10850b57cec5SDimitry Andric
10860b57cec5SDimitry Andric} // End OtherPredicates = [isGFX8Plus]
10870b57cec5SDimitry Andric
10880b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
10890b57cec5SDimitry Andric// GFX9
10900b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
10910b57cec5SDimitry Andric
10920b57cec5SDimitry Andricmulticlass VOP1_Real_gfx9 <bits<10> op> {
1093480093f4SDimitry Andric  let AssemblerPredicate = isGFX9Only, DecoderNamespace = "GFX9" in {
10940b57cec5SDimitry Andric    defm NAME : VOP1_Real_e32e64_vi <op>;
10950b57cec5SDimitry Andric  }
10960b57cec5SDimitry Andric
10978bcb0991SDimitry Andric  foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA9>.ret in
10980b57cec5SDimitry Andric  def _sdwa_gfx9 :
10990b57cec5SDimitry Andric    VOP_SDWA9_Real <!cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa")>,
11000b57cec5SDimitry Andric    VOP1_SDWA9Ae <op{7-0}, !cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa").Pfl>;
11010b57cec5SDimitry Andric
11020b57cec5SDimitry Andric  foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtDPP>.ret in
11030b57cec5SDimitry Andric    def _dpp_gfx9 :
11040b57cec5SDimitry Andric      VOP_DPP_Real<!cast<VOP1_DPP_Pseudo>(NAME#"_dpp"), SIEncodingFamily.GFX9>,
11050b57cec5SDimitry Andric      VOP1_DPPe<op{7-0}, !cast<VOP1_DPP_Pseudo>(NAME#"_dpp")>;
11060b57cec5SDimitry Andric
11070b57cec5SDimitry Andric}
11080b57cec5SDimitry Andric
11090b57cec5SDimitry Andricdefm V_SCREEN_PARTITION_4SE_B32 : VOP1_Real_gfx9 <0x37>;
11100b57cec5SDimitry Andric
1111*81ad6265SDimitry Andriclet AssemblerPredicate = isGFX940Plus, DecoderNamespace = "GFX9" in
1112*81ad6265SDimitry Andricdefm V_MOV_B64 : VOP1_Real_gfx9 <0x38>;
1113*81ad6265SDimitry Andric
11140b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
11150b57cec5SDimitry Andric// GFX10
11160b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
11170b57cec5SDimitry Andric
1118*81ad6265SDimitry Andriclet OtherPredicates = [isGFX10Only] in {
11190b57cec5SDimitry Andricdef : GCNPat <
11208bcb0991SDimitry Andric  (i32 (int_amdgcn_mov_dpp8 i32:$src, timm:$dpp8)),
11215ffd83dbSDimitry Andric  (V_MOV_B32_dpp8_gfx10 VGPR_32:$src, VGPR_32:$src,
11225ffd83dbSDimitry Andric                        (as_i32timm $dpp8), (i32 DPP8Mode.FI_0))
11230b57cec5SDimitry Andric>;
1124*81ad6265SDimitry Andric} // End OtherPredicates = [isGFX10Only]
1125*81ad6265SDimitry Andric
1126*81ad6265SDimitry Andric//===----------------------------------------------------------------------===//
1127*81ad6265SDimitry Andric// GFX11
1128*81ad6265SDimitry Andric//===----------------------------------------------------------------------===//
1129*81ad6265SDimitry Andric
1130*81ad6265SDimitry Andriclet OtherPredicates = [isGFX11Only] in {
1131*81ad6265SDimitry Andricdef : GCNPat <
1132*81ad6265SDimitry Andric  (i32 (int_amdgcn_mov_dpp8 i32:$src, timm:$dpp8)),
1133*81ad6265SDimitry Andric  (V_MOV_B32_dpp8_gfx11 VGPR_32:$src, VGPR_32:$src,
1134*81ad6265SDimitry Andric                        (as_i32timm $dpp8), (i32 DPP8Mode.FI_0))
1135*81ad6265SDimitry Andric>;
1136*81ad6265SDimitry Andric} // End OtherPredicates = [isGFX11Only]
1137