[llvm] r358788 - [AArch64] Fix checks for AArch64MCExpr::VK_SABS flag.

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 19 14:58:11 PDT 2019


Author: efriedma
Date: Fri Apr 19 14:58:10 2019
New Revision: 358788

URL: http://llvm.org/viewvc/llvm-project?rev=358788&view=rev
Log:
[AArch64] Fix checks for AArch64MCExpr::VK_SABS flag.

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.

As far as I know, the existing code happened to produce the correct
results in all cases, so this is just a cleanup.

Patch by Stephen Crane.

Differential Revision: https://reviews.llvm.org/D60596


Modified:
    llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp

Modified: llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp?rev=358788&r1=358787&r2=358788&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp Fri Apr 19 14:58:10 2019
@@ -273,7 +273,7 @@ static uint64_t adjustFixupValue(const M
     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 @@ void AArch64AsmBackend::applyFixup(const
   // 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)




More information about the llvm-commits mailing list