Skip to content

Commit 2b1ce25

Browse files
authored
AMDGPU: Fix -amdgpu-mfma-vgpr-form flag on gfx908 (llvm#150599)
This should be ignored since there are no VGPR forms. This makes it possible to flip the default for the flag to true.
1 parent 129a354 commit 2b1ce25

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,15 @@ SIMachineFunctionInfo::SIMachineFunctionInfo(const Function &F,
8181
PSInputAddr = AMDGPU::getInitialPSInputAddr(F);
8282
}
8383

84-
MayNeedAGPRs = ST.hasMAIInsts() && !MFMAVGPRForm;
85-
if (!MFMAVGPRForm && ST.hasGFX90AInsts() &&
86-
ST.getMaxNumVGPRs(F) <= AMDGPU::VGPR_32RegClass.getNumRegs() &&
87-
!mayUseAGPRs(F))
88-
MayNeedAGPRs = false; // We will select all MAI with VGPR operands.
84+
MayNeedAGPRs = ST.hasMAIInsts();
85+
if (ST.hasGFX90AInsts()) {
86+
// FIXME: MayNeedAGPRs is a misnomer for how this is used. MFMA selection
87+
// should be separated from availability of AGPRs
88+
if (MFMAVGPRForm ||
89+
(ST.getMaxNumVGPRs(F) <= AMDGPU::VGPR_32RegClass.getNumRegs() &&
90+
!mayUseAGPRs(F)))
91+
MayNeedAGPRs = false; // We will select all MAI with VGPR operands.
92+
}
8993

9094
if (AMDGPU::isChainCC(CC)) {
9195
// Chain functions don't receive an SP from their caller, but are free to

llvm/test/CodeGen/AMDGPU/gfx90a-enc.ll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
; RUN: llc -mtriple=amdgcn -mcpu=gfx908 -show-mc-encoding < %s | FileCheck -check-prefixes=GFX9,GFX908 %s
2+
3+
; Make sure flag is ignored
4+
; RUN: llc -mtriple=amdgcn -mcpu=gfx908 -amdgpu-mfma-vgpr-form=1 -show-mc-encoding < %s | FileCheck -check-prefixes=GFX9,GFX908 %s
25
; RUN: llc -mtriple=amdgcn -mcpu=gfx90a -show-mc-encoding < %s | FileCheck -check-prefixes=GFX9,GFX90A %s
36

47
; GFX9-DAG: buffer_load_format_xyzw v[{{[0-9:]+}}], v{{[0-9]+}}, s[{{[0-9:]+}}], 0 idxen ; encoding:

0 commit comments

Comments
 (0)