Skip to content

Commit bd862a4

Browse files
authored
[AMDGPU] Add subtarget feature for v_lshl_add_u64. NFC. (#133723)
1 parent c20bea0 commit bd862a4

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

llvm/lib/Target/AMDGPU/AMDGPU.td

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1269,6 +1269,10 @@ def FeatureDynamicVGPRBlockSize32 : SubtargetFeature<"dynamic-vgpr-block-size-32
12691269
"Use a block size of 32 for dynamic VGPR allocation (default is 16)"
12701270
>;
12711271

1272+
def FeatureLshlAddU64Inst
1273+
: SubtargetFeature<"lshl-add-u64-inst", "HasLshlAddU64Inst", "true",
1274+
"Has v_lshl_add_u64 instruction">;
1275+
12721276
// Dummy feature used to disable assembler instructions.
12731277
def FeatureDisable : SubtargetFeature<"",
12741278
"FeatureDisable","true",
@@ -1622,7 +1626,8 @@ def FeatureISAVersion9_4_Common : FeatureSet<
16221626
FeatureAtomicFMinFMaxF64FlatInsts,
16231627
FeatureAgentScopeFineGrainedRemoteMemoryAtomics,
16241628
FeatureMemoryAtomicFAddF32DenormalSupport,
1625-
FeatureFlatBufferGlobalAtomicFaddF64Inst
1629+
FeatureFlatBufferGlobalAtomicFaddF64Inst,
1630+
FeatureLshlAddU64Inst,
16261631
]>;
16271632

16281633
def FeatureISAVersion9_5_Common : FeatureSet<
@@ -2554,6 +2559,9 @@ def HasXF32Insts : Predicate<"Subtarget->hasXF32Insts()">,
25542559
def HasAshrPkInsts : Predicate<"Subtarget->hasAshrPkInsts()">,
25552560
AssemblerPredicate<(all_of FeatureAshrPkInsts)>;
25562561

2562+
def HasLshlAddU64Inst : Predicate<"Subtarget->hasLshlAddU64Inst()">,
2563+
AssemblerPredicate<(all_of FeatureLshlAddU64Inst)>;
2564+
25572565
// Include AMDGPU TD files
25582566
include "SISchedule.td"
25592567
include "GCNProcessors.td"

llvm/lib/Target/AMDGPU/GCNSubtarget.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo,
257257
bool HasMinimum3Maximum3F32 = false;
258258
bool HasMinimum3Maximum3F16 = false;
259259
bool HasMinimum3Maximum3PKF16 = false;
260+
bool HasLshlAddU64Inst = false;
260261

261262
bool RequiresCOV6 = false;
262263

@@ -1140,7 +1141,7 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo,
11401141

11411142
bool hasMovB64() const { return GFX940Insts; }
11421143

1143-
bool hasLshlAddB64() const { return GFX940Insts; }
1144+
bool hasLshlAddU64Inst() const { return HasLshlAddU64Inst; }
11441145

11451146
bool enableSIScheduler() const {
11461147
return EnableSIScheduler;

llvm/lib/Target/AMDGPU/SIISelLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5246,7 +5246,7 @@ SITargetLowering::EmitInstrWithCustomInserter(MachineInstr &MI,
52465246
MachineOperand &Src0 = MI.getOperand(1);
52475247
MachineOperand &Src1 = MI.getOperand(2);
52485248

5249-
if (IsAdd && ST.hasLshlAddB64()) {
5249+
if (IsAdd && ST.hasLshlAddU64Inst()) {
52505250
auto Add = BuildMI(*BB, MI, DL, TII->get(AMDGPU::V_LSHL_ADD_U64_e64),
52515251
Dest.getReg())
52525252
.add(Src0)

llvm/lib/Target/AMDGPU/VOP3Instructions.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ defm V_LSHL_OR_B32 : VOP3Inst <"v_lshl_or_b32", VOP3_Profile<VOP_I32_I32_I32_I32
679679

680680
// V_LSHL_ADD_U64: D0.u64 = (S0.u64 << S1.u[2:0]) + S2.u64
681681
// src0 is shifted left by 0-4 (use “0” to get ADD_U64).
682-
let SubtargetPredicate = isGFX940Plus in
682+
let SubtargetPredicate = HasLshlAddU64Inst in
683683
defm V_LSHL_ADD_U64 : VOP3Inst <"v_lshl_add_u64", VOP3_Profile<VOP_I64_I64_I32_I64>>;
684684

685685
let OtherPredicates = [HasFP8ConversionInsts], mayRaiseFPException = 0,

0 commit comments

Comments
 (0)