[llvm] [M68k] add 32 bit branch instrs and relaxations (PR #117371)

via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 2 12:22:04 PST 2025


================
@@ -166,26 +225,35 @@ bool M68kAsmBackend::mayNeedRelaxation(const MCInst &Inst,
 }
 
 bool M68kAsmBackend::fixupNeedsRelaxation(const MCFixup &Fixup,
-                                          uint64_t Value) const {
-  // TODO Newer CPU can use 32 bit offsets, so check for this when ready
-  if (!isInt<16>(Value)) {
+                                          uint64_t UnsignedValue) const {
+  int64_t Value = static_cast<int64_t>(UnsignedValue);
+
+  if (!isInt<32>(Value) || (!Allows32BitBranch && !isInt<16>(Value)))
     llvm_unreachable("Cannot relax the instruction, value does not fit");
----------------
knickish wrote:

Would you prefer it to be an `assert` instead of `llvm_unreachable`, or something more detailed?

https://github.com/llvm/llvm-project/pull/117371


More information about the llvm-commits mailing list