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 51*7a6dacacSDimitry Andric let ReadsModeReg = !or(P.DstVT.isFP, P.Src0VT.isFP); 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 6281ad6265SDimitry Andricclass VOP1_Real <VOP1_Pseudo ps, int EncodingFamily, string real_name = ps.Mnemonic > : 63fe6060f1SDimitry Andric VOP_Real <ps>, 6481ad6265SDimitry 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; 77297eecfbSDimitry Andric let OtherPredicates = ps.OtherPredicates; 780b57cec5SDimitry Andric let AsmMatchConverter = ps.AsmMatchConverter; 790b57cec5SDimitry Andric let AsmVariantName = ps.AsmVariantName; 800b57cec5SDimitry Andric let Constraints = ps.Constraints; 810b57cec5SDimitry Andric let DisableEncoding = ps.DisableEncoding; 820b57cec5SDimitry Andric let TSFlags = ps.TSFlags; 830b57cec5SDimitry Andric let UseNamedOperandTable = ps.UseNamedOperandTable; 840b57cec5SDimitry Andric let Uses = ps.Uses; 850b57cec5SDimitry Andric let Defs = ps.Defs; 86fe6060f1SDimitry Andric let SchedRW = ps.SchedRW; 87fe6060f1SDimitry Andric let mayLoad = ps.mayLoad; 88fe6060f1SDimitry Andric let mayStore = ps.mayStore; 89fe6060f1SDimitry Andric let TRANS = ps.TRANS; 900b57cec5SDimitry Andric} 910b57cec5SDimitry Andric 925f757f3fSDimitry Andricclass VOP1_Real_Gen <VOP1_Pseudo ps, GFXGen Gen, string real_name = ps.Mnemonic> : 935f757f3fSDimitry Andric VOP1_Real <ps, Gen.Subtarget, real_name> { 945f757f3fSDimitry Andric let AssemblerPredicate = Gen.AssemblerPredicate; 955f757f3fSDimitry Andric let DecoderNamespace = Gen.DecoderNamespace; 965f757f3fSDimitry Andric} 975f757f3fSDimitry Andric 980b57cec5SDimitry Andricclass VOP1_SDWA_Pseudo <string OpName, VOPProfile P, list<dag> pattern=[]> : 990b57cec5SDimitry Andric VOP_SDWA_Pseudo <OpName, P, pattern> { 1000b57cec5SDimitry Andric let AsmMatchConverter = "cvtSdwaVOP1"; 1010b57cec5SDimitry Andric} 1020b57cec5SDimitry Andric 1030b57cec5SDimitry Andricclass VOP1_DPP_Pseudo <string OpName, VOPProfile P, list<dag> pattern=[]> : 1040b57cec5SDimitry Andric VOP_DPP_Pseudo <OpName, P, pattern> { 1050b57cec5SDimitry Andric} 1060b57cec5SDimitry Andric 1070b57cec5SDimitry Andricclass getVOP1Pat64 <SDPatternOperator node, VOPProfile P> : LetDummies { 1080b57cec5SDimitry Andric list<dag> ret = 1090b57cec5SDimitry Andric !if(P.HasModifiers, 1105ffd83dbSDimitry Andric [(set P.DstVT:$vdst, (node (P.Src0VT (VOP3Mods P.Src0VT:$src0, i32:$src0_modifiers))))], 1110b57cec5SDimitry Andric !if(P.HasOMod, 1120b57cec5SDimitry Andric [(set P.DstVT:$vdst, (node (P.Src0VT (VOP3OMods P.Src0VT:$src0, 1130b57cec5SDimitry Andric i1:$clamp, i32:$omod))))], 1140b57cec5SDimitry Andric [(set P.DstVT:$vdst, (node P.Src0VT:$src0))] 1150b57cec5SDimitry Andric ) 1160b57cec5SDimitry Andric ); 1170b57cec5SDimitry Andric} 1180b57cec5SDimitry Andric 1190b57cec5SDimitry Andricmulticlass VOP1Inst <string opName, VOPProfile P, 12081ad6265SDimitry Andric SDPatternOperator node = null_frag, int VOPDOp = -1> { 1215ffd83dbSDimitry Andric // We only want to set this on the basic, non-SDWA or DPP forms. 12281ad6265SDimitry Andric defvar should_mov_imm = !or(!eq(opName, "v_mov_b32"), 12381ad6265SDimitry Andric !eq(opName, "v_mov_b64")); 1245ffd83dbSDimitry Andric 1255ffd83dbSDimitry Andric let isMoveImm = should_mov_imm in { 12681ad6265SDimitry Andric if !eq(VOPDOp, -1) then 1270b57cec5SDimitry Andric def _e32 : VOP1_Pseudo <opName, P>; 12881ad6265SDimitry Andric else 12981ad6265SDimitry Andric // Only for V_MOV_B32 13006c3fb27SDimitry Andric def _e32 : VOP1_Pseudo <opName, P>, VOPD_Component<VOPDOp, opName>; 13181ad6265SDimitry Andric def _e64 : VOP3InstBase <opName, P, node>; 1325ffd83dbSDimitry Andric } 1338bcb0991SDimitry Andric 13406c3fb27SDimitry Andric if P.HasExtSDWA then 1350b57cec5SDimitry Andric def _sdwa : VOP1_SDWA_Pseudo <opName, P>; 1368bcb0991SDimitry Andric 13706c3fb27SDimitry Andric if P.HasExtDPP then 1380b57cec5SDimitry Andric def _dpp : VOP1_DPP_Pseudo <opName, P>; 1398bcb0991SDimitry Andric 14081ad6265SDimitry Andric let SubtargetPredicate = isGFX11Plus in { 14106c3fb27SDimitry Andric if P.HasExtVOP3DPP then 14281ad6265SDimitry Andric def _e64_dpp : VOP3_DPP_Pseudo <opName, P>; 14381ad6265SDimitry Andric } // End SubtargetPredicate = isGFX11Plus 14481ad6265SDimitry Andric 1458bcb0991SDimitry Andric def : MnemonicAlias<opName#"_e32", opName>, LetDummies; 1468bcb0991SDimitry Andric def : MnemonicAlias<opName#"_e64", opName>, LetDummies; 1478bcb0991SDimitry Andric 14806c3fb27SDimitry Andric if P.HasExtSDWA then 1498bcb0991SDimitry Andric def : MnemonicAlias<opName#"_sdwa", opName>, LetDummies; 1508bcb0991SDimitry Andric 15106c3fb27SDimitry Andric if P.HasExtDPP then 152bdd1243dSDimitry Andric def : MnemonicAlias<opName#"_dpp", opName, AMDGPUAsmVariants.DPP>, LetDummies; 153bdd1243dSDimitry Andric} 154bdd1243dSDimitry Andric 155bdd1243dSDimitry Andricmulticlass VOP1Inst_t16<string opName, 156bdd1243dSDimitry Andric VOPProfile P, 157bdd1243dSDimitry Andric SDPatternOperator node = null_frag> { 158bdd1243dSDimitry Andric let OtherPredicates = [NotHasTrue16BitInsts, Has16BitInsts] in { 159bdd1243dSDimitry Andric defm NAME : VOP1Inst<opName, P, node>; 160bdd1243dSDimitry Andric } 161297eecfbSDimitry Andric let OtherPredicates = [UseRealTrue16Insts] in { 162297eecfbSDimitry Andric defm _t16 : VOP1Inst<opName#"_t16", VOPProfile_True16<P>, node>; 163297eecfbSDimitry Andric } 164297eecfbSDimitry Andric let OtherPredicates = [UseFakeTrue16Insts] in { 165297eecfbSDimitry Andric defm _fake16 : VOP1Inst<opName#"_fake16", VOPProfile_Fake16<P>, node>; 166bdd1243dSDimitry Andric } 1670b57cec5SDimitry Andric} 1680b57cec5SDimitry Andric 1690b57cec5SDimitry Andric// Special profile for instructions which have clamp 1700b57cec5SDimitry Andric// and output modifiers (but have no input modifiers) 1710b57cec5SDimitry Andricclass VOPProfileI2F<ValueType dstVt, ValueType srcVt> : 1720b57cec5SDimitry Andric VOPProfile<[dstVt, srcVt, untyped, untyped]> { 1730b57cec5SDimitry Andric 1740b57cec5SDimitry Andric let Ins64 = (ins Src0RC64:$src0, clampmod:$clamp, omod:$omod); 175bdd1243dSDimitry Andric let InsVOP3Base = (ins Src0VOP3DPP:$src0, clampmod:$clamp, omod:$omod); 176bdd1243dSDimitry Andric let AsmVOP3Base = "$vdst, $src0$clamp$omod"; 177bdd1243dSDimitry Andric 178bdd1243dSDimitry Andric let HasModifiers = 0; 179bdd1243dSDimitry Andric let HasClamp = 1; 180bdd1243dSDimitry Andric} 181bdd1243dSDimitry Andric 182bdd1243dSDimitry Andricclass VOPProfileI2F_True16<ValueType dstVt, ValueType srcVt> : 1835f757f3fSDimitry Andric VOPProfile_Fake16<VOPProfile<[dstVt, srcVt, untyped, untyped]>> { 184bdd1243dSDimitry Andric 185bdd1243dSDimitry Andric let Ins64 = (ins Src0RC64:$src0, clampmod:$clamp, omod:$omod); 186bdd1243dSDimitry Andric let InsVOP3Base = (ins Src0VOP3DPP:$src0, clampmod:$clamp, omod:$omod); 187bdd1243dSDimitry Andric let AsmVOP3Base = "$vdst, $src0$clamp$omod"; 1880b57cec5SDimitry Andric 1890b57cec5SDimitry Andric let HasModifiers = 0; 1900b57cec5SDimitry Andric let HasClamp = 1; 1910b57cec5SDimitry Andric} 1920b57cec5SDimitry Andric 1930b57cec5SDimitry Andricdef VOP1_F64_I32 : VOPProfileI2F <f64, i32>; 1940b57cec5SDimitry Andricdef VOP1_F32_I32 : VOPProfileI2F <f32, i32>; 1950b57cec5SDimitry Andricdef VOP1_F16_I16 : VOPProfileI2F <f16, i16>; 196bdd1243dSDimitry Andricdef VOP1_F16_I16_t16 : VOPProfileI2F_True16 <f16, i16>; 1970b57cec5SDimitry Andric 19881ad6265SDimitry Andricdef VOP_NOP_PROFILE : VOPProfile <[untyped, untyped, untyped, untyped]>{ 19981ad6265SDimitry Andric let HasExtVOP3DPP = 0; 20081ad6265SDimitry Andric} 20181ad6265SDimitry Andric 20281ad6265SDimitry Andric// OMod clears exceptions when set. OMod was always an operand, but its 20381ad6265SDimitry Andric// now explicitly set. 204fe6060f1SDimitry Andricclass VOP_SPECIAL_OMOD_PROF<ValueType dstVt, ValueType srcVt> : 205fe6060f1SDimitry Andric VOPProfile<[dstVt, srcVt, untyped, untyped]> { 206fe6060f1SDimitry Andric 207fe6060f1SDimitry Andric let HasOMod = 1; 208fe6060f1SDimitry Andric} 209fe6060f1SDimitry Andricdef VOP_I32_F32_SPECIAL_OMOD : VOP_SPECIAL_OMOD_PROF<i32, f32>; 210fe6060f1SDimitry Andricdef VOP_I32_F64_SPECIAL_OMOD : VOP_SPECIAL_OMOD_PROF<i32, f64>; 211fe6060f1SDimitry Andricdef VOP_I16_F16_SPECIAL_OMOD : VOP_SPECIAL_OMOD_PROF<i16, f16>; 2125f757f3fSDimitry Andricdef VOP_I16_F16_SPECIAL_OMOD_t16 : VOPProfile_Fake16<VOP_I16_F16> { 213bdd1243dSDimitry Andric let HasOMod = 1; 214bdd1243dSDimitry Andric} 215fe6060f1SDimitry Andric 2160b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 2170b57cec5SDimitry Andric// VOP1 Instructions 2180b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 2190b57cec5SDimitry Andric 2200b57cec5SDimitry Andriclet VOPAsmPrefer32Bit = 1 in { 22181ad6265SDimitry Andricdefm V_NOP : VOP1Inst <"v_nop", VOP_NOP_PROFILE>; 22281ad6265SDimitry Andric} 22381ad6265SDimitry Andric 22481ad6265SDimitry Andricdef VOPProfile_MOV : VOPProfile <[i32, i32, untyped, untyped]> { 22581ad6265SDimitry Andric let InsVOPDX = (ins Src0RC32:$src0X); 22681ad6265SDimitry Andric let InsVOPDXDeferred = (ins VSrc_f32_Deferred:$src0X); 22781ad6265SDimitry Andric let InsVOPDY = (ins Src0RC32:$src0Y); 22881ad6265SDimitry Andric let InsVOPDYDeferred = (ins VSrc_f32_Deferred:$src0Y); 2290b57cec5SDimitry Andric} 2300b57cec5SDimitry Andric 2315ffd83dbSDimitry Andriclet isReMaterializable = 1, isAsCheapAsAMove = 1 in { 23281ad6265SDimitry Andricdefm V_MOV_B32 : VOP1Inst <"v_mov_b32", VOPProfile_MOV, null_frag, 0x8>; 23381ad6265SDimitry Andric 2345f757f3fSDimitry Andriclet SubtargetPredicate = isGFX940Plus, SchedRW = [Write64Bit] in 23581ad6265SDimitry Andricdefm V_MOV_B64 : VOP1Inst <"v_mov_b64", VOP_I64_I64>; 2360b57cec5SDimitry Andric} // End isMoveImm = 1 2370b57cec5SDimitry Andric 2380b57cec5SDimitry Andric// FIXME: Specify SchedRW for READFIRSTLANE_B32 2390b57cec5SDimitry Andric// TODO: Make profile for this, there is VOP3 encoding also 2400b57cec5SDimitry Andricdef V_READFIRSTLANE_B32 : 2410b57cec5SDimitry Andric InstSI <(outs SReg_32:$vdst), 24206c3fb27SDimitry Andric (ins VRegOrLdsSrc_32:$src0), 2430b57cec5SDimitry Andric "v_readfirstlane_b32 $vdst, $src0", 24406c3fb27SDimitry Andric [(set i32:$vdst, (int_amdgcn_readfirstlane (i32 VRegOrLdsSrc_32:$src0)))]>, 2450b57cec5SDimitry Andric Enc32 { 2460b57cec5SDimitry Andric 2470b57cec5SDimitry Andric let isCodeGenOnly = 0; 2480b57cec5SDimitry Andric let UseNamedOperandTable = 1; 2490b57cec5SDimitry Andric 2500b57cec5SDimitry Andric let Size = 4; 2510b57cec5SDimitry Andric let mayLoad = 0; 2520b57cec5SDimitry Andric let mayStore = 0; 2530b57cec5SDimitry Andric let hasSideEffects = 0; 2540b57cec5SDimitry Andric 2550b57cec5SDimitry Andric let VOP1 = 1; 2560b57cec5SDimitry Andric let VALU = 1; 2570b57cec5SDimitry Andric let Uses = [EXEC]; 2580b57cec5SDimitry Andric let isConvergent = 1; 2590b57cec5SDimitry Andric 2600b57cec5SDimitry Andric bits<8> vdst; 2610b57cec5SDimitry Andric bits<9> src0; 2620b57cec5SDimitry Andric 2630b57cec5SDimitry Andric let Inst{8-0} = src0; 2640b57cec5SDimitry Andric let Inst{16-9} = 0x2; 2650b57cec5SDimitry Andric let Inst{24-17} = vdst; 2660b57cec5SDimitry Andric let Inst{31-25} = 0x3f; //encoding 2670b57cec5SDimitry Andric} 2680b57cec5SDimitry Andric 269fe6060f1SDimitry Andriclet isReMaterializable = 1 in { 2700b57cec5SDimitry Andriclet SchedRW = [WriteDoubleCvt] in { 271fe6060f1SDimitry Andric// OMod clears exceptions when set in this instruction 272fe6060f1SDimitry Andricdefm V_CVT_I32_F64 : VOP1Inst <"v_cvt_i32_f64", VOP_I32_F64_SPECIAL_OMOD, fp_to_sint>; 2735ffd83dbSDimitry Andric 2745ffd83dbSDimitry Andriclet mayRaiseFPException = 0 in { 2750b57cec5SDimitry Andricdefm V_CVT_F64_I32 : VOP1Inst <"v_cvt_f64_i32", VOP1_F64_I32, sint_to_fp>; 2765ffd83dbSDimitry Andric} 2775ffd83dbSDimitry Andric 2780b57cec5SDimitry Andricdefm V_CVT_F32_F64 : VOP1Inst <"v_cvt_f32_f64", VOP_F32_F64, fpround>; 27906c3fb27SDimitry Andricdefm V_CVT_F64_F32 : VOP1Inst <"v_cvt_f64_f32", VOP_F64_F32, any_fpextend>; 280fe6060f1SDimitry Andric// OMod clears exceptions when set in this instruction 281fe6060f1SDimitry Andricdefm V_CVT_U32_F64 : VOP1Inst <"v_cvt_u32_f64", VOP_I32_F64_SPECIAL_OMOD, fp_to_uint>; 2825ffd83dbSDimitry Andric 2835ffd83dbSDimitry Andriclet mayRaiseFPException = 0 in { 2840b57cec5SDimitry Andricdefm V_CVT_F64_U32 : VOP1Inst <"v_cvt_f64_u32", VOP1_F64_I32, uint_to_fp>; 2855ffd83dbSDimitry Andric} 2865ffd83dbSDimitry Andric 2870b57cec5SDimitry Andric} // End SchedRW = [WriteDoubleCvt] 2880b57cec5SDimitry Andric 2895ffd83dbSDimitry Andriclet SchedRW = [WriteFloatCvt] in { 2905ffd83dbSDimitry Andric 2915ffd83dbSDimitry Andric// XXX: Does this really not raise exceptions? The manual claims the 2925ffd83dbSDimitry Andric// 16-bit ones can. 2935ffd83dbSDimitry Andriclet mayRaiseFPException = 0 in { 2940b57cec5SDimitry Andricdefm V_CVT_F32_I32 : VOP1Inst <"v_cvt_f32_i32", VOP1_F32_I32, sint_to_fp>; 2950b57cec5SDimitry Andricdefm V_CVT_F32_U32 : VOP1Inst <"v_cvt_f32_u32", VOP1_F32_I32, uint_to_fp>; 2965ffd83dbSDimitry Andric} 2975ffd83dbSDimitry Andric 298fe6060f1SDimitry Andric// OMod clears exceptions when set in these 2 instructions 299fe6060f1SDimitry Andricdefm V_CVT_U32_F32 : VOP1Inst <"v_cvt_u32_f32", VOP_I32_F32_SPECIAL_OMOD, fp_to_uint>; 300fe6060f1SDimitry Andricdefm V_CVT_I32_F32 : VOP1Inst <"v_cvt_i32_f32", VOP_I32_F32_SPECIAL_OMOD, fp_to_sint>; 301fe6060f1SDimitry Andriclet FPDPRounding = 1, isReMaterializable = 0 in { 302bdd1243dSDimitry Andric let OtherPredicates = [NotHasTrue16BitInsts] in 30306c3fb27SDimitry Andric defm V_CVT_F16_F32 : VOP1Inst <"v_cvt_f16_f32", VOP_F16_F32, any_fpround>; 304bdd1243dSDimitry Andric let OtherPredicates = [HasTrue16BitInsts] in 3055f757f3fSDimitry Andric defm V_CVT_F16_F32_t16 : VOP1Inst <"v_cvt_f16_f32_t16", VOPProfile_Fake16<VOP_F16_F32>, any_fpround>; 306fe6060f1SDimitry Andric} // End FPDPRounding = 1, isReMaterializable = 0 3075ffd83dbSDimitry Andric 308bdd1243dSDimitry Andriclet OtherPredicates = [NotHasTrue16BitInsts] in 30906c3fb27SDimitry Andricdefm V_CVT_F32_F16 : VOP1Inst <"v_cvt_f32_f16", VOP_F32_F16, any_fpextend>; 310bdd1243dSDimitry Andriclet OtherPredicates = [HasTrue16BitInsts] in 3115f757f3fSDimitry Andricdefm V_CVT_F32_F16_t16 : VOP1Inst <"v_cvt_f32_f16_t16", VOPProfile_Fake16<VOP_F32_F16>, any_fpextend>; 3125ffd83dbSDimitry Andric 3135ffd83dbSDimitry Andriclet ReadsModeReg = 0, mayRaiseFPException = 0 in { 3140b57cec5SDimitry Andricdefm V_CVT_RPI_I32_F32 : VOP1Inst <"v_cvt_rpi_i32_f32", VOP_I32_F32, cvt_rpi_i32_f32>; 3150b57cec5SDimitry Andricdefm V_CVT_FLR_I32_F32 : VOP1Inst <"v_cvt_flr_i32_f32", VOP_I32_F32, cvt_flr_i32_f32>; 3160b57cec5SDimitry Andricdefm V_CVT_OFF_F32_I4 : VOP1Inst <"v_cvt_off_f32_i4", VOP1_F32_I32>; 3175ffd83dbSDimitry Andric} // End ReadsModeReg = 0, mayRaiseFPException = 0 3185ffd83dbSDimitry Andric} // End SchedRW = [WriteFloatCvt] 3190b57cec5SDimitry Andric 3205ffd83dbSDimitry Andriclet ReadsModeReg = 0, mayRaiseFPException = 0 in { 3210b57cec5SDimitry Andricdefm V_CVT_F32_UBYTE0 : VOP1Inst <"v_cvt_f32_ubyte0", VOP1_F32_I32, AMDGPUcvt_f32_ubyte0>; 3220b57cec5SDimitry Andricdefm V_CVT_F32_UBYTE1 : VOP1Inst <"v_cvt_f32_ubyte1", VOP1_F32_I32, AMDGPUcvt_f32_ubyte1>; 3230b57cec5SDimitry Andricdefm V_CVT_F32_UBYTE2 : VOP1Inst <"v_cvt_f32_ubyte2", VOP1_F32_I32, AMDGPUcvt_f32_ubyte2>; 3240b57cec5SDimitry Andricdefm V_CVT_F32_UBYTE3 : VOP1Inst <"v_cvt_f32_ubyte3", VOP1_F32_I32, AMDGPUcvt_f32_ubyte3>; 3255ffd83dbSDimitry Andric} // ReadsModeReg = 0, mayRaiseFPException = 0 3260b57cec5SDimitry Andric 3270b57cec5SDimitry Andricdefm V_FRACT_F32 : VOP1Inst <"v_fract_f32", VOP_F32_F32, AMDGPUfract>; 3280b57cec5SDimitry Andricdefm V_TRUNC_F32 : VOP1Inst <"v_trunc_f32", VOP_F32_F32, ftrunc>; 3290b57cec5SDimitry Andricdefm V_CEIL_F32 : VOP1Inst <"v_ceil_f32", VOP_F32_F32, fceil>; 3305f757f3fSDimitry Andricdefm V_RNDNE_F32 : VOP1Inst <"v_rndne_f32", VOP_F32_F32, froundeven>; 3310b57cec5SDimitry Andricdefm V_FLOOR_F32 : VOP1Inst <"v_floor_f32", VOP_F32_F32, ffloor>; 3320b57cec5SDimitry Andric 333e8d8bef9SDimitry Andriclet TRANS = 1, SchedRW = [WriteTrans32] in { 33406c3fb27SDimitry Andricdefm V_EXP_F32 : VOP1Inst <"v_exp_f32", VOP_F32_F32, AMDGPUexp>; 33506c3fb27SDimitry Andricdefm V_LOG_F32 : VOP1Inst <"v_log_f32", VOP_F32_F32, AMDGPUlog>; 3360b57cec5SDimitry Andricdefm V_RCP_F32 : VOP1Inst <"v_rcp_f32", VOP_F32_F32, AMDGPUrcp>; 3370b57cec5SDimitry Andricdefm V_RCP_IFLAG_F32 : VOP1Inst <"v_rcp_iflag_f32", VOP_F32_F32, AMDGPUrcp_iflag>; 3380b57cec5SDimitry Andricdefm V_RSQ_F32 : VOP1Inst <"v_rsq_f32", VOP_F32_F32, AMDGPUrsq>; 3395f757f3fSDimitry Andricdefm V_SQRT_F32 : VOP1Inst <"v_sqrt_f32", VOP_F32_F32, int_amdgcn_sqrt>; 340e8d8bef9SDimitry Andric} // End TRANS = 1, SchedRW = [WriteTrans32] 3410b57cec5SDimitry Andric 342e8d8bef9SDimitry Andriclet TRANS = 1, SchedRW = [WriteTrans64] in { 3430b57cec5SDimitry Andricdefm V_RCP_F64 : VOP1Inst <"v_rcp_f64", VOP_F64_F64, AMDGPUrcp>; 3440b57cec5SDimitry Andricdefm V_RSQ_F64 : VOP1Inst <"v_rsq_f64", VOP_F64_F64, AMDGPUrsq>; 34506c3fb27SDimitry Andricdefm V_SQRT_F64 : VOP1Inst <"v_sqrt_f64", VOP_F64_F64, int_amdgcn_sqrt>; 346e8d8bef9SDimitry Andric} // End TRANS = 1, SchedRW = [WriteTrans64] 3470b57cec5SDimitry Andric 348e8d8bef9SDimitry Andriclet TRANS = 1, SchedRW = [WriteTrans32] in { 3490b57cec5SDimitry Andricdefm V_SIN_F32 : VOP1Inst <"v_sin_f32", VOP_F32_F32, AMDGPUsin>; 3500b57cec5SDimitry Andricdefm V_COS_F32 : VOP1Inst <"v_cos_f32", VOP_F32_F32, AMDGPUcos>; 351e8d8bef9SDimitry Andric} // End TRANS = 1, SchedRW = [WriteTrans32] 3520b57cec5SDimitry Andric 3530b57cec5SDimitry Andricdefm V_NOT_B32 : VOP1Inst <"v_not_b32", VOP_I32_I32>; 35481ad6265SDimitry Andricdefm V_BFREV_B32 : VOP1Inst <"v_bfrev_b32", VOP_I32_I32, DivergentUnaryFrag<bitreverse>>; 3558bcb0991SDimitry Andricdefm V_FFBH_U32 : VOP1Inst <"v_ffbh_u32", VOP_I32_I32, AMDGPUffbh_u32>; 3565ffd83dbSDimitry Andricdefm V_FFBL_B32 : VOP1Inst <"v_ffbl_b32", VOP_I32_I32, AMDGPUffbl_b32>; 3578bcb0991SDimitry Andricdefm V_FFBH_I32 : VOP1Inst <"v_ffbh_i32", VOP_I32_I32, AMDGPUffbh_i32>; 3580b57cec5SDimitry Andric 3590b57cec5SDimitry Andriclet SchedRW = [WriteDoubleAdd] in { 360fe6060f1SDimitry Andricdefm V_FREXP_EXP_I32_F64 : VOP1Inst <"v_frexp_exp_i32_f64", VOP_I32_F64_SPECIAL_OMOD, int_amdgcn_frexp_exp>; 3610b57cec5SDimitry Andricdefm V_FREXP_MANT_F64 : VOP1Inst <"v_frexp_mant_f64", VOP_F64_F64, int_amdgcn_frexp_mant>; 3620b57cec5SDimitry Andriclet FPDPRounding = 1 in { 3630b57cec5SDimitry Andricdefm V_FRACT_F64 : VOP1Inst <"v_fract_f64", VOP_F64_F64, AMDGPUfract>; 3640b57cec5SDimitry Andric} // End FPDPRounding = 1 3650b57cec5SDimitry Andric} // End SchedRW = [WriteDoubleAdd] 3660b57cec5SDimitry Andric 3670b57cec5SDimitry Andricdefm V_FREXP_EXP_I32_F32 : VOP1Inst <"v_frexp_exp_i32_f32", VOP_I32_F32, int_amdgcn_frexp_exp>; 3680b57cec5SDimitry Andricdefm V_FREXP_MANT_F32 : VOP1Inst <"v_frexp_mant_f32", VOP_F32_F32, int_amdgcn_frexp_mant>; 369fe6060f1SDimitry Andric} // End isReMaterializable = 1 3700b57cec5SDimitry Andric 3710b57cec5SDimitry Andriclet VOPAsmPrefer32Bit = 1 in { 3720b57cec5SDimitry Andricdefm V_CLREXCP : VOP1Inst <"v_clrexcp", VOP_NO_EXT<VOP_NONE>>; 3730b57cec5SDimitry Andric} 3740b57cec5SDimitry Andric 3750b57cec5SDimitry Andric// Restrict src0 to be VGPR 376480093f4SDimitry Andricdef VOP_MOVRELS : VOPProfile<[i32, i32, untyped, untyped]> { 3770b57cec5SDimitry Andric let Src0RC32 = VRegSrc_32; 3780b57cec5SDimitry Andric let Src0RC64 = VRegSrc_32; 3790b57cec5SDimitry Andric} 3800b57cec5SDimitry Andric 3810b57cec5SDimitry Andric// Special case because there are no true output operands. Hack vdst 3820b57cec5SDimitry Andric// to be a src operand. The custom inserter must add a tied implicit 3830b57cec5SDimitry Andric// def and use of the super register since there seems to be no way to 3840b57cec5SDimitry Andric// add an implicit def of a virtual register in tablegen. 385480093f4SDimitry Andricclass VOP_MOVREL<RegisterOperand Src1RC> : VOPProfile<[untyped, i32, untyped, untyped]> { 3860b57cec5SDimitry Andric let Src0RC32 = VOPDstOperand<VGPR_32>; 3870b57cec5SDimitry Andric let Src0RC64 = VOPDstOperand<VGPR_32>; 3880b57cec5SDimitry Andric 3890b57cec5SDimitry Andric let Outs = (outs); 390480093f4SDimitry Andric let Ins32 = (ins Src0RC32:$vdst, Src1RC:$src0); 391480093f4SDimitry Andric let Ins64 = (ins Src0RC64:$vdst, Src1RC:$src0); 3920b57cec5SDimitry Andric let Asm32 = getAsm32<1, 1>.ret; 393480093f4SDimitry Andric 394480093f4SDimitry Andric let OutsSDWA = (outs Src0RC32:$vdst); 395480093f4SDimitry Andric let InsSDWA = (ins Src0ModSDWA:$src0_modifiers, Src0SDWA:$src0, 396480093f4SDimitry Andric clampmod:$clamp, dst_sel:$dst_sel, dst_unused:$dst_unused, 397480093f4SDimitry Andric src0_sel:$src0_sel); 3980b57cec5SDimitry Andric let AsmSDWA9 = getAsmSDWA9<1, 0, 1>.ret; 3990b57cec5SDimitry Andric 400480093f4SDimitry Andric let OutsDPP = (outs Src0RC32:$vdst); 401480093f4SDimitry Andric let InsDPP16 = (ins Src0RC32:$old, Src0RC32:$src0, 402480093f4SDimitry Andric dpp_ctrl:$dpp_ctrl, row_mask:$row_mask, 403480093f4SDimitry Andric bank_mask:$bank_mask, bound_ctrl:$bound_ctrl, FI:$fi); 404480093f4SDimitry Andric let AsmDPP16 = getAsmDPP16<1, 1, 0>.ret; 405480093f4SDimitry Andric let InsDPP8 = (ins Src0RC32:$old, Src0RC32:$src0, dpp8:$dpp8, FI:$fi); 406480093f4SDimitry Andric let AsmDPP8 = getAsmDPP8<1, 1, 0>.ret; 4070b57cec5SDimitry Andric 408bdd1243dSDimitry Andric let OutsVOP3DPP = (outs Src0RC64:$vdst); 409bdd1243dSDimitry Andric let InsVOP3DPP = getInsVOP3DPP<InsVOP3Base, Src0RC64, NumSrcArgs>.ret; 410bdd1243dSDimitry Andric let InsVOP3DPP16 = getInsVOP3DPP16<InsVOP3Base, Src0RC64, NumSrcArgs>.ret; 411bdd1243dSDimitry Andric let InsVOP3DPP8 = getInsVOP3DPP8<InsVOP3Base, Src0RC64, NumSrcArgs>.ret; 412bdd1243dSDimitry Andric 413bdd1243dSDimitry Andric let AsmVOP3Base = 414bdd1243dSDimitry Andric getAsmVOP3Base<NumSrcArgs, 1 /* HasDst */, HasClamp, 415bdd1243dSDimitry Andric HasOpSel, HasOMod, IsVOP3P, HasModifiers, 416bdd1243dSDimitry Andric HasModifiers, HasModifiers, HasModifiers>.ret; 417bdd1243dSDimitry Andric 4180b57cec5SDimitry Andric let HasDst = 0; 4190b57cec5SDimitry Andric let EmitDst = 1; // force vdst emission 4200b57cec5SDimitry Andric} 4210b57cec5SDimitry Andric 422480093f4SDimitry Andricdef VOP_MOVRELD : VOP_MOVREL<VSrc_b32>; 423480093f4SDimitry Andricdef VOP_MOVRELSD : VOP_MOVREL<VRegSrc_32>; 424480093f4SDimitry Andric 4250b57cec5SDimitry Andriclet SubtargetPredicate = HasMovrel, Uses = [M0, EXEC] in { 4260b57cec5SDimitry Andric // v_movreld_b32 is a special case because the destination output 4270b57cec5SDimitry Andric // register is really a source. It isn't actually read (but may be 4280b57cec5SDimitry Andric // written), and is only to provide the base register to start 4290b57cec5SDimitry Andric // indexing from. Tablegen seems to not let you define an implicit 4300b57cec5SDimitry Andric // virtual register output for the super register being written into, 4310b57cec5SDimitry Andric // so this must have an implicit def of the register added to it. 4320b57cec5SDimitry Andricdefm V_MOVRELD_B32 : VOP1Inst <"v_movreld_b32", VOP_MOVRELD>; 433480093f4SDimitry Andricdefm V_MOVRELS_B32 : VOP1Inst <"v_movrels_b32", VOP_MOVRELS>; 434480093f4SDimitry Andricdefm V_MOVRELSD_B32 : VOP1Inst <"v_movrelsd_b32", VOP_MOVRELSD>; 4350b57cec5SDimitry Andric} // End Uses = [M0, EXEC] 4360b57cec5SDimitry Andric 437fe6060f1SDimitry Andriclet isReMaterializable = 1 in { 4380b57cec5SDimitry Andriclet SubtargetPredicate = isGFX6GFX7 in { 439e8d8bef9SDimitry Andric let TRANS = 1, SchedRW = [WriteTrans32] in { 4400b57cec5SDimitry Andric defm V_LOG_CLAMP_F32 : 4410b57cec5SDimitry Andric VOP1Inst<"v_log_clamp_f32", VOP_F32_F32, int_amdgcn_log_clamp>; 4420b57cec5SDimitry Andric defm V_RCP_CLAMP_F32 : 4430b57cec5SDimitry Andric VOP1Inst<"v_rcp_clamp_f32", VOP_F32_F32>; 4440b57cec5SDimitry Andric defm V_RCP_LEGACY_F32 : 4450b57cec5SDimitry Andric VOP1Inst<"v_rcp_legacy_f32", VOP_F32_F32, AMDGPUrcp_legacy>; 4460b57cec5SDimitry Andric defm V_RSQ_CLAMP_F32 : 4470b57cec5SDimitry Andric VOP1Inst<"v_rsq_clamp_f32", VOP_F32_F32, AMDGPUrsq_clamp>; 4480b57cec5SDimitry Andric defm V_RSQ_LEGACY_F32 : 4495ffd83dbSDimitry Andric VOP1Inst<"v_rsq_legacy_f32", VOP_F32_F32, int_amdgcn_rsq_legacy>; 450e8d8bef9SDimitry Andric } // End TRANS = 1, SchedRW = [WriteTrans32] 4510b57cec5SDimitry Andric 452fe6060f1SDimitry Andric let SchedRW = [WriteTrans64] in { 4530b57cec5SDimitry Andric defm V_RCP_CLAMP_F64 : 4540b57cec5SDimitry Andric VOP1Inst<"v_rcp_clamp_f64", VOP_F64_F64>; 4550b57cec5SDimitry Andric defm V_RSQ_CLAMP_F64 : 4560b57cec5SDimitry Andric VOP1Inst<"v_rsq_clamp_f64", VOP_F64_F64, AMDGPUrsq_clamp>; 457fe6060f1SDimitry Andric } // End SchedRW = [WriteTrans64] 4580b57cec5SDimitry Andric} // End SubtargetPredicate = isGFX6GFX7 4590b57cec5SDimitry Andric 4600b57cec5SDimitry Andriclet SubtargetPredicate = isGFX7GFX8GFX9 in { 461e8d8bef9SDimitry Andric let TRANS = 1, SchedRW = [WriteTrans32] in { 4620b57cec5SDimitry Andric defm V_LOG_LEGACY_F32 : VOP1Inst<"v_log_legacy_f32", VOP_F32_F32>; 4630b57cec5SDimitry Andric defm V_EXP_LEGACY_F32 : VOP1Inst<"v_exp_legacy_f32", VOP_F32_F32>; 464e8d8bef9SDimitry Andric } // End TRANS = 1, SchedRW = [WriteTrans32] 4650b57cec5SDimitry Andric} // End SubtargetPredicate = isGFX7GFX8GFX9 4660b57cec5SDimitry Andric 4670b57cec5SDimitry Andriclet SubtargetPredicate = isGFX7Plus in { 4680b57cec5SDimitry Andric let SchedRW = [WriteDoubleAdd] in { 4690b57cec5SDimitry Andric defm V_TRUNC_F64 : VOP1Inst<"v_trunc_f64", VOP_F64_F64, ftrunc>; 4700b57cec5SDimitry Andric defm V_CEIL_F64 : VOP1Inst<"v_ceil_f64", VOP_F64_F64, fceil>; 4715f757f3fSDimitry Andric defm V_RNDNE_F64 : VOP1Inst<"v_rndne_f64", VOP_F64_F64, froundeven>; 4720b57cec5SDimitry Andric defm V_FLOOR_F64 : VOP1Inst<"v_floor_f64", VOP_F64_F64, ffloor>; 4730b57cec5SDimitry Andric } // End SchedRW = [WriteDoubleAdd] 4740b57cec5SDimitry Andric} // End SubtargetPredicate = isGFX7Plus 475fe6060f1SDimitry Andric} // End isReMaterializable = 1 4760b57cec5SDimitry Andric 4770b57cec5SDimitry Andriclet FPDPRounding = 1 in { 478bdd1243dSDimitry Andriclet OtherPredicates = [Has16BitInsts, NotHasTrue16BitInsts] in { 4790b57cec5SDimitry Andricdefm V_CVT_F16_U16 : VOP1Inst <"v_cvt_f16_u16", VOP1_F16_I16, uint_to_fp>; 4800b57cec5SDimitry Andricdefm V_CVT_F16_I16 : VOP1Inst <"v_cvt_f16_i16", VOP1_F16_I16, sint_to_fp>; 481bdd1243dSDimitry Andric} 482bdd1243dSDimitry Andriclet OtherPredicates = [HasTrue16BitInsts] in { 483bdd1243dSDimitry Andricdefm V_CVT_F16_U16_t16 : VOP1Inst <"v_cvt_f16_u16_t16", VOP1_F16_I16_t16, uint_to_fp>; 484bdd1243dSDimitry Andricdefm V_CVT_F16_I16_t16 : VOP1Inst <"v_cvt_f16_i16_t16", VOP1_F16_I16_t16, sint_to_fp>; 485bdd1243dSDimitry Andric} 4860b57cec5SDimitry Andric} // End FPDPRounding = 1 487fe6060f1SDimitry Andric// OMod clears exceptions when set in these two instructions 488bdd1243dSDimitry Andriclet OtherPredicates = [Has16BitInsts, NotHasTrue16BitInsts] in { 489fe6060f1SDimitry Andricdefm V_CVT_U16_F16 : VOP1Inst <"v_cvt_u16_f16", VOP_I16_F16_SPECIAL_OMOD, fp_to_uint>; 490fe6060f1SDimitry Andricdefm V_CVT_I16_F16 : VOP1Inst <"v_cvt_i16_f16", VOP_I16_F16_SPECIAL_OMOD, fp_to_sint>; 491bdd1243dSDimitry Andric} 492bdd1243dSDimitry Andriclet OtherPredicates = [HasTrue16BitInsts] in { 493bdd1243dSDimitry Andricdefm V_CVT_U16_F16_t16 : VOP1Inst <"v_cvt_u16_f16_t16", VOP_I16_F16_SPECIAL_OMOD_t16, fp_to_uint>; 494bdd1243dSDimitry Andricdefm V_CVT_I16_F16_t16 : VOP1Inst <"v_cvt_i16_f16_t16", VOP_I16_F16_SPECIAL_OMOD_t16, fp_to_sint>; 495bdd1243dSDimitry Andric} 496e8d8bef9SDimitry Andriclet TRANS = 1, SchedRW = [WriteTrans32] in { 497bdd1243dSDimitry Andricdefm V_RCP_F16 : VOP1Inst_t16 <"v_rcp_f16", VOP_F16_F16, AMDGPUrcp>; 498bdd1243dSDimitry Andricdefm V_SQRT_F16 : VOP1Inst_t16 <"v_sqrt_f16", VOP_F16_F16, any_amdgcn_sqrt>; 499bdd1243dSDimitry Andricdefm V_RSQ_F16 : VOP1Inst_t16 <"v_rsq_f16", VOP_F16_F16, AMDGPUrsq>; 50006c3fb27SDimitry Andricdefm V_LOG_F16 : VOP1Inst_t16 <"v_log_f16", VOP_F16_F16, AMDGPUlogf16>; 50106c3fb27SDimitry Andricdefm V_EXP_F16 : VOP1Inst_t16 <"v_exp_f16", VOP_F16_F16, AMDGPUexpf16>; 502bdd1243dSDimitry Andricdefm V_SIN_F16 : VOP1Inst_t16 <"v_sin_f16", VOP_F16_F16, AMDGPUsin>; 503bdd1243dSDimitry Andricdefm V_COS_F16 : VOP1Inst_t16 <"v_cos_f16", VOP_F16_F16, AMDGPUcos>; 504e8d8bef9SDimitry Andric} // End TRANS = 1, SchedRW = [WriteTrans32] 505bdd1243dSDimitry Andricdefm V_FREXP_MANT_F16 : VOP1Inst_t16 <"v_frexp_mant_f16", VOP_F16_F16, int_amdgcn_frexp_mant>; 506bdd1243dSDimitry Andriclet OtherPredicates = [Has16BitInsts, NotHasTrue16BitInsts] in { 507fe6060f1SDimitry Andricdefm V_FREXP_EXP_I16_F16 : VOP1Inst <"v_frexp_exp_i16_f16", VOP_I16_F16_SPECIAL_OMOD, int_amdgcn_frexp_exp>; 508bdd1243dSDimitry Andric} 509bdd1243dSDimitry Andriclet OtherPredicates = [HasTrue16BitInsts] in { 510bdd1243dSDimitry Andricdefm V_FREXP_EXP_I16_F16_t16 : VOP1Inst <"v_frexp_exp_i16_f16_t16", VOP_I16_F16_SPECIAL_OMOD_t16, int_amdgcn_frexp_exp>; 511bdd1243dSDimitry Andric} 512bdd1243dSDimitry Andricdefm V_FLOOR_F16 : VOP1Inst_t16 <"v_floor_f16", VOP_F16_F16, ffloor>; 513bdd1243dSDimitry Andricdefm V_CEIL_F16 : VOP1Inst_t16 <"v_ceil_f16", VOP_F16_F16, fceil>; 514bdd1243dSDimitry Andricdefm V_TRUNC_F16 : VOP1Inst_t16 <"v_trunc_f16", VOP_F16_F16, ftrunc>; 5155f757f3fSDimitry Andricdefm V_RNDNE_F16 : VOP1Inst_t16 <"v_rndne_f16", VOP_F16_F16, froundeven>; 5160b57cec5SDimitry Andriclet FPDPRounding = 1 in { 517bdd1243dSDimitry Andricdefm V_FRACT_F16 : VOP1Inst_t16 <"v_fract_f16", VOP_F16_F16, AMDGPUfract>; 5180b57cec5SDimitry Andric} // End FPDPRounding = 1 5190b57cec5SDimitry Andric 520bdd1243dSDimitry Andriclet OtherPredicates = [Has16BitInsts, NotHasTrue16BitInsts] in { 5210b57cec5SDimitry Andricdef : GCNPat< 5220b57cec5SDimitry Andric (f32 (f16_to_fp i16:$src)), 5230b57cec5SDimitry Andric (V_CVT_F32_F16_e32 $src) 5240b57cec5SDimitry Andric>; 5250b57cec5SDimitry Andricdef : GCNPat< 5260b57cec5SDimitry Andric (i16 (AMDGPUfp_to_f16 f32:$src)), 5270b57cec5SDimitry Andric (V_CVT_F16_F32_e32 $src) 5280b57cec5SDimitry Andric>; 529bdd1243dSDimitry Andric} 530bdd1243dSDimitry Andriclet OtherPredicates = [HasTrue16BitInsts] in { 531bdd1243dSDimitry Andricdef : GCNPat< 532bdd1243dSDimitry Andric (f32 (f16_to_fp i16:$src)), 533bdd1243dSDimitry Andric (V_CVT_F32_F16_t16_e32 $src) 534bdd1243dSDimitry Andric>; 535bdd1243dSDimitry Andricdef : GCNPat< 536bdd1243dSDimitry Andric (i16 (AMDGPUfp_to_f16 f32:$src)), 537bdd1243dSDimitry Andric (V_CVT_F16_F32_t16_e32 $src) 538bdd1243dSDimitry Andric>; 5390b57cec5SDimitry Andric} 5400b57cec5SDimitry Andric 54106c3fb27SDimitry Andricdef VOP_SWAP_I32 : VOPProfile<[i32, i32, untyped, untyped]> { 54206c3fb27SDimitry Andric let Outs32 = (outs VGPR_32:$vdst, VRegSrc_32:$vdst1); 54306c3fb27SDimitry Andric let Ins32 = (ins VRegSrc_32:$src0, VGPR_32:$src1); 5440b57cec5SDimitry Andric let Asm32 = " $vdst, $src0"; 5450b57cec5SDimitry Andric} 5460b57cec5SDimitry Andric 5470b57cec5SDimitry Andriclet SubtargetPredicate = isGFX9Plus in { 5480b57cec5SDimitry Andric def V_SWAP_B32 : VOP1_Pseudo<"v_swap_b32", VOP_SWAP_I32, [], 1> { 5490b57cec5SDimitry Andric let Constraints = "$vdst = $src1, $vdst1 = $src0"; 5500b57cec5SDimitry Andric let DisableEncoding = "$vdst1,$src1"; 5510b57cec5SDimitry Andric let SchedRW = [Write64Bit, Write64Bit]; 5520b57cec5SDimitry Andric } 5530b57cec5SDimitry Andric 554fe6060f1SDimitry Andric let isReMaterializable = 1 in 555bdd1243dSDimitry Andric defm V_SAT_PK_U8_I16 : VOP1Inst_t16<"v_sat_pk_u8_i16", VOP_I16_I32>; 5565ffd83dbSDimitry Andric 5575ffd83dbSDimitry Andric let mayRaiseFPException = 0 in { 558bdd1243dSDimitry Andric let OtherPredicates = [Has16BitInsts, NotHasTrue16BitInsts] in { 559fe6060f1SDimitry Andric defm V_CVT_NORM_I16_F16 : VOP1Inst<"v_cvt_norm_i16_f16", VOP_I16_F16_SPECIAL_OMOD>; 560fe6060f1SDimitry Andric defm V_CVT_NORM_U16_F16 : VOP1Inst<"v_cvt_norm_u16_f16", VOP_I16_F16_SPECIAL_OMOD>; 561bdd1243dSDimitry Andric } 562bdd1243dSDimitry Andric let OtherPredicates = [HasTrue16BitInsts] in { 563bdd1243dSDimitry Andric defm V_CVT_NORM_I16_F16_t16 : VOP1Inst<"v_cvt_norm_i16_f16_t16", VOP_I16_F16_SPECIAL_OMOD_t16>; 564bdd1243dSDimitry Andric defm V_CVT_NORM_U16_F16_t16 : VOP1Inst<"v_cvt_norm_u16_f16_t16", VOP_I16_F16_SPECIAL_OMOD_t16>; 565bdd1243dSDimitry Andric } 5665ffd83dbSDimitry Andric } // End mayRaiseFPException = 0 5670b57cec5SDimitry Andric} // End SubtargetPredicate = isGFX9Plus 5680b57cec5SDimitry Andric 5690b57cec5SDimitry Andriclet SubtargetPredicate = isGFX9Only in { 5700b57cec5SDimitry Andric defm V_SCREEN_PARTITION_4SE_B32 : VOP1Inst <"v_screen_partition_4se_b32", VOP_I32_I32>; 5710b57cec5SDimitry Andric} // End SubtargetPredicate = isGFX9Only 5720b57cec5SDimitry Andric 573fcaf7f86SDimitry Andricclass VOPProfile_Base_CVT_F32_F8<ValueType vt> : VOPProfileI2F <vt, i32> { 574fcaf7f86SDimitry Andric let HasExtSDWA = 1; 575fcaf7f86SDimitry Andric let HasExtSDWA9 = 1; 576fcaf7f86SDimitry Andric let HasExt = 1; 577fcaf7f86SDimitry Andric let DstRCSDWA = getVALUDstForVT<vt>.ret; 578fcaf7f86SDimitry Andric let InsSDWA = (ins Bin32SDWAInputMods:$src0_modifiers, Src0SDWA:$src0, 579fcaf7f86SDimitry Andric clampmod:$clamp, omod:$omod, src0_sel:$src0_sel); 580fcaf7f86SDimitry Andric let AsmSDWA = "$vdst, $src0_modifiers$clamp$omod $src0_sel"; // No dst_sel 581fcaf7f86SDimitry Andric let AsmSDWA9 = AsmSDWA; 582fcaf7f86SDimitry Andric let EmitDstSel = 0; 583fcaf7f86SDimitry Andric} 584fcaf7f86SDimitry Andric 585fcaf7f86SDimitry Andricdef VOPProfileCVT_F32_F8 : VOPProfile_Base_CVT_F32_F8 <f32>; 586fcaf7f86SDimitry Andricdef VOPProfileCVT_PK_F32_F8 : VOPProfile_Base_CVT_F32_F8 <v2f32>; 587fcaf7f86SDimitry Andric 588*7a6dacacSDimitry Andriclet SubtargetPredicate = HasFP8ConversionInsts, mayRaiseFPException = 0, 589fcaf7f86SDimitry Andric SchedRW = [WriteFloatCvt] in { 590fcaf7f86SDimitry Andric defm V_CVT_F32_FP8 : VOP1Inst<"v_cvt_f32_fp8", VOPProfileCVT_F32_F8>; 591fcaf7f86SDimitry Andric defm V_CVT_F32_BF8 : VOP1Inst<"v_cvt_f32_bf8", VOPProfileCVT_F32_F8>; 592fcaf7f86SDimitry Andric defm V_CVT_PK_F32_FP8 : VOP1Inst<"v_cvt_pk_f32_fp8", VOPProfileCVT_PK_F32_F8>; 593fcaf7f86SDimitry Andric defm V_CVT_PK_F32_BF8 : VOP1Inst<"v_cvt_pk_f32_bf8", VOPProfileCVT_PK_F32_F8>; 594fcaf7f86SDimitry Andric} 595fcaf7f86SDimitry Andric 596fcaf7f86SDimitry Andricclass Cvt_F32_F8_Pat<SDPatternOperator node, int index, 5975f757f3fSDimitry Andric VOP1_SDWA_Pseudo inst_sdwa> : GCNPat< 598fcaf7f86SDimitry Andric (f32 (node i32:$src, index)), 5995f757f3fSDimitry Andric (inst_sdwa 0, $src, 0, 0, index) 600fcaf7f86SDimitry Andric>; 601fcaf7f86SDimitry Andric 6025f757f3fSDimitry Andriclet OtherPredicates = [HasCvtFP8VOP1Bug] in { 6035f757f3fSDimitry Andric def : GCNPat<(f32 (int_amdgcn_cvt_f32_fp8 i32:$src, 0)), 6045f757f3fSDimitry Andric (V_CVT_F32_FP8_sdwa 0, $src, 0, 0, 0)>; 6055f757f3fSDimitry Andric def : GCNPat<(f32 (int_amdgcn_cvt_f32_bf8 i32:$src, 0)), 6065f757f3fSDimitry Andric (V_CVT_F32_BF8_sdwa 0, $src, 0, 0, 0)>; 6075f757f3fSDimitry Andric} 6085f757f3fSDimitry Andric 6095f757f3fSDimitry Andriclet OtherPredicates = [HasNoCvtFP8VOP1Bug] in { 6105f757f3fSDimitry Andric def : GCNPat<(f32 (int_amdgcn_cvt_f32_fp8 i32:$src, 0)), 6115f757f3fSDimitry Andric (V_CVT_F32_FP8_e32 $src)>; 6125f757f3fSDimitry Andric def : GCNPat<(f32 (int_amdgcn_cvt_f32_bf8 i32:$src, 0)), 6135f757f3fSDimitry Andric (V_CVT_F32_BF8_e32 $src)>; 6145f757f3fSDimitry Andric} 6155f757f3fSDimitry Andric 6165f757f3fSDimitry Andricforeach Index = [1, 2, 3] in { 6175f757f3fSDimitry Andric def : Cvt_F32_F8_Pat<int_amdgcn_cvt_f32_fp8, Index, V_CVT_F32_FP8_sdwa>; 6185f757f3fSDimitry Andric def : Cvt_F32_F8_Pat<int_amdgcn_cvt_f32_bf8, Index, V_CVT_F32_BF8_sdwa>; 619fcaf7f86SDimitry Andric} 620fcaf7f86SDimitry Andric 621fcaf7f86SDimitry Andricclass Cvt_PK_F32_F8_Pat<SDPatternOperator node, int index, 622fcaf7f86SDimitry Andric VOP1_Pseudo inst_e32, VOP1_SDWA_Pseudo inst_sdwa> : GCNPat< 623fcaf7f86SDimitry Andric (v2f32 (node i32:$src, index)), 624fcaf7f86SDimitry Andric !if (index, 625fcaf7f86SDimitry Andric (inst_sdwa 0, $src, 0, 0, SDWA.WORD_1), 626fcaf7f86SDimitry Andric (inst_e32 $src)) 627fcaf7f86SDimitry Andric>; 628fcaf7f86SDimitry Andric 629fcaf7f86SDimitry Andricforeach Index = [0, -1] in { 630fcaf7f86SDimitry Andric def : Cvt_PK_F32_F8_Pat<int_amdgcn_cvt_pk_f32_fp8, Index, 631fcaf7f86SDimitry Andric V_CVT_PK_F32_FP8_e32, V_CVT_PK_F32_FP8_sdwa>; 632fcaf7f86SDimitry Andric def : Cvt_PK_F32_F8_Pat<int_amdgcn_cvt_pk_f32_bf8, Index, 633fcaf7f86SDimitry Andric V_CVT_PK_F32_BF8_e32, V_CVT_PK_F32_BF8_sdwa>; 634fcaf7f86SDimitry Andric} 635fcaf7f86SDimitry Andric 6360b57cec5SDimitry Andriclet SubtargetPredicate = isGFX10Plus in { 63781ad6265SDimitry Andric defm V_PIPEFLUSH : VOP1Inst<"v_pipeflush", VOP_NO_EXT<VOP_NONE>>; 6380b57cec5SDimitry Andric 6390b57cec5SDimitry Andric let Uses = [M0] in { 6400b57cec5SDimitry Andric defm V_MOVRELSD_2_B32 : 641480093f4SDimitry Andric VOP1Inst<"v_movrelsd_2_b32", VOP_MOVRELSD>; 6420b57cec5SDimitry Andric 6430b57cec5SDimitry Andric def V_SWAPREL_B32 : VOP1_Pseudo<"v_swaprel_b32", VOP_SWAP_I32, [], 1> { 6440b57cec5SDimitry Andric let Constraints = "$vdst = $src1, $vdst1 = $src0"; 6450b57cec5SDimitry Andric let DisableEncoding = "$vdst1,$src1"; 6460b57cec5SDimitry Andric let SchedRW = [Write64Bit, Write64Bit]; 6470b57cec5SDimitry Andric } 6480b57cec5SDimitry Andric } // End Uses = [M0] 6490b57cec5SDimitry Andric} // End SubtargetPredicate = isGFX10Plus 6500b57cec5SDimitry Andric 651fe6060f1SDimitry Andricdef VOPProfileAccMov : VOP_NO_EXT<VOP_I32_I32> { 652fe6060f1SDimitry Andric let DstRC = RegisterOperand<AGPR_32>; 65306c3fb27SDimitry Andric let Src0RC32 = ARegSrc_32; 654fe6060f1SDimitry Andric let Asm32 = " $vdst, $src0"; 655fe6060f1SDimitry Andric} 656fe6060f1SDimitry Andric 657fe6060f1SDimitry Andricdef V_ACCVGPR_MOV_B32 : VOP1_Pseudo<"v_accvgpr_mov_b32", VOPProfileAccMov, [], 1> { 658fe6060f1SDimitry Andric let SubtargetPredicate = isGFX90APlus; 659fe6060f1SDimitry Andric let isReMaterializable = 1; 660fe6060f1SDimitry Andric let isAsCheapAsAMove = 1; 661fe6060f1SDimitry Andric} 662fe6060f1SDimitry Andric 66381ad6265SDimitry Andriclet SubtargetPredicate = isGFX11Plus in { 66481ad6265SDimitry Andric // Restrict src0 to be VGPR 66581ad6265SDimitry Andric def V_PERMLANE64_B32 : VOP1_Pseudo<"v_permlane64_b32", VOP_MOVRELS, 66681ad6265SDimitry Andric getVOP1Pat64<int_amdgcn_permlane64, 66781ad6265SDimitry Andric VOP_MOVRELS>.ret, 66881ad6265SDimitry Andric /*VOP1Only=*/ 1>; 6695f757f3fSDimitry Andric defm V_MOV_B16_t16 : VOP1Inst<"v_mov_b16_t16", VOPProfile_True16<VOP_I16_I16>>; 670bdd1243dSDimitry Andric defm V_NOT_B16 : VOP1Inst_t16<"v_not_b16", VOP_I16_I16>; 671bdd1243dSDimitry Andric defm V_CVT_I32_I16 : VOP1Inst_t16<"v_cvt_i32_i16", VOP_I32_I16>; 672bdd1243dSDimitry Andric defm V_CVT_U32_U16 : VOP1Inst_t16<"v_cvt_u32_u16", VOP_I32_I16>; 67381ad6265SDimitry Andric} // End SubtargetPredicate = isGFX11Plus 67481ad6265SDimitry Andric 6750b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 6760b57cec5SDimitry Andric// Target-specific instruction encodings. 6770b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 6780b57cec5SDimitry Andric 6798bcb0991SDimitry Andricclass VOP1_DPP<bits<8> op, VOP1_DPP_Pseudo ps, VOPProfile p = ps.Pfl, bit isDPP16 = 0> : 6800b57cec5SDimitry Andric VOP_DPP<ps.OpName, p, isDPP16> { 6810b57cec5SDimitry Andric let hasSideEffects = ps.hasSideEffects; 6820b57cec5SDimitry Andric let Defs = ps.Defs; 6830b57cec5SDimitry Andric let SchedRW = ps.SchedRW; 6840b57cec5SDimitry Andric let Uses = ps.Uses; 685fe6060f1SDimitry Andric let TRANS = ps.TRANS; 686297eecfbSDimitry Andric let OtherPredicates = ps.OtherPredicates; 6870b57cec5SDimitry Andric 6880b57cec5SDimitry Andric bits<8> vdst; 6890b57cec5SDimitry Andric let Inst{8-0} = 0xfa; 6900b57cec5SDimitry Andric let Inst{16-9} = op; 6910b57cec5SDimitry Andric let Inst{24-17} = !if(p.EmitDst, vdst{7-0}, 0); 6920b57cec5SDimitry Andric let Inst{31-25} = 0x3f; 6930b57cec5SDimitry Andric} 6940b57cec5SDimitry Andric 69581ad6265SDimitry Andricclass VOP1_DPP16<bits<8> op, VOP1_DPP_Pseudo ps, int subtarget, VOPProfile p = ps.Pfl> : 6968bcb0991SDimitry Andric VOP1_DPP<op, ps, p, 1>, 69781ad6265SDimitry Andric SIMCInstr <ps.PseudoInstr, subtarget> { 6985ffd83dbSDimitry Andric let AssemblerPredicate = HasDPP16; 6990b57cec5SDimitry Andric let SubtargetPredicate = HasDPP16; 7000b57cec5SDimitry Andric} 7010b57cec5SDimitry Andric 7025f757f3fSDimitry Andricclass VOP1_DPP16_Gen<bits<8> op, VOP1_DPP_Pseudo ps, GFXGen Gen, VOPProfile p = ps.Pfl> : 7035f757f3fSDimitry Andric VOP1_DPP16 <op, ps, Gen.Subtarget, p> { 7045f757f3fSDimitry Andric let AssemblerPredicate = Gen.AssemblerPredicate; 7055f757f3fSDimitry Andric let DecoderNamespace = "DPP"#Gen.DecoderNamespace; 7065f757f3fSDimitry Andric} 7075f757f3fSDimitry Andric 7080b57cec5SDimitry Andricclass VOP1_DPP8<bits<8> op, VOP1_Pseudo ps, VOPProfile p = ps.Pfl> : 7090b57cec5SDimitry Andric VOP_DPP8<ps.OpName, p> { 7100b57cec5SDimitry Andric let hasSideEffects = ps.hasSideEffects; 7110b57cec5SDimitry Andric let Defs = ps.Defs; 7120b57cec5SDimitry Andric let SchedRW = ps.SchedRW; 7130b57cec5SDimitry Andric let Uses = ps.Uses; 714297eecfbSDimitry Andric let OtherPredicates = ps.OtherPredicates; 7150b57cec5SDimitry Andric 7160b57cec5SDimitry Andric bits<8> vdst; 7170b57cec5SDimitry Andric let Inst{8-0} = fi; 7180b57cec5SDimitry Andric let Inst{16-9} = op; 7190b57cec5SDimitry Andric let Inst{24-17} = !if(p.EmitDst, vdst{7-0}, 0); 7200b57cec5SDimitry Andric let Inst{31-25} = 0x3f; 7210b57cec5SDimitry Andric} 7220b57cec5SDimitry Andric 7235f757f3fSDimitry Andricclass VOP1_DPP8_Gen<bits<8> op, VOP1_Pseudo ps, GFXGen Gen, VOPProfile p = ps.Pfl> : 7245f757f3fSDimitry Andric VOP1_DPP8<op, ps, p> { 7255f757f3fSDimitry Andric let AssemblerPredicate = Gen.AssemblerPredicate; 7265f757f3fSDimitry Andric let DecoderNamespace = "DPP8"#Gen.DecoderNamespace; 7275f757f3fSDimitry Andric} 7285f757f3fSDimitry Andric 7290b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 7305f757f3fSDimitry Andric// GFX11, GFX12 73181ad6265SDimitry Andric//===----------------------------------------------------------------------===// 73281ad6265SDimitry Andric 7335f757f3fSDimitry Andricmulticlass VOP1Only_Real<GFXGen Gen, bits<9> op> { 73481ad6265SDimitry Andric let IsSingle = 1 in 7355f757f3fSDimitry Andric def Gen.Suffix : 7365f757f3fSDimitry Andric VOP1_Real_Gen<!cast<VOP1_Pseudo>(NAME), Gen>, 73781ad6265SDimitry Andric VOP1e<op{7-0}, !cast<VOP1_Pseudo>(NAME).Pfl>; 73881ad6265SDimitry Andric} 7395f757f3fSDimitry Andric 7405f757f3fSDimitry Andricmulticlass VOP1_Real_e32<GFXGen Gen, bits<9> op, string opName = NAME> { 74181ad6265SDimitry Andric defvar ps = !cast<VOP1_Pseudo>(opName#"_e32"); 7425f757f3fSDimitry Andric def _e32#Gen.Suffix : 7435f757f3fSDimitry Andric VOP1_Real_Gen<ps, Gen>, 74481ad6265SDimitry Andric VOP1e<op{7-0}, ps.Pfl>; 74581ad6265SDimitry Andric} 7465f757f3fSDimitry Andric 7475f757f3fSDimitry Andricmulticlass VOP1_Real_e32_with_name<GFXGen Gen, bits<9> op, string opName, 74881ad6265SDimitry Andric string asmName> { 74981ad6265SDimitry Andric defvar ps = !cast<VOP1_Pseudo>(opName#"_e32"); 750297eecfbSDimitry Andric let AsmString = asmName # ps.AsmOperands, 751297eecfbSDimitry Andric DecoderNamespace = Gen.DecoderNamespace # 752297eecfbSDimitry Andric !if(ps.Pfl.IsRealTrue16, "", "_FAKE16") in { 7535f757f3fSDimitry Andric defm NAME : VOP1_Real_e32<Gen, op, opName>; 75481ad6265SDimitry Andric } 75581ad6265SDimitry Andric} 75681ad6265SDimitry Andric 7575f757f3fSDimitry Andricmulticlass VOP1_Real_e64<GFXGen Gen, bits<9> op> { 7585f757f3fSDimitry Andric def _e64#Gen.Suffix : 7595f757f3fSDimitry Andric VOP3_Real_Gen<!cast<VOP3_Pseudo>(NAME#"_e64"), Gen>, 7605f757f3fSDimitry Andric VOP3e_gfx11_gfx12<{0, 1, 1, op{6-0}}, !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>; 76181ad6265SDimitry Andric} 7625f757f3fSDimitry Andric 7635f757f3fSDimitry Andricmulticlass VOP1_Real_dpp<GFXGen Gen, bits<9> op, string opName = NAME> { 7645f757f3fSDimitry Andric defvar ps = !cast<VOP1_Pseudo>(opName#"_e32"); 7655f757f3fSDimitry Andric def _dpp#Gen.Suffix : VOP1_DPP16_Gen<op{7-0}, !cast<VOP1_DPP_Pseudo>(opName#"_dpp"), Gen>; 7665f757f3fSDimitry Andric} 7675f757f3fSDimitry Andric 7685f757f3fSDimitry Andricmulticlass VOP1_Real_dpp_with_name<GFXGen Gen, bits<9> op, string opName, 76981ad6265SDimitry Andric string asmName> { 7705f757f3fSDimitry Andric defvar ps = !cast<VOP1_Pseudo>(opName#"_e32"); 771297eecfbSDimitry Andric let AsmString = asmName # ps.Pfl.AsmDPP16, 772297eecfbSDimitry Andric DecoderNamespace = "DPP" # Gen.DecoderNamespace # 773297eecfbSDimitry Andric !if(ps.Pfl.IsRealTrue16, "", "_FAKE16") in { 7745f757f3fSDimitry Andric defm NAME : VOP1_Real_dpp<Gen, op, opName>; 7755f757f3fSDimitry Andric } 7765f757f3fSDimitry Andric} 7775f757f3fSDimitry Andric 7785f757f3fSDimitry Andricmulticlass VOP1_Real_dpp8<GFXGen Gen, bits<9> op, string opName = NAME> { 7795f757f3fSDimitry Andric defvar ps = !cast<VOP1_Pseudo>(opName#"_e32"); 7805f757f3fSDimitry Andric def _dpp8#Gen.Suffix : VOP1_DPP8_Gen<op{7-0}, ps, Gen>; 7815f757f3fSDimitry Andric} 7825f757f3fSDimitry Andric 7835f757f3fSDimitry Andricmulticlass VOP1_Real_dpp8_with_name<GFXGen Gen, bits<9> op, string opName, 7845f757f3fSDimitry Andric string asmName> { 7855f757f3fSDimitry Andric defvar ps = !cast<VOP1_Pseudo>(opName#"_e32"); 786297eecfbSDimitry Andric let AsmString = asmName # ps.Pfl.AsmDPP8, 787297eecfbSDimitry Andric DecoderNamespace = "DPP8" # Gen.DecoderNamespace # 788297eecfbSDimitry Andric !if(ps.Pfl.IsRealTrue16, "", "_FAKE16") in { 7895f757f3fSDimitry Andric defm NAME : VOP1_Real_dpp8<Gen, op, opName>; 7905f757f3fSDimitry Andric } 7915f757f3fSDimitry Andric} 7925f757f3fSDimitry Andric 7935f757f3fSDimitry Andricmulticlass VOP1_Realtriple_e64<GFXGen Gen, bits<9> op> { 7945f757f3fSDimitry Andric defm NAME : VOP3_Realtriple<Gen, {0, 1, 1, op{6-0}}, /*isSingle=*/ 0, NAME>; 7955f757f3fSDimitry Andric} 7965f757f3fSDimitry Andric 7975f757f3fSDimitry Andricmulticlass VOP1_Realtriple_e64_with_name<GFXGen Gen, bits<9> op, string opName, 7985f757f3fSDimitry Andric string asmName> { 7995f757f3fSDimitry Andric defm NAME : VOP3_Realtriple_with_name<Gen, {0, 1, 1, op{6-0}}, opName, 80081ad6265SDimitry Andric asmName>; 80181ad6265SDimitry Andric} 80281ad6265SDimitry Andric 8035f757f3fSDimitry Andricmulticlass VOP1_Real_FULL<GFXGen Gen, bits<9> op> : 8045f757f3fSDimitry Andric VOP1_Real_e32<Gen, op>, VOP1_Realtriple_e64<Gen, op>, 8055f757f3fSDimitry Andric VOP1_Real_dpp<Gen, op>, VOP1_Real_dpp8<Gen, op>; 80681ad6265SDimitry Andric 80781ad6265SDimitry Andricmulticlass VOP1_Real_NO_VOP3_with_name_gfx11<bits<9> op, string opName, 808bdd1243dSDimitry Andric string asmName> { 8095f757f3fSDimitry Andric defm NAME : VOP1_Real_e32_with_name<GFX11Gen, op, opName, asmName>, 8105f757f3fSDimitry Andric VOP1_Real_dpp_with_name<GFX11Gen, op, opName, asmName>, 8115f757f3fSDimitry Andric VOP1_Real_dpp8_with_name<GFX11Gen, op, opName, asmName>; 812bdd1243dSDimitry Andric defvar ps = !cast<VOP1_Pseudo>(opName#"_e32"); 813bdd1243dSDimitry Andric def gfx11_alias : MnemonicAlias<ps.Mnemonic, asmName>, 814bdd1243dSDimitry Andric Requires<[isGFX11Plus]>; 815bdd1243dSDimitry Andric} 81681ad6265SDimitry Andric 8175f757f3fSDimitry Andricmulticlass VOP1_Real_NO_VOP3_with_name_gfx12<bits<9> op, string opName, 8185f757f3fSDimitry Andric string asmName> { 8195f757f3fSDimitry Andric defm NAME : VOP1_Real_e32_with_name<GFX12Gen, op, opName, asmName>, 8205f757f3fSDimitry Andric VOP1_Real_dpp_with_name<GFX12Gen, op, opName, asmName>, 8215f757f3fSDimitry Andric VOP1_Real_dpp8_with_name<GFX12Gen, op, opName, asmName>; 8225f757f3fSDimitry Andric} 8235f757f3fSDimitry Andric 8245f757f3fSDimitry Andricmulticlass VOP1_Real_FULL_with_name<GFXGen Gen, bits<9> op, string opName, 82581ad6265SDimitry Andric string asmName> : 8265f757f3fSDimitry Andric VOP1_Real_e32_with_name<Gen, op, opName, asmName>, 8275f757f3fSDimitry Andric VOP1_Real_dpp_with_name<Gen, op, opName, asmName>, 8285f757f3fSDimitry Andric VOP1_Real_dpp8_with_name<Gen, op, opName, asmName>, 8295f757f3fSDimitry Andric VOP1_Realtriple_e64_with_name<Gen, op, opName, asmName>; 83081ad6265SDimitry Andric 8315f757f3fSDimitry Andricmulticlass VOP1_Real_NO_DPP<GFXGen Gen, bits<9> op> : 8325f757f3fSDimitry Andric VOP1_Real_e32<Gen, op>, VOP1_Real_e64<Gen, op>; 8335f757f3fSDimitry Andric 8345f757f3fSDimitry Andricmulticlass VOP1_Real_FULL_t16_gfx11_gfx12<bits<9> op, string asmName, 835bdd1243dSDimitry Andric string opName = NAME> : 8365f757f3fSDimitry Andric VOP1_Real_FULL_with_name<GFX11Gen, op, opName, asmName>, 8375f757f3fSDimitry Andric VOP1_Real_FULL_with_name<GFX12Gen, op, opName, asmName>; 838bdd1243dSDimitry Andric 8395f757f3fSDimitry Andricmulticlass VOP1_Real_FULL_with_name_gfx11_gfx12<bits<9> op, string opName, 8405f757f3fSDimitry Andric string asmName> : 8415f757f3fSDimitry Andric VOP1_Real_FULL_with_name<GFX11Gen, op, opName, asmName>, 8425f757f3fSDimitry Andric VOP1_Real_FULL_with_name<GFX12Gen, op, opName, asmName>; 84381ad6265SDimitry Andric 8445f757f3fSDimitry Andricmulticlass VOP1Only_Real_gfx11_gfx12<bits<9> op> : 8455f757f3fSDimitry Andric VOP1Only_Real<GFX11Gen, op>, VOP1Only_Real<GFX12Gen, op>; 8465f757f3fSDimitry Andric 8475f757f3fSDimitry Andricmulticlass VOP1_Real_FULL_gfx11_gfx12<bits<9> op> : 8485f757f3fSDimitry Andric VOP1_Real_FULL<GFX11Gen, op>, VOP1_Real_FULL<GFX12Gen, op>; 8495f757f3fSDimitry Andric 8505f757f3fSDimitry Andricmulticlass VOP1_Real_NO_DPP_OP_SEL_with_name<GFXGen Gen, bits<9> op, 8515f757f3fSDimitry Andric string opName, string asmName> : 8525f757f3fSDimitry Andric VOP1_Real_e32_with_name<Gen, op, opName, asmName>, 8535f757f3fSDimitry Andric VOP3_Real_with_name<Gen, {0, 1, 1, op{6-0}}, opName, asmName>; 8545f757f3fSDimitry Andric 8555f757f3fSDimitry Andric 8565f757f3fSDimitry Andricdefm V_CVT_NEAREST_I32_F32 : VOP1_Real_FULL_with_name_gfx11_gfx12<0x00c, 85781ad6265SDimitry Andric "V_CVT_RPI_I32_F32", "v_cvt_nearest_i32_f32">; 8585f757f3fSDimitry Andricdefm V_CVT_FLOOR_I32_F32 : VOP1_Real_FULL_with_name_gfx11_gfx12<0x00d, 85981ad6265SDimitry Andric "V_CVT_FLR_I32_F32", "v_cvt_floor_i32_f32">; 8605f757f3fSDimitry Andricdefm V_CLZ_I32_U32 : VOP1_Real_FULL_with_name_gfx11_gfx12<0x039, 86181ad6265SDimitry Andric "V_FFBH_U32", "v_clz_i32_u32">; 8625f757f3fSDimitry Andricdefm V_CTZ_I32_B32 : VOP1_Real_FULL_with_name_gfx11_gfx12<0x03a, 86381ad6265SDimitry Andric "V_FFBL_B32", "v_ctz_i32_b32">; 8645f757f3fSDimitry Andricdefm V_CLS_I32 : VOP1_Real_FULL_with_name_gfx11_gfx12<0x03b, 86581ad6265SDimitry Andric "V_FFBH_I32", "v_cls_i32">; 8665f757f3fSDimitry Andricdefm V_PERMLANE64_B32 : VOP1Only_Real_gfx11_gfx12<0x067>; 8675f757f3fSDimitry Andricdefm V_MOV_B16_t16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x01c, "v_mov_b16">; 868297eecfbSDimitry Andricdefm V_NOT_B16_fake16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x069, "v_not_b16">; 869297eecfbSDimitry Andricdefm V_CVT_I32_I16_fake16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x06a, "v_cvt_i32_i16">; 870297eecfbSDimitry Andricdefm V_CVT_U32_U16_fake16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x06b, "v_cvt_u32_u16">; 871bdd1243dSDimitry Andric 8725f757f3fSDimitry Andricdefm V_CVT_F16_U16_t16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x050, "v_cvt_f16_u16">; 8735f757f3fSDimitry Andricdefm V_CVT_F16_I16_t16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x051, "v_cvt_f16_i16">; 8745f757f3fSDimitry Andricdefm V_CVT_U16_F16_t16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x052, "v_cvt_u16_f16">; 8755f757f3fSDimitry Andricdefm V_CVT_I16_F16_t16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x053, "v_cvt_i16_f16">; 876297eecfbSDimitry Andricdefm V_RCP_F16_fake16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x054, "v_rcp_f16">; 877297eecfbSDimitry Andricdefm V_SQRT_F16_fake16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x055, "v_sqrt_f16">; 878297eecfbSDimitry Andricdefm V_RSQ_F16_fake16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x056, "v_rsq_f16">; 879297eecfbSDimitry Andricdefm V_LOG_F16_fake16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x057, "v_log_f16">; 880297eecfbSDimitry Andricdefm V_EXP_F16_fake16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x058, "v_exp_f16">; 881297eecfbSDimitry Andricdefm V_FREXP_MANT_F16_fake16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x059, "v_frexp_mant_f16">; 8825f757f3fSDimitry Andricdefm V_FREXP_EXP_I16_F16_t16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x05a, "v_frexp_exp_i16_f16">; 883*7a6dacacSDimitry Andricdefm V_FLOOR_F16_t16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x05b, "v_floor_f16">; 884297eecfbSDimitry Andricdefm V_FLOOR_F16_fake16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x05b, "v_floor_f16">; 8855f757f3fSDimitry Andricdefm V_CEIL_F16_t16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x05c, "v_ceil_f16">; 886297eecfbSDimitry Andricdefm V_CEIL_F16_fake16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x05c, "v_ceil_f16">; 887297eecfbSDimitry Andricdefm V_TRUNC_F16_fake16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x05d, "v_trunc_f16">; 888297eecfbSDimitry Andricdefm V_RNDNE_F16_fake16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x05e, "v_rndne_f16">; 889297eecfbSDimitry Andricdefm V_FRACT_F16_fake16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x05f, "v_fract_f16">; 890297eecfbSDimitry Andricdefm V_SIN_F16_fake16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x060, "v_sin_f16">; 891297eecfbSDimitry Andricdefm V_COS_F16_fake16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x061, "v_cos_f16">; 892297eecfbSDimitry Andricdefm V_SAT_PK_U8_I16_fake16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x062, "v_sat_pk_u8_i16">; 8935f757f3fSDimitry Andricdefm V_CVT_NORM_I16_F16_t16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x063, "v_cvt_norm_i16_f16">; 8945f757f3fSDimitry Andricdefm V_CVT_NORM_U16_F16_t16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x064, "v_cvt_norm_u16_f16">; 895bdd1243dSDimitry Andric 8965f757f3fSDimitry Andricdefm V_CVT_F16_F32_t16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x00a, "v_cvt_f16_f32">; 8975f757f3fSDimitry Andricdefm V_CVT_F32_F16_t16 : VOP1_Real_FULL_t16_gfx11_gfx12<0x00b, "v_cvt_f32_f16">; 89881ad6265SDimitry Andric 89981ad6265SDimitry Andric//===----------------------------------------------------------------------===// 9000b57cec5SDimitry Andric// GFX10. 9010b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 9020b57cec5SDimitry Andric 90381ad6265SDimitry Andriclet AssemblerPredicate = isGFX10Only, DecoderNamespace = "GFX10" in { 9040b57cec5SDimitry Andric multiclass VOP1Only_Real_gfx10<bits<9> op> { 9050b57cec5SDimitry Andric def _gfx10 : 9060b57cec5SDimitry Andric VOP1_Real<!cast<VOP1_Pseudo>(NAME), SIEncodingFamily.GFX10>, 9070b57cec5SDimitry Andric VOP1e<op{7-0}, !cast<VOP1_Pseudo>(NAME).Pfl>; 9080b57cec5SDimitry Andric } 9090b57cec5SDimitry Andric multiclass VOP1_Real_e32_gfx10<bits<9> op> { 9100b57cec5SDimitry Andric def _e32_gfx10 : 9110b57cec5SDimitry Andric VOP1_Real<!cast<VOP1_Pseudo>(NAME#"_e32"), SIEncodingFamily.GFX10>, 9120b57cec5SDimitry Andric VOP1e<op{7-0}, !cast<VOP1_Pseudo>(NAME#"_e32").Pfl>; 9130b57cec5SDimitry Andric } 9140b57cec5SDimitry Andric multiclass VOP1_Real_e64_gfx10<bits<9> op> { 9150b57cec5SDimitry Andric def _e64_gfx10 : 9160b57cec5SDimitry Andric VOP3_Real<!cast<VOP3_Pseudo>(NAME#"_e64"), SIEncodingFamily.GFX10>, 9170b57cec5SDimitry Andric VOP3e_gfx10<{0, 1, 1, op{6-0}}, !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>; 9180b57cec5SDimitry Andric } 9190b57cec5SDimitry Andric multiclass VOP1_Real_sdwa_gfx10<bits<9> op> { 92006c3fb27SDimitry Andric if !cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA9 then 9210b57cec5SDimitry Andric def _sdwa_gfx10 : 9220b57cec5SDimitry Andric VOP_SDWA10_Real<!cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa")>, 9230b57cec5SDimitry Andric VOP1_SDWA9Ae<op{7-0}, !cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa").Pfl> { 9240b57cec5SDimitry Andric let DecoderNamespace = "SDWA10"; 9250b57cec5SDimitry Andric } 9260b57cec5SDimitry Andric } 9270b57cec5SDimitry Andric multiclass VOP1_Real_dpp_gfx10<bits<9> op> { 92806c3fb27SDimitry Andric if !cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExt32BitDPP then 92981ad6265SDimitry Andric def _dpp_gfx10 : VOP1_DPP16<op{7-0}, !cast<VOP1_DPP_Pseudo>(NAME#"_dpp"), SIEncodingFamily.GFX10> { 9300b57cec5SDimitry Andric let DecoderNamespace = "SDWA10"; 9310b57cec5SDimitry Andric } 9320b57cec5SDimitry Andric } 9330b57cec5SDimitry Andric multiclass VOP1_Real_dpp8_gfx10<bits<9> op> { 93406c3fb27SDimitry Andric if !cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExt32BitDPP then 9350b57cec5SDimitry Andric def _dpp8_gfx10 : VOP1_DPP8<op{7-0}, !cast<VOP1_Pseudo>(NAME#"_e32")> { 9360b57cec5SDimitry Andric let DecoderNamespace = "DPP8"; 9370b57cec5SDimitry Andric } 9380b57cec5SDimitry Andric } 93981ad6265SDimitry Andric} // End AssemblerPredicate = isGFX10Only, DecoderNamespace = "GFX10" 9400b57cec5SDimitry Andric 9410b57cec5SDimitry Andricmulticlass VOP1_Real_gfx10<bits<9> op> : 942480093f4SDimitry Andric VOP1_Real_e32_gfx10<op>, VOP1_Real_e64_gfx10<op>, 943480093f4SDimitry Andric VOP1_Real_sdwa_gfx10<op>, VOP1_Real_dpp_gfx10<op>, 944480093f4SDimitry Andric VOP1_Real_dpp8_gfx10<op>; 9450b57cec5SDimitry Andric 9465f757f3fSDimitry Andricmulticlass VOP1_Real_gfx10_FULL_gfx11_gfx12<bits<9> op> : 9475f757f3fSDimitry Andric VOP1_Real_gfx10<op>, 9485f757f3fSDimitry Andric VOP1_Real_FULL<GFX11Gen, op>, 9495f757f3fSDimitry Andric VOP1_Real_FULL<GFX12Gen, op>; 9500b57cec5SDimitry Andric 9515f757f3fSDimitry Andricmulticlass VOP1_Real_gfx10_NO_DPP_gfx11_gfx12<bits<9> op> : 9525f757f3fSDimitry Andric VOP1_Real_gfx10<op>, 9535f757f3fSDimitry Andric VOP1_Real_NO_DPP<GFX11Gen, op>, 9545f757f3fSDimitry Andric VOP1_Real_NO_DPP<GFX12Gen, op>; 95581ad6265SDimitry Andric 9565f757f3fSDimitry Andricmulticlass VOP1Only_Real_gfx10_gfx11_gfx12<bits<9> op> : 9575f757f3fSDimitry Andric VOP1Only_Real_gfx10<op>, 9585f757f3fSDimitry Andric VOP1Only_Real<GFX11Gen, op>, 9595f757f3fSDimitry Andric VOP1Only_Real<GFX12Gen, op>; 96081ad6265SDimitry Andric 9615f757f3fSDimitry Andricdefm V_PIPEFLUSH : VOP1_Real_gfx10_NO_DPP_gfx11_gfx12<0x01b>; 9625f757f3fSDimitry Andricdefm V_MOVRELSD_2_B32 : VOP1_Real_gfx10_FULL_gfx11_gfx12<0x048>; 963bdd1243dSDimitry Andricdefm V_CVT_F16_U16 : VOP1_Real_gfx10<0x050>; 964bdd1243dSDimitry Andricdefm V_CVT_F16_I16 : VOP1_Real_gfx10<0x051>; 965bdd1243dSDimitry Andricdefm V_CVT_U16_F16 : VOP1_Real_gfx10<0x052>; 966bdd1243dSDimitry Andricdefm V_CVT_I16_F16 : VOP1_Real_gfx10<0x053>; 967bdd1243dSDimitry Andricdefm V_RCP_F16 : VOP1_Real_gfx10<0x054>; 968bdd1243dSDimitry Andricdefm V_SQRT_F16 : VOP1_Real_gfx10<0x055>; 969bdd1243dSDimitry Andricdefm V_RSQ_F16 : VOP1_Real_gfx10<0x056>; 970bdd1243dSDimitry Andricdefm V_LOG_F16 : VOP1_Real_gfx10<0x057>; 971bdd1243dSDimitry Andricdefm V_EXP_F16 : VOP1_Real_gfx10<0x058>; 972bdd1243dSDimitry Andricdefm V_FREXP_MANT_F16 : VOP1_Real_gfx10<0x059>; 973bdd1243dSDimitry Andricdefm V_FREXP_EXP_I16_F16 : VOP1_Real_gfx10<0x05a>; 974bdd1243dSDimitry Andricdefm V_FLOOR_F16 : VOP1_Real_gfx10<0x05b>; 975bdd1243dSDimitry Andricdefm V_CEIL_F16 : VOP1_Real_gfx10<0x05c>; 976bdd1243dSDimitry Andricdefm V_TRUNC_F16 : VOP1_Real_gfx10<0x05d>; 977bdd1243dSDimitry Andricdefm V_RNDNE_F16 : VOP1_Real_gfx10<0x05e>; 978bdd1243dSDimitry Andricdefm V_FRACT_F16 : VOP1_Real_gfx10<0x05f>; 979bdd1243dSDimitry Andricdefm V_SIN_F16 : VOP1_Real_gfx10<0x060>; 980bdd1243dSDimitry Andricdefm V_COS_F16 : VOP1_Real_gfx10<0x061>; 981bdd1243dSDimitry Andricdefm V_SAT_PK_U8_I16 : VOP1_Real_gfx10<0x062>; 982bdd1243dSDimitry Andricdefm V_CVT_NORM_I16_F16 : VOP1_Real_gfx10<0x063>; 983bdd1243dSDimitry Andricdefm V_CVT_NORM_U16_F16 : VOP1_Real_gfx10<0x064>; 98481ad6265SDimitry Andric 9855f757f3fSDimitry Andricdefm V_SWAP_B32 : VOP1Only_Real_gfx10_gfx11_gfx12<0x065>; 9865f757f3fSDimitry Andricdefm V_SWAPREL_B32 : VOP1Only_Real_gfx10_gfx11_gfx12<0x068>; 9870b57cec5SDimitry Andric 9880b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 9895f757f3fSDimitry Andric// GFX7, GFX10, GFX11, GFX12 9900b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 9910b57cec5SDimitry Andric 9920b57cec5SDimitry Andriclet AssemblerPredicate = isGFX7Only, DecoderNamespace = "GFX7" in { 9930b57cec5SDimitry Andric multiclass VOP1_Real_e32_gfx7<bits<9> op> { 9940b57cec5SDimitry Andric def _e32_gfx7 : 9950b57cec5SDimitry Andric VOP1_Real<!cast<VOP1_Pseudo>(NAME#"_e32"), SIEncodingFamily.SI>, 9960b57cec5SDimitry Andric VOP1e<op{7-0}, !cast<VOP1_Pseudo>(NAME#"_e32").Pfl>; 9970b57cec5SDimitry Andric } 9980b57cec5SDimitry Andric multiclass VOP1_Real_e64_gfx7<bits<9> op> { 9990b57cec5SDimitry Andric def _e64_gfx7 : 10000b57cec5SDimitry Andric VOP3_Real<!cast<VOP3_Pseudo>(NAME#"_e64"), SIEncodingFamily.SI>, 10010b57cec5SDimitry Andric VOP3e_gfx6_gfx7<{1, 1, op{6-0}}, !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>; 10020b57cec5SDimitry Andric } 10030b57cec5SDimitry Andric} // End AssemblerPredicate = isGFX7Only, DecoderNamespace = "GFX7" 10040b57cec5SDimitry Andric 10050b57cec5SDimitry Andricmulticlass VOP1_Real_gfx7<bits<9> op> : 10060b57cec5SDimitry Andric VOP1_Real_e32_gfx7<op>, VOP1_Real_e64_gfx7<op>; 10070b57cec5SDimitry Andric 10085f757f3fSDimitry Andricmulticlass VOP1_Real_gfx7_gfx10_NO_DPP_gfx11_gfx12<bits<9> op> : 10095f757f3fSDimitry Andric VOP1_Real_gfx7<op>, VOP1_Real_gfx10<op>, VOP1_Real_NO_DPP<GFX11Gen, op>, 10105f757f3fSDimitry Andric VOP1_Real_NO_DPP<GFX12Gen, op>; 101181ad6265SDimitry Andric 10120b57cec5SDimitry Andricdefm V_LOG_LEGACY_F32 : VOP1_Real_gfx7<0x045>; 10130b57cec5SDimitry Andricdefm V_EXP_LEGACY_F32 : VOP1_Real_gfx7<0x046>; 10140b57cec5SDimitry Andric 10155f757f3fSDimitry Andricdefm V_TRUNC_F64 : VOP1_Real_gfx7_gfx10_NO_DPP_gfx11_gfx12<0x017>; 10165f757f3fSDimitry Andricdefm V_CEIL_F64 : VOP1_Real_gfx7_gfx10_NO_DPP_gfx11_gfx12<0x018>; 10175f757f3fSDimitry Andricdefm V_RNDNE_F64 : VOP1_Real_gfx7_gfx10_NO_DPP_gfx11_gfx12<0x019>; 10185f757f3fSDimitry Andricdefm V_FLOOR_F64 : VOP1_Real_gfx7_gfx10_NO_DPP_gfx11_gfx12<0x01a>; 10190b57cec5SDimitry Andric 10200b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 10215f757f3fSDimitry Andric// GFX6, GFX7, GFX10, GFX11, GFX12 10220b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 10230b57cec5SDimitry Andric 10240b57cec5SDimitry Andriclet AssemblerPredicate = isGFX6GFX7, DecoderNamespace = "GFX6GFX7" in { 10250b57cec5SDimitry Andric multiclass VOP1_Real_e32_gfx6_gfx7<bits<9> op> { 10260b57cec5SDimitry Andric def _e32_gfx6_gfx7 : 10270b57cec5SDimitry Andric VOP1_Real<!cast<VOP1_Pseudo>(NAME#"_e32"), SIEncodingFamily.SI>, 10280b57cec5SDimitry Andric VOP1e<op{7-0}, !cast<VOP1_Pseudo>(NAME#"_e32").Pfl>; 10290b57cec5SDimitry Andric } 10300b57cec5SDimitry Andric multiclass VOP1_Real_e64_gfx6_gfx7<bits<9> op> { 10310b57cec5SDimitry Andric def _e64_gfx6_gfx7 : 10320b57cec5SDimitry Andric VOP3_Real<!cast<VOP3_Pseudo>(NAME#"_e64"), SIEncodingFamily.SI>, 10330b57cec5SDimitry Andric VOP3e_gfx6_gfx7<{1, 1, op{6-0}}, !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>; 10340b57cec5SDimitry Andric } 10350b57cec5SDimitry Andric} // End AssemblerPredicate = isGFX6GFX7, DecoderNamespace = "GFX6GFX7" 10360b57cec5SDimitry Andric 10370b57cec5SDimitry Andricmulticlass VOP1_Real_gfx6_gfx7<bits<9> op> : 10380b57cec5SDimitry Andric VOP1_Real_e32_gfx6_gfx7<op>, VOP1_Real_e64_gfx6_gfx7<op>; 10390b57cec5SDimitry Andric 10400b57cec5SDimitry Andricmulticlass VOP1_Real_gfx6_gfx7_gfx10<bits<9> op> : 10410b57cec5SDimitry Andric VOP1_Real_gfx6_gfx7<op>, VOP1_Real_gfx10<op>; 10420b57cec5SDimitry Andric 10435f757f3fSDimitry Andricmulticlass VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<bits<9> op> : 10445f757f3fSDimitry Andric VOP1_Real_gfx6_gfx7_gfx10<op>, VOP1_Real_FULL<GFX11Gen, op>, 10455f757f3fSDimitry Andric VOP1_Real_FULL<GFX12Gen, op>; 104681ad6265SDimitry Andric 10475f757f3fSDimitry Andricmulticlass VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11_gfx12<bits<9> op> : 10485f757f3fSDimitry Andric VOP1_Real_gfx6_gfx7_gfx10<op>, VOP1_Real_NO_DPP<GFX11Gen, op>, 10495f757f3fSDimitry Andric VOP1_Real_NO_DPP<GFX12Gen, op>; 105081ad6265SDimitry Andric 10510b57cec5SDimitry Andricdefm V_LOG_CLAMP_F32 : VOP1_Real_gfx6_gfx7<0x026>; 10520b57cec5SDimitry Andricdefm V_RCP_CLAMP_F32 : VOP1_Real_gfx6_gfx7<0x028>; 10530b57cec5SDimitry Andricdefm V_RCP_LEGACY_F32 : VOP1_Real_gfx6_gfx7<0x029>; 10540b57cec5SDimitry Andricdefm V_RSQ_CLAMP_F32 : VOP1_Real_gfx6_gfx7<0x02c>; 10550b57cec5SDimitry Andricdefm V_RSQ_LEGACY_F32 : VOP1_Real_gfx6_gfx7<0x02d>; 10560b57cec5SDimitry Andricdefm V_RCP_CLAMP_F64 : VOP1_Real_gfx6_gfx7<0x030>; 10570b57cec5SDimitry Andricdefm V_RSQ_CLAMP_F64 : VOP1_Real_gfx6_gfx7<0x032>; 10580b57cec5SDimitry Andric 10595f757f3fSDimitry Andricdefm V_NOP : VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11_gfx12<0x000>; 10605f757f3fSDimitry Andricdefm V_MOV_B32 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x001>; 10615f757f3fSDimitry Andricdefm V_CVT_I32_F64 : VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11_gfx12<0x003>; 10625f757f3fSDimitry Andricdefm V_CVT_F64_I32 : VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11_gfx12<0x004>; 10635f757f3fSDimitry Andricdefm V_CVT_F32_I32 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x005>; 10645f757f3fSDimitry Andricdefm V_CVT_F32_U32 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x006>; 10655f757f3fSDimitry Andricdefm V_CVT_U32_F32 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x007>; 10665f757f3fSDimitry Andricdefm V_CVT_I32_F32 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x008>; 1067bdd1243dSDimitry Andricdefm V_CVT_F16_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x00a>; 1068bdd1243dSDimitry Andricdefm V_CVT_F32_F16 : VOP1_Real_gfx6_gfx7_gfx10<0x00b>; 10690b57cec5SDimitry Andricdefm V_CVT_RPI_I32_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x00c>; 10700b57cec5SDimitry Andricdefm V_CVT_FLR_I32_F32 : VOP1_Real_gfx6_gfx7_gfx10<0x00d>; 10715f757f3fSDimitry Andricdefm V_CVT_OFF_F32_I4 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x00e>; 10725f757f3fSDimitry Andricdefm V_CVT_F32_F64 : VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11_gfx12<0x00f>; 10735f757f3fSDimitry Andricdefm V_CVT_F64_F32 : VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11_gfx12<0x010>; 10745f757f3fSDimitry Andricdefm V_CVT_F32_UBYTE0 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x011>; 10755f757f3fSDimitry Andricdefm V_CVT_F32_UBYTE1 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x012>; 10765f757f3fSDimitry Andricdefm V_CVT_F32_UBYTE2 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x013>; 10775f757f3fSDimitry Andricdefm V_CVT_F32_UBYTE3 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x014>; 10785f757f3fSDimitry Andricdefm V_CVT_U32_F64 : VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11_gfx12<0x015>; 10795f757f3fSDimitry Andricdefm V_CVT_F64_U32 : VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11_gfx12<0x016>; 10805f757f3fSDimitry Andricdefm V_FRACT_F32 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x020>; 10815f757f3fSDimitry Andricdefm V_TRUNC_F32 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x021>; 10825f757f3fSDimitry Andricdefm V_CEIL_F32 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x022>; 10835f757f3fSDimitry Andricdefm V_RNDNE_F32 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x023>; 10845f757f3fSDimitry Andricdefm V_FLOOR_F32 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x024>; 10855f757f3fSDimitry Andricdefm V_EXP_F32 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x025>; 10865f757f3fSDimitry Andricdefm V_LOG_F32 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x027>; 10875f757f3fSDimitry Andricdefm V_RCP_F32 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x02a>; 10885f757f3fSDimitry Andricdefm V_RCP_IFLAG_F32 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x02b>; 10895f757f3fSDimitry Andricdefm V_RSQ_F32 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x02e>; 10905f757f3fSDimitry Andricdefm V_RCP_F64 : VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11_gfx12<0x02f>; 10915f757f3fSDimitry Andricdefm V_RSQ_F64 : VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11_gfx12<0x031>; 10925f757f3fSDimitry Andricdefm V_SQRT_F32 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x033>; 10935f757f3fSDimitry Andricdefm V_SQRT_F64 : VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11_gfx12<0x034>; 10945f757f3fSDimitry Andricdefm V_SIN_F32 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x035>; 10955f757f3fSDimitry Andricdefm V_COS_F32 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x036>; 10965f757f3fSDimitry Andricdefm V_NOT_B32 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x037>; 10975f757f3fSDimitry Andricdefm V_BFREV_B32 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x038>; 10980b57cec5SDimitry Andricdefm V_FFBH_U32 : VOP1_Real_gfx6_gfx7_gfx10<0x039>; 10990b57cec5SDimitry Andricdefm V_FFBL_B32 : VOP1_Real_gfx6_gfx7_gfx10<0x03a>; 11000b57cec5SDimitry Andricdefm V_FFBH_I32 : VOP1_Real_gfx6_gfx7_gfx10<0x03b>; 11015f757f3fSDimitry Andricdefm V_FREXP_EXP_I32_F64 : VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11_gfx12<0x03c>; 11025f757f3fSDimitry Andricdefm V_FREXP_MANT_F64 : VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11_gfx12<0x03d>; 11035f757f3fSDimitry Andricdefm V_FRACT_F64 : VOP1_Real_gfx6_gfx7_gfx10_NO_DPP_gfx11_gfx12<0x03e>; 11045f757f3fSDimitry Andricdefm V_FREXP_EXP_I32_F32 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x03f>; 11055f757f3fSDimitry Andricdefm V_FREXP_MANT_F32 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x040>; 11060b57cec5SDimitry Andricdefm V_CLREXCP : VOP1_Real_gfx6_gfx7_gfx10<0x041>; 11075f757f3fSDimitry Andricdefm V_MOVRELD_B32 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x042>; 11085f757f3fSDimitry Andricdefm V_MOVRELS_B32 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x043>; 11095f757f3fSDimitry Andricdefm V_MOVRELSD_B32 : VOP1_Real_gfx6_gfx7_gfx10_FULL_gfx11_gfx12<0x044>; 11100b57cec5SDimitry Andric 11110b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 11120b57cec5SDimitry Andric// GFX8, GFX9 (VI). 11130b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 11140b57cec5SDimitry Andric 11150b57cec5SDimitry Andricclass VOP1_DPPe <bits<8> op, VOP1_DPP_Pseudo ps, VOPProfile P = ps.Pfl> : 11160b57cec5SDimitry Andric VOP_DPPe <P> { 11170b57cec5SDimitry Andric bits<8> vdst; 11180b57cec5SDimitry Andric let Inst{8-0} = 0xfa; // dpp 11190b57cec5SDimitry Andric let Inst{16-9} = op; 11200b57cec5SDimitry Andric let Inst{24-17} = !if(P.EmitDst, vdst{7-0}, 0); 11210b57cec5SDimitry Andric let Inst{31-25} = 0x3f; //encoding 11220b57cec5SDimitry Andric} 11230b57cec5SDimitry Andric 11240b57cec5SDimitry Andricmulticlass VOP1Only_Real_vi <bits<10> op> { 1125480093f4SDimitry Andric let AssemblerPredicate = isGFX8GFX9, DecoderNamespace = "GFX8" in { 11260b57cec5SDimitry Andric def _vi : 11270b57cec5SDimitry Andric VOP1_Real<!cast<VOP1_Pseudo>(NAME), SIEncodingFamily.VI>, 11280b57cec5SDimitry Andric VOP1e<op{7-0}, !cast<VOP1_Pseudo>(NAME).Pfl>; 11290b57cec5SDimitry Andric } 11300b57cec5SDimitry Andric} 11310b57cec5SDimitry Andric 11320b57cec5SDimitry Andricmulticlass VOP1_Real_e32e64_vi <bits<10> op> { 1133480093f4SDimitry Andric let AssemblerPredicate = isGFX8GFX9, DecoderNamespace = "GFX8" in { 11340b57cec5SDimitry Andric def _e32_vi : 11350b57cec5SDimitry Andric VOP1_Real<!cast<VOP1_Pseudo>(NAME#"_e32"), SIEncodingFamily.VI>, 11360b57cec5SDimitry Andric VOP1e<op{7-0}, !cast<VOP1_Pseudo>(NAME#"_e32").Pfl>; 11370b57cec5SDimitry Andric def _e64_vi : 11380b57cec5SDimitry Andric VOP3_Real<!cast<VOP3_Pseudo>(NAME#"_e64"), SIEncodingFamily.VI>, 11390b57cec5SDimitry Andric VOP3e_vi <!add(0x140, op), !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>; 11400b57cec5SDimitry Andric } 11410b57cec5SDimitry Andric} 11420b57cec5SDimitry Andric 11430b57cec5SDimitry Andricmulticlass VOP1_Real_vi <bits<10> op> { 11440b57cec5SDimitry Andric defm NAME : VOP1_Real_e32e64_vi <op>; 11450b57cec5SDimitry Andric 114606c3fb27SDimitry Andric if !cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA then 11470b57cec5SDimitry Andric def _sdwa_vi : 11480b57cec5SDimitry Andric VOP_SDWA_Real <!cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa")>, 11490b57cec5SDimitry Andric VOP1_SDWAe <op{7-0}, !cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa").Pfl>; 11500b57cec5SDimitry Andric 115106c3fb27SDimitry Andric if !cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA9 then 11520b57cec5SDimitry Andric def _sdwa_gfx9 : 11530b57cec5SDimitry Andric VOP_SDWA9_Real <!cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa")>, 11540b57cec5SDimitry Andric VOP1_SDWA9Ae <op{7-0}, !cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa").Pfl>; 11550b57cec5SDimitry Andric 115606c3fb27SDimitry Andric if !cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtDPP then 11570b57cec5SDimitry Andric def _dpp_vi : 11580b57cec5SDimitry Andric VOP_DPP_Real<!cast<VOP1_DPP_Pseudo>(NAME#"_dpp"), SIEncodingFamily.VI>, 11590b57cec5SDimitry Andric VOP1_DPPe<op{7-0}, !cast<VOP1_DPP_Pseudo>(NAME#"_dpp")>; 11600b57cec5SDimitry Andric} 11610b57cec5SDimitry Andric 11620b57cec5SDimitry Andricdefm V_NOP : VOP1_Real_vi <0x0>; 11630b57cec5SDimitry Andricdefm V_MOV_B32 : VOP1_Real_vi <0x1>; 11640b57cec5SDimitry Andricdefm V_CVT_I32_F64 : VOP1_Real_vi <0x3>; 11650b57cec5SDimitry Andricdefm V_CVT_F64_I32 : VOP1_Real_vi <0x4>; 11660b57cec5SDimitry Andricdefm V_CVT_F32_I32 : VOP1_Real_vi <0x5>; 11670b57cec5SDimitry Andricdefm V_CVT_F32_U32 : VOP1_Real_vi <0x6>; 11680b57cec5SDimitry Andricdefm V_CVT_U32_F32 : VOP1_Real_vi <0x7>; 11690b57cec5SDimitry Andricdefm V_CVT_I32_F32 : VOP1_Real_vi <0x8>; 11700b57cec5SDimitry Andricdefm V_CVT_F16_F32 : VOP1_Real_vi <0xa>; 11710b57cec5SDimitry Andricdefm V_CVT_F32_F16 : VOP1_Real_vi <0xb>; 11720b57cec5SDimitry Andricdefm V_CVT_RPI_I32_F32 : VOP1_Real_vi <0xc>; 11730b57cec5SDimitry Andricdefm V_CVT_FLR_I32_F32 : VOP1_Real_vi <0xd>; 11740b57cec5SDimitry Andricdefm V_CVT_OFF_F32_I4 : VOP1_Real_vi <0xe>; 11750b57cec5SDimitry Andricdefm V_CVT_F32_F64 : VOP1_Real_vi <0xf>; 11760b57cec5SDimitry Andricdefm V_CVT_F64_F32 : VOP1_Real_vi <0x10>; 11770b57cec5SDimitry Andricdefm V_CVT_F32_UBYTE0 : VOP1_Real_vi <0x11>; 11780b57cec5SDimitry Andricdefm V_CVT_F32_UBYTE1 : VOP1_Real_vi <0x12>; 11790b57cec5SDimitry Andricdefm V_CVT_F32_UBYTE2 : VOP1_Real_vi <0x13>; 11800b57cec5SDimitry Andricdefm V_CVT_F32_UBYTE3 : VOP1_Real_vi <0x14>; 11810b57cec5SDimitry Andricdefm V_CVT_U32_F64 : VOP1_Real_vi <0x15>; 11820b57cec5SDimitry Andricdefm V_CVT_F64_U32 : VOP1_Real_vi <0x16>; 11830b57cec5SDimitry Andricdefm V_FRACT_F32 : VOP1_Real_vi <0x1b>; 11840b57cec5SDimitry Andricdefm V_TRUNC_F32 : VOP1_Real_vi <0x1c>; 11850b57cec5SDimitry Andricdefm V_CEIL_F32 : VOP1_Real_vi <0x1d>; 11860b57cec5SDimitry Andricdefm V_RNDNE_F32 : VOP1_Real_vi <0x1e>; 11870b57cec5SDimitry Andricdefm V_FLOOR_F32 : VOP1_Real_vi <0x1f>; 11880b57cec5SDimitry Andricdefm V_EXP_F32 : VOP1_Real_vi <0x20>; 11890b57cec5SDimitry Andricdefm V_LOG_F32 : VOP1_Real_vi <0x21>; 11900b57cec5SDimitry Andricdefm V_RCP_F32 : VOP1_Real_vi <0x22>; 11910b57cec5SDimitry Andricdefm V_RCP_IFLAG_F32 : VOP1_Real_vi <0x23>; 11920b57cec5SDimitry Andricdefm V_RSQ_F32 : VOP1_Real_vi <0x24>; 11930b57cec5SDimitry Andricdefm V_RCP_F64 : VOP1_Real_vi <0x25>; 11940b57cec5SDimitry Andricdefm V_RSQ_F64 : VOP1_Real_vi <0x26>; 11950b57cec5SDimitry Andricdefm V_SQRT_F32 : VOP1_Real_vi <0x27>; 11960b57cec5SDimitry Andricdefm V_SQRT_F64 : VOP1_Real_vi <0x28>; 11970b57cec5SDimitry Andricdefm V_SIN_F32 : VOP1_Real_vi <0x29>; 11980b57cec5SDimitry Andricdefm V_COS_F32 : VOP1_Real_vi <0x2a>; 11990b57cec5SDimitry Andricdefm V_NOT_B32 : VOP1_Real_vi <0x2b>; 12000b57cec5SDimitry Andricdefm V_BFREV_B32 : VOP1_Real_vi <0x2c>; 12010b57cec5SDimitry Andricdefm V_FFBH_U32 : VOP1_Real_vi <0x2d>; 12020b57cec5SDimitry Andricdefm V_FFBL_B32 : VOP1_Real_vi <0x2e>; 12030b57cec5SDimitry Andricdefm V_FFBH_I32 : VOP1_Real_vi <0x2f>; 12040b57cec5SDimitry Andricdefm V_FREXP_EXP_I32_F64 : VOP1_Real_vi <0x30>; 12050b57cec5SDimitry Andricdefm V_FREXP_MANT_F64 : VOP1_Real_vi <0x31>; 12060b57cec5SDimitry Andricdefm V_FRACT_F64 : VOP1_Real_vi <0x32>; 12070b57cec5SDimitry Andricdefm V_FREXP_EXP_I32_F32 : VOP1_Real_vi <0x33>; 12080b57cec5SDimitry Andricdefm V_FREXP_MANT_F32 : VOP1_Real_vi <0x34>; 12090b57cec5SDimitry Andricdefm V_CLREXCP : VOP1_Real_vi <0x35>; 12100b57cec5SDimitry Andricdefm V_MOVRELD_B32 : VOP1_Real_e32e64_vi <0x36>; 12110b57cec5SDimitry Andricdefm V_MOVRELS_B32 : VOP1_Real_e32e64_vi <0x37>; 12120b57cec5SDimitry Andricdefm V_MOVRELSD_B32 : VOP1_Real_e32e64_vi <0x38>; 12130b57cec5SDimitry Andricdefm V_TRUNC_F64 : VOP1_Real_vi <0x17>; 12140b57cec5SDimitry Andricdefm V_CEIL_F64 : VOP1_Real_vi <0x18>; 12150b57cec5SDimitry Andricdefm V_FLOOR_F64 : VOP1_Real_vi <0x1A>; 12160b57cec5SDimitry Andricdefm V_RNDNE_F64 : VOP1_Real_vi <0x19>; 12170b57cec5SDimitry Andricdefm V_LOG_LEGACY_F32 : VOP1_Real_vi <0x4c>; 12180b57cec5SDimitry Andricdefm V_EXP_LEGACY_F32 : VOP1_Real_vi <0x4b>; 12190b57cec5SDimitry Andricdefm V_CVT_F16_U16 : VOP1_Real_vi <0x39>; 12200b57cec5SDimitry Andricdefm V_CVT_F16_I16 : VOP1_Real_vi <0x3a>; 12210b57cec5SDimitry Andricdefm V_CVT_U16_F16 : VOP1_Real_vi <0x3b>; 12220b57cec5SDimitry Andricdefm V_CVT_I16_F16 : VOP1_Real_vi <0x3c>; 12230b57cec5SDimitry Andricdefm V_RCP_F16 : VOP1_Real_vi <0x3d>; 12240b57cec5SDimitry Andricdefm V_SQRT_F16 : VOP1_Real_vi <0x3e>; 12250b57cec5SDimitry Andricdefm V_RSQ_F16 : VOP1_Real_vi <0x3f>; 12260b57cec5SDimitry Andricdefm V_LOG_F16 : VOP1_Real_vi <0x40>; 12270b57cec5SDimitry Andricdefm V_EXP_F16 : VOP1_Real_vi <0x41>; 12280b57cec5SDimitry Andricdefm V_FREXP_MANT_F16 : VOP1_Real_vi <0x42>; 12290b57cec5SDimitry Andricdefm V_FREXP_EXP_I16_F16 : VOP1_Real_vi <0x43>; 12300b57cec5SDimitry Andricdefm V_FLOOR_F16 : VOP1_Real_vi <0x44>; 12310b57cec5SDimitry Andricdefm V_CEIL_F16 : VOP1_Real_vi <0x45>; 12320b57cec5SDimitry Andricdefm V_TRUNC_F16 : VOP1_Real_vi <0x46>; 12330b57cec5SDimitry Andricdefm V_RNDNE_F16 : VOP1_Real_vi <0x47>; 12340b57cec5SDimitry Andricdefm V_FRACT_F16 : VOP1_Real_vi <0x48>; 12350b57cec5SDimitry Andricdefm V_SIN_F16 : VOP1_Real_vi <0x49>; 12360b57cec5SDimitry Andricdefm V_COS_F16 : VOP1_Real_vi <0x4a>; 12370b57cec5SDimitry Andricdefm V_SWAP_B32 : VOP1Only_Real_vi <0x51>; 12380b57cec5SDimitry Andric 12390b57cec5SDimitry Andricdefm V_SAT_PK_U8_I16 : VOP1_Real_vi<0x4f>; 12400b57cec5SDimitry Andricdefm V_CVT_NORM_I16_F16 : VOP1_Real_vi<0x4d>; 12410b57cec5SDimitry Andricdefm V_CVT_NORM_U16_F16 : VOP1_Real_vi<0x4e>; 12420b57cec5SDimitry Andric 1243fe6060f1SDimitry Andricdefm V_ACCVGPR_MOV_B32 : VOP1Only_Real_vi<0x52>; 1244fe6060f1SDimitry Andric 12455f757f3fSDimitry Andriclet VOP1 = 1, SubtargetPredicate = isGFX8GFX9, Uses = [EXEC, M0], Size = V_MOV_B32_e32.Size in { 1246349cc55cSDimitry Andric 12470b57cec5SDimitry Andric// Copy of v_mov_b32 with $vdst as a use operand for use with VGPR 12480b57cec5SDimitry Andric// indexing mode. vdst can't be treated as a def for codegen purposes, 12490b57cec5SDimitry Andric// and an implicit use and def of the super register should be added. 1250349cc55cSDimitry Andricdef V_MOV_B32_indirect_write : VPseudoInstSI<(outs), 1251bdd1243dSDimitry Andric (ins getVALUDstForVT<i32>.ret:$vdst, getVOPSrc0ForVT<i32, 0>.ret:$src0)>, 12520b57cec5SDimitry Andric PseudoInstExpansion<(V_MOV_B32_e32_vi getVALUDstForVT<i32>.ret:$vdst, 1253bdd1243dSDimitry Andric getVOPSrc0ForVT<i32, 0>.ret:$src0)>; 1254349cc55cSDimitry Andric 1255349cc55cSDimitry Andric// Copy of v_mov_b32 for use with VGPR indexing mode. An implicit use of the 1256349cc55cSDimitry Andric// super register should be added. 1257349cc55cSDimitry Andricdef V_MOV_B32_indirect_read : VPseudoInstSI< 1258349cc55cSDimitry Andric (outs getVALUDstForVT<i32>.ret:$vdst), 1259bdd1243dSDimitry Andric (ins getVOPSrc0ForVT<i32, 0>.ret:$src0)>, 1260349cc55cSDimitry Andric PseudoInstExpansion<(V_MOV_B32_e32_vi getVALUDstForVT<i32>.ret:$vdst, 1261bdd1243dSDimitry Andric getVOPSrc0ForVT<i32, 0>.ret:$src0)>; 1262349cc55cSDimitry Andric 1263349cc55cSDimitry Andric} // End VOP1 = 1, SubtargetPredicate = isGFX8GFX9, Uses = [M0] 12640b57cec5SDimitry Andric 12658bcb0991SDimitry Andriclet OtherPredicates = [isGFX8Plus] in { 12660b57cec5SDimitry Andric 12670b57cec5SDimitry Andricdef : GCNPat < 12685ffd83dbSDimitry Andric (i32 (int_amdgcn_mov_dpp i32:$src, timm:$dpp_ctrl, timm:$row_mask, 12695ffd83dbSDimitry Andric timm:$bank_mask, timm:$bound_ctrl)), 12705ffd83dbSDimitry Andric (V_MOV_B32_dpp VGPR_32:$src, VGPR_32:$src, (as_i32timm $dpp_ctrl), 12715ffd83dbSDimitry Andric (as_i32timm $row_mask), (as_i32timm $bank_mask), 12725ffd83dbSDimitry Andric (as_i1timm $bound_ctrl)) 12730b57cec5SDimitry Andric>; 12740b57cec5SDimitry Andric 12755f757f3fSDimitry Andricclass UpdateDPPPat<ValueType vt> : GCNPat < 12765f757f3fSDimitry Andric (vt (int_amdgcn_update_dpp vt:$old, vt:$src, timm:$dpp_ctrl, 12775ffd83dbSDimitry Andric timm:$row_mask, timm:$bank_mask, 12785ffd83dbSDimitry Andric timm:$bound_ctrl)), 12795ffd83dbSDimitry Andric (V_MOV_B32_dpp VGPR_32:$old, VGPR_32:$src, (as_i32timm $dpp_ctrl), 12805ffd83dbSDimitry Andric (as_i32timm $row_mask), (as_i32timm $bank_mask), 12815ffd83dbSDimitry Andric (as_i1timm $bound_ctrl)) 12820b57cec5SDimitry Andric>; 12830b57cec5SDimitry Andric 12845f757f3fSDimitry Andricdef : UpdateDPPPat<i32>; 12855f757f3fSDimitry Andricdef : UpdateDPPPat<f32>; 12865f757f3fSDimitry Andricdef : UpdateDPPPat<v2i16>; 12875f757f3fSDimitry Andricdef : UpdateDPPPat<v2f16>; 12885f757f3fSDimitry Andric 12898bcb0991SDimitry Andric} // End OtherPredicates = [isGFX8Plus] 12900b57cec5SDimitry Andric 12910b57cec5SDimitry Andriclet OtherPredicates = [isGFX8Plus] in { 12920b57cec5SDimitry Andricdef : GCNPat< 12930b57cec5SDimitry Andric (i32 (anyext i16:$src)), 12940b57cec5SDimitry Andric (COPY $src) 12950b57cec5SDimitry Andric>; 12960b57cec5SDimitry Andric 12970b57cec5SDimitry Andricdef : GCNPat< 12980b57cec5SDimitry Andric (i64 (anyext i16:$src)), 12990b57cec5SDimitry Andric (REG_SEQUENCE VReg_64, 13000b57cec5SDimitry Andric (i32 (COPY $src)), sub0, 13010b57cec5SDimitry Andric (V_MOV_B32_e32 (i32 0)), sub1) 13020b57cec5SDimitry Andric>; 13030b57cec5SDimitry Andric 13040b57cec5SDimitry Andricdef : GCNPat< 13050b57cec5SDimitry Andric (i16 (trunc i32:$src)), 13060b57cec5SDimitry Andric (COPY $src) 13070b57cec5SDimitry Andric>; 13080b57cec5SDimitry Andric 13090b57cec5SDimitry Andricdef : GCNPat < 13100b57cec5SDimitry Andric (i16 (trunc i64:$src)), 13110b57cec5SDimitry Andric (EXTRACT_SUBREG $src, sub0) 13120b57cec5SDimitry Andric>; 13130b57cec5SDimitry Andric 13140b57cec5SDimitry Andric} // End OtherPredicates = [isGFX8Plus] 13150b57cec5SDimitry Andric 13160b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 13170b57cec5SDimitry Andric// GFX9 13180b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 13190b57cec5SDimitry Andric 13200b57cec5SDimitry Andricmulticlass VOP1_Real_gfx9 <bits<10> op> { 1321480093f4SDimitry Andric let AssemblerPredicate = isGFX9Only, DecoderNamespace = "GFX9" in { 13220b57cec5SDimitry Andric defm NAME : VOP1_Real_e32e64_vi <op>; 13230b57cec5SDimitry Andric } 13240b57cec5SDimitry Andric 132506c3fb27SDimitry Andric if !cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA9 then 13260b57cec5SDimitry Andric def _sdwa_gfx9 : 13270b57cec5SDimitry Andric VOP_SDWA9_Real <!cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa")>, 13280b57cec5SDimitry Andric VOP1_SDWA9Ae <op{7-0}, !cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa").Pfl>; 13290b57cec5SDimitry Andric 133006c3fb27SDimitry Andric if !cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtDPP then 13310b57cec5SDimitry Andric def _dpp_gfx9 : 13320b57cec5SDimitry Andric VOP_DPP_Real<!cast<VOP1_DPP_Pseudo>(NAME#"_dpp"), SIEncodingFamily.GFX9>, 13330b57cec5SDimitry Andric VOP1_DPPe<op{7-0}, !cast<VOP1_DPP_Pseudo>(NAME#"_dpp")>; 13340b57cec5SDimitry Andric 13350b57cec5SDimitry Andric} 13360b57cec5SDimitry Andric 1337fcaf7f86SDimitry Andricmulticlass VOP1_Real_NoDstSel_SDWA_gfx9 <bits<10> op> { 1338fcaf7f86SDimitry Andric let AssemblerPredicate = isGFX9Only, DecoderNamespace = "GFX9" in { 1339fcaf7f86SDimitry Andric defm NAME : VOP1_Real_e32e64_vi <op>; 1340fcaf7f86SDimitry Andric } 1341fcaf7f86SDimitry Andric 134206c3fb27SDimitry Andric if !cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA9 then 1343fcaf7f86SDimitry Andric def _sdwa_gfx9 : 1344fcaf7f86SDimitry Andric VOP_SDWA9_Real <!cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa")>, 1345fcaf7f86SDimitry Andric VOP1_SDWA9Ae <op{7-0}, !cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa").Pfl> { 1346fcaf7f86SDimitry Andric let Inst{42-40} = 6; 1347fcaf7f86SDimitry Andric } 1348fcaf7f86SDimitry Andric 134906c3fb27SDimitry Andric if !cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtDPP then 1350fcaf7f86SDimitry Andric def _dpp_gfx9 : 1351fcaf7f86SDimitry Andric VOP_DPP_Real<!cast<VOP1_DPP_Pseudo>(NAME#"_dpp"), SIEncodingFamily.GFX9>, 1352fcaf7f86SDimitry Andric VOP1_DPPe<op{7-0}, !cast<VOP1_DPP_Pseudo>(NAME#"_dpp")>; 1353fcaf7f86SDimitry Andric} 1354fcaf7f86SDimitry Andric 13550b57cec5SDimitry Andricdefm V_SCREEN_PARTITION_4SE_B32 : VOP1_Real_gfx9 <0x37>; 13560b57cec5SDimitry Andric 135781ad6265SDimitry Andriclet AssemblerPredicate = isGFX940Plus, DecoderNamespace = "GFX9" in 135881ad6265SDimitry Andricdefm V_MOV_B64 : VOP1_Real_gfx9 <0x38>; 135981ad6265SDimitry Andric 1360*7a6dacacSDimitry Andriclet OtherPredicates = [HasFP8ConversionInsts] in { 1361fcaf7f86SDimitry Andricdefm V_CVT_F32_FP8 : VOP1_Real_NoDstSel_SDWA_gfx9<0x54>; 1362fcaf7f86SDimitry Andricdefm V_CVT_F32_BF8 : VOP1_Real_NoDstSel_SDWA_gfx9<0x55>; 1363fcaf7f86SDimitry Andricdefm V_CVT_PK_F32_FP8 : VOP1_Real_NoDstSel_SDWA_gfx9<0x56>; 1364fcaf7f86SDimitry Andricdefm V_CVT_PK_F32_BF8 : VOP1_Real_NoDstSel_SDWA_gfx9<0x57>; 1365fcaf7f86SDimitry Andric} 1366fcaf7f86SDimitry Andric 13670b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 13680b57cec5SDimitry Andric// GFX10 13690b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 13700b57cec5SDimitry Andric 137181ad6265SDimitry Andriclet OtherPredicates = [isGFX10Only] in { 13720b57cec5SDimitry Andricdef : GCNPat < 13738bcb0991SDimitry Andric (i32 (int_amdgcn_mov_dpp8 i32:$src, timm:$dpp8)), 13745ffd83dbSDimitry Andric (V_MOV_B32_dpp8_gfx10 VGPR_32:$src, VGPR_32:$src, 13755ffd83dbSDimitry Andric (as_i32timm $dpp8), (i32 DPP8Mode.FI_0)) 13760b57cec5SDimitry Andric>; 137781ad6265SDimitry Andric} // End OtherPredicates = [isGFX10Only] 137881ad6265SDimitry Andric 137981ad6265SDimitry Andric//===----------------------------------------------------------------------===// 138081ad6265SDimitry Andric// GFX11 138181ad6265SDimitry Andric//===----------------------------------------------------------------------===// 138281ad6265SDimitry Andric 138381ad6265SDimitry Andriclet OtherPredicates = [isGFX11Only] in { 138481ad6265SDimitry Andricdef : GCNPat < 138581ad6265SDimitry Andric (i32 (int_amdgcn_mov_dpp8 i32:$src, timm:$dpp8)), 138681ad6265SDimitry Andric (V_MOV_B32_dpp8_gfx11 VGPR_32:$src, VGPR_32:$src, 138781ad6265SDimitry Andric (as_i32timm $dpp8), (i32 DPP8Mode.FI_0)) 138881ad6265SDimitry Andric>; 138981ad6265SDimitry Andric} // End OtherPredicates = [isGFX11Only] 13905f757f3fSDimitry Andric 13915f757f3fSDimitry Andric//===----------------------------------------------------------------------===// 13925f757f3fSDimitry Andric// GFX12 13935f757f3fSDimitry Andric//===----------------------------------------------------------------------===// 13945f757f3fSDimitry Andric 13955f757f3fSDimitry Andriclet OtherPredicates = [isGFX12Only] in { 13965f757f3fSDimitry Andricdef : GCNPat < 13975f757f3fSDimitry Andric (i32 (int_amdgcn_mov_dpp8 i32:$src, timm:$dpp8)), 13985f757f3fSDimitry Andric (V_MOV_B32_dpp8_gfx12 VGPR_32:$src, VGPR_32:$src, 13995f757f3fSDimitry Andric (as_i32timm $dpp8), (i32 DPP8Mode.FI_0)) 14005f757f3fSDimitry Andric>; 14015f757f3fSDimitry Andric} // End OtherPredicates = [isGFX12Only] 1402