Skip to content

Commit bf3f866

Browse files
committed
[AMDGPU] Simplify GFX11 and GFX12 FLAT saddr field definition
It is simpler to define this field correctly in the base class for the Reals for each architecture, than to override it in subclasses for different addressing modes.
1 parent c957715 commit bf3f866

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

llvm/lib/Target/AMDGPU/FLATInstructions.td

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class VFLAT_Real <bits<8> op, FLAT_Pseudo ps, string opName = ps.Mnemonic> :
174174
bits<8> vaddr;
175175
bits<24> offset;
176176

177-
let Inst{6-0} = !if(ps.enabled_saddr, saddr, 0x7f);
177+
let Inst{6-0} = !if(ps.enabled_saddr, saddr, SGPR_NULL_gfx11plus.Index);
178178
let Inst{21-14} = op;
179179
let Inst{31-26} = 0x3b;
180180
let Inst{39-32} = !if(ps.has_vdst, vdst, ?);
@@ -2353,6 +2353,7 @@ class FLAT_Real_gfx11 <bits<7> op, FLAT_Pseudo ps, string opName = ps.Mnemonic>
23532353
let Inst{14} = !if(ps.has_glc, cpol{CPolBit.GLC}, ps.glcValue);
23542354
let Inst{15} = cpol{CPolBit.SLC};
23552355
let Inst{17-16} = seg;
2356+
let Inst{54-48} = !if(ps.enabled_saddr, saddr, SGPR_NULL_gfx11plus.Index);
23562357
let Inst{55} = ps.sve;
23572358
}
23582359

@@ -2363,15 +2364,11 @@ multiclass FLAT_Aliases_gfx11<string ps, string opName, int renamed> {
23632364

23642365
multiclass FLAT_Real_Base_gfx11<bits<7> op, string ps, string opName, int renamed = false> :
23652366
FLAT_Aliases_gfx11<ps, opName, renamed> {
2366-
def _gfx11 : FLAT_Real_gfx11<op, !cast<FLAT_Pseudo>(ps), opName> {
2367-
let Inst{54-48} = SGPR_NULL_gfx11plus.Index;
2368-
}
2367+
def _gfx11 : FLAT_Real_gfx11<op, !cast<FLAT_Pseudo>(ps), opName>;
23692368
}
23702369

23712370
multiclass FLAT_Real_RTN_gfx11<bits<7> op, string ps, string opName> {
2372-
def _RTN_gfx11 : FLAT_Real_gfx11<op, !cast<FLAT_Pseudo>(ps#"_RTN"), opName> {
2373-
let Inst{54-48} = SGPR_NULL_gfx11plus.Index;
2374-
}
2371+
def _RTN_gfx11 : FLAT_Real_gfx11<op, !cast<FLAT_Pseudo>(ps#"_RTN"), opName>;
23752372
}
23762373

23772374
multiclass FLAT_Real_SADDR_gfx11<bits<7> op, string ps, string opName> {
@@ -2384,7 +2381,6 @@ multiclass FLAT_Real_SADDR_RTN_gfx11<bits<7> op, string ps, string opName> {
23842381

23852382
multiclass FLAT_Real_ST_gfx11<bits<7> op, string ps, string opName> {
23862383
def _ST_gfx11 : FLAT_Real_gfx11<op, !cast<FLAT_Pseudo>(ps#"_ST"), opName> {
2387-
let Inst{54-48} = SGPR_NULL_gfx11plus.Index;
23882384
let OtherPredicates = [HasFlatScratchSTMode];
23892385
}
23902386
}
@@ -2579,15 +2575,11 @@ multiclass VFLAT_Aliases_gfx12<string ps, string opName, int renamed, string ali
25792575
multiclass VFLAT_Real_Base_gfx12<bits<8> op, string ps = NAME, string opName = !tolower(NAME),
25802576
int renamed = false, string alias = ""> :
25812577
VFLAT_Aliases_gfx12<ps, opName, renamed, alias> {
2582-
def _gfx12 : VFLAT_Real_gfx12<op, !cast<FLAT_Pseudo>(ps), opName> {
2583-
let Inst{6-0} = !cast<int>(SGPR_NULL_gfx11plus.HWEncoding);
2584-
}
2578+
def _gfx12 : VFLAT_Real_gfx12<op, !cast<FLAT_Pseudo>(ps), opName>;
25852579
}
25862580

25872581
multiclass VFLAT_Real_RTN_gfx12<bits<8> op, string ps, string opName> {
2588-
def _RTN_gfx12 : VFLAT_Real_gfx12<op, !cast<FLAT_Pseudo>(ps#"_RTN"), opName> {
2589-
let Inst{6-0} = !cast<int>(SGPR_NULL_gfx11plus.HWEncoding);
2590-
}
2582+
def _RTN_gfx12 : VFLAT_Real_gfx12<op, !cast<FLAT_Pseudo>(ps#"_RTN"), opName>;
25912583
}
25922584

25932585
multiclass VFLAT_Real_SADDR_gfx12<bits<8> op, string ps, string opName> {
@@ -2600,7 +2592,6 @@ multiclass VFLAT_Real_SADDR_RTN_gfx12<bits<8> op, string ps, string opName> {
26002592

26012593
multiclass VFLAT_Real_ST_gfx12<bits<8> op, string ps, string opName> {
26022594
def _ST_gfx12 : VFLAT_Real_gfx12<op, !cast<FLAT_Pseudo>(ps#"_ST"), opName> {
2603-
let Inst{6-0} = !cast<int>(SGPR_NULL_gfx11plus.HWEncoding);
26042595
let OtherPredicates = [HasFlatScratchSTMode];
26052596
}
26062597
}

0 commit comments

Comments
 (0)