[llvm] [llvm][ARM] Add Addend Checks for MOVT and MOVW instructions. (PR #111970)
Jack Styles via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 11 07:57:12 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)))) {
----------------
Stylie777 wrote:
I long for the day. I have updated with your suggestion so it reads better.
https://github.com/llvm/llvm-project/pull/111970
More information about the llvm-commits
mailing list