[llvm] Add Addend Checks for MOVT and MOVW instructions. (PR #111970)
David Spickett via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 11 02:43:51 PDT 2024
================
@@ -446,6 +447,16 @@ unsigned ARMAsmBackend::adjustFixupValue(const MCAssembler &Asm,
const MCSubtargetInfo* STI) const {
unsigned Kind = Fixup.getKind();
+ // For MOVW/MOVT Instructions, the Fixup Value needs to be 16 bit aligned.
+ // If this is not the case, we should reject compilation.
+ if((Kind == ARM::fixup_arm_movw_lo16 || Kind == ARM::fixup_arm_movt_hi16 ||
+ Kind == ARM::fixup_t2_movw_lo16 || Kind == ARM::fixup_t2_movt_hi16) &&
+ (!(minIntN(16) <= static_cast<int64_t>(Value) &&
+ static_cast<int64_t>(Value) <= maxIntN(16)))) {
----------------
DavidSpickett wrote:
One day we'll be able to do Python's `x < y < z` :unicorn:
https://github.com/llvm/llvm-project/pull/111970
More information about the llvm-commits
mailing list