[PATCH] D60596: Fix checks for AArch64MCExpr::VK_SABS flag

Stephen Crane via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 11 19:09:03 PDT 2019


rinon created this revision.
rinon added reviewers: mgrang, efriedma.
Herald added subscribers: hiraditya, kristof.beyls, javed.absar.
Herald added a project: LLVM.

VK_SABS is part of the SymLoc bitfield in the variant kind which should be
compared for equality, not by checking the VK_SABS bit.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D60596

Files:
  llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp


Index: llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
===================================================================
--- llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
+++ llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
@@ -273,7 +273,7 @@
     if (RefKind & AArch64MCExpr::VK_NC) {
       Value &= 0xFFFF;
     }
-    else if (RefKind & AArch64MCExpr::VK_SABS) {
+    else if (AArch64MCExpr::getSymbolLoc(RefKind) == AArch64MCExpr::VK_SABS) {
       if (SignedValue > 0xFFFF || SignedValue < -0xFFFF)
         Ctx.reportError(Fixup.getLoc(), "fixup value out of range");
 
@@ -397,7 +397,7 @@
   // handle this more cleanly. This may affect the output of -show-mc-encoding.
   AArch64MCExpr::VariantKind RefKind =
     static_cast<AArch64MCExpr::VariantKind>(Target.getRefKind());
-  if (RefKind & AArch64MCExpr::VK_SABS) {
+  if (AArch64MCExpr::getSymbolLoc(RefKind) == AArch64MCExpr::VK_SABS) {
     // If the immediate is negative, generate MOVN else MOVZ.
     // (Bit 30 = 0) ==> MOVN, (Bit 30 = 1) ==> MOVZ.
     if (SignedValue < 0)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60596.194798.patch
Type: text/x-patch
Size: 1081 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190412/f29251f2/attachment.bin>


More information about the llvm-commits mailing list