[compiler-rt] r347517 - [X86] Make conversion of feature bits into a mask explicitly unsigned by using 1U instead of 1.

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


Author: ctopper
Date: Sat Nov 24 12:25:45 2018
New Revision: 347517

URL: http://llvm.org/viewvc/llvm-project?rev=347517&view=rev
Log:
[X86] Make conversion of feature bits into a mask explicitly unsigned by using 1U instead of 1.

Modified:
    compiler-rt/trunk/lib/builtins/cpu_model.c

Modified: compiler-rt/trunk/lib/builtins/cpu_model.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/cpu_model.c?rev=347517&r1=347516&r2=347517&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/cpu_model.c (original)
+++ compiler-rt/trunk/lib/builtins/cpu_model.c Sat Nov 24 12:25:45 2018
@@ -462,12 +462,12 @@ static void getAvailableFeatures(unsigne
   unsigned Features2 = 0;
   unsigned EAX, EBX;
 
-#define setFeature(F)               \
-  do {                              \
-    if (F < 32)                     \
-      Features |= 1 << (F & 0x1f)   \
-    else if (F < 64)                \
-      Features2 |= 1 << (F & 0x1f); \
+#define setFeature(F)                       \
+  do {                                      \
+    if (F < 32)                             \
+      Features |= 1U << (F & 0x1f)          \
+    else if (F < 64)                        \
+      Features2 |= 1U << ((F - 32) & 0x1f); \
   } while (0)
 
   if ((EDX >> 15) & 1)




More information about the llvm-commits mailing list