Skip to content

Commit 3e73cfb

Browse files
broxigarchengithub-actions[bot]
authored andcommitted
Automerge: [AMDGPU][True16][CodeGen] lower flat_d16_saddr_t16 to saddr inst (#166603)
In true16 mode, D16 insts are lowered to a pseudo t16 first, and then lowered to hi/lo inst in MC lowering using D16T16 table. However, the D16T16 table selects both `flat_load_d16_t16 / flat_load_d16_t16_saddr` to `flat_load_d16_(hi)_b16` which is wrong. saddr pseudo inst `flat_load_d16_t16_saddr` should be selected to saddr hi/lo inst The global/scratch are correct while the flat seems to be the only one with this issue.
2 parents 0b30881 + 3d41567 commit 3e73cfb

File tree

2 files changed

+533
-56
lines changed

2 files changed

+533
-56
lines changed

llvm/lib/Target/AMDGPU/FLATInstructions.td

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,18 @@ multiclass FLAT_Flat_Load_Pseudo<string opName, RegisterOperand regClass = AVLdS
262262

263263
multiclass FLAT_Flat_Load_Pseudo_t16<string opName> {
264264
defm "" : FLAT_Flat_Load_Pseudo<opName, AVLdSt_32, 1>;
265-
let True16Predicate = UseRealTrue16Insts in
266-
defm _t16 : FLAT_Flat_Load_Pseudo<opName#"_t16", VGPROp_16>, True16D16Table<NAME#"_HI", NAME>;
265+
266+
defvar Name16 = opName#"_t16";
267+
let True16Predicate = UseRealTrue16Insts in {
268+
def _t16 : FLAT_Load_Pseudo<Name16, VGPROp_16>,
269+
GlobalSaddrTable<0, Name16>,
270+
True16D16Table<NAME#"_HI", NAME>;
271+
272+
let OtherPredicates = [HasFlatGVSMode] in
273+
def _t16_SADDR : FLAT_Load_Pseudo<Name16, VGPROp_16, 0, 1, 1>,
274+
GlobalSaddrTable<1, Name16>,
275+
True16D16Table<NAME#"_HI_SADDR", NAME#"_SADDR">;
276+
}
267277
}
268278

269279
class FLAT_Store_Pseudo <string opName, RegisterOperand vdataClass,

0 commit comments

Comments
 (0)