[libc-commits] [libc] 2e9c75d - [libc] Use __builtin_ctzll instead of __builtin_ctzl in elements_x86.h.

Siva Chandra Reddy via libc-commits libc-commits at lists.llvm.org
Fri Jun 25 15:58:35 PDT 2021


Author: Siva Chandra Reddy
Date: 2021-06-25T22:58:13Z
New Revision: 2e9c75daffddd65e37c3236708b5b133e6f5f2f5

URL: https://github.com/llvm/llvm-project/commit/2e9c75daffddd65e37c3236708b5b133e6f5f2f5
DIFF: https://github.com/llvm/llvm-project/commit/2e9c75daffddd65e37c3236708b5b133e6f5f2f5.diff

LOG: [libc] Use __builtin_ctzll instead of __builtin_ctzl in elements_x86.h.

__builtin_ctzl takes an unsigned long argument which need not be 64-bit
long on all platforms. Using __builtin_ctzll, which takes an unsigned
long long argument, ensures that 64-bit values will be handled on a
wider range of platforms.

Without this change, the test corresponding to M512 fails in Windows.

Reviewed By: gchatelet

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

Added: 
    

Modified: 
    libc/src/string/memory_utils/elements_x86.h

Removed: 
    


################################################################################
diff  --git a/libc/src/string/memory_utils/elements_x86.h b/libc/src/string/memory_utils/elements_x86.h
index 36f40be4f680..2873fff8b2e2 100644
--- a/libc/src/string/memory_utils/elements_x86.h
+++ b/libc/src/string/memory_utils/elements_x86.h
@@ -46,7 +46,7 @@ template <typename Base> struct Vector : public Base {
   }
 
   static int CharDiff(const char *a, const char *b, uint64_t mask) {
-    const size_t 
diff _index = __builtin_ctzl(mask);
+    const size_t 
diff _index = __builtin_ctzll(mask);
     const int ca = (unsigned char)a[
diff _index];
     const int cb = (unsigned char)b[
diff _index];
     return ca - cb;


        


More information about the libc-commits mailing list