Skip to content

Commit 5fcd600

Browse files
mbrkusaninmemfrob
authored andcommitted
[AMDGPU] Fix use of HasModifiers in VopProfile
HasModifiers should be true if at least one modifier is used. This should make the use of this field bit more consistent. Differential Revision: https://reviews.llvm.org/D94795
1 parent f14dfc3 commit 5fcd600

File tree

5 files changed

+17
-15
lines changed

5 files changed

+17
-15
lines changed

llvm/lib/Target/AMDGPU/SIInstrInfo.td

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2042,11 +2042,6 @@ class VOPProfile <list<ValueType> _ArgVT, bit _EnableF32SrcMods = 0,
20422042
field bit HasSrc1 = !ne(Src1VT.Value, untyped.Value);
20432043
field bit HasSrc2 = !ne(Src2VT.Value, untyped.Value);
20442044

2045-
// TODO: Modifiers logic is somewhat adhoc here, to be refined later
2046-
// HasModifiers affects the normal and DPP encodings. We take note of EnableF32SrcMods, which
2047-
// enables modifiers for i32 type.
2048-
field bit HasModifiers = !or(isModifierType<Src0VT>.ret, EnableF32SrcMods);
2049-
20502045
// HasSrc*FloatMods affects the SDWA encoding. We ignore EnableF32SrcMods.
20512046
field bit HasSrc0FloatMods = isFloatType<Src0VT>.ret;
20522047
field bit HasSrc1FloatMods = isFloatType<Src1VT>.ret;
@@ -2057,10 +2052,6 @@ class VOPProfile <list<ValueType> _ArgVT, bit _EnableF32SrcMods = 0,
20572052
field bit HasSrc1IntMods = isIntType<Src1VT>.ret;
20582053
field bit HasSrc2IntMods = isIntType<Src2VT>.ret;
20592054

2060-
field bit HasSrc0Mods = HasModifiers;
2061-
field bit HasSrc1Mods = !if(HasModifiers, !or(HasSrc1FloatMods, HasSrc1IntMods), 0);
2062-
field bit HasSrc2Mods = !if(HasModifiers, !or(HasSrc2FloatMods, HasSrc2IntMods), 0);
2063-
20642055
field bit HasClamp = !or(isModifierType<Src0VT>.ret, EnableClamp);
20652056
field bit HasSDWAClamp = EmitDst;
20662057
field bit HasFPClamp = !and(isFloatType<DstVT>.ret, HasClamp);
@@ -2074,6 +2065,16 @@ class VOPProfile <list<ValueType> _ArgVT, bit _EnableF32SrcMods = 0,
20742065
field bit HasOMod = !if(HasOpSel, 0, isFloatType<DstVT>.ret);
20752066
field bit HasSDWAOMod = isFloatType<DstVT>.ret;
20762067

2068+
field bit HasModifiers = !or(isModifierType<Src0VT>.ret,
2069+
isModifierType<Src1VT>.ret,
2070+
isModifierType<Src2VT>.ret,
2071+
HasOMod,
2072+
EnableF32SrcMods);
2073+
2074+
field bit HasSrc0Mods = HasModifiers;
2075+
field bit HasSrc1Mods = !if(HasModifiers, !or(HasSrc1FloatMods, HasSrc1IntMods), 0);
2076+
field bit HasSrc2Mods = !if(HasModifiers, !or(HasSrc2FloatMods, HasSrc2IntMods), 0);
2077+
20772078
field bit HasExt = getHasExt<NumSrcArgs, DstVT, Src0VT, Src1VT>.ret;
20782079
field bit HasExtDPP = getHasDPP<NumSrcArgs, DstVT, Src0VT, Src1VT>.ret;
20792080
field bit HasExtSDWA = HasExt;

llvm/lib/Target/AMDGPU/VOP1Instructions.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ class VOPProfileI2F<ValueType dstVt, ValueType srcVt> :
138138

139139
let HasModifiers = 0;
140140
let HasClamp = 1;
141-
let HasOMod = 1;
142141
}
143142

144143
def VOP1_F64_I32 : VOPProfileI2F <f64, i32>;

llvm/lib/Target/AMDGPU/VOP2Instructions.td

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,6 @@ def VOP_MAC_LEGACY_F32 : VOP_MAC <f32>;
339339
class VOP_DOT_ACC<ValueType vt0, ValueType vt1> : VOP_MAC<vt0, vt1> {
340340
let HasClamp = 0;
341341
let HasExtSDWA = 0;
342-
let HasModifiers = 1;
343342
let HasOpSel = 0;
344343
let IsPacked = 0;
345344
}
@@ -348,7 +347,11 @@ def VOP_DOT_ACC_F32_V2F16 : VOP_DOT_ACC<f32, v2f16> {
348347
let Src0ModDPP = FPVRegInputMods;
349348
let Src1ModDPP = FPVRegInputMods;
350349
}
351-
def VOP_DOT_ACC_I32_I32 : VOP_DOT_ACC<i32, i32>;
350+
351+
def VOP_DOT_ACC_I32_I32 : VOP_DOT_ACC<i32, i32> {
352+
let HasSrc0Mods = 1;
353+
let HasSrc1Mods = 1;
354+
}
352355

353356
// Write out to vcc or arbitrary SGPR.
354357
def VOP2b_I32_I1_I32_I32 : VOPProfile<[i32, i32, i32, untyped], 0, /*EnableClamp=*/1> {

llvm/lib/Target/AMDGPU/VOP3Instructions.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class VOP3_Profile<VOPProfile P, VOP3Features Features = VOP3_REGULAR> : VOPProf
183183
let IsMAI = !if(Features.IsMAI, 1, P.IsMAI);
184184
let IsPacked = !if(Features.IsPacked, 1, P.IsPacked);
185185

186-
let HasModifiers = !if(Features.IsPacked, !not(Features.IsMAI), P.HasModifiers);
186+
let HasModifiers = !if(Features.IsMAI, 0, !or(Features.IsPacked, P.HasModifiers));
187187

188188
// FIXME: Hack to stop printing _e64
189189
let Outs64 = (outs DstRC.RegClass:$vdst);
@@ -253,6 +253,7 @@ def VOP3_INTERP_MOV : VOPProfile<[f32, i32, i32, untyped]> {
253253
let Asm64 = "$vdst, $src0, $attr$attrchan$clamp$omod";
254254

255255
let HasClamp = 1;
256+
let HasSrc0Mods = 0;
256257
}
257258

258259
class getInterp16Asm <bit HasSrc2, bit HasOMod> {
@@ -691,7 +692,6 @@ def VOP3_PERMLANE_Profile : VOP3_Profile<VOPProfile <[i32, i32, i32, i32]>, VOP3
691692
IntOpSelMods:$src2_modifiers, SCSrc_b32:$src2,
692693
VGPR_32:$vdst_in, op_sel0:$op_sel);
693694
let HasClamp = 0;
694-
let HasOMod = 0;
695695
}
696696

697697
class PermlanePat<SDPatternOperator permlane,

llvm/lib/Target/AMDGPU/VOP3PInstructions.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,6 @@ class VOPProfileMAI<VOPProfile P, RegisterOperand _SrcRC, RegisterOperand _DstRC
362362
let Src2RC64 = _SrcRC;
363363
let HasOpSel = 0;
364364
let HasClamp = 0;
365-
let HasModifiers = 0;
366365
let Asm64 = " $vdst, $src0, $src1, $src2$cbsz$abid$blgp";
367366
let Ins64 = (ins Src0RC64:$src0, Src1RC64:$src1, Src2RC64:$src2, cbsz:$cbsz, abid:$abid, blgp:$blgp);
368367
}

0 commit comments

Comments
 (0)