[llvm] r347518 - [X86] Synchronize a macro in getAvailableFeatures in Host.cpp with the same macro in compiler-rt to fix a negative shift amount warning.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 24 12:26:11 PST 2018


Author: ctopper
Date: Sat Nov 24 12:26:11 2018
New Revision: 347518

URL: http://llvm.org/viewvc/llvm-project?rev=347518&view=rev
Log:
[X86] Synchronize a macro in getAvailableFeatures in Host.cpp with the same macro in compiler-rt to fix a negative shift amount warning.

Modified:
    llvm/trunk/lib/Support/Host.cpp

Modified: llvm/trunk/lib/Support/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Host.cpp?rev=347518&r1=347517&r2=347518&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Host.cpp (original)
+++ llvm/trunk/lib/Support/Host.cpp Sat Nov 24 12:26:11 2018
@@ -903,11 +903,11 @@ static void getAvailableFeatures(unsigne
 
   auto setFeature = [&](unsigned F) {
     if (F < 32)
-      Features |= 1 << F;
+      Features |= 1U << (F & 0x1f);
     else if (F < 64)
-      Features2 |= 1 << (F - 32);
+      Features2 |= 1U << ((F - 32) & 0x1f);
     else if (F < 96)
-      Features3 |= 1 << (F - 64);
+      Features3 |= 1U << ((F - 64) & 0x1f);
     else
       llvm_unreachable("Unexpected FeatureBit");
   };




More information about the llvm-commits mailing list