[llvm] bd862a4 - [AMDGPU] Add subtarget feature for v_lshl_add_u64. NFC. (#133723)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 31 08:25:04 PDT 2025
Author: Jay Foad
Date: 2025-03-31T16:25:00+01:00
New Revision: bd862a459d75ef137235853c994dea97a0bc7794
URL: https://github.com/llvm/llvm-project/commit/bd862a459d75ef137235853c994dea97a0bc7794
DIFF: https://github.com/llvm/llvm-project/commit/bd862a459d75ef137235853c994dea97a0bc7794.diff
LOG: [AMDGPU] Add subtarget feature for v_lshl_add_u64. NFC. (#133723)
Added:
Modified:
llvm/lib/Target/AMDGPU/AMDGPU.td
llvm/lib/Target/AMDGPU/GCNSubtarget.h
llvm/lib/Target/AMDGPU/SIISelLowering.cpp
llvm/lib/Target/AMDGPU/VOP3Instructions.td
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/AMDGPU.td b/llvm/lib/Target/AMDGPU/AMDGPU.td
index 84619dd656f35..6963b24dd8a5e 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPU.td
+++ b/llvm/lib/Target/AMDGPU/AMDGPU.td
@@ -1269,6 +1269,10 @@ def FeatureDynamicVGPRBlockSize32 : SubtargetFeature<"dynamic-vgpr-block-size-32
"Use a block size of 32 for dynamic VGPR allocation (default is 16)"
>;
+def FeatureLshlAddU64Inst
+ : SubtargetFeature<"lshl-add-u64-inst", "HasLshlAddU64Inst", "true",
+ "Has v_lshl_add_u64 instruction">;
+
// Dummy feature used to disable assembler instructions.
def FeatureDisable : SubtargetFeature<"",
"FeatureDisable","true",
@@ -1622,7 +1626,8 @@ def FeatureISAVersion9_4_Common : FeatureSet<
FeatureAtomicFMinFMaxF64FlatInsts,
FeatureAgentScopeFineGrainedRemoteMemoryAtomics,
FeatureMemoryAtomicFAddF32DenormalSupport,
- FeatureFlatBufferGlobalAtomicFaddF64Inst
+ FeatureFlatBufferGlobalAtomicFaddF64Inst,
+ FeatureLshlAddU64Inst,
]>;
def FeatureISAVersion9_5_Common : FeatureSet<
@@ -2554,6 +2559,9 @@ def HasXF32Insts : Predicate<"Subtarget->hasXF32Insts()">,
def HasAshrPkInsts : Predicate<"Subtarget->hasAshrPkInsts()">,
AssemblerPredicate<(all_of FeatureAshrPkInsts)>;
+def HasLshlAddU64Inst : Predicate<"Subtarget->hasLshlAddU64Inst()">,
+ AssemblerPredicate<(all_of FeatureLshlAddU64Inst)>;
+
// Include AMDGPU TD files
include "SISchedule.td"
include "GCNProcessors.td"
diff --git a/llvm/lib/Target/AMDGPU/GCNSubtarget.h b/llvm/lib/Target/AMDGPU/GCNSubtarget.h
index 7384278d81cc1..301e4c0275ad4 100644
--- a/llvm/lib/Target/AMDGPU/GCNSubtarget.h
+++ b/llvm/lib/Target/AMDGPU/GCNSubtarget.h
@@ -257,6 +257,7 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo,
bool HasMinimum3Maximum3F32 = false;
bool HasMinimum3Maximum3F16 = false;
bool HasMinimum3Maximum3PKF16 = false;
+ bool HasLshlAddU64Inst = false;
bool RequiresCOV6 = false;
@@ -1140,7 +1141,7 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo,
bool hasMovB64() const { return GFX940Insts; }
- bool hasLshlAddB64() const { return GFX940Insts; }
+ bool hasLshlAddU64Inst() const { return HasLshlAddU64Inst; }
bool enableSIScheduler() const {
return EnableSIScheduler;
diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index 56149bcd8a839..96c113cc5d24c 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -5246,7 +5246,7 @@ SITargetLowering::EmitInstrWithCustomInserter(MachineInstr &MI,
MachineOperand &Src0 = MI.getOperand(1);
MachineOperand &Src1 = MI.getOperand(2);
- if (IsAdd && ST.hasLshlAddB64()) {
+ if (IsAdd && ST.hasLshlAddU64Inst()) {
auto Add = BuildMI(*BB, MI, DL, TII->get(AMDGPU::V_LSHL_ADD_U64_e64),
Dest.getReg())
.add(Src0)
diff --git a/llvm/lib/Target/AMDGPU/VOP3Instructions.td b/llvm/lib/Target/AMDGPU/VOP3Instructions.td
index 14da3447a2256..9feb5df2f9203 100644
--- a/llvm/lib/Target/AMDGPU/VOP3Instructions.td
+++ b/llvm/lib/Target/AMDGPU/VOP3Instructions.td
@@ -679,7 +679,7 @@ defm V_LSHL_OR_B32 : VOP3Inst <"v_lshl_or_b32", VOP3_Profile<VOP_I32_I32_I32_I32
// V_LSHL_ADD_U64: D0.u64 = (S0.u64 << S1.u[2:0]) + S2.u64
// src0 is shifted left by 0-4 (use “0” to get ADD_U64).
-let SubtargetPredicate = isGFX940Plus in
+let SubtargetPredicate = HasLshlAddU64Inst in
defm V_LSHL_ADD_U64 : VOP3Inst <"v_lshl_add_u64", VOP3_Profile<VOP_I64_I64_I32_I64>>;
let OtherPredicates = [HasFP8ConversionInsts], mayRaiseFPException = 0,
More information about the llvm-commits
mailing list