[llvm] [AMDGPU] Add MovB64 subtarget feature (PR #196340)
via llvm-commits
llvm-commits at lists.llvm.org
Thu May 7 08:05:48 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-amdgpu
Author: Mariusz Sikora (mariusz-sikora-at-amd)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/196340.diff
4 Files Affected:
- (modified) llvm/lib/Target/AMDGPU/AMDGPU.td (+6)
- (modified) llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp (+1-1)
- (modified) llvm/lib/Target/AMDGPU/GCNSubtarget.h (-2)
- (modified) llvm/lib/Target/AMDGPU/SIInstrInfo.cpp (+4-4)
``````````diff
diff --git a/llvm/lib/Target/AMDGPU/AMDGPU.td b/llvm/lib/Target/AMDGPU/AMDGPU.td
index 25fc64d178858..35d31571b4592 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPU.td
+++ b/llvm/lib/Target/AMDGPU/AMDGPU.td
@@ -483,6 +483,10 @@ defm SBarrierLeaveImm : AMDGPUSubtargetFeature<"s-barrier-leave-imm",
"s_barrier_leave takes an immediate operand"
>;
+defm MovB64Inst : AMDGPUSubtargetFeature<"mov-b64-inst",
+ "Has mov_b64 instruction"
+>;
+
defm GFX950Insts : AMDGPUSubtargetFeature<"gfx950-insts",
"Additional instructions for GFX950+",
/*GenPredicate=*/1,
@@ -1755,6 +1759,7 @@ def FeatureISAVersion9_4_Common : FeatureSet<
FeatureMemoryAtomicFAddF32DenormalSupport,
FeatureFlatBufferGlobalAtomicFaddF64Inst,
FeatureLshlAddU64Inst,
+ FeatureMovB64Inst,
]>;
def FeatureISAVersion9_5_Common : FeatureSet<
@@ -2110,6 +2115,7 @@ def FeatureISAVersion12_50_Common : FeatureSet<
FeatureMcastLoadInsts,
FeatureNoF16PseudoScalarTransInlineConstants,
FeatureRealTrue16Insts,
+ FeatureMovB64Inst,
]>;
def FeatureISAVersion12_50 : FeatureSet<
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
index e05213b2aaf93..37ff096a0c294 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
@@ -5551,7 +5551,7 @@ bool AMDGPUTargetLowering::isInt64ImmLegal(SDNode *N, SelectionDAG &DAG) const {
auto &ST = DAG.getSubtarget<GCNSubtarget>();
const auto *TII = ST.getInstrInfo();
- if (!ST.hasMovB64() || (!SDConstant && !SDFPConstant))
+ if (!ST.hasMovB64Inst() || (!SDConstant && !SDFPConstant))
return false;
if (ST.has64BitLiterals())
diff --git a/llvm/lib/Target/AMDGPU/GCNSubtarget.h b/llvm/lib/Target/AMDGPU/GCNSubtarget.h
index ec7dd92d6b10e..2e2797269fbcf 100644
--- a/llvm/lib/Target/AMDGPU/GCNSubtarget.h
+++ b/llvm/lib/Target/AMDGPU/GCNSubtarget.h
@@ -507,8 +507,6 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo,
bool hasMadF16() const;
- bool hasMovB64() const { return HasGFX940Insts || HasGFX1250Insts; }
-
// Scalar and global loads support scale_offset bit.
bool hasScaleOffset() const { return HasGFX1250Insts; }
diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
index 65137fa09e209..0dcebd43f9866 100644
--- a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -1041,7 +1041,7 @@ void SIInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
}
if (RC == RI.getVGPR64Class() && (SrcRC == RC || RI.isSGPRClass(SrcRC))) {
- if (ST.hasMovB64()) {
+ if (ST.hasMovB64Inst()) {
BuildMI(MBB, MI, DL, get(AMDGPU::V_MOV_B64_e32), DestReg)
.addReg(SrcReg, getKillRegState(KillSrc));
return;
@@ -1090,7 +1090,7 @@ void SIInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
(RI.isProperlyAlignedRC(*RC) &&
(SrcRC == RC || RI.isSGPRClass(SrcRC)))) {
// TODO: In 96-bit case, could do a 64-bit mov and then a 32-bit mov.
- if (ST.hasMovB64()) {
+ if (ST.hasMovB64Inst()) {
Opcode = AMDGPU::V_MOV_B64_e32;
EltSize = 8;
} else if (ST.hasPkMovB32()) {
@@ -2182,7 +2182,7 @@ bool SIInstrInfo::expandPostRAPseudo(MachineInstr &MI) const {
const MachineOperand &SrcOp = MI.getOperand(1);
// FIXME: Will this work for 64-bit floating point immediates?
assert(!SrcOp.isFPImm());
- if (ST.hasMovB64() && Mov64RC->contains(Dst)) {
+ if (ST.hasMovB64Inst() && Mov64RC->contains(Dst)) {
MI.setDesc(Mov64Desc);
if (SrcOp.isReg() || isInlineConstant(MI, 1) ||
isUInt<32>(SrcOp.getImm()) || ST.has64BitLiterals())
@@ -2726,7 +2726,7 @@ std::pair<MachineInstr*, MachineInstr*>
SIInstrInfo::expandMovDPP64(MachineInstr &MI) const {
assert (MI.getOpcode() == AMDGPU::V_MOV_B64_DPP_PSEUDO);
- if (ST.hasMovB64() && ST.hasFeature(AMDGPU::FeatureDPALU_DPP) &&
+ if (ST.hasMovB64Inst() && ST.hasFeature(AMDGPU::FeatureDPALU_DPP) &&
AMDGPU::isLegalDPALU_DPPControl(
ST, getNamedOperand(MI, AMDGPU::OpName::dpp_ctrl)->getImm())) {
MI.setDesc(get(AMDGPU::V_MOV_B64_dpp));
``````````
</details>
https://github.com/llvm/llvm-project/pull/196340
More information about the llvm-commits
mailing list