-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[AMDGPU] Add subtarget feature for v_lshl_add_u64. NFC. #133723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-backend-amdgpu Author: Jay Foad (jayfoad) ChangesFull diff: https://github.com/llvm/llvm-project/pull/133723.diff 4 Files Affected:
diff --git a/llvm/lib/Target/AMDGPU/AMDGPU.td b/llvm/lib/Target/AMDGPU/AMDGPU.td
index 84619dd656f35..72b4aca6f543a 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 FeatureLshlAddU64
+ : SubtargetFeature<"lshl-add-u64", "HasLshlAddU64", "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,
+ FeatureLshlAddU64,
]>;
def FeatureISAVersion9_5_Common : FeatureSet<
@@ -2554,6 +2559,9 @@ def HasXF32Insts : Predicate<"Subtarget->hasXF32Insts()">,
def HasAshrPkInsts : Predicate<"Subtarget->hasAshrPkInsts()">,
AssemblerPredicate<(all_of FeatureAshrPkInsts)>;
+def HasLshlAddU64 : Predicate<"Subtarget->hasLshlAddU64()">,
+ AssemblerPredicate<(all_of FeatureLshlAddU64)>;
+
// 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..d5ab02da87e1e 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 HasLshlAddU64 = false;
bool RequiresCOV6 = false;
@@ -1140,7 +1141,7 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo,
bool hasMovB64() const { return GFX940Insts; }
- bool hasLshlAddB64() const { return GFX940Insts; }
+ bool hasLshlAddU64() const { return HasLshlAddU64; }
bool enableSIScheduler() const {
return EnableSIScheduler;
diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index c8645850fe111..bc9add218520a 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.hasLshlAddU64()) {
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..cc33a9622e62f 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 = HasLshlAddU64 in
defm V_LSHL_ADD_U64 : VOP3Inst <"v_lshl_add_u64", VOP3_Profile<VOP_I64_I64_I32_I64>>;
let OtherPredicates = [HasFP8ConversionInsts], mayRaiseFPException = 0,
|
llvm/lib/Target/AMDGPU/AMDGPU.td
Outdated
@@ -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 FeatureLshlAddU64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure whether to include "-inst" in the name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have something like FeatureAtomicFMinFMaxF64FlatInsts
right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, yes, the convention seems to be to use Inst
or Insts
in the name.
Following on from llvm#133723, use the new subtarget feature for the selection pattern as well as for the instruction definition.
) Following on from #133723, use the new subtarget feature for the selection pattern as well as for the instruction definition.
…#144544) Following on from llvm#133723, use the new subtarget feature for the selection pattern as well as for the instruction definition.
No description provided.