Index: llvm/lib/MC/MCInstPrinter.cpp =================================================================== --- llvm/lib/MC/MCInstPrinter.cpp +++ llvm/lib/MC/MCInstPrinter.cpp @@ -83,15 +83,19 @@ } format_object MCInstPrinter::formatHex(int64_t Value) const { - switch(PrintHexStyle) { + switch (PrintHexStyle) { case HexStyle::C: - if (Value < 0) + if (Value == std::numeric_limits::min()) + return format("0x%" PRIx64, Value); + else if (Value < 0) return format("-0x%" PRIx64, -Value); else return format("0x%" PRIx64, Value); case HexStyle::Asm: - if (Value < 0) { - if (needsLeadingZero((uint64_t)(-Value))) + if (Value == std::numeric_limits::min()) + return format("%" PRIx64 "h", Value); + else if (Value < 0) { + if (needsLeadingZero(-(uint64_t)(Value))) return format("-0%" PRIx64 "h", -Value); else return format("-%" PRIx64 "h", -Value);