Index: llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp =================================================================== --- llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp +++ llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp @@ -4023,11 +4023,17 @@ switch (Result) { default: break; - case Match_MissingFeature: + case Match_MissingFeature: { // It has been verified that the specified instruction // mnemonic is valid. A match was found but it requires // features which are not supported on this GPU. + bool IsMIMG = Mnemo.startswith("image_"); + if (IsMIMG && isGFX10() && + getImmLoc(AMDGPUOperand::ImmTyDim, Operands) == IDLoc) { + return Error(IDLoc, "missing dim modifier"); + } return Error(IDLoc, "operands are not valid for this GPU or mode"); + } case Match_InvalidOperand: { SMLoc ErrorLoc = IDLoc; Index: llvm/test/MC/AMDGPU/gfx10_asm_mimg_err.s =================================================================== --- llvm/test/MC/AMDGPU/gfx10_asm_mimg_err.s +++ llvm/test/MC/AMDGPU/gfx10_asm_mimg_err.s @@ -1,8 +1,7 @@ // RUN: not llvm-mc -arch=amdgcn -mcpu=gfx1010 %s 2>&1 | FileCheck --check-prefixes=NOGFX10 --implicit-check-not=error: %s -// TODO: more helpful error message for missing dim operand image_load v[0:3], v0, s[0:7] dmask:0xf unorm -// NOGFX10: :[[@LINE-1]]:{{[0-9]+}}: error: operands are not valid for this GPU or mode +// NOGFX10: :[[@LINE-1]]:{{[0-9]+}}: error: missing dim modifier image_load v[0:3], v0, s[0:7] dmask:0xf dim:SQ_RSRC_IMG_1D da // NOGFX10: :[[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction Index: llvm/test/MC/AMDGPU/gfx10_err_pos.s =================================================================== --- llvm/test/MC/AMDGPU/gfx10_err_pos.s +++ llvm/test/MC/AMDGPU/gfx10_err_pos.s @@ -759,6 +759,14 @@ // CHECK-NEXT:{{^}}s_sendmsg sendmsg(MSG_GS_DONE, GS_OP_NOP, 0) // CHECK-NEXT:{{^}} ^ +//============================================================================== +// missing dim modifier + +image_load v[0:3], v0, s[0:7] dmask:0xf unorm +// CHECK: error: missing dim modifier +// CHECK-NEXT:{{^}}image_load v[0:3], v0, s[0:7] dmask:0xf unorm +// CHECK-NEXT:{{^}}^ + //============================================================================== // missing message operation