Skip to content

Commit a6b7243

Browse files
arsenmjrbyrnes
authored andcommitted
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. Change-Id: I4ad172ace5a65e478b553242325ceee9ba6ed6a6
1 parent f87a620 commit a6b7243

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,15 @@ SIMachineFunctionInfo::SIMachineFunctionInfo(const Function &F,
7373
PSInputAddr = AMDGPU::getInitialPSInputAddr(F);
7474
}
7575

76-
MayNeedAGPRs = ST.hasMAIInsts() && !MFMAVGPRForm;
77-
if (!MFMAVGPRForm && ST.hasGFX90AInsts() &&
78-
ST.getMaxNumVGPRs(F) <= AMDGPU::VGPR_32RegClass.getNumRegs() &&
79-
!mayUseAGPRs(F))
80-
MayNeedAGPRs = false; // We will select all MAI with VGPR operands.
76+
MayNeedAGPRs = ST.hasMAIInsts();
77+
if (ST.hasGFX90AInsts()) {
78+
// FIXME: MayNeedAGPRs is a misnomer for how this is used. MFMA selection
79+
// should be separated from availability of AGPRs
80+
if (MFMAVGPRForm ||
81+
(ST.getMaxNumVGPRs(F) <= AMDGPU::VGPR_32RegClass.getNumRegs() &&
82+
!mayUseAGPRs(F)))
83+
MayNeedAGPRs = false; // We will select all MAI with VGPR operands.
84+
}
8185

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

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
; RUN: llc -mtriple=amdgcn -mcpu=gfx908 -verify-machineinstrs -show-mc-encoding < %s | FileCheck -check-prefixes=GFX9,GFX908 %s
2-
; RUN: llc -mtriple=amdgcn -mcpu=gfx90a -verify-machineinstrs -show-mc-encoding < %s | FileCheck -check-prefixes=GFX9,GFX90A %s
1+
; 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
5+
; 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:
58
; GFX9-DAG: buffer_load_format_d16_xyzw v[{{[0-9:]+}}], v{{[0-9]+}}, s[{{[0-9:]+}}], 0 idxen ; encoding:

0 commit comments

Comments
 (0)