[llvm] [M68k] add 32 bit branch instrs and relaxations (PR #117371)
Kane York via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 1 23:42:49 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");
----------------
riking wrote:
This probably should be a cleaner error than an unreachable? You can trip this easily by compiling 32-bit-okay code for a 16-bit-only device
https://github.com/llvm/llvm-project/pull/117371
More information about the llvm-commits
mailing list