diff --git a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp index 93083f2660c2d..68424cc2f7071 100644 --- a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp +++ b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp @@ -5819,6 +5819,7 @@ bool AMDGPUAsmParser::matchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode, uint64_t &ErrorInfo, bool MatchingInlineAsm) { MCInst Inst; + Inst.setLoc(IDLoc); unsigned Result = Match_Success; for (auto Variant : getMatchedVariants()) { uint64_t EI; @@ -5842,7 +5843,6 @@ bool AMDGPUAsmParser::matchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode, if (!validateInstruction(Inst, IDLoc, Operands)) { return true; } - Inst.setLoc(IDLoc); Out.emitInstruction(Inst, getSTI()); return false; } diff --git a/llvm/test/MC/AMDGPU/warnings.s b/llvm/test/MC/AMDGPU/warnings.s new file mode 100644 index 0000000000000..3f94d14a59ce6 --- /dev/null +++ b/llvm/test/MC/AMDGPU/warnings.s @@ -0,0 +1,5 @@ +// NOTE: Assertions have been autogenerated by utils/update_mc_test_checks.py UTC_ARGS: --version 5 +// RUN: llvm-mc -triple=amdgcn -mcpu=gfx900 -filetype=null %s 2>&1 | FileCheck %s + +v_floor_f64 v[0:1], 1.23456 +// CHECK: :[[@LINE-1]]:1: warning: Can't encode literal as exact 64-bit floating-point operand. Low 32-bits will be set to zero