[Arm] Add assert in T2 Imm7s code emitter
authorSimon Wallis <simon.wallis2@arm.com>
Tue, 31 Aug 2021 07:16:26 +0000 (08:16 +0100)
committerSimon Wallis <simon.wallis2@arm.com>
Tue, 31 Aug 2021 07:16:48 +0000 (08:16 +0100)
Add assert to provoke failure in object file output, not just in disassembly output.

Reviewed By: yroux

Differential Revision: https://reviews.llvm.org/D107259

llvm/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp

index ced48cc..5ecacda 100644 (file)
@@ -1138,6 +1138,7 @@ getT2AddrModeImm8s4OpValue(const MCInst &MI, unsigned OpIdx,
   // representation for the complex operand in the .td file. This isn't just
   // style, unfortunately. As-is, we can't represent the distinct encoding
   // for #-0.
+  assert(((Imm8 & 0x3) == 0) && "Not a valid immediate!");
   uint32_t Binary = (Imm8 >> 2) & 0xff;
   // Immediate is always encoded as positive. The 'U' bit controls add vs sub.
   if (isAdd)