This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU][AsmParser] Distinguish literal and modifier SMEM offsets.
ClosedPublic

Authored by kosarev on Feb 27 2023, 11:35 AM.

Diff Detail

Event Timeline

kosarev created this revision.Feb 27 2023, 11:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 27 2023, 11:35 AM
kosarev requested review of this revision.Feb 27 2023, 11:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 27 2023, 11:35 AM

I'm not sure I know where tests for things like that should go. smem-err.s should be generic enough but looks abandoned. And leaving it in gfx11_asm_err.s raises questions on how it could survive adding tests for future subtarget generations.

kosarev updated this revision to Diff 500864.Feb 27 2023, 11:47 AM

Remove unwanted clang-formatting.

kosarev retitled this revision from [AMDGPU] Distinguish literal and modifier SMEM offsets. to [AMDGPU][AsmParser] Distinguish literal and modifier SMEM offsets..Feb 27 2023, 11:48 AM
foad added a comment.Feb 28 2023, 2:17 AM

I don't quite understand the bug here - can you explain how "s_load_dword s1, s[2:3], s0 0x1" would have been mishandled before your patch?

I'm not sure I know where tests for things like that should go. smem-err.s should be generic enough but looks abandoned. And leaving it in gfx11_asm_err.s raises questions on how it could survive adding tests for future subtarget generations.

I think adding it to gfx11_asm_err.s is fine. If you really wanted to, you could add it to gfx*_asm_err.s for all affected architectures. Unfortunately there is a lot of duplication in the assembler tests.

I don't quite understand the bug here - can you explain how "s_load_dword s1, s[2:3], s0 0x1" would have been mishandled before your patch?

The 0x1 bit is currently indistinguishable from offset:0x1 and therefore accepted as a valid operand.

foad accepted this revision.Feb 28 2023, 4:19 AM

I don't quite understand the bug here - can you explain how "s_load_dword s1, s[2:3], s0 0x1" would have been mishandled before your patch?

The 0x1 bit is currently indistinguishable from offset:0x1 and therefore accepted as a valid operand.

Thanks, LGTM!

This revision is now accepted and ready to land.Feb 28 2023, 4:19 AM
This revision was landed with ongoing or failed builds.Feb 28 2023, 4:59 AM
This revision was automatically updated to reflect the committed changes.