1//===-- VOP3Instructions.td - Vector Instruction Definitions --------------===// 2// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6// 7//===----------------------------------------------------------------------===// 8 9// Special case for v_div_fmas_{f32|f64}, since it seems to be the 10// only VOP instruction that implicitly reads VCC. 11let Asm64 = " $vdst, $src0_modifiers, $src1_modifiers, $src2_modifiers$clamp$omod" in { 12def VOP_F32_F32_F32_F32_VCC : VOPProfile<[f32, f32, f32, f32]> { 13 let Outs64 = (outs DstRC.RegClass:$vdst); 14 let HasExtVOP3DPP = 0; 15 let HasExtDPP = 0; 16} 17def VOP_F64_F64_F64_F64_VCC : VOPProfile<[f64, f64, f64, f64]> { 18 let Outs64 = (outs DstRC.RegClass:$vdst); 19} 20} 21 22class VOP3b_Profile<ValueType vt> : VOPProfile<[vt, vt, vt, vt]> { 23 let Outs64 = (outs DstRC:$vdst, VOPDstS64orS32:$sdst); 24 let Asm64 = "$vdst, $sdst, $src0_modifiers, $src1_modifiers, $src2_modifiers$clamp$omod"; 25 let IsSingle = 1; 26 let HasExtVOP3DPP = 0; 27 let HasExtDPP = 0; 28} 29 30def VOP3b_F32_I1_F32_F32_F32 : VOP3b_Profile<f32>; 31def VOP3b_F64_I1_F64_F64_F64 : VOP3b_Profile<f64>; 32 33def VOP3b_I64_I1_I32_I32_I64 : VOPProfile<[i64, i32, i32, i64]> { 34 let HasClamp = 1; 35 36 let IsSingle = 1; 37 let Outs64 = (outs DstRC:$vdst, VOPDstS64orS32:$sdst); 38 let Asm64 = "$vdst, $sdst, $src0, $src1, $src2$clamp"; 39} 40 41class V_MUL_PROF<VOPProfile P> : VOP3_Profile<P> { 42 let HasExtVOP3DPP = 0; 43 let HasExtDPP = 0; 44} 45 46def DIV_FIXUP_F32_PROF : VOP3_Profile<VOP_F32_F32_F32_F32> { 47 let HasExtVOP3DPP = 0; 48 let HasExtDPP = 0; 49} 50 51//===----------------------------------------------------------------------===// 52// VOP3 INTERP 53//===----------------------------------------------------------------------===// 54 55class VOP3Interp<string OpName, VOPProfile P, list<dag> pattern = []> : 56 VOP3_Pseudo<OpName, P, pattern> { 57 let AsmMatchConverter = "cvtVOP3Interp"; 58 let mayRaiseFPException = 0; 59} 60 61def VOP3_INTERP : VOPProfile<[f32, f32, i32, untyped]> { 62 let Src0Mod = FPVRegInputMods; 63 let Ins64 = (ins Src0Mod:$src0_modifiers, VRegSrc_32:$src0, 64 InterpAttr:$attr, InterpAttrChan:$attrchan, 65 clampmod0:$clamp, omod0:$omod); 66 67 let Asm64 = "$vdst, $src0_modifiers, $attr$attrchan$clamp$omod"; 68} 69 70def VOP3_INTERP_MOV : VOPProfile<[f32, i32, i32, untyped]> { 71 let Ins64 = (ins InterpSlot:$src0, 72 InterpAttr:$attr, InterpAttrChan:$attrchan, 73 clampmod0:$clamp, omod0:$omod); 74 75 let Asm64 = "$vdst, $src0, $attr$attrchan$clamp$omod"; 76 77 let HasClamp = 1; 78 let HasSrc0Mods = 0; 79} 80 81class getInterp16Asm <bit HasSrc2, bit HasOMod> { 82 string src2 = !if(HasSrc2, ", $src2_modifiers", ""); 83 string omod = !if(HasOMod, "$omod", ""); 84 string ret = 85 " $vdst, $src0_modifiers, $attr$attrchan"#src2#"$high$clamp"#omod; 86} 87 88class getInterp16Ins <bit HasSrc2, bit HasOMod, 89 Operand Src0Mod, Operand Src2Mod> { 90 dag ret = !if(HasSrc2, 91 !if(HasOMod, 92 (ins Src0Mod:$src0_modifiers, VRegSrc_32:$src0, 93 InterpAttr:$attr, InterpAttrChan:$attrchan, 94 Src2Mod:$src2_modifiers, VRegSrc_32:$src2, 95 highmod:$high, clampmod0:$clamp, omod0:$omod), 96 (ins Src0Mod:$src0_modifiers, VRegSrc_32:$src0, 97 InterpAttr:$attr, InterpAttrChan:$attrchan, 98 Src2Mod:$src2_modifiers, VRegSrc_32:$src2, 99 highmod:$high, clampmod0:$clamp) 100 ), 101 (ins Src0Mod:$src0_modifiers, VRegSrc_32:$src0, 102 InterpAttr:$attr, InterpAttrChan:$attrchan, 103 highmod:$high, clampmod0:$clamp, omod0:$omod) 104 ); 105} 106 107class VOP3_INTERP16 <list<ValueType> ArgVT> : VOPProfile<ArgVT> { 108 109 let HasOMod = !ne(DstVT.Value, f16.Value); 110 let HasHigh = 1; 111 112 let Src0Mod = FPVRegInputMods; 113 let Src2Mod = FPVRegInputMods; 114 115 let Outs64 = (outs DstRC.RegClass:$vdst); 116 let Ins64 = getInterp16Ins<HasSrc2, HasOMod, Src0Mod, Src2Mod>.ret; 117 let Asm64 = getInterp16Asm<HasSrc2, HasOMod>.ret; 118} 119 120//===----------------------------------------------------------------------===// 121// VOP3 Instructions 122//===----------------------------------------------------------------------===// 123 124let isCommutable = 1 in { 125 126let isReMaterializable = 1 in { 127let mayRaiseFPException = 0 in { 128let SubtargetPredicate = HasMadMacF32Insts in { 129defm V_MAD_LEGACY_F32 : VOP3Inst <"v_mad_legacy_f32", VOP3_Profile<VOP_F32_F32_F32_F32>>; 130defm V_MAD_F32 : VOP3Inst <"v_mad_f32", VOP3_Profile<VOP_F32_F32_F32_F32>, any_fmad>; 131} // End SubtargetPredicate = HasMadMacInsts 132 133let SubtargetPredicate = HasFmaLegacy32 in 134defm V_FMA_LEGACY_F32 : VOP3Inst <"v_fma_legacy_f32", 135 VOP3_Profile<VOP_F32_F32_F32_F32>, 136 int_amdgcn_fma_legacy>; 137} 138 139defm V_MAD_I32_I24 : VOP3Inst <"v_mad_i32_i24", VOP3_Profile<VOP_I32_I32_I32_I32, VOP3_CLAMP>>; 140defm V_MAD_U32_U24 : VOP3Inst <"v_mad_u32_u24", VOP3_Profile<VOP_I32_I32_I32_I32, VOP3_CLAMP>>; 141defm V_FMA_F32 : VOP3Inst <"v_fma_f32", VOP3_Profile<VOP_F32_F32_F32_F32>, any_fma>; 142defm V_LERP_U8 : VOP3Inst <"v_lerp_u8", VOP3_Profile<VOP_I32_I32_I32_I32>, int_amdgcn_lerp>; 143 144let SchedRW = [WriteDoubleAdd] in { 145let FPDPRounding = 1 in { 146defm V_FMA_F64 : VOP3Inst <"v_fma_f64", VOP3_Profile<VOP_F64_F64_F64_F64>, any_fma>; 147defm V_ADD_F64 : VOP3Inst <"v_add_f64", VOP3_Profile<VOP_F64_F64_F64>, any_fadd>; 148defm V_MUL_F64 : VOP3Inst <"v_mul_f64", VOP3_Profile<VOP_F64_F64_F64>, any_fmul>; 149} // End FPDPRounding = 1 150defm V_MIN_F64 : VOP3Inst <"v_min_f64", VOP3_Profile<VOP_F64_F64_F64>, fminnum_like>; 151defm V_MAX_F64 : VOP3Inst <"v_max_f64", VOP3_Profile<VOP_F64_F64_F64>, fmaxnum_like>; 152} // End SchedRW = [WriteDoubleAdd] 153 154let SchedRW = [WriteIntMul] in { 155defm V_MUL_LO_U32 : VOP3Inst <"v_mul_lo_u32", V_MUL_PROF<VOP_I32_I32_I32>, DivergentBinFrag<mul>>; 156defm V_MUL_HI_U32 : VOP3Inst <"v_mul_hi_u32", V_MUL_PROF<VOP_I32_I32_I32>, mulhu>; 157defm V_MUL_LO_I32 : VOP3Inst <"v_mul_lo_i32", V_MUL_PROF<VOP_I32_I32_I32>>; 158defm V_MUL_HI_I32 : VOP3Inst <"v_mul_hi_i32", V_MUL_PROF<VOP_I32_I32_I32>, mulhs>; 159} // End SchedRW = [WriteIntMul] 160} // End isReMaterializable = 1 161 162let Uses = [MODE, VCC, EXEC] in { 163// v_div_fmas_f32: 164// result = src0 * src1 + src2 165// if (vcc) 166// result *= 2^32 167// 168let SchedRW = [WriteFloatFMA] in 169defm V_DIV_FMAS_F32 : VOP3Inst_Pseudo_Wrapper <"v_div_fmas_f32", VOP_F32_F32_F32_F32_VCC, []>; 170// v_div_fmas_f64: 171// result = src0 * src1 + src2 172// if (vcc) 173// result *= 2^64 174// 175let SchedRW = [WriteDouble], FPDPRounding = 1 in 176defm V_DIV_FMAS_F64 : VOP3Inst_Pseudo_Wrapper <"v_div_fmas_f64", VOP_F64_F64_F64_F64_VCC, []>; 177} // End Uses = [MODE, VCC, EXEC] 178 179} // End isCommutable = 1 180 181let isReMaterializable = 1 in { 182let mayRaiseFPException = 0 in { 183defm V_CUBEID_F32 : VOP3Inst <"v_cubeid_f32", VOP3_Profile<VOP_F32_F32_F32_F32>, int_amdgcn_cubeid>; 184defm V_CUBESC_F32 : VOP3Inst <"v_cubesc_f32", VOP3_Profile<VOP_F32_F32_F32_F32>, int_amdgcn_cubesc>; 185defm V_CUBETC_F32 : VOP3Inst <"v_cubetc_f32", VOP3_Profile<VOP_F32_F32_F32_F32>, int_amdgcn_cubetc>; 186defm V_CUBEMA_F32 : VOP3Inst <"v_cubema_f32", VOP3_Profile<VOP_F32_F32_F32_F32>, int_amdgcn_cubema>; 187} // End mayRaiseFPException 188 189defm V_BFE_U32 : VOP3Inst <"v_bfe_u32", VOP3_Profile<VOP_I32_I32_I32_I32>, AMDGPUbfe_u32>; 190defm V_BFE_I32 : VOP3Inst <"v_bfe_i32", VOP3_Profile<VOP_I32_I32_I32_I32>, AMDGPUbfe_i32>; 191defm V_BFI_B32 : VOP3Inst <"v_bfi_b32", VOP3_Profile<VOP_I32_I32_I32_I32>, AMDGPUbfi>; 192defm V_ALIGNBIT_B32 : VOP3Inst <"v_alignbit_b32", VOP3_Profile<VOP_I32_I32_I32_I32>, fshr>; 193defm V_ALIGNBYTE_B32 : VOP3Inst <"v_alignbyte_b32", VOP3_Profile<VOP_I32_I32_I32_I32>, int_amdgcn_alignbyte>; 194 195// XXX - No FPException seems suspect but manual doesn't say it does 196let mayRaiseFPException = 0 in { 197 let isCommutable = 1 in { 198 defm V_MIN3_I32 : VOP3Inst <"v_min3_i32", VOP3_Profile<VOP_I32_I32_I32_I32>, AMDGPUsmin3>; 199 defm V_MIN3_U32 : VOP3Inst <"v_min3_u32", VOP3_Profile<VOP_I32_I32_I32_I32>, AMDGPUumin3>; 200 defm V_MAX3_I32 : VOP3Inst <"v_max3_i32", VOP3_Profile<VOP_I32_I32_I32_I32>, AMDGPUsmax3>; 201 defm V_MAX3_U32 : VOP3Inst <"v_max3_u32", VOP3_Profile<VOP_I32_I32_I32_I32>, AMDGPUumax3>; 202 defm V_MED3_I32 : VOP3Inst <"v_med3_i32", VOP3_Profile<VOP_I32_I32_I32_I32>, AMDGPUsmed3>; 203 defm V_MED3_U32 : VOP3Inst <"v_med3_u32", VOP3_Profile<VOP_I32_I32_I32_I32>, AMDGPUumed3>; 204 } // End isCommutable = 1 205 defm V_MIN3_F32 : VOP3Inst <"v_min3_f32", VOP3_Profile<VOP_F32_F32_F32_F32>, AMDGPUfmin3>; 206 defm V_MAX3_F32 : VOP3Inst <"v_max3_f32", VOP3_Profile<VOP_F32_F32_F32_F32>, AMDGPUfmax3>; 207 defm V_MED3_F32 : VOP3Inst <"v_med3_f32", VOP3_Profile<VOP_F32_F32_F32_F32>, AMDGPUfmed3>; 208} // End mayRaiseFPException = 0 209 210let isCommutable = 1 in { 211 defm V_SAD_U8 : VOP3Inst <"v_sad_u8", VOP3_Profile<VOP_I32_I32_I32_I32, VOP3_CLAMP>>; 212 defm V_SAD_HI_U8 : VOP3Inst <"v_sad_hi_u8", VOP3_Profile<VOP_I32_I32_I32_I32, VOP3_CLAMP>>; 213 defm V_SAD_U16 : VOP3Inst <"v_sad_u16", VOP3_Profile<VOP_I32_I32_I32_I32, VOP3_CLAMP>>; 214 defm V_SAD_U32 : VOP3Inst <"v_sad_u32", VOP3_Profile<VOP_I32_I32_I32_I32, VOP3_CLAMP>>; 215} // End isCommutable = 1 216defm V_CVT_PK_U8_F32 : VOP3Inst<"v_cvt_pk_u8_f32", VOP3_Profile<VOP_I32_F32_I32_I32>, int_amdgcn_cvt_pk_u8_f32>; 217 218defm V_DIV_FIXUP_F32 : VOP3Inst <"v_div_fixup_f32", DIV_FIXUP_F32_PROF, AMDGPUdiv_fixup>; 219 220let SchedRW = [WriteDoubleAdd], FPDPRounding = 1 in { 221 defm V_DIV_FIXUP_F64 : VOP3Inst <"v_div_fixup_f64", VOP3_Profile<VOP_F64_F64_F64_F64>, AMDGPUdiv_fixup>; 222 defm V_LDEXP_F64 : VOP3Inst <"v_ldexp_f64", VOP3_Profile<VOP_F64_F64_I32>, any_fldexp>; 223} // End SchedRW = [WriteDoubleAdd], FPDPRounding = 1 224} // End isReMaterializable = 1 225 226 227let mayRaiseFPException = 0 in { // Seems suspicious but manual doesn't say it does. 228 let SchedRW = [WriteFloatFMA, WriteSALU] in 229 defm V_DIV_SCALE_F32 : VOP3Inst_Pseudo_Wrapper <"v_div_scale_f32", VOP3b_F32_I1_F32_F32_F32> ; 230 231 // Double precision division pre-scale. 232 let SchedRW = [WriteDouble, WriteSALU], FPDPRounding = 1 in 233 defm V_DIV_SCALE_F64 : VOP3Inst_Pseudo_Wrapper <"v_div_scale_f64", VOP3b_F64_I1_F64_F64_F64>; 234} // End mayRaiseFPException = 0 235 236let isReMaterializable = 1 in 237defm V_MSAD_U8 : VOP3Inst <"v_msad_u8", VOP3_Profile<VOP_I32_I32_I32_I32, VOP3_CLAMP>>; 238 239let Constraints = "@earlyclobber $vdst" in { 240defm V_MQSAD_PK_U16_U8 : VOP3Inst <"v_mqsad_pk_u16_u8", VOP3_Profile<VOP_I64_I64_I32_I64, VOP3_CLAMP>>; 241} // End Constraints = "@earlyclobber $vdst" 242 243 244let isReMaterializable = 1 in { 245let SchedRW = [WriteDouble] in { 246defm V_TRIG_PREOP_F64 : VOP3Inst <"v_trig_preop_f64", VOP3_Profile<VOP_F64_F64_I32>, int_amdgcn_trig_preop>; 247} // End SchedRW = [WriteDouble] 248 249let SchedRW = [Write64Bit] in { 250 let SubtargetPredicate = isGFX6GFX7 in { 251 defm V_LSHL_B64 : VOP3Inst <"v_lshl_b64", VOP3_Profile<VOP_I64_I64_I32>, cshl_64>; 252 defm V_LSHR_B64 : VOP3Inst <"v_lshr_b64", VOP3_Profile<VOP_I64_I64_I32>, csrl_64>; 253 defm V_ASHR_I64 : VOP3Inst <"v_ashr_i64", VOP3_Profile<VOP_I64_I64_I32>, csra_64>; 254 } // End SubtargetPredicate = isGFX6GFX7 255 256 let SubtargetPredicate = isGFX8Plus in { 257 defm V_LSHLREV_B64 : VOP3Inst <"v_lshlrev_b64", VOP3_Profile<VOP_I64_I32_I64>, clshl_rev_64>; 258 defm V_LSHRREV_B64 : VOP3Inst <"v_lshrrev_b64", VOP3_Profile<VOP_I64_I32_I64>, clshr_rev_64>; 259 defm V_ASHRREV_I64 : VOP3Inst <"v_ashrrev_i64", VOP3_Profile<VOP_I64_I32_I64>, cashr_rev_64>; 260 } // End SubtargetPredicate = isGFX8Plus 261} // End SchedRW = [Write64Bit] 262} // End isReMaterializable = 1 263 264def : GCNPat< 265 (i32 (DivergentUnaryFrag<sext> i16:$src)), 266 (i32 (V_BFE_I32_e64 i16:$src, (i32 0), (i32 0x10))) 267>; 268 269let isReMaterializable = 1 in { 270let SubtargetPredicate = isGFX6GFX7GFX10Plus in { 271defm V_MULLIT_F32 : VOP3Inst <"v_mullit_f32", VOP3_Profile<VOP_F32_F32_F32_F32>>; 272} // End SubtargetPredicate = isGFX6GFX7GFX10Plus 273 274let SchedRW = [Write32Bit] in { 275let SubtargetPredicate = isGFX8Plus in { 276defm V_PERM_B32 : VOP3Inst <"v_perm_b32", VOP3_Profile<VOP_I32_I32_I32_I32>, AMDGPUperm>; 277} // End SubtargetPredicate = isGFX8Plus 278} // End SchedRW = [Write32Bit] 279} // End isReMaterializable = 1 280 281def VOPProfileMQSAD : VOP3_Profile<VOP_V4I32_I64_I32_V4I32, VOP3_CLAMP> { 282 let HasModifiers = 0; 283} 284 285let SubtargetPredicate = isGFX7Plus in { 286let Constraints = "@earlyclobber $vdst", SchedRW = [WriteQuarterRate32] in { 287defm V_QSAD_PK_U16_U8 : VOP3Inst <"v_qsad_pk_u16_u8", VOP3_Profile<VOP_I64_I64_I32_I64, VOP3_CLAMP>>; 288defm V_MQSAD_U32_U8 : VOP3Inst <"v_mqsad_u32_u8", VOPProfileMQSAD>; 289} // End Constraints = "@earlyclobber $vdst", SchedRW = [WriteQuarterRate32] 290} // End SubtargetPredicate = isGFX7Plus 291 292let isCommutable = 1, SchedRW = [WriteIntMul, WriteSALU] in { 293 let SubtargetPredicate = isGFX7Plus, OtherPredicates = [HasNotMADIntraFwdBug] in { 294 defm V_MAD_U64_U32 : VOP3Inst <"v_mad_u64_u32", VOP3b_I64_I1_I32_I32_I64>; 295 defm V_MAD_I64_I32 : VOP3Inst <"v_mad_i64_i32", VOP3b_I64_I1_I32_I32_I64>; 296 } 297 let SubtargetPredicate = isGFX11Only, OtherPredicates = [HasMADIntraFwdBug], 298 Constraints = "@earlyclobber $vdst" in { 299 defm V_MAD_U64_U32_gfx11 : VOP3Inst <"v_mad_u64_u32", VOP3b_I64_I1_I32_I32_I64>; 300 defm V_MAD_I64_I32_gfx11 : VOP3Inst <"v_mad_i64_i32", VOP3b_I64_I1_I32_I32_I64>; 301 } 302} // End isCommutable = 1, SchedRW = [WriteIntMul, WriteSALU] 303 304 305let FPDPRounding = 1 in { 306 let Predicates = [Has16BitInsts, isGFX8Only] in { 307 defm V_DIV_FIXUP_F16 : VOP3Inst <"v_div_fixup_f16", VOP3_Profile<VOP_F16_F16_F16_F16>, AMDGPUdiv_fixup>; 308 defm V_FMA_F16 : VOP3Inst <"v_fma_f16", VOP3_Profile<VOP_F16_F16_F16_F16>, any_fma>; 309 } // End Predicates = [Has16BitInsts, isGFX8Only] 310 311 let renamedInGFX9 = 1, SubtargetPredicate = isGFX9Plus in { 312 defm V_DIV_FIXUP_F16_gfx9 : VOP3Inst <"v_div_fixup_f16_gfx9", 313 VOP3_Profile<VOP_F16_F16_F16_F16, VOP3_OPSEL>, AMDGPUdiv_fixup>; 314 defm V_FMA_F16_gfx9 : VOP3Inst <"v_fma_f16_gfx9", VOP3_Profile<VOP_F16_F16_F16_F16, VOP3_OPSEL>, any_fma>; 315 } // End renamedInGFX9 = 1, SubtargetPredicate = isGFX9Plus 316} // End FPDPRounding = 1 317 318let SubtargetPredicate = Has16BitInsts, isCommutable = 1 in { 319 320let renamedInGFX9 = 1 in { 321 defm V_MAD_U16 : VOP3Inst <"v_mad_u16", VOP3_Profile<VOP_I16_I16_I16_I16, VOP3_CLAMP>>; 322 defm V_MAD_I16 : VOP3Inst <"v_mad_i16", VOP3_Profile<VOP_I16_I16_I16_I16, VOP3_CLAMP>>; 323 let FPDPRounding = 1 in { 324 defm V_MAD_F16 : VOP3Inst <"v_mad_f16", VOP3_Profile<VOP_F16_F16_F16_F16>, any_fmad>; 325 let Uses = [MODE, M0, EXEC] in { 326 let OtherPredicates = [isNotGFX90APlus] in 327 // For some reason the intrinsic operands are in a different order 328 // from the instruction operands. 329 def V_INTERP_P2_F16 : VOP3Interp <"v_interp_p2_f16", VOP3_INTERP16<[f16, f32, i32, f32]>, 330 [(set f16:$vdst, 331 (int_amdgcn_interp_p2_f16 (VOP3Mods f32:$src2, i32:$src2_modifiers), 332 (VOP3Mods f32:$src0, i32:$src0_modifiers), 333 (i32 timm:$attrchan), 334 (i32 timm:$attr), 335 (i1 timm:$high), 336 M0))]>; 337 } // End Uses = [M0, MODE, EXEC] 338 } // End FPDPRounding = 1 339} // End renamedInGFX9 = 1 340 341let SubtargetPredicate = isGFX9Only, FPDPRounding = 1 in { 342 defm V_MAD_F16_gfx9 : VOP3Inst <"v_mad_f16_gfx9", VOP3_Profile<VOP_F16_F16_F16_F16, VOP3_OPSEL>> ; 343} // End SubtargetPredicate = isGFX9Only, FPDPRounding = 1 344 345let SubtargetPredicate = isGFX9Plus in { 346defm V_MAD_U16_gfx9 : VOP3Inst <"v_mad_u16_gfx9", VOP3_Profile<VOP_I16_I16_I16_I16, VOP3_OPSEL>>; 347defm V_MAD_I16_gfx9 : VOP3Inst <"v_mad_i16_gfx9", VOP3_Profile<VOP_I16_I16_I16_I16, VOP3_OPSEL>>; 348let OtherPredicates = [isNotGFX90APlus] in 349def V_INTERP_P2_F16_gfx9 : VOP3Interp <"v_interp_p2_f16_gfx9", VOP3_INTERP16<[f16, f32, i32, f32]>>; 350} // End SubtargetPredicate = isGFX9Plus 351 352// This predicate should only apply to the selection pattern. The 353// instruction still exists and should decode on subtargets with 354// other bank counts. 355let OtherPredicates = [isNotGFX90APlus, has32BankLDS], Uses = [MODE, M0, EXEC], FPDPRounding = 1 in { 356def V_INTERP_P1LL_F16 : VOP3Interp <"v_interp_p1ll_f16", VOP3_INTERP16<[f32, f32, i32, untyped]>, 357 [(set f32:$vdst, (int_amdgcn_interp_p1_f16 (VOP3Mods f32:$src0, i32:$src0_modifiers), 358 (i32 timm:$attrchan), 359 (i32 timm:$attr), 360 (i1 timm:$high), M0))]>; 361} // End OtherPredicates = [isNotGFX90APlus, has32BankLDS], Uses = [MODE, M0, EXEC], FPDPRounding = 1 362 363let OtherPredicates = [isNotGFX90APlus], Uses = [MODE, M0, EXEC], FPDPRounding = 1 in { 364def V_INTERP_P1LV_F16 : VOP3Interp <"v_interp_p1lv_f16", VOP3_INTERP16<[f32, f32, i32, f16]>>; 365} // End OtherPredicates = [isNotGFX90APlus], Uses = [MODE, M0, EXEC], FPDPRounding = 1 366 367} // End SubtargetPredicate = Has16BitInsts, isCommutable = 1 368 369def : GCNPat< 370 (i64 (DivergentUnaryFrag<sext> i16:$src)), 371 (REG_SEQUENCE VReg_64, 372 (i32 (V_BFE_I32_e64 $src, (S_MOV_B32 (i32 0)), (S_MOV_B32 (i32 0x10)))), sub0, 373 (i32 (COPY_TO_REGCLASS 374 (V_ASHRREV_I32_e32 (S_MOV_B32 (i32 0x1f)), (i32 (V_BFE_I32_e64 $src, (S_MOV_B32 (i32 0)), (S_MOV_B32 (i32 0x10)))) 375 ), VGPR_32)), sub1) 376>; 377 378let SubtargetPredicate = isGFX8Plus, Uses = [MODE, M0, EXEC], OtherPredicates = [isNotGFX90APlus] in { 379def V_INTERP_P1_F32_e64 : VOP3Interp <"v_interp_p1_f32", VOP3_INTERP>; 380def V_INTERP_P2_F32_e64 : VOP3Interp <"v_interp_p2_f32", VOP3_INTERP>; 381def V_INTERP_MOV_F32_e64 : VOP3Interp <"v_interp_mov_f32", VOP3_INTERP_MOV>; 382} // End SubtargetPredicate = isGFX8Plus, Uses = [MODE, M0, EXEC], OtherPredicates = [isNotGFX90APlus] 383 384// Note: 16-bit instructions produce a 0 result in the high 16-bits 385// on GFX8 and GFX9 and preserve high 16 bits on GFX10+ 386multiclass Arithmetic_i16_0Hi_TernaryPats <SDPatternOperator op, Instruction inst> { 387 def : GCNPat< 388 (i32 (zext (op i16:$src0, i16:$src1, i16:$src2))), 389 (inst VSrc_b16:$src0, VSrc_b16:$src1, VSrc_b16:$src2) 390 >; 391} 392 393let Predicates = [Has16BitInsts, isGFX8GFX9] in { 394defm : Arithmetic_i16_0Hi_TernaryPats<imad, V_MAD_U16_e64>; 395} 396 397let Predicates = [Has16BitInsts, isGFX6GFX7GFX8GFX9] in { 398 399// FIXME: Should be able to just pass imad to the instruction 400// definition pattern, but the implied clamp input interferes. 401multiclass Ternary_i16_Pats <SDPatternOperator op, Instruction inst> { 402 def : GCNPat < 403 (op i16:$src0, i16:$src1, i16:$src2), 404 (inst i16:$src0, i16:$src1, i16:$src2, (i1 0)) 405 >; 406} 407 408defm: Ternary_i16_Pats<imad, V_MAD_U16_e64>; 409 410} // End Predicates = [Has16BitInsts, isGFX6GFX7GFX8GFX9] 411 412 413class Ternary_i16_Pats_gfx9<SDPatternOperator op1, SDPatternOperator op2, 414 Instruction inst> : GCNPat < 415 (op2 (op1 i16:$src0, i16:$src1), i16:$src2), 416 (inst SRCMODS.NONE, $src0, SRCMODS.NONE, $src1, SRCMODS.NONE, $src2, DSTCLAMP.NONE) 417>; 418 419let Predicates = [Has16BitInsts, isGFX10Plus] in { 420def: Ternary_i16_Pats_gfx9<mul, add, V_MAD_U16_gfx9_e64>; 421} // End Predicates = [Has16BitInsts, isGFX10Plus] 422 423class ThreeOpFragSDAG<SDPatternOperator op1, SDPatternOperator op2> : PatFrag< 424 (ops node:$x, node:$y, node:$z), 425 // When the inner operation is used multiple times, selecting 3-op 426 // instructions may still be beneficial -- if the other users can be 427 // combined similarly. Let's be conservative for now. 428 (op2 (HasOneUseBinOp<op1> node:$x, node:$y), node:$z), 429 [{ 430 // Only use VALU ops when the result is divergent. 431 if (!N->isDivergent()) 432 return false; 433 434 // Check constant bus limitations. 435 // 436 // Note: Use !isDivergent as a conservative proxy for whether the value 437 // is in an SGPR (uniform values can end up in VGPRs as well). 438 unsigned ConstantBusUses = 0; 439 for (unsigned i = 0; i < 3; ++i) { 440 if (!Operands[i]->isDivergent() && 441 !isInlineImmediate(Operands[i].getNode())) { 442 ConstantBusUses++; 443 // This uses AMDGPU::V_ADD3_U32_e64, but all three operand instructions 444 // have the same constant bus limit. 445 if (ConstantBusUses > Subtarget->getConstantBusLimit(AMDGPU::V_ADD3_U32_e64)) 446 return false; 447 } 448 } 449 450 return true; 451 }]> { 452 let PredicateCodeUsesOperands = 1; 453} 454 455class ThreeOpFrag<SDPatternOperator op1, SDPatternOperator op2> : ThreeOpFragSDAG<op1, op2> { 456 // The divergence predicate is irrelevant in GlobalISel, as we have 457 // proper register bank checks. We just need to verify the constant 458 // bus restriction when all the sources are considered. 459 // 460 // FIXME: With unlucky SGPR operands, we could penalize code by 461 // blocking folding SGPR->VGPR copies later. 462 // FIXME: There's no register bank verifier 463 let GISelPredicateCode = [{ 464 const int ConstantBusLimit = Subtarget->getConstantBusLimit(AMDGPU::V_ADD3_U32_e64); 465 int ConstantBusUses = 0; 466 for (unsigned i = 0; i < 3; ++i) { 467 const RegisterBank *RegBank = RBI.getRegBank(Operands[i]->getReg(), MRI, TRI); 468 if (RegBank->getID() == AMDGPU::SGPRRegBankID) { 469 if (++ConstantBusUses > ConstantBusLimit) 470 return false; 471 } 472 } 473 return true; 474 }]; 475} 476 477def shl_0_to_4 : PatFrag< 478 (ops node:$src0, node:$src1), (shl node:$src0, node:$src1), 479 [{ 480 if (auto *C = dyn_cast<ConstantSDNode>(N->getOperand(1))) { 481 return C->getZExtValue() <= 4; 482 } 483 return false; 484 }]> { 485 let GISelPredicateCode = [{ 486 int64_t Imm = 0; 487 if (!mi_match(MI.getOperand(2).getReg(), MRI, m_ICst(Imm)) && 488 !mi_match(MI.getOperand(2).getReg(), MRI, m_Copy(m_ICst(Imm)))) 489 return false; 490 return (uint64_t)Imm <= 4; 491 }]; 492} 493 494def VOP3_CVT_PK_F8_F32_Profile : VOP3_Profile<VOP_I32_F32_F32, VOP3_OPSEL> { 495 let InsVOP3OpSel = (ins FP32InputMods:$src0_modifiers, Src0RC64:$src0, 496 FP32InputMods:$src1_modifiers, Src1RC64:$src1, 497 VGPR_32:$vdst_in, op_sel0:$op_sel); 498 let HasClamp = 0; 499 let HasExtVOP3DPP = 0; 500} 501 502def VOP3_CVT_SR_F8_F32_Profile : VOP3_Profile<VOPProfile<[i32, f32, i32, f32]>, 503 VOP3_OPSEL> { 504 let InsVOP3OpSel = (ins FP32InputMods:$src0_modifiers, Src0RC64:$src0, 505 FP32InputMods:$src1_modifiers, Src1RC64:$src1, 506 FP32InputMods:$src2_modifiers, VGPR_32:$src2, 507 op_sel0:$op_sel); 508 let HasClamp = 0; 509 let HasSrc2 = 0; 510 let HasSrc2Mods = 1; 511 let AsmVOP3OpSel = !subst(", $src2_modifiers", "", 512 getAsmVOP3OpSel<3, HasClamp, HasOMod, 513 HasSrc0FloatMods, HasSrc1FloatMods, 514 HasSrc2FloatMods>.ret); 515 let HasExtVOP3DPP = 0; 516} 517 518let SubtargetPredicate = isGFX9Plus in { 519let isCommutable = 1, isReMaterializable = 1 in { 520 defm V_ADD3_U32 : VOP3Inst <"v_add3_u32", VOP3_Profile<VOP_I32_I32_I32_I32>>; 521 defm V_AND_OR_B32 : VOP3Inst <"v_and_or_b32", VOP3_Profile<VOP_I32_I32_I32_I32>>; 522 defm V_OR3_B32 : VOP3Inst <"v_or3_b32", VOP3_Profile<VOP_I32_I32_I32_I32>>; 523 defm V_XAD_U32 : VOP3Inst <"v_xad_u32", VOP3_Profile<VOP_I32_I32_I32_I32>>; 524 defm V_ADD_I32 : VOP3Inst <"v_add_i32", VOP3_Profile<VOP_I32_I32_I32_ARITH>>; 525 defm V_ADD_LSHL_U32 : VOP3Inst <"v_add_lshl_u32", VOP3_Profile<VOP_I32_I32_I32_I32>>; 526} // End isCommutable = 1, isReMaterializable = 1 527// TODO src0 contains the opsel bit for dst, so if we commute, need to mask and swap this 528// to the new src0. 529defm V_MED3_F16 : VOP3Inst <"v_med3_f16", VOP3_Profile<VOP_F16_F16_F16_F16, VOP3_OPSEL>, AMDGPUfmed3>; 530defm V_MED3_I16 : VOP3Inst <"v_med3_i16", VOP3_Profile<VOP_I16_I16_I16_I16, VOP3_OPSEL>, AMDGPUsmed3>; 531defm V_MED3_U16 : VOP3Inst <"v_med3_u16", VOP3_Profile<VOP_I16_I16_I16_I16, VOP3_OPSEL>, AMDGPUumed3>; 532 533defm V_MIN3_F16 : VOP3Inst <"v_min3_f16", VOP3_Profile<VOP_F16_F16_F16_F16, VOP3_OPSEL>, AMDGPUfmin3>; 534defm V_MIN3_I16 : VOP3Inst <"v_min3_i16", VOP3_Profile<VOP_I16_I16_I16_I16, VOP3_OPSEL>, AMDGPUsmin3>; 535defm V_MIN3_U16 : VOP3Inst <"v_min3_u16", VOP3_Profile<VOP_I16_I16_I16_I16, VOP3_OPSEL>, AMDGPUumin3>; 536 537defm V_MAX3_F16 : VOP3Inst <"v_max3_f16", VOP3_Profile<VOP_F16_F16_F16_F16, VOP3_OPSEL>, AMDGPUfmax3>; 538defm V_MAX3_I16 : VOP3Inst <"v_max3_i16", VOP3_Profile<VOP_I16_I16_I16_I16, VOP3_OPSEL>, AMDGPUsmax3>; 539defm V_MAX3_U16 : VOP3Inst <"v_max3_u16", VOP3_Profile<VOP_I16_I16_I16_I16, VOP3_OPSEL>, AMDGPUumax3>; 540 541defm V_ADD_I16 : VOP3Inst <"v_add_i16", VOP3_Profile<VOP_I16_I16_I16, VOP3_OPSEL>>; 542defm V_SUB_I16 : VOP3Inst <"v_sub_i16", VOP3_Profile<VOP_I16_I16_I16, VOP3_OPSEL>>; 543 544defm V_MAD_U32_U16 : VOP3Inst <"v_mad_u32_u16", VOP3_Profile<VOP_I32_I16_I16_I32, VOP3_OPSEL>>; 545defm V_MAD_I32_I16 : VOP3Inst <"v_mad_i32_i16", VOP3_Profile<VOP_I32_I16_I16_I32, VOP3_OPSEL>>; 546 547defm V_CVT_PKNORM_I16_F16 : VOP3Inst <"v_cvt_pknorm_i16_f16", VOP3_Profile<VOP_B32_F16_F16, VOP3_OPSEL>>; 548defm V_CVT_PKNORM_U16_F16 : VOP3Inst <"v_cvt_pknorm_u16_f16", VOP3_Profile<VOP_B32_F16_F16, VOP3_OPSEL>>; 549 550defm V_PACK_B32_F16 : VOP3Inst <"v_pack_b32_f16", VOP3_Profile<VOP_B32_F16_F16, VOP3_OPSEL>>; 551 552let isReMaterializable = 1 in { 553defm V_SUB_I32 : VOP3Inst <"v_sub_i32", VOP3_Profile<VOP_I32_I32_I32_ARITH>>; 554defm V_LSHL_ADD_U32 : VOP3Inst <"v_lshl_add_u32", VOP3_Profile<VOP_I32_I32_I32_I32>>; 555defm V_LSHL_OR_B32 : VOP3Inst <"v_lshl_or_b32", VOP3_Profile<VOP_I32_I32_I32_I32>>; 556} // End isReMaterializable = 1 557 558// V_LSHL_ADD_U64: D0.u64 = (S0.u64 << S1.u[2:0]) + S2.u64 559// src0 is shifted left by 0-4 (use “0” to get ADD_U64). 560let SubtargetPredicate = isGFX940Plus in 561defm V_LSHL_ADD_U64 : VOP3Inst <"v_lshl_add_u64", VOP3_Profile<VOP_I64_I64_I32_I64>>; 562 563let SubtargetPredicate = HasFP8Insts, mayRaiseFPException = 0, 564 SchedRW = [WriteFloatCvt] in { 565 let Constraints = "$vdst = $vdst_in", DisableEncoding = "$vdst_in" in { 566 defm V_CVT_PK_FP8_F32 : VOP3Inst<"v_cvt_pk_fp8_f32", VOP3_CVT_PK_F8_F32_Profile>; 567 defm V_CVT_PK_BF8_F32 : VOP3Inst<"v_cvt_pk_bf8_f32", VOP3_CVT_PK_F8_F32_Profile>; 568 } 569 570 // These instructions have non-standard use of op_sel. In particular they are 571 // using op_sel bits 2 and 3 while only having two sources. Therefore dummy 572 // src2 is used to hold the op_sel value. 573 let Constraints = "$vdst = $src2", DisableEncoding = "$src2" in { 574 defm V_CVT_SR_FP8_F32 : VOP3Inst<"v_cvt_sr_fp8_f32", VOP3_CVT_SR_F8_F32_Profile>; 575 defm V_CVT_SR_BF8_F32 : VOP3Inst<"v_cvt_sr_bf8_f32", VOP3_CVT_SR_F8_F32_Profile>; 576 } 577} 578 579class Cvt_PK_F8_F32_Pat<SDPatternOperator node, int index, VOP3_Pseudo inst> : GCNPat< 580 (i32 (node f32:$src0, f32:$src1, i32:$old, index)), 581 (inst !if(index, SRCMODS.DST_OP_SEL, 0), $src0, 0, $src1, $old, !if(index, SRCMODS.OP_SEL_0, 0)) 582>; 583 584class Cvt_SR_F8_F32_Pat<SDPatternOperator node, bits<2> index, VOP3_Pseudo inst> : GCNPat< 585 (i32 (node f32:$src0, i32:$src1, i32:$old, index)), 586 (inst !if(index{1}, SRCMODS.DST_OP_SEL, 0), $src0, 0, $src1, 587 !if(index{0}, SRCMODS.OP_SEL_0, 0), $old, !if(index{1}, SRCMODS.OP_SEL_0, 0)) 588>; 589 590foreach Index = [0, -1] in { 591 def : Cvt_PK_F8_F32_Pat<int_amdgcn_cvt_pk_fp8_f32, Index, V_CVT_PK_FP8_F32_e64>; 592 def : Cvt_PK_F8_F32_Pat<int_amdgcn_cvt_pk_bf8_f32, Index, V_CVT_PK_BF8_F32_e64>; 593} 594 595foreach Index = [0, 1, 2, 3] in { 596 def : Cvt_SR_F8_F32_Pat<int_amdgcn_cvt_sr_fp8_f32, Index, V_CVT_SR_FP8_F32_e64>; 597 def : Cvt_SR_F8_F32_Pat<int_amdgcn_cvt_sr_bf8_f32, Index, V_CVT_SR_BF8_F32_e64>; 598} 599 600class ThreeOp_i32_Pats <SDPatternOperator op1, SDPatternOperator op2, Instruction inst> : GCNPat < 601 // This matches (op2 (op1 i32:$src0, i32:$src1), i32:$src2) with conditions. 602 (ThreeOpFrag<op1, op2> i32:$src0, i32:$src1, i32:$src2), 603 (inst VSrc_b32:$src0, VSrc_b32:$src1, VSrc_b32:$src2) 604>; 605 606def : ThreeOp_i32_Pats<cshl_32, add, V_LSHL_ADD_U32_e64>; 607def : ThreeOp_i32_Pats<add, cshl_32, V_ADD_LSHL_U32_e64>; 608def : ThreeOp_i32_Pats<add, add, V_ADD3_U32_e64>; 609def : ThreeOp_i32_Pats<ptradd, ptradd, V_ADD3_U32_e64>; 610def : ThreeOp_i32_Pats<cshl_32, or, V_LSHL_OR_B32_e64>; 611def : ThreeOp_i32_Pats<and, or, V_AND_OR_B32_e64>; 612def : ThreeOp_i32_Pats<or, or, V_OR3_B32_e64>; 613def : ThreeOp_i32_Pats<xor, add, V_XAD_U32_e64>; 614 615let SubtargetPredicate = isGFX940Plus in 616def : GCNPat< 617 (ThreeOpFrag<shl_0_to_4, add> i64:$src0, i32:$src1, i64:$src2), 618 (V_LSHL_ADD_U64_e64 VSrc_b64:$src0, VSrc_b32:$src1, VSrc_b64:$src2) 619>; 620 621def : VOPBinOpClampPat<saddsat, V_ADD_I32_e64, i32>; 622def : VOPBinOpClampPat<ssubsat, V_SUB_I32_e64, i32>; 623 624def : GCNPat<(DivergentBinFrag<or> (or_oneuse i64:$src0, i64:$src1), i64:$src2), 625 (REG_SEQUENCE VReg_64, 626 (V_OR3_B32_e64 (i32 (EXTRACT_SUBREG $src0, sub0)), 627 (i32 (EXTRACT_SUBREG $src1, sub0)), 628 (i32 (EXTRACT_SUBREG $src2, sub0))), sub0, 629 (V_OR3_B32_e64 (i32 (EXTRACT_SUBREG $src0, sub1)), 630 (i32 (EXTRACT_SUBREG $src1, sub1)), 631 (i32 (EXTRACT_SUBREG $src2, sub1))), sub1)>; 632 633// FIXME: Probably should hardcode clamp bit in pseudo and avoid this. 634class OpSelBinOpClampPat<SDPatternOperator node, 635 Instruction inst> : GCNPat< 636 (node (i16 (VOP3OpSel i16:$src0, i32:$src0_modifiers)), 637 (i16 (VOP3OpSel i16:$src1, i32:$src1_modifiers))), 638 (inst $src0_modifiers, $src0, $src1_modifiers, $src1, DSTCLAMP.ENABLE, 0) 639>; 640 641def : OpSelBinOpClampPat<saddsat, V_ADD_I16_e64>; 642def : OpSelBinOpClampPat<ssubsat, V_SUB_I16_e64>; 643} // End SubtargetPredicate = isGFX9Plus 644 645// FIXME: GlobalISel in general does not handle instructions with 2 results, 646// so it cannot use these patterns. 647multiclass IMAD32_Pats <VOP3_Pseudo inst> { 648 def : GCNPat < 649 (ThreeOpFrag<mul, add> i32:$src0, i32:$src1, i32:$src2), 650 (EXTRACT_SUBREG (inst $src0, $src1, 651 (REG_SEQUENCE SReg_64, // Use scalar and let it be legalized 652 $src2, sub0, 653 (i32 (IMPLICIT_DEF)), sub1), 654 0 /* clamp */), 655 sub0) 656 >; 657 // Immediate src2 in the pattern above will not fold because it would be partially 658 // undef. Hence define specialized pattern for this case. 659 // FIXME: GlobalISel pattern exporter fails to export a pattern like this and asserts, 660 // make it SDAG only. 661 def : GCNPat < 662 (ThreeOpFragSDAG<mul, add> i32:$src0, i32:$src1, (i32 imm:$src2)), 663 (EXTRACT_SUBREG (inst $src0, $src1, (i64 (as_i64imm $src2)), 0 /* clamp */), sub0) 664 >; 665} 666 667// exclude pre-GFX9 where it was slow 668let OtherPredicates = [HasNotMADIntraFwdBug], SubtargetPredicate = isGFX9Plus in 669 defm : IMAD32_Pats<V_MAD_U64_U32_e64>; 670let OtherPredicates = [HasMADIntraFwdBug], SubtargetPredicate = isGFX11Only in 671 defm : IMAD32_Pats<V_MAD_U64_U32_gfx11_e64>; 672 673def VOP3_PERMLANE_Profile : VOP3_Profile<VOPProfile <[i32, i32, i32, i32]>, VOP3_OPSEL> { 674 let InsVOP3OpSel = (ins IntOpSelMods:$src0_modifiers, VRegSrc_32:$src0, 675 IntOpSelMods:$src1_modifiers, SSrc_b32:$src1, 676 IntOpSelMods:$src2_modifiers, SSrc_b32:$src2, 677 VGPR_32:$vdst_in, op_sel0:$op_sel); 678 let HasClamp = 0; 679 let HasExtVOP3DPP = 0; 680 let HasExtDPP = 0; 681} 682 683def opsel_i1timm : SDNodeXForm<timm, [{ 684 return CurDAG->getTargetConstant( 685 N->getZExtValue() ? SISrcMods::OP_SEL_0 : SISrcMods::NONE, 686 SDLoc(N), MVT::i32); 687}]>; 688def gi_opsel_i1timm : GICustomOperandRenderer<"renderOpSelTImm">, 689 GISDNodeXFormEquiv<opsel_i1timm>; 690 691class PermlanePat<SDPatternOperator permlane, 692 Instruction inst> : GCNPat< 693 (permlane i32:$vdst_in, i32:$src0, i32:$src1, i32:$src2, 694 timm:$fi, timm:$bc), 695 (inst (opsel_i1timm $fi), VGPR_32:$src0, (opsel_i1timm $bc), 696 SCSrc_b32:$src1, 0, SCSrc_b32:$src2, VGPR_32:$vdst_in) 697>; 698 699 700let SubtargetPredicate = isGFX10Plus in { 701 let isCommutable = 1, isReMaterializable = 1 in { 702 defm V_XOR3_B32 : VOP3Inst <"v_xor3_b32", VOP3_Profile<VOP_I32_I32_I32_I32>>; 703 } // End isCommutable = 1, isReMaterializable = 1 704 def : ThreeOp_i32_Pats<xor, xor, V_XOR3_B32_e64>; 705 706 let Constraints = "$vdst = $vdst_in", DisableEncoding="$vdst_in" in { 707 defm V_PERMLANE16_B32 : VOP3Inst<"v_permlane16_b32", VOP3_PERMLANE_Profile>; 708 defm V_PERMLANEX16_B32 : VOP3Inst<"v_permlanex16_b32", VOP3_PERMLANE_Profile>; 709 } // End $vdst = $vdst_in, DisableEncoding $vdst_in 710 711 def : PermlanePat<int_amdgcn_permlane16, V_PERMLANE16_B32_e64>; 712 def : PermlanePat<int_amdgcn_permlanex16, V_PERMLANEX16_B32_e64>; 713 714 defm V_ADD_NC_U16 : VOP3Inst <"v_add_nc_u16", VOP3_Profile<VOP_I16_I16_I16, VOP3_OPSEL>, add>; 715 defm V_SUB_NC_U16 : VOP3Inst <"v_sub_nc_u16", VOP3_Profile<VOP_I16_I16_I16, VOP3_OPSEL>, sub>; 716 717 def : OpSelBinOpClampPat<uaddsat, V_ADD_NC_U16_e64>; 718 def : OpSelBinOpClampPat<usubsat, V_SUB_NC_U16_e64>; 719 720 // Undo sub x, c -> add x, -c canonicalization since c is more likely 721 // an inline immediate than -c. 722 def : GCNPat< 723 (add i16:$src0, (i16 NegSubInlineIntConst16:$src1)), 724 (V_SUB_NC_U16_e64 0, VSrc_b16:$src0, 0, NegSubInlineIntConst16:$src1, 0, 0) 725 >; 726 727} // End SubtargetPredicate = isGFX10Plus 728 729class DivFmasPat<ValueType vt, Instruction inst, Register CondReg> : GCNPat< 730 (AMDGPUdiv_fmas (vt (VOP3Mods vt:$src0, i32:$src0_modifiers)), 731 (vt (VOP3Mods vt:$src1, i32:$src1_modifiers)), 732 (vt (VOP3Mods vt:$src2, i32:$src2_modifiers)), 733 (i1 CondReg)), 734 (inst $src0_modifiers, $src0, $src1_modifiers, $src1, $src2_modifiers, $src2) 735>; 736 737let WaveSizePredicate = isWave64 in { 738def : DivFmasPat<f32, V_DIV_FMAS_F32_e64, VCC>; 739def : DivFmasPat<f64, V_DIV_FMAS_F64_e64, VCC>; 740} 741 742let WaveSizePredicate = isWave32 in { 743def : DivFmasPat<f32, V_DIV_FMAS_F32_e64, VCC_LO>; 744def : DivFmasPat<f64, V_DIV_FMAS_F64_e64, VCC_LO>; 745} 746 747class VOP3_DOT_Profile<VOPProfile P, VOP3Features Features = VOP3_REGULAR> : VOP3_Profile<P, Features> { 748 let HasClamp = 0; 749 let HasOMod = 0; 750 // Override modifiers for bf16(i16) (same as float modifiers). 751 let HasSrc0Mods = 1; 752 let HasSrc1Mods = 1; 753 let HasSrc2Mods = 1; 754 let Src0ModVOP3DPP = FPVRegInputMods; 755 let Src1ModVOP3DPP = FPVRegInputMods; 756 let Src2ModVOP3DPP = FP16InputMods; 757 let InsVOP3OpSel = getInsVOP3OpSel<Src0RC64, Src1RC64, Src2RC64, NumSrcArgs, 758 HasClamp, HasOMod, FP16InputMods, 759 FP16InputMods, FP16InputMods>.ret; 760 let AsmVOP3OpSel = getAsmVOP3OpSel<NumSrcArgs, HasClamp, HasOMod, 1, 1, 1>.ret; 761} 762 763let SubtargetPredicate = isGFX11Plus in { 764 defm V_MAXMIN_F32 : VOP3Inst<"v_maxmin_f32", VOP3_Profile<VOP_F32_F32_F32_F32>>; 765 defm V_MINMAX_F32 : VOP3Inst<"v_minmax_f32", VOP3_Profile<VOP_F32_F32_F32_F32>>; 766 defm V_MAXMIN_F16 : VOP3Inst<"v_maxmin_f16", VOP3_Profile<VOP_F16_F16_F16_F16>>; 767 defm V_MINMAX_F16 : VOP3Inst<"v_minmax_f16", VOP3_Profile<VOP_F16_F16_F16_F16>>; 768 defm V_MAXMIN_U32 : VOP3Inst<"v_maxmin_u32", VOP3_Profile<VOP_I32_I32_I32_I32>>; 769 defm V_MINMAX_U32 : VOP3Inst<"v_minmax_u32", VOP3_Profile<VOP_I32_I32_I32_I32>>; 770 defm V_MAXMIN_I32 : VOP3Inst<"v_maxmin_i32", VOP3_Profile<VOP_I32_I32_I32_I32>>; 771 defm V_MINMAX_I32 : VOP3Inst<"v_minmax_i32", VOP3_Profile<VOP_I32_I32_I32_I32>>; 772 defm V_CVT_PK_I16_F32 : VOP3Inst<"v_cvt_pk_i16_f32", VOP3_Profile<VOP_V2I16_F32_F32>>; 773 defm V_CVT_PK_U16_F32 : VOP3Inst<"v_cvt_pk_u16_f32", VOP3_Profile<VOP_V2I16_F32_F32>>; 774} // End SubtargetPredicate = isGFX11Plus 775 776let SubtargetPredicate = HasDot9Insts, IsDOT=1 in { 777 defm V_DOT2_F16_F16 : VOP3Inst<"v_dot2_f16_f16", VOP3_DOT_Profile<VOP_F16_V2F16_V2F16_F16>, int_amdgcn_fdot2_f16_f16>; 778 defm V_DOT2_BF16_BF16 : VOP3Inst<"v_dot2_bf16_bf16", VOP3_DOT_Profile<VOP_I16_V2I16_V2I16_I16>, int_amdgcn_fdot2_bf16_bf16>; 779} 780 781//===----------------------------------------------------------------------===// 782// Integer Clamp Patterns 783//===----------------------------------------------------------------------===// 784 785class getClampPat<VOPProfile P, SDPatternOperator node> { 786 dag ret3 = (P.DstVT (node P.Src0VT:$src0, P.Src1VT:$src1, P.Src2VT:$src2)); 787 dag ret2 = (P.DstVT (node P.Src0VT:$src0, P.Src1VT:$src1)); 788 dag ret1 = (P.DstVT (node P.Src0VT:$src0)); 789 dag ret = !if(!eq(P.NumSrcArgs, 3), ret3, 790 !if(!eq(P.NumSrcArgs, 2), ret2, 791 ret1)); 792} 793 794class getClampRes<VOPProfile P, Instruction inst> { 795 dag ret3 = (inst P.Src0VT:$src0, P.Src1VT:$src1, P.Src2VT:$src2, (i1 0)); 796 dag ret2 = (inst P.Src0VT:$src0, P.Src1VT:$src1, (i1 0)); 797 dag ret1 = (inst P.Src0VT:$src0, (i1 0)); 798 dag ret = !if(!eq(P.NumSrcArgs, 3), ret3, 799 !if(!eq(P.NumSrcArgs, 2), ret2, 800 ret1)); 801} 802 803class IntClampPat<VOP3InstBase inst, SDPatternOperator node> : GCNPat< 804 getClampPat<inst.Pfl, node>.ret, 805 getClampRes<inst.Pfl, inst>.ret 806>; 807 808def : IntClampPat<V_MAD_I32_I24_e64, AMDGPUmad_i24>; 809def : IntClampPat<V_MAD_U32_U24_e64, AMDGPUmad_u24>; 810 811def : IntClampPat<V_SAD_U8_e64, int_amdgcn_sad_u8>; 812def : IntClampPat<V_SAD_HI_U8_e64, int_amdgcn_sad_hi_u8>; 813def : IntClampPat<V_SAD_U16_e64, int_amdgcn_sad_u16>; 814 815def : IntClampPat<V_MSAD_U8_e64, int_amdgcn_msad_u8>; 816def : IntClampPat<V_MQSAD_PK_U16_U8_e64, int_amdgcn_mqsad_pk_u16_u8>; 817 818def : IntClampPat<V_QSAD_PK_U16_U8_e64, int_amdgcn_qsad_pk_u16_u8>; 819def : IntClampPat<V_MQSAD_U32_U8_e64, int_amdgcn_mqsad_u32_u8>; 820 821//===----------------------------------------------------------------------===// 822// Target-specific instruction encodings. 823//===----------------------------------------------------------------------===// 824 825//===----------------------------------------------------------------------===// 826// GFX11. 827//===----------------------------------------------------------------------===// 828 829defm V_FMA_DX9_ZERO_F32 : VOP3_Real_with_name_gfx11<0x209, "V_FMA_LEGACY_F32", "v_fma_dx9_zero_f32">; 830defm V_MAD_I32_I24 : VOP3_Realtriple_gfx11<0x20a>; 831defm V_MAD_U32_U24 : VOP3_Realtriple_gfx11<0x20b>; 832defm V_CUBEID_F32 : VOP3_Realtriple_gfx11<0x20c>; 833defm V_CUBESC_F32 : VOP3_Realtriple_gfx11<0x20d>; 834defm V_CUBETC_F32 : VOP3_Realtriple_gfx11<0x20e>; 835defm V_CUBEMA_F32 : VOP3_Realtriple_gfx11<0x20f>; 836defm V_BFE_U32 : VOP3_Realtriple_gfx11<0x210>; 837defm V_BFE_I32 : VOP3_Realtriple_gfx11<0x211>; 838defm V_BFI_B32 : VOP3_Realtriple_gfx11<0x212>; 839defm V_FMA_F32 : VOP3_Realtriple_gfx11<0x213>; 840defm V_FMA_F64 : VOP3_Real_Base_gfx11<0x214>; 841defm V_LERP_U8 : VOP3_Realtriple_gfx11<0x215>; 842defm V_ALIGNBIT_B32 : VOP3_Realtriple_gfx11<0x216>; 843defm V_ALIGNBYTE_B32 : VOP3_Realtriple_gfx11<0x217>; 844defm V_MULLIT_F32 : VOP3_Realtriple_gfx11<0x218>; 845defm V_MIN3_F32 : VOP3_Realtriple_gfx11<0x219>; 846defm V_MIN3_I32 : VOP3_Realtriple_gfx11<0x21a>; 847defm V_MIN3_U32 : VOP3_Realtriple_gfx11<0x21b>; 848defm V_MAX3_F32 : VOP3_Realtriple_gfx11<0x21c>; 849defm V_MAX3_I32 : VOP3_Realtriple_gfx11<0x21d>; 850defm V_MAX3_U32 : VOP3_Realtriple_gfx11<0x21e>; 851defm V_MED3_F32 : VOP3_Realtriple_gfx11<0x21f>; 852defm V_MED3_I32 : VOP3_Realtriple_gfx11<0x220>; 853defm V_MED3_U32 : VOP3_Realtriple_gfx11<0x221>; 854defm V_SAD_U8 : VOP3_Realtriple_gfx11<0x222>; 855defm V_SAD_HI_U8 : VOP3_Realtriple_gfx11<0x223>; 856defm V_SAD_U16 : VOP3_Realtriple_gfx11<0x224>; 857defm V_SAD_U32 : VOP3_Realtriple_gfx11<0x225>; 858defm V_CVT_PK_U8_F32 : VOP3_Realtriple_gfx11<0x226>; 859defm V_DIV_FIXUP_F32 : VOP3_Real_Base_gfx11<0x227>; 860defm V_DIV_FIXUP_F64 : VOP3_Real_Base_gfx11<0x228>; 861defm V_DIV_FMAS_F32 : VOP3_Real_Base_gfx11<0x237>; 862defm V_DIV_FMAS_F64 : VOP3_Real_Base_gfx11<0x238>; 863defm V_MSAD_U8 : VOP3_Realtriple_gfx11<0x239>; 864defm V_QSAD_PK_U16_U8 : VOP3_Real_Base_gfx11<0x23a>; 865defm V_MQSAD_PK_U16_U8 : VOP3_Real_Base_gfx11<0x23b>; 866defm V_MQSAD_U32_U8 : VOP3_Real_Base_gfx11<0x23d>; 867defm V_XOR3_B32 : VOP3_Realtriple_gfx11<0x240>; 868defm V_MAD_U16 : VOP3_Realtriple_with_name_gfx11<0x241, "V_MAD_U16_gfx9", "v_mad_u16">; 869defm V_PERM_B32 : VOP3_Realtriple_gfx11<0x244>; 870defm V_XAD_U32 : VOP3_Realtriple_gfx11<0x245>; 871defm V_LSHL_ADD_U32 : VOP3_Realtriple_gfx11<0x246>; 872defm V_ADD_LSHL_U32 : VOP3_Realtriple_gfx11<0x247>; 873defm V_FMA_F16 : VOP3_Realtriple_with_name_gfx11<0x248, "V_FMA_F16_gfx9", "v_fma_f16">; 874defm V_MIN3_F16 : VOP3_Realtriple_gfx11<0x249>; 875defm V_MIN3_I16 : VOP3_Realtriple_gfx11<0x24a>; 876defm V_MIN3_U16 : VOP3_Realtriple_gfx11<0x24b>; 877defm V_MAX3_F16 : VOP3_Realtriple_gfx11<0x24c>; 878defm V_MAX3_I16 : VOP3_Realtriple_gfx11<0x24d>; 879defm V_MAX3_U16 : VOP3_Realtriple_gfx11<0x24e>; 880defm V_MED3_F16 : VOP3_Realtriple_gfx11<0x24f>; 881defm V_MED3_I16 : VOP3_Realtriple_gfx11<0x250>; 882defm V_MED3_U16 : VOP3_Realtriple_gfx11<0x251>; 883defm V_MAD_I16 : VOP3_Realtriple_with_name_gfx11<0x253, "V_MAD_I16_gfx9", "v_mad_i16">; 884defm V_DIV_FIXUP_F16 : VOP3_Realtriple_with_name_gfx11<0x254, "V_DIV_FIXUP_F16_gfx9", "v_div_fixup_f16">; 885defm V_ADD3_U32 : VOP3_Realtriple_gfx11<0x255>; 886defm V_LSHL_OR_B32 : VOP3_Realtriple_gfx11<0x256>; 887defm V_AND_OR_B32 : VOP3_Realtriple_gfx11<0x257>; 888defm V_OR3_B32 : VOP3_Realtriple_gfx11<0x258>; 889defm V_MAD_U32_U16 : VOP3_Realtriple_gfx11<0x259>; 890defm V_MAD_I32_I16 : VOP3_Realtriple_gfx11<0x25a>; 891defm V_PERMLANE16_B32 : VOP3_Real_Base_gfx11<0x25b>; 892defm V_PERMLANEX16_B32 : VOP3_Real_Base_gfx11<0x25c>; 893defm V_MAXMIN_F32 : VOP3_Realtriple_gfx11<0x25e>; 894defm V_MINMAX_F32 : VOP3_Realtriple_gfx11<0x25f>; 895defm V_MAXMIN_F16 : VOP3_Realtriple_gfx11<0x260>; 896defm V_MINMAX_F16 : VOP3_Realtriple_gfx11<0x261>; 897defm V_MAXMIN_U32 : VOP3_Realtriple_gfx11<0x262>; 898defm V_MINMAX_U32 : VOP3_Realtriple_gfx11<0x263>; 899defm V_MAXMIN_I32 : VOP3_Realtriple_gfx11<0x264>; 900defm V_MINMAX_I32 : VOP3_Realtriple_gfx11<0x265>; 901defm V_DOT2_F16_F16 : VOP3Dot_Realtriple_gfx11<0x266>; 902defm V_DOT2_BF16_BF16 : VOP3Dot_Realtriple_gfx11<0x267>; 903defm V_DIV_SCALE_F32 : VOP3be_Real_gfx11<0x2fc, "V_DIV_SCALE_F32", "v_div_scale_f32">; 904defm V_DIV_SCALE_F64 : VOP3be_Real_gfx11<0x2fd, "V_DIV_SCALE_F64", "v_div_scale_f64">; 905defm V_MAD_U64_U32_gfx11 : VOP3be_Real_gfx11<0x2fe, "V_MAD_U64_U32_gfx11", "v_mad_u64_u32">; 906defm V_MAD_I64_I32_gfx11 : VOP3be_Real_gfx11<0x2ff, "V_MAD_I64_I32_gfx11", "v_mad_i64_i32">; 907defm V_ADD_NC_U16 : VOP3Only_Realtriple_gfx11<0x303>; 908defm V_SUB_NC_U16 : VOP3Only_Realtriple_gfx11<0x304>; 909defm V_MUL_LO_U16_t16 : VOP3Only_Realtriple_t16_gfx11<0x305, "v_mul_lo_u16">; 910defm V_CVT_PK_I16_F32 : VOP3_Realtriple_gfx11<0x306>; 911defm V_CVT_PK_U16_F32 : VOP3_Realtriple_gfx11<0x307>; 912defm V_MAX_U16_t16 : VOP3Only_Realtriple_t16_gfx11<0x309, "v_max_u16">; 913defm V_MAX_I16_t16 : VOP3Only_Realtriple_t16_gfx11<0x30a, "v_max_i16">; 914defm V_MIN_U16_t16 : VOP3Only_Realtriple_t16_gfx11<0x30b, "v_min_u16">; 915defm V_MIN_I16_t16 : VOP3Only_Realtriple_t16_gfx11<0x30c, "v_min_i16">; 916defm V_ADD_NC_I16 : VOP3_Realtriple_with_name_gfx11<0x30d, "V_ADD_I16", "v_add_nc_i16">; 917defm V_SUB_NC_I16 : VOP3_Realtriple_with_name_gfx11<0x30e, "V_SUB_I16", "v_sub_nc_i16">; 918defm V_PACK_B32_F16 : VOP3_Realtriple_gfx11<0x311>; 919defm V_CVT_PK_NORM_I16_F16 : VOP3_Realtriple_with_name_gfx11<0x312, "V_CVT_PKNORM_I16_F16" , "v_cvt_pk_norm_i16_f16" >; 920defm V_CVT_PK_NORM_U16_F16 : VOP3_Realtriple_with_name_gfx11<0x313, "V_CVT_PKNORM_U16_F16" , "v_cvt_pk_norm_u16_f16" >; 921defm V_SUB_NC_I32 : VOP3_Realtriple_with_name_gfx11<0x325, "V_SUB_I32", "v_sub_nc_i32">; 922defm V_ADD_NC_I32 : VOP3_Realtriple_with_name_gfx11<0x326, "V_ADD_I32", "v_add_nc_i32">; 923defm V_ADD_F64 : VOP3_Real_Base_gfx11<0x327>; 924defm V_MUL_F64 : VOP3_Real_Base_gfx11<0x328>; 925defm V_MIN_F64 : VOP3_Real_Base_gfx11<0x329>; 926defm V_MAX_F64 : VOP3_Real_Base_gfx11<0x32a>; 927defm V_LDEXP_F64 : VOP3_Real_Base_gfx11<0x32b>; 928defm V_MUL_LO_U32 : VOP3_Real_Base_gfx11<0x32c>; 929defm V_MUL_HI_U32 : VOP3_Real_Base_gfx11<0x32d>; 930defm V_MUL_HI_I32 : VOP3_Real_Base_gfx11<0x32e>; 931defm V_TRIG_PREOP_F64 : VOP3_Real_Base_gfx11<0x32f>; 932defm V_LSHLREV_B16_t16 : VOP3Only_Realtriple_t16_gfx11<0x338, "v_lshlrev_b16">; 933defm V_LSHRREV_B16_t16 : VOP3Only_Realtriple_t16_gfx11<0x339, "v_lshrrev_b16">; 934defm V_ASHRREV_I16_t16 : VOP3Only_Realtriple_t16_gfx11<0x33a, "v_ashrrev_i16">; 935defm V_LSHLREV_B64 : VOP3_Real_Base_gfx11<0x33c>; 936defm V_LSHRREV_B64 : VOP3_Real_Base_gfx11<0x33d>; 937defm V_ASHRREV_I64 : VOP3_Real_Base_gfx11<0x33e>; 938defm V_READLANE_B32 : VOP3_Real_No_Suffix_gfx11<0x360>; // Pseudo in VOP2 939let InOperandList = (ins SSrcOrLds_b32:$src0, SCSrc_b32:$src1, VGPR_32:$vdst_in) in { 940 defm V_WRITELANE_B32 : VOP3_Real_No_Suffix_gfx11<0x361>; // Pseudo in VOP2 941} // End InOperandList = (ins SSrcOrLds_b32:$src0, SCSrc_b32:$src1, VGPR_32:$vdst_in) 942defm V_AND_B16_t16 : VOP3Only_Realtriple_t16_gfx11<0x362, "v_and_b16">; 943defm V_OR_B16_t16 : VOP3Only_Realtriple_t16_gfx11<0x363, "v_or_b16">; 944defm V_XOR_B16_t16 : VOP3Only_Realtriple_t16_gfx11<0x364, "v_xor_b16">; 945 946//===----------------------------------------------------------------------===// 947// GFX10. 948//===----------------------------------------------------------------------===// 949 950let AssemblerPredicate = isGFX10Only, DecoderNamespace = "GFX10" in { 951 multiclass VOP3_Real_gfx10<bits<10> op> { 952 def _gfx10 : 953 VOP3_Real<!cast<VOP_Pseudo>(NAME#"_e64"), SIEncodingFamily.GFX10>, 954 VOP3e_gfx10<op, !cast<VOP_Pseudo>(NAME#"_e64").Pfl>; 955 } 956 multiclass VOP3_Real_No_Suffix_gfx10<bits<10> op> { 957 def _gfx10 : 958 VOP3_Real<!cast<VOP_Pseudo>(NAME), SIEncodingFamily.GFX10>, 959 VOP3e_gfx10<op, !cast<VOP_Pseudo>(NAME).Pfl>; 960 } 961 multiclass VOP3_Real_gfx10_with_name<bits<10> op, string opName, 962 string asmName> { 963 def _gfx10 : 964 VOP3_Real<!cast<VOP3_Pseudo>(opName#"_e64"), SIEncodingFamily.GFX10>, 965 VOP3e_gfx10<op, !cast<VOP3_Pseudo>(opName#"_e64").Pfl> { 966 VOP3_Pseudo ps = !cast<VOP3_Pseudo>(opName#"_e64"); 967 let AsmString = asmName # ps.AsmOperands; 968 let IsSingle = 1; 969 } 970 } 971 multiclass VOP3be_Real_gfx10<bits<10> op> { 972 def _gfx10 : 973 VOP3_Real<!cast<VOP3_Pseudo>(NAME#"_e64"), SIEncodingFamily.GFX10>, 974 VOP3be_gfx10<op, !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>; 975 } 976 multiclass VOP3Interp_Real_gfx10<bits<10> op> { 977 def _gfx10 : 978 VOP3_Real<!cast<VOP3_Pseudo>(NAME), SIEncodingFamily.GFX10>, 979 VOP3Interp_gfx10<op, !cast<VOP3_Pseudo>(NAME).Pfl>; 980 } 981 multiclass VOP3OpSel_Real_gfx10<bits<10> op> { 982 def _gfx10 : 983 VOP3_Real<!cast<VOP3_Pseudo>(NAME#"_e64"), SIEncodingFamily.GFX10>, 984 VOP3OpSel_gfx10<op, !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>; 985 } 986 multiclass VOP3OpSel_Real_gfx10_with_name<bits<10> op, string opName, 987 string asmName> { 988 def _gfx10 : 989 VOP3_Real<!cast<VOP3_Pseudo>(opName#"_e64"), SIEncodingFamily.GFX10>, 990 VOP3OpSel_gfx10<op, !cast<VOP3_Pseudo>(opName#"_e64").Pfl> { 991 VOP3_Pseudo ps = !cast<VOP3_Pseudo>(opName#"_e64"); 992 let AsmString = asmName # ps.AsmOperands; 993 } 994 } 995} // End AssemblerPredicate = isGFX10Only, DecoderNamespace = "GFX10" 996 997defm V_READLANE_B32 : VOP3_Real_No_Suffix_gfx10<0x360>; 998 999let InOperandList = (ins SSrcOrLds_b32:$src0, SCSrc_b32:$src1, VGPR_32:$vdst_in) in { 1000 defm V_WRITELANE_B32 : VOP3_Real_No_Suffix_gfx10<0x361>; 1001} // End InOperandList = (ins SSrcOrLds_b32:$src0, SCSrc_b32:$src1, VGPR_32:$vdst_in) 1002 1003let SubtargetPredicate = isGFX10Before1030 in { 1004 defm V_MUL_LO_I32 : VOP3_Real_gfx10<0x16b>; 1005} 1006 1007defm V_XOR3_B32 : VOP3_Real_gfx10<0x178>; 1008defm V_LSHLREV_B64 : VOP3_Real_gfx10<0x2ff>; 1009defm V_LSHRREV_B64 : VOP3_Real_gfx10<0x300>; 1010defm V_ASHRREV_I64 : VOP3_Real_gfx10<0x301>; 1011defm V_PERM_B32 : VOP3_Real_gfx10<0x344>; 1012defm V_XAD_U32 : VOP3_Real_gfx10<0x345>; 1013defm V_LSHL_ADD_U32 : VOP3_Real_gfx10<0x346>; 1014defm V_ADD_LSHL_U32 : VOP3_Real_gfx10<0x347>; 1015defm V_ADD3_U32 : VOP3_Real_gfx10<0x36d>; 1016defm V_LSHL_OR_B32 : VOP3_Real_gfx10<0x36f>; 1017defm V_AND_OR_B32 : VOP3_Real_gfx10<0x371>; 1018defm V_OR3_B32 : VOP3_Real_gfx10<0x372>; 1019 1020// TODO-GFX10: add MC tests for v_add/sub_nc_i16 1021defm V_ADD_NC_I16 : 1022 VOP3OpSel_Real_gfx10_with_name<0x30d, "V_ADD_I16", "v_add_nc_i16">; 1023defm V_SUB_NC_I16 : 1024 VOP3OpSel_Real_gfx10_with_name<0x30e, "V_SUB_I16", "v_sub_nc_i16">; 1025defm V_SUB_NC_I32 : 1026 VOP3_Real_gfx10_with_name<0x376, "V_SUB_I32", "v_sub_nc_i32">; 1027defm V_ADD_NC_I32 : 1028 VOP3_Real_gfx10_with_name<0x37f, "V_ADD_I32", "v_add_nc_i32">; 1029 1030defm V_INTERP_P1_F32_e64 : VOP3Interp_Real_gfx10<0x200>; 1031defm V_INTERP_P2_F32_e64 : VOP3Interp_Real_gfx10<0x201>; 1032defm V_INTERP_MOV_F32_e64 : VOP3Interp_Real_gfx10<0x202>; 1033 1034defm V_INTERP_P1LL_F16 : VOP3Interp_Real_gfx10<0x342>; 1035defm V_INTERP_P1LV_F16 : VOP3Interp_Real_gfx10<0x343>; 1036defm V_INTERP_P2_F16 : VOP3Interp_Real_gfx10<0x35a>; 1037 1038defm V_PACK_B32_F16 : VOP3OpSel_Real_gfx10<0x311>; 1039defm V_CVT_PKNORM_I16_F16 : VOP3OpSel_Real_gfx10<0x312>; 1040defm V_CVT_PKNORM_U16_F16 : VOP3OpSel_Real_gfx10<0x313>; 1041 1042defm V_MIN3_F16 : VOP3OpSel_Real_gfx10<0x351>; 1043defm V_MIN3_I16 : VOP3OpSel_Real_gfx10<0x352>; 1044defm V_MIN3_U16 : VOP3OpSel_Real_gfx10<0x353>; 1045defm V_MAX3_F16 : VOP3OpSel_Real_gfx10<0x354>; 1046defm V_MAX3_I16 : VOP3OpSel_Real_gfx10<0x355>; 1047defm V_MAX3_U16 : VOP3OpSel_Real_gfx10<0x356>; 1048defm V_MED3_F16 : VOP3OpSel_Real_gfx10<0x357>; 1049defm V_MED3_I16 : VOP3OpSel_Real_gfx10<0x358>; 1050defm V_MED3_U16 : VOP3OpSel_Real_gfx10<0x359>; 1051defm V_MAD_U32_U16 : VOP3OpSel_Real_gfx10<0x373>; 1052defm V_MAD_I32_I16 : VOP3OpSel_Real_gfx10<0x375>; 1053 1054defm V_MAD_U16 : 1055 VOP3OpSel_Real_gfx10_with_name<0x340, "V_MAD_U16_gfx9", "v_mad_u16">; 1056defm V_FMA_F16 : 1057 VOP3OpSel_Real_gfx10_with_name<0x34b, "V_FMA_F16_gfx9", "v_fma_f16">; 1058defm V_MAD_I16 : 1059 VOP3OpSel_Real_gfx10_with_name<0x35e, "V_MAD_I16_gfx9", "v_mad_i16">; 1060defm V_DIV_FIXUP_F16 : 1061 VOP3OpSel_Real_gfx10_with_name<0x35f, "V_DIV_FIXUP_F16_gfx9", "v_div_fixup_f16">; 1062 1063defm V_ADD_NC_U16 : VOP3OpSel_Real_gfx10<0x303>; 1064defm V_SUB_NC_U16 : VOP3OpSel_Real_gfx10<0x304>; 1065 1066// FIXME-GFX10-OPSEL: Need to add "selective" opsel support to some of these 1067// (they do not support SDWA or DPP). 1068defm V_MUL_LO_U16 : VOP3_Real_gfx10_with_name<0x305, "V_MUL_LO_U16", "v_mul_lo_u16">; 1069defm V_LSHRREV_B16 : VOP3_Real_gfx10_with_name<0x307, "V_LSHRREV_B16", "v_lshrrev_b16">; 1070defm V_ASHRREV_I16 : VOP3_Real_gfx10_with_name<0x308, "V_ASHRREV_I16", "v_ashrrev_i16">; 1071defm V_MAX_U16 : VOP3_Real_gfx10_with_name<0x309, "V_MAX_U16", "v_max_u16">; 1072defm V_MAX_I16 : VOP3_Real_gfx10_with_name<0x30a, "V_MAX_I16", "v_max_i16">; 1073defm V_MIN_U16 : VOP3_Real_gfx10_with_name<0x30b, "V_MIN_U16", "v_min_u16">; 1074defm V_MIN_I16 : VOP3_Real_gfx10_with_name<0x30c, "V_MIN_I16", "v_min_i16">; 1075defm V_LSHLREV_B16 : VOP3_Real_gfx10_with_name<0x314, "V_LSHLREV_B16", "v_lshlrev_b16">; 1076defm V_PERMLANE16_B32 : VOP3OpSel_Real_gfx10<0x377>; 1077defm V_PERMLANEX16_B32 : VOP3OpSel_Real_gfx10<0x378>; 1078 1079//===----------------------------------------------------------------------===// 1080// GFX7, GFX10. 1081//===----------------------------------------------------------------------===// 1082 1083let AssemblerPredicate = isGFX7Only, DecoderNamespace = "GFX7" in { 1084 multiclass VOP3_Real_gfx7<bits<10> op> { 1085 def _gfx7 : 1086 VOP3_Real<!cast<VOP3_Pseudo>(NAME#"_e64"), SIEncodingFamily.SI>, 1087 VOP3e_gfx6_gfx7<op{8-0}, !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>; 1088 } 1089 multiclass VOP3be_Real_gfx7<bits<10> op> { 1090 def _gfx7 : 1091 VOP3_Real<!cast<VOP3_Pseudo>(NAME#"_e64"), SIEncodingFamily.SI>, 1092 VOP3be_gfx6_gfx7<op{8-0}, !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>; 1093 } 1094} // End AssemblerPredicate = isGFX7Only, DecoderNamespace = "GFX7" 1095 1096multiclass VOP3_Real_gfx7_gfx10<bits<10> op> : 1097 VOP3_Real_gfx7<op>, VOP3_Real_gfx10<op>; 1098 1099multiclass VOP3be_Real_gfx7_gfx10<bits<10> op> : 1100 VOP3be_Real_gfx7<op>, VOP3be_Real_gfx10<op>; 1101 1102defm V_QSAD_PK_U16_U8 : VOP3_Real_gfx7_gfx10<0x172>; 1103defm V_MQSAD_U32_U8 : VOP3_Real_gfx7_gfx10<0x175>; 1104defm V_MAD_U64_U32 : VOP3be_Real_gfx7_gfx10<0x176>; 1105defm V_MAD_I64_I32 : VOP3be_Real_gfx7_gfx10<0x177>; 1106 1107//===----------------------------------------------------------------------===// 1108// GFX6, GFX7, GFX10. 1109//===----------------------------------------------------------------------===// 1110 1111let AssemblerPredicate = isGFX6GFX7, DecoderNamespace = "GFX6GFX7" in { 1112 multiclass VOP3_Real_gfx6_gfx7<bits<10> op> { 1113 def _gfx6_gfx7 : 1114 VOP3_Real<!cast<VOP3_Pseudo>(NAME#"_e64"), SIEncodingFamily.SI>, 1115 VOP3e_gfx6_gfx7<op{8-0}, !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>; 1116 } 1117 multiclass VOP3be_Real_gfx6_gfx7<bits<10> op> { 1118 def _gfx6_gfx7 : 1119 VOP3_Real<!cast<VOP3_Pseudo>(NAME#"_e64"), SIEncodingFamily.SI>, 1120 VOP3be_gfx6_gfx7<op{8-0}, !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>; 1121 } 1122} // End AssemblerPredicate = isGFX6GFX7, DecoderNamespace = "GFX6GFX7" 1123 1124multiclass VOP3_Real_gfx6_gfx7_gfx10<bits<10> op> : 1125 VOP3_Real_gfx6_gfx7<op>, VOP3_Real_gfx10<op>; 1126 1127multiclass VOP3be_Real_gfx6_gfx7_gfx10<bits<10> op> : 1128 VOP3be_Real_gfx6_gfx7<op>, VOP3be_Real_gfx10<op>; 1129 1130defm V_LSHL_B64 : VOP3_Real_gfx6_gfx7<0x161>; 1131defm V_LSHR_B64 : VOP3_Real_gfx6_gfx7<0x162>; 1132defm V_ASHR_I64 : VOP3_Real_gfx6_gfx7<0x163>; 1133defm V_MUL_LO_I32 : VOP3_Real_gfx6_gfx7<0x16b>; 1134 1135defm V_MAD_LEGACY_F32 : VOP3_Real_gfx6_gfx7_gfx10<0x140>; 1136defm V_MAD_F32 : VOP3_Real_gfx6_gfx7_gfx10<0x141>; 1137defm V_MAD_I32_I24 : VOP3_Real_gfx6_gfx7_gfx10<0x142>; 1138defm V_MAD_U32_U24 : VOP3_Real_gfx6_gfx7_gfx10<0x143>; 1139defm V_CUBEID_F32 : VOP3_Real_gfx6_gfx7_gfx10<0x144>; 1140defm V_CUBESC_F32 : VOP3_Real_gfx6_gfx7_gfx10<0x145>; 1141defm V_CUBETC_F32 : VOP3_Real_gfx6_gfx7_gfx10<0x146>; 1142defm V_CUBEMA_F32 : VOP3_Real_gfx6_gfx7_gfx10<0x147>; 1143defm V_BFE_U32 : VOP3_Real_gfx6_gfx7_gfx10<0x148>; 1144defm V_BFE_I32 : VOP3_Real_gfx6_gfx7_gfx10<0x149>; 1145defm V_BFI_B32 : VOP3_Real_gfx6_gfx7_gfx10<0x14a>; 1146defm V_FMA_F32 : VOP3_Real_gfx6_gfx7_gfx10<0x14b>; 1147defm V_FMA_F64 : VOP3_Real_gfx6_gfx7_gfx10<0x14c>; 1148defm V_LERP_U8 : VOP3_Real_gfx6_gfx7_gfx10<0x14d>; 1149defm V_ALIGNBIT_B32 : VOP3_Real_gfx6_gfx7_gfx10<0x14e>; 1150defm V_ALIGNBYTE_B32 : VOP3_Real_gfx6_gfx7_gfx10<0x14f>; 1151defm V_MULLIT_F32 : VOP3_Real_gfx6_gfx7_gfx10<0x150>; 1152defm V_MIN3_F32 : VOP3_Real_gfx6_gfx7_gfx10<0x151>; 1153defm V_MIN3_I32 : VOP3_Real_gfx6_gfx7_gfx10<0x152>; 1154defm V_MIN3_U32 : VOP3_Real_gfx6_gfx7_gfx10<0x153>; 1155defm V_MAX3_F32 : VOP3_Real_gfx6_gfx7_gfx10<0x154>; 1156defm V_MAX3_I32 : VOP3_Real_gfx6_gfx7_gfx10<0x155>; 1157defm V_MAX3_U32 : VOP3_Real_gfx6_gfx7_gfx10<0x156>; 1158defm V_MED3_F32 : VOP3_Real_gfx6_gfx7_gfx10<0x157>; 1159defm V_MED3_I32 : VOP3_Real_gfx6_gfx7_gfx10<0x158>; 1160defm V_MED3_U32 : VOP3_Real_gfx6_gfx7_gfx10<0x159>; 1161defm V_SAD_U8 : VOP3_Real_gfx6_gfx7_gfx10<0x15a>; 1162defm V_SAD_HI_U8 : VOP3_Real_gfx6_gfx7_gfx10<0x15b>; 1163defm V_SAD_U16 : VOP3_Real_gfx6_gfx7_gfx10<0x15c>; 1164defm V_SAD_U32 : VOP3_Real_gfx6_gfx7_gfx10<0x15d>; 1165defm V_CVT_PK_U8_F32 : VOP3_Real_gfx6_gfx7_gfx10<0x15e>; 1166defm V_DIV_FIXUP_F32 : VOP3_Real_gfx6_gfx7_gfx10<0x15f>; 1167defm V_DIV_FIXUP_F64 : VOP3_Real_gfx6_gfx7_gfx10<0x160>; 1168defm V_ADD_F64 : VOP3_Real_gfx6_gfx7_gfx10<0x164>; 1169defm V_MUL_F64 : VOP3_Real_gfx6_gfx7_gfx10<0x165>; 1170defm V_MIN_F64 : VOP3_Real_gfx6_gfx7_gfx10<0x166>; 1171defm V_MAX_F64 : VOP3_Real_gfx6_gfx7_gfx10<0x167>; 1172defm V_LDEXP_F64 : VOP3_Real_gfx6_gfx7_gfx10<0x168>; 1173defm V_MUL_LO_U32 : VOP3_Real_gfx6_gfx7_gfx10<0x169>; 1174defm V_MUL_HI_U32 : VOP3_Real_gfx6_gfx7_gfx10<0x16a>; 1175defm V_MUL_HI_I32 : VOP3_Real_gfx6_gfx7_gfx10<0x16c>; 1176defm V_DIV_FMAS_F32 : VOP3_Real_gfx6_gfx7_gfx10<0x16f>; 1177defm V_DIV_FMAS_F64 : VOP3_Real_gfx6_gfx7_gfx10<0x170>; 1178defm V_MSAD_U8 : VOP3_Real_gfx6_gfx7_gfx10<0x171>; 1179defm V_MQSAD_PK_U16_U8 : VOP3_Real_gfx6_gfx7_gfx10<0x173>; 1180defm V_TRIG_PREOP_F64 : VOP3_Real_gfx6_gfx7_gfx10<0x174>; 1181defm V_DIV_SCALE_F32 : VOP3be_Real_gfx6_gfx7_gfx10<0x16d>; 1182defm V_DIV_SCALE_F64 : VOP3be_Real_gfx6_gfx7_gfx10<0x16e>; 1183 1184// NB: Same opcode as v_mad_legacy_f32 1185let DecoderNamespace = "GFX10_B" in 1186defm V_FMA_LEGACY_F32 : VOP3_Real_gfx10<0x140>; 1187 1188//===----------------------------------------------------------------------===// 1189// GFX8, GFX9 (VI). 1190//===----------------------------------------------------------------------===// 1191 1192let AssemblerPredicate = isGFX8GFX9, DecoderNamespace = "GFX8" in { 1193 1194multiclass VOP3_Real_vi<bits<10> op> { 1195 def _vi : VOP3_Real<!cast<VOP_Pseudo>(NAME#"_e64"), SIEncodingFamily.VI>, 1196 VOP3e_vi <op, !cast<VOP_Pseudo>(NAME#"_e64").Pfl>; 1197} 1198multiclass VOP3_Real_No_Suffix_vi<bits<10> op> { 1199 def _vi : VOP3_Real<!cast<VOP_Pseudo>(NAME), SIEncodingFamily.VI>, 1200 VOP3e_vi <op, !cast<VOP_Pseudo>(NAME).Pfl>; 1201} 1202 1203multiclass VOP3be_Real_vi<bits<10> op> { 1204 def _vi : VOP3_Real<!cast<VOP_Pseudo>(NAME#"_e64"), SIEncodingFamily.VI>, 1205 VOP3be_vi <op, !cast<VOP_Pseudo>(NAME#"_e64").Pfl>; 1206} 1207 1208multiclass VOP3OpSel_Real_gfx9<bits<10> op> { 1209 def _vi : VOP3_Real<!cast<VOP_Pseudo>(NAME#"_e64"), SIEncodingFamily.VI>, 1210 VOP3OpSel_gfx9 <op, !cast<VOP_Pseudo>(NAME#"_e64").Pfl>; 1211} 1212 1213multiclass VOP3OpSel_Real_gfx9_forced_opsel2<bits<10> op> { 1214 def _vi : VOP3_Real<!cast<VOP_Pseudo>(NAME#"_e64"), SIEncodingFamily.VI>, 1215 VOP3OpSel_gfx9 <op, !cast<VOP_Pseudo>(NAME#"_e64").Pfl> { 1216 let Inst{13} = src2_modifiers{2}; // op_sel(2) 1217 } 1218} 1219 1220multiclass VOP3Interp_Real_vi<bits<10> op> { 1221 def _vi : VOP3_Real<!cast<VOP_Pseudo>(NAME), SIEncodingFamily.VI>, 1222 VOP3Interp_vi <op, !cast<VOP_Pseudo>(NAME).Pfl>; 1223} 1224 1225} // End AssemblerPredicate = isGFX8GFX9, DecoderNamespace = "GFX8" 1226 1227let AssemblerPredicate = isGFX8Only, DecoderNamespace = "GFX8" in { 1228 1229multiclass VOP3_F16_Real_vi<bits<10> op> { 1230 def _vi : VOP3_Real<!cast<VOP3_Pseudo>(NAME#"_e64"), SIEncodingFamily.VI>, 1231 VOP3e_vi <op, !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>; 1232} 1233 1234multiclass VOP3Interp_F16_Real_vi<bits<10> op> { 1235 def _vi : VOP3_Real<!cast<VOP3_Pseudo>(NAME), SIEncodingFamily.VI>, 1236 VOP3Interp_vi <op, !cast<VOP3_Pseudo>(NAME).Pfl>; 1237} 1238 1239} // End AssemblerPredicate = isGFX8Only, DecoderNamespace = "GFX8" 1240 1241let AssemblerPredicate = isGFX9Only, DecoderNamespace = "GFX9" in { 1242 1243multiclass VOP3_F16_Real_gfx9<bits<10> op, string OpName, string AsmName> { 1244 def _gfx9 : VOP3_Real<!cast<VOP3_Pseudo>(OpName#"_e64"), SIEncodingFamily.GFX9>, 1245 VOP3e_vi <op, !cast<VOP3_Pseudo>(OpName#"_e64").Pfl> { 1246 VOP3_Pseudo ps = !cast<VOP3_Pseudo>(OpName#"_e64"); 1247 let AsmString = AsmName # ps.AsmOperands; 1248 } 1249} 1250 1251multiclass VOP3OpSel_F16_Real_gfx9<bits<10> op, string AsmName> { 1252 def _gfx9 : VOP3_Real<!cast<VOP3_Pseudo>(NAME#"_e64"), SIEncodingFamily.GFX9>, 1253 VOP3OpSel_gfx9 <op, !cast<VOP3_Pseudo>(NAME#"_e64").Pfl> { 1254 VOP3_Pseudo ps = !cast<VOP3_Pseudo>(NAME#"_e64"); 1255 let AsmString = AsmName # ps.AsmOperands; 1256 } 1257} 1258 1259multiclass VOP3Interp_F16_Real_gfx9<bits<10> op, string OpName, string AsmName> { 1260 def _gfx9 : VOP3_Real<!cast<VOP3_Pseudo>(OpName), SIEncodingFamily.GFX9>, 1261 VOP3Interp_vi <op, !cast<VOP3_Pseudo>(OpName).Pfl> { 1262 VOP3_Pseudo ps = !cast<VOP3_Pseudo>(OpName); 1263 let AsmString = AsmName # ps.AsmOperands; 1264 } 1265} 1266 1267multiclass VOP3_Real_gfx9<bits<10> op, string AsmName> { 1268 def _gfx9 : VOP3_Real<!cast<VOP_Pseudo>(NAME#"_e64"), SIEncodingFamily.GFX9>, 1269 VOP3e_vi <op, !cast<VOP_Pseudo>(NAME#"_e64").Pfl> { 1270 VOP_Pseudo ps = !cast<VOP_Pseudo>(NAME#"_e64"); 1271 let AsmString = AsmName # ps.AsmOperands; 1272 } 1273} 1274 1275} // End AssemblerPredicate = isGFX9Only, DecoderNamespace = "GFX9" 1276 1277defm V_MAD_U64_U32 : VOP3be_Real_vi <0x1E8>; 1278defm V_MAD_I64_I32 : VOP3be_Real_vi <0x1E9>; 1279 1280defm V_MAD_LEGACY_F32 : VOP3_Real_vi <0x1c0>; 1281defm V_MAD_F32 : VOP3_Real_vi <0x1c1>; 1282defm V_MAD_I32_I24 : VOP3_Real_vi <0x1c2>; 1283defm V_MAD_U32_U24 : VOP3_Real_vi <0x1c3>; 1284defm V_CUBEID_F32 : VOP3_Real_vi <0x1c4>; 1285defm V_CUBESC_F32 : VOP3_Real_vi <0x1c5>; 1286defm V_CUBETC_F32 : VOP3_Real_vi <0x1c6>; 1287defm V_CUBEMA_F32 : VOP3_Real_vi <0x1c7>; 1288defm V_BFE_U32 : VOP3_Real_vi <0x1c8>; 1289defm V_BFE_I32 : VOP3_Real_vi <0x1c9>; 1290defm V_BFI_B32 : VOP3_Real_vi <0x1ca>; 1291defm V_FMA_F32 : VOP3_Real_vi <0x1cb>; 1292defm V_FMA_F64 : VOP3_Real_vi <0x1cc>; 1293defm V_LERP_U8 : VOP3_Real_vi <0x1cd>; 1294defm V_ALIGNBIT_B32 : VOP3_Real_vi <0x1ce>; 1295defm V_ALIGNBYTE_B32 : VOP3_Real_vi <0x1cf>; 1296defm V_MIN3_F32 : VOP3_Real_vi <0x1d0>; 1297defm V_MIN3_I32 : VOP3_Real_vi <0x1d1>; 1298defm V_MIN3_U32 : VOP3_Real_vi <0x1d2>; 1299defm V_MAX3_F32 : VOP3_Real_vi <0x1d3>; 1300defm V_MAX3_I32 : VOP3_Real_vi <0x1d4>; 1301defm V_MAX3_U32 : VOP3_Real_vi <0x1d5>; 1302defm V_MED3_F32 : VOP3_Real_vi <0x1d6>; 1303defm V_MED3_I32 : VOP3_Real_vi <0x1d7>; 1304defm V_MED3_U32 : VOP3_Real_vi <0x1d8>; 1305defm V_SAD_U8 : VOP3_Real_vi <0x1d9>; 1306defm V_SAD_HI_U8 : VOP3_Real_vi <0x1da>; 1307defm V_SAD_U16 : VOP3_Real_vi <0x1db>; 1308defm V_SAD_U32 : VOP3_Real_vi <0x1dc>; 1309defm V_CVT_PK_U8_F32 : VOP3_Real_vi <0x1dd>; 1310defm V_DIV_FIXUP_F32 : VOP3_Real_vi <0x1de>; 1311defm V_DIV_FIXUP_F64 : VOP3_Real_vi <0x1df>; 1312defm V_DIV_SCALE_F32 : VOP3be_Real_vi <0x1e0>; 1313defm V_DIV_SCALE_F64 : VOP3be_Real_vi <0x1e1>; 1314defm V_DIV_FMAS_F32 : VOP3_Real_vi <0x1e2>; 1315defm V_DIV_FMAS_F64 : VOP3_Real_vi <0x1e3>; 1316defm V_MSAD_U8 : VOP3_Real_vi <0x1e4>; 1317defm V_QSAD_PK_U16_U8 : VOP3_Real_vi <0x1e5>; 1318defm V_MQSAD_PK_U16_U8 : VOP3_Real_vi <0x1e6>; 1319defm V_MQSAD_U32_U8 : VOP3_Real_vi <0x1e7>; 1320 1321defm V_PERM_B32 : VOP3_Real_vi <0x1ed>; 1322 1323defm V_MAD_F16 : VOP3_F16_Real_vi <0x1ea>; 1324defm V_MAD_U16 : VOP3_F16_Real_vi <0x1eb>; 1325defm V_MAD_I16 : VOP3_F16_Real_vi <0x1ec>; 1326defm V_FMA_F16 : VOP3_F16_Real_vi <0x1ee>; 1327defm V_DIV_FIXUP_F16 : VOP3_F16_Real_vi <0x1ef>; 1328defm V_INTERP_P2_F16 : VOP3Interp_F16_Real_vi <0x276>; 1329 1330let FPDPRounding = 1 in { 1331defm V_MAD_LEGACY_F16 : VOP3_F16_Real_gfx9 <0x1ea, "V_MAD_F16", "v_mad_legacy_f16">; 1332defm V_FMA_LEGACY_F16 : VOP3_F16_Real_gfx9 <0x1ee, "V_FMA_F16", "v_fma_legacy_f16">; 1333defm V_DIV_FIXUP_LEGACY_F16 : VOP3_F16_Real_gfx9 <0x1ef, "V_DIV_FIXUP_F16", "v_div_fixup_legacy_f16">; 1334defm V_INTERP_P2_LEGACY_F16 : VOP3Interp_F16_Real_gfx9 <0x276, "V_INTERP_P2_F16", "v_interp_p2_legacy_f16">; 1335} // End FPDPRounding = 1 1336 1337defm V_MAD_LEGACY_U16 : VOP3_F16_Real_gfx9 <0x1eb, "V_MAD_U16", "v_mad_legacy_u16">; 1338defm V_MAD_LEGACY_I16 : VOP3_F16_Real_gfx9 <0x1ec, "V_MAD_I16", "v_mad_legacy_i16">; 1339 1340defm V_MAD_F16_gfx9 : VOP3OpSel_F16_Real_gfx9 <0x203, "v_mad_f16">; 1341defm V_MAD_U16_gfx9 : VOP3OpSel_F16_Real_gfx9 <0x204, "v_mad_u16">; 1342defm V_MAD_I16_gfx9 : VOP3OpSel_F16_Real_gfx9 <0x205, "v_mad_i16">; 1343defm V_FMA_F16_gfx9 : VOP3OpSel_F16_Real_gfx9 <0x206, "v_fma_f16">; 1344defm V_DIV_FIXUP_F16_gfx9 : VOP3OpSel_F16_Real_gfx9 <0x207, "v_div_fixup_f16">; 1345defm V_INTERP_P2_F16_gfx9 : VOP3Interp_F16_Real_gfx9 <0x277, "V_INTERP_P2_F16_gfx9", "v_interp_p2_f16">; 1346 1347defm V_ADD_I32 : VOP3_Real_vi <0x29c>; 1348defm V_SUB_I32 : VOP3_Real_vi <0x29d>; 1349 1350defm V_INTERP_P1_F32_e64 : VOP3Interp_Real_vi <0x270>; 1351defm V_INTERP_P2_F32_e64 : VOP3Interp_Real_vi <0x271>; 1352defm V_INTERP_MOV_F32_e64 : VOP3Interp_Real_vi <0x272>; 1353 1354defm V_INTERP_P1LL_F16 : VOP3Interp_Real_vi <0x274>; 1355defm V_INTERP_P1LV_F16 : VOP3Interp_Real_vi <0x275>; 1356defm V_ADD_F64 : VOP3_Real_vi <0x280>; 1357defm V_MUL_F64 : VOP3_Real_vi <0x281>; 1358defm V_MIN_F64 : VOP3_Real_vi <0x282>; 1359defm V_MAX_F64 : VOP3_Real_vi <0x283>; 1360defm V_LDEXP_F64 : VOP3_Real_vi <0x284>; 1361defm V_MUL_LO_U32 : VOP3_Real_vi <0x285>; 1362 1363// removed from VI as identical to V_MUL_LO_U32 1364let isAsmParserOnly = 1 in { 1365defm V_MUL_LO_I32 : VOP3_Real_vi <0x285>; 1366} 1367 1368defm V_MUL_HI_U32 : VOP3_Real_vi <0x286>; 1369defm V_MUL_HI_I32 : VOP3_Real_vi <0x287>; 1370 1371defm V_READLANE_B32 : VOP3_Real_No_Suffix_vi <0x289>; 1372defm V_WRITELANE_B32 : VOP3_Real_No_Suffix_vi <0x28a>; 1373 1374defm V_LSHLREV_B64 : VOP3_Real_vi <0x28f>; 1375defm V_LSHRREV_B64 : VOP3_Real_vi <0x290>; 1376defm V_ASHRREV_I64 : VOP3_Real_vi <0x291>; 1377defm V_TRIG_PREOP_F64 : VOP3_Real_vi <0x292>; 1378 1379defm V_LSHL_ADD_U32 : VOP3_Real_vi <0x1fd>; 1380defm V_ADD_LSHL_U32 : VOP3_Real_vi <0x1fe>; 1381defm V_ADD3_U32 : VOP3_Real_vi <0x1ff>; 1382defm V_LSHL_OR_B32 : VOP3_Real_vi <0x200>; 1383defm V_AND_OR_B32 : VOP3_Real_vi <0x201>; 1384defm V_OR3_B32 : VOP3_Real_vi <0x202>; 1385defm V_PACK_B32_F16 : VOP3OpSel_Real_gfx9 <0x2a0>; 1386 1387defm V_XAD_U32 : VOP3_Real_vi <0x1f3>; 1388 1389defm V_MIN3_F16 : VOP3OpSel_Real_gfx9 <0x1f4>; 1390defm V_MIN3_I16 : VOP3OpSel_Real_gfx9 <0x1f5>; 1391defm V_MIN3_U16 : VOP3OpSel_Real_gfx9 <0x1f6>; 1392 1393defm V_MAX3_F16 : VOP3OpSel_Real_gfx9 <0x1f7>; 1394defm V_MAX3_I16 : VOP3OpSel_Real_gfx9 <0x1f8>; 1395defm V_MAX3_U16 : VOP3OpSel_Real_gfx9 <0x1f9>; 1396 1397defm V_MED3_F16 : VOP3OpSel_Real_gfx9 <0x1fa>; 1398defm V_MED3_I16 : VOP3OpSel_Real_gfx9 <0x1fb>; 1399defm V_MED3_U16 : VOP3OpSel_Real_gfx9 <0x1fc>; 1400 1401defm V_ADD_I16 : VOP3OpSel_Real_gfx9 <0x29e>; 1402defm V_SUB_I16 : VOP3OpSel_Real_gfx9 <0x29f>; 1403 1404defm V_MAD_U32_U16 : VOP3OpSel_Real_gfx9 <0x1f1>; 1405defm V_MAD_I32_I16 : VOP3OpSel_Real_gfx9 <0x1f2>; 1406 1407defm V_CVT_PKNORM_I16_F16 : VOP3OpSel_Real_gfx9 <0x299>; 1408defm V_CVT_PKNORM_U16_F16 : VOP3OpSel_Real_gfx9 <0x29a>; 1409 1410defm V_LSHL_ADD_U64 : VOP3_Real_vi <0x208>; 1411 1412let OtherPredicates = [HasFP8Insts] in { 1413defm V_CVT_PK_FP8_F32 : VOP3OpSel_Real_gfx9 <0x2a2>; 1414defm V_CVT_PK_BF8_F32 : VOP3OpSel_Real_gfx9 <0x2a3>; 1415defm V_CVT_SR_FP8_F32 : VOP3OpSel_Real_gfx9_forced_opsel2 <0x2a4>; 1416defm V_CVT_SR_BF8_F32 : VOP3OpSel_Real_gfx9_forced_opsel2 <0x2a5>; 1417} 1418