Skip to content

[LLVM][AMDGPU] MC support for ds_bpermute_fi_b32 #124108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions llvm/lib/Target/AMDGPU/DSInstructions.td
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,7 @@ def DS_PERMUTE_B32 : DS_1A1D_PERMUTE <"ds_permute_b32",
int_amdgcn_ds_permute>;
def DS_BPERMUTE_B32 : DS_1A1D_PERMUTE <"ds_bpermute_b32",
int_amdgcn_ds_bpermute>;
def DS_BPERMUTE_FI_B32 : DS_1A1D_PERMUTE <"ds_bpermute_fi_b32">;
}

} // let SubtargetPredicate = isGFX8Plus
Expand Down Expand Up @@ -1264,6 +1265,7 @@ defm DS_PK_ADD_F16 : DS_Real_gfx12<0x09a>;
defm DS_PK_ADD_RTN_F16 : DS_Real_gfx12<0x0aa>;
defm DS_PK_ADD_BF16 : DS_Real_gfx12<0x09b>;
defm DS_PK_ADD_RTN_BF16 : DS_Real_gfx12<0x0ab>;
defm DS_BPERMUTE_FI_B32 : DS_Real_gfx12<0x0cd>;

// New aliases added in GFX12 without renaming the instructions.
let AssemblerPredicate = isGFX12Plus in {
Expand Down
12 changes: 12 additions & 0 deletions llvm/test/MC/AMDGPU/gfx12_asm_ds.s
Original file line number Diff line number Diff line change
Expand Up @@ -1910,3 +1910,15 @@ ds_swizzle_b32 v8, v2 offset:swizzle(BROADCAST,8,7)

ds_swizzle_b32 v8, v2 offset:swizzle(BITMASK_PERM, "01pip")
// GFX12: [0x07,0x09,0xd4,0xd8,0x02,0x00,0x00,0x08]

ds_bpermute_fi_b32 v5, v1, v2
// GFX12: encoding: [0x00,0x00,0x34,0xdb,0x01,0x02,0x00,0x05]

ds_bpermute_fi_b32 v5, v1, v2 offset:65535
// GFX12: encoding: [0xff,0xff,0x34,0xdb,0x01,0x02,0x00,0x05]

ds_bpermute_fi_b32 v5, v1, v2 offset:0
// GFX12: encoding: [0x00,0x00,0x34,0xdb,0x01,0x02,0x00,0x05]

ds_bpermute_fi_b32 v255, v255, v255 offset:4
// GFX12: encoding: [0x04,0x00,0x34,0xdb,0xff,0xff,0x00,0xff]
9 changes: 9 additions & 0 deletions llvm/test/MC/Disassembler/AMDGPU/gfx12_dasm_ds.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3233,3 +3233,12 @@

# GFX12: ds_xor_rtn_b64 v[5:6], v255, v[2:3] offset:65535 ; encoding: [0xff,0xff,0xac,0xd9,0xff,0x02,0x00,0x05]
0xff,0xff,0xac,0xd9,0xff,0x02,0x00,0x05

# GFX12: ds_bpermute_fi_b32 v5, v1, v2 ; encoding: [0x00,0x00,0x34,0xdb,0x01,0x02,0x00,0x05]
0x00,0x00,0x34,0xdb,0x01,0x02,0x00,0x05

# GFX12: ds_bpermute_fi_b32 v5, v1, v2 offset:65535 ; encoding: [0xff,0xff,0x34,0xdb,0x01,0x02,0x00,0x05]
0xff,0xff,0x34,0xdb,0x01,0x02,0x00,0x05

# GFX12: ds_bpermute_fi_b32 v255, v255, v255 offset:4 ; encoding: [0x04,0x00,0x34,0xdb,0xff,0xff,0x00,0xff]
0x04,0x00,0x34,0xdb,0xff,0xff,0x00,0xff
Loading