[llvm] [AMDGPU] Add MovB64 subtarget feature (PR #196340)
Mariusz Sikora via llvm-commits
llvm-commits at lists.llvm.org
Thu May 7 08:04:59 PDT 2026
https://github.com/mariusz-sikora-at-amd created https://github.com/llvm/llvm-project/pull/196340
None
>From bb87d65539bf367f6c66b4e816e708651e6e2cd0 Mon Sep 17 00:00:00 2001
From: Mariusz Sikora <mariusz.sikora at amd.com>
Date: Thu, 7 May 2026 11:02:16 -0400
Subject: [PATCH] [AMDGPU] Add MovB64 subtarget feature
---
llvm/lib/Target/AMDGPU/AMDGPU.td | 6 ++++++
llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp | 2 +-
llvm/lib/Target/AMDGPU/GCNSubtarget.h | 2 --
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp | 8 ++++----
4 files changed, 11 insertions(+), 7 deletions(-)
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));
More information about the llvm-commits
mailing list