From ab045561eeb713d30c15271d57533bf27a60fcf8 Mon Sep 17 00:00:00 2001 From: Dmitry Preobrazhensky Date: Thu, 20 Oct 2022 15:05:40 +0300 Subject: [PATCH] [AMDGPU][MC] Correct v_cndmask operand types Differential Revision: https://reviews.llvm.org/D136152 --- llvm/lib/Target/AMDGPU/SIInstrInfo.td | 29 ++++++++++++----------------- llvm/lib/Target/AMDGPU/VOP2Instructions.td | 18 ++++++++++++------ llvm/test/MC/AMDGPU/gfx10_asm_vop2.s | 16 ++++++++++++++++ 3 files changed, 40 insertions(+), 23 deletions(-) diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.td b/llvm/lib/Target/AMDGPU/SIInstrInfo.td index 89ce127..c29e92e 100644 --- a/llvm/lib/Target/AMDGPU/SIInstrInfo.td +++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.td @@ -1778,7 +1778,7 @@ class isModifierType { } // Return type of input modifiers operand for specified input operand -class getSrcMod { +class getSrcMod { bit isFP = isFloatType.ret; bit isPacked = isPackedType.ret; Operand ret = !if(!eq(VT.Size, 64), @@ -1788,7 +1788,7 @@ class getSrcMod { FP16InputMods, FP32InputMods ), - !if(EnableF32SrcMods, FP32InputMods, Int32InputMods)) + Int32InputMods) ); } @@ -1813,14 +1813,14 @@ class getSrcModDPP_t16 { } // Return type of input modifiers operand for specified input operand for DPP -class getSrcModVOP3DPP { +class getSrcModVOP3DPP { bit isFP = isFloatType.ret; bit isPacked = isPackedType.ret; Operand ret = !if (isFP, !if (!eq(VT.Value, f16.Value), FP16VCSrcInputMods, FP32VCSrcInputMods), - !if (EnableF32SrcMods, FP32VCSrcInputMods, Int32VCSrcInputMods)); + Int32VCSrcInputMods); } // Return type of input modifiers operand specified input operand for SDWA @@ -2429,11 +2429,9 @@ def PatGenMode { int Pattern = 1; } -class VOPProfile _ArgVT, bit _EnableF32SrcMods = 0, - bit _EnableClamp = 0> { +class VOPProfile _ArgVT, bit _EnableClamp = 0> { field list ArgVT = _ArgVT; - field bit EnableF32SrcMods = _EnableF32SrcMods; field bit EnableClamp = _EnableClamp; field bit IsTrue16 = 0; @@ -2459,15 +2457,15 @@ class VOPProfile _ArgVT, bit _EnableF32SrcMods = 0, field RegisterOperand Src2VOP3DPP = getVOP3DPPSrcForVT.ret; field RegisterOperand Src0SDWA = getSDWASrcForVT.ret; field RegisterOperand Src1SDWA = getSDWASrcForVT.ret; - field Operand Src0Mod = getSrcMod.ret; - field Operand Src1Mod = getSrcMod.ret; - field Operand Src2Mod = getSrcMod.ret; + field Operand Src0Mod = getSrcMod.ret; + field Operand Src1Mod = getSrcMod.ret; + field Operand Src2Mod = getSrcMod.ret; field Operand Src0ModDPP = getSrcModDPP.ret; field Operand Src1ModDPP = getSrcModDPP.ret; field Operand Src2ModDPP = getSrcModDPP.ret; field Operand Src0ModVOP3DPP = getSrcModDPP.ret; field Operand Src1ModVOP3DPP = getSrcModDPP.ret; - field Operand Src2ModVOP3DPP = getSrcModVOP3DPP.ret; + field Operand Src2ModVOP3DPP = getSrcModVOP3DPP.ret; field Operand Src0ModSDWA = getSrcModSDWA.ret; field Operand Src1ModSDWA = getSrcModSDWA.ret; @@ -2481,12 +2479,10 @@ class VOPProfile _ArgVT, bit _EnableF32SrcMods = 0, field bit HasSrc1 = !ne(Src1VT.Value, untyped.Value); field bit HasSrc2 = !ne(Src2VT.Value, untyped.Value); - // HasSrc*FloatMods affects the SDWA encoding. We ignore EnableF32SrcMods. field bit HasSrc0FloatMods = isFloatType.ret; field bit HasSrc1FloatMods = isFloatType.ret; field bit HasSrc2FloatMods = isFloatType.ret; - // HasSrc*IntMods affects the SDWA encoding. We ignore EnableF32SrcMods. field bit HasSrc0IntMods = isIntType.ret; field bit HasSrc1IntMods = isIntType.ret; field bit HasSrc2IntMods = isIntType.ret; @@ -2507,8 +2503,7 @@ class VOPProfile _ArgVT, bit _EnableF32SrcMods = 0, field bit HasModifiers = !or(isModifierType.ret, isModifierType.ret, isModifierType.ret, - HasOMod, - EnableF32SrcMods); + HasOMod); field bit HasSrc0Mods = HasModifiers; field bit HasSrc1Mods = !if(HasModifiers, !or(HasSrc1FloatMods, HasSrc1IntMods), 0); @@ -2652,7 +2647,7 @@ def VOP_F16_F16_F16 : VOPProfile <[f16, f16, f16, untyped]>; def VOP_F16_F16_I16 : VOPProfile <[f16, f16, i16, untyped]>; def VOP_F16_F16_I32 : VOPProfile <[f16, f16, i32, untyped]>; def VOP_I16_I16_I16 : VOPProfile <[i16, i16, i16, untyped]>; -def VOP_I16_I16_I16_ARITH : VOPProfile <[i16, i16, i16, untyped], 0, /*EnableClamp=*/1>; +def VOP_I16_I16_I16_ARITH : VOPProfile <[i16, i16, i16, untyped], /*EnableClamp=*/1>; def VOP_I16_I16_I16_I16 : VOPProfile <[i16, i16, i16, i16, untyped]>; def VOP_F16_F16_F16_F16 : VOPProfile <[f16, f16, f16, f16, untyped]>; @@ -2699,7 +2694,7 @@ def VOP_F64_F64_I32 : VOPProfile <[f64, f64, i32, untyped]>; def VOP_I32_F32_F32 : VOPProfile <[i32, f32, f32, untyped]>; def VOP_I32_F32_I32 : VOPProfile <[i32, f32, i32, untyped]>; def VOP_I32_I32_I32 : VOPProfile <[i32, i32, i32, untyped]>; -def VOP_I32_I32_I32_ARITH : VOPProfile <[i32, i32, i32, untyped], 0, /*EnableClamp=*/1>; +def VOP_I32_I32_I32_ARITH : VOPProfile <[i32, i32, i32, untyped], /*EnableClamp=*/1>; def VOP_V2F16_F32_F32 : VOPProfile <[v2f16, f32, f32, untyped]>; def VOP_F32_F16_F16_F16 : VOPProfile <[f32, f16, f16, f16]>; diff --git a/llvm/lib/Target/AMDGPU/VOP2Instructions.td b/llvm/lib/Target/AMDGPU/VOP2Instructions.td index c3d66f4..5f376b1 100644 --- a/llvm/lib/Target/AMDGPU/VOP2Instructions.td +++ b/llvm/lib/Target/AMDGPU/VOP2Instructions.td @@ -505,7 +505,7 @@ def VOP_DOT_ACC_I32_I32 : VOP_DOT_ACC { } // Write out to vcc or arbitrary SGPR. -def VOP2b_I32_I1_I32_I32 : VOPProfile<[i32, i32, i32, untyped], 0, /*EnableClamp=*/1> { +def VOP2b_I32_I1_I32_I32 : VOPProfile<[i32, i32, i32, untyped], /*EnableClamp=*/1> { let Asm32 = "$vdst, vcc, $src0, $src1"; let Asm64 = "$vdst, $sdst, $src0, $src1$clamp"; let AsmSDWA = "$vdst, vcc, $src0_modifiers, $src1_modifiers$clamp $dst_sel $dst_unused $src0_sel $src1_sel"; @@ -532,7 +532,7 @@ def VOP2b_I32_I1_I32_I32 : VOPProfile<[i32, i32, i32, untyped], 0, /*EnableClamp // Write out to vcc or arbitrary SGPR and read in from vcc or // arbitrary SGPR. -def VOP2b_I32_I1_I32_I32_I1 : VOPProfile<[i32, i32, i32, i1], 0, /*EnableClamp=*/1> { +def VOP2b_I32_I1_I32_I32_I1 : VOPProfile<[i32, i32, i32, i1], /*EnableClamp=*/1> { let HasSrc2Mods = 0; let Asm32 = "$vdst, vcc, $src0, $src1, vcc"; let Asm64 = "$vdst, $sdst, $src0, $src1, $src2$clamp"; @@ -576,7 +576,7 @@ def VOP2b_I32_I1_I32_I32_I1 : VOPProfile<[i32, i32, i32, i1], 0, /*EnableClamp=* } // Read in from vcc or arbitrary SGPR. -class VOP2e_SGPR ArgVT> : VOPProfile { +class VOP2e_SGPR ArgVT> : VOPProfile { let Asm32 = "$vdst, $src0, $src1"; let Asm64 = "$vdst, $src0_modifiers, $src1_modifiers, $src2"; let AsmSDWA = "$vdst, $src0_modifiers, $src1_modifiers, vcc$clamp $dst_sel $dst_unused $src0_sel $src1_sel"; @@ -591,14 +591,20 @@ class VOP2e_SGPR ArgVT> : VOPProfile