diff --git a/llvm/lib/Target/BPF/AsmParser/BPFAsmParser.cpp b/llvm/lib/Target/BPF/AsmParser/BPFAsmParser.cpp index 88c92da8e95b4..a347794a9a30c 100644 --- a/llvm/lib/Target/BPF/AsmParser/BPFAsmParser.cpp +++ b/llvm/lib/Target/BPF/AsmParser/BPFAsmParser.cpp @@ -348,6 +348,9 @@ bool BPFAsmParser::matchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode, case Match_InvalidSImm16: return Error(Operands[ErrorInfo]->getStartLoc(), "operand is not a 16-bit signed integer"); + case Match_InvalidTiedOperand: + return Error(Operands[ErrorInfo]->getStartLoc(), + "operand is not the same as the dst register"); } llvm_unreachable("Unknown match type detected!"); diff --git a/llvm/test/MC/BPF/bad-tied.s b/llvm/test/MC/BPF/bad-tied.s new file mode 100644 index 0000000000000..9cd47896c3dd2 --- /dev/null +++ b/llvm/test/MC/BPF/bad-tied.s @@ -0,0 +1,12 @@ +# RUN: not llvm-mc -mcpu=v4 -triple bpfel < %s 2>&1 \ +# RUN: | grep 'error: operand is not the same as the dst register' \ +# RUN: | count 9 + r0 = bswap16 r1 + r0 = bswap32 r1 + r0 = bswap64 r1 + r0 = atomic_fetch_add((u64*)(r2 + 0), r1) + r0 = atomic_fetch_and((u64*)(r2 + 0), r1) + r0 = atomic_fetch_or((u64*)(r2 + 0), r1) + r0 = atomic_fetch_xor((u64*)(r2 + 0), r1) + w0 = xchg32_32(r2 + 0, w1) + r0 = xchg_64(r2 + 0, r1)