Index: lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp =================================================================== --- lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp +++ lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp @@ -3838,7 +3838,9 @@ return Ok? MatchOperand_Success : MatchOperand_ParseFail; } else { - return MatchOperand_NoMatch; + // Swizzle "offset" operand is optional. + // If it is omitted, try parsing other optional operands. + return parseOptionalOperand(Operands); } } Index: test/MC/AMDGPU/ds.s =================================================================== --- test/MC/AMDGPU/ds.s +++ test/MC/AMDGPU/ds.s @@ -511,6 +511,10 @@ // SICI: ds_swizzle_b32 v8, v2 ; encoding: [0x00,0x00,0xd4,0xd8,0x02,0x00,0x00,0x08] // VI: ds_swizzle_b32 v8, v2 ; encoding: [0x00,0x00,0x7a,0xd8,0x02,0x00,0x00,0x08] +ds_swizzle_b32 v8, v2 gds +// SICI: ds_swizzle_b32 v8, v2 gds ; encoding: [0x00,0x00,0xd6,0xd8,0x02,0x00,0x00,0x08] +// VI: ds_swizzle_b32 v8, v2 gds ; encoding: [0x00,0x00,0x7b,0xd8,0x02,0x00,0x00,0x08] + ds_swizzle_b32 v8, v2 offset:0xFFFF // SICI: ds_swizzle_b32 v8, v2 offset:65535 ; encoding: [0xff,0xff,0xd4,0xd8,0x02,0x00,0x00,0x08] // VI: ds_swizzle_b32 v8, v2 offset:65535 ; encoding: [0xff,0xff,0x7a,0xd8,0x02,0x00,0x00,0x08] Index: test/MC/Disassembler/AMDGPU/ds_vi.txt =================================================================== --- test/MC/Disassembler/AMDGPU/ds_vi.txt +++ test/MC/Disassembler/AMDGPU/ds_vi.txt @@ -171,6 +171,9 @@ # VI: ds_swizzle_b32 v8, v2 ; encoding: [0x00,0x00,0x7a,0xd8,0x02,0x00,0x00,0x08] 0x00 0x00 0x7a 0xd8 0x02 0x00 0x00 0x08 +# VI: ds_swizzle_b32 v8, v2 gds ; encoding: [0x00,0x00,0x7b,0xd8,0x02,0x00,0x00,0x08] +0x00 0x00 0x7b 0xd8 0x02 0x00 0x00 0x08 + # VI: ds_read_b32 v8, v2 ; encoding: [0x00,0x00,0x6c,0xd8,0x02,0x00,0x00,0x08] 0x00 0x00 0x6c 0xd8 0x02 0x00 0x00 0x08