This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU][MC] New syntax for ds_swizzle_b32 offset
ClosedPublic

Authored by dp on May 25 2017, 4:23 AM.

Details

Summary

This is an initial implementation for GFX7 swizzle modes.
GFX8/9 has additional swizzle modes; these features will be added by a separate fix.

See Bug 28601: https://bugs.llvm.org//show_bug.cgi?id=28601

Diff Detail

Repository
rL LLVM

Event Timeline

dp created this revision.May 25 2017, 4:23 AM
artem.tamazov requested changes to this revision.May 25 2017, 6:06 AM

Good work, especially negative tests. The finishing touch is necessary: let's follow ODR. That would require some refactoring, but it seems that all the needed functionality is in place.

lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
3421 ↗(On Diff #100220)

I believe we shall use symbolic names instead of integer literals. Pls refer to sendmsg implementation. See .../lib/Target/AMDGPU/SIDefines.h,

3587 ↗(On Diff #100220)

Ditto wrt string liternals. Let's follow the One Definition Rule. See .../lib/Target/AMDGPU/Utils/AMDGPUAsmUtils.h.

test/MC/Disassembler/AMDGPU/gfx8_dasm_all.txt
993 ↗(On Diff #100220)

Any reason for removing offset from this and following ds_swizzle_b32 test cases? I think we shall keep some cases with non-zero offset in disassembler tests.

This revision now requires changes to proceed.May 25 2017, 6:06 AM
dp marked an inline comment as done.May 25 2017, 6:57 AM
dp added inline comments.
test/MC/Disassembler/AMDGPU/gfx8_dasm_all.txt
993 ↗(On Diff #100220)

This would require changes in TestGen to support new swizzle syntax. I believe handwritten tests provide sufficient coverage for both assembler and disassembler. To make things simpler, I corrected TestGen to generate tests with 'offset:XXX' for assembler but skip these for disassembler. This way TestGen does not need to know new swizzle syntax.

artem.tamazov added inline comments.May 25 2017, 7:22 AM
test/MC/Disassembler/AMDGPU/gfx8_dasm_all.txt
993 ↗(On Diff #100220)

There is none handwritten ds_swizzle_b32 disassembler tests with non-zero offset. Could you please add some?
...\test\MC\Disassembler\AMDGPU\ds_vi.txt

dp updated this revision to Diff 100426.May 26 2017, 9:48 AM
dp edited edge metadata.
dp marked an inline comment as done.

Corrected as suggested by Artem

dp marked 4 inline comments as done.May 26 2017, 9:50 AM
artem.tamazov accepted this revision.May 29 2017, 6:59 AM
This revision is now accepted and ready to land.May 29 2017, 6:59 AM
This revision was automatically updated to reflect the committed changes.