[libc-commits] [PATCH] D152865: [libc][NFC] Fix some issues with LIBC_INLINE
Alex Brachet via Phabricator via libc-commits
libc-commits at lists.llvm.org
Wed Jun 14 07:09:34 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG10e7b451ada5: [libc][NFC] Fix some issues with LIBC_INLINE (authored by abrachet).
Herald added a project: libc-project.
Herald added a subscriber: libc-commits.
Changed prior to commit:
https://reviews.llvm.org/D152865?vs=531095&id=531314#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152865/new/
https://reviews.llvm.org/D152865
Files:
libc/src/string/memory_utils/op_generic.h
libc/src/string/memory_utils/op_x86.h
Index: libc/src/string/memory_utils/op_x86.h
===================================================================
--- libc/src/string/memory_utils/op_x86.h
+++ libc/src/string/memory_utils/op_x86.h
@@ -40,12 +40,12 @@
namespace __llvm_libc::x86 {
// A set of constants to check compile time features.
-static LIBC_INLINE constexpr bool kSse2 = LLVM_LIBC_IS_DEFINED(__SSE2__);
-static LIBC_INLINE constexpr bool kSse41 = LLVM_LIBC_IS_DEFINED(__SSE4_1__);
-static LIBC_INLINE constexpr bool kAvx = LLVM_LIBC_IS_DEFINED(__AVX__);
-static LIBC_INLINE constexpr bool kAvx2 = LLVM_LIBC_IS_DEFINED(__AVX2__);
-static LIBC_INLINE constexpr bool kAvx512F = LLVM_LIBC_IS_DEFINED(__AVX512F__);
-static LIBC_INLINE constexpr bool kAvx512BW =
+LIBC_INLINE static constexpr bool kSse2 = LLVM_LIBC_IS_DEFINED(__SSE2__);
+LIBC_INLINE static constexpr bool kSse41 = LLVM_LIBC_IS_DEFINED(__SSE4_1__);
+LIBC_INLINE static constexpr bool kAvx = LLVM_LIBC_IS_DEFINED(__AVX__);
+LIBC_INLINE static constexpr bool kAvx2 = LLVM_LIBC_IS_DEFINED(__AVX2__);
+LIBC_INLINE static constexpr bool kAvx512F = LLVM_LIBC_IS_DEFINED(__AVX512F__);
+LIBC_INLINE static constexpr bool kAvx512BW =
LLVM_LIBC_IS_DEFINED(__AVX512BW__);
///////////////////////////////////////////////////////////////////////////////
@@ -130,7 +130,8 @@
8, 9, 10, 11, 12, 13, 14, 15));
}
LIBC_INLINE uint16_t big_endian_cmp_mask(__m128i max, __m128i value) {
- return _mm_movemask_epi8(bytewise_reverse(_mm_cmpeq_epi8(max, value)));
+ return static_cast<uint16_t>(
+ _mm_movemask_epi8(bytewise_reverse(_mm_cmpeq_epi8(max, value))));
}
template <> LIBC_INLINE bool eq<__m128i>(CPtr p1, CPtr p2, size_t offset) {
const auto a = load<__m128i>(p1, offset);
Index: libc/src/string/memory_utils/op_generic.h
===================================================================
--- libc/src/string/memory_utils/op_generic.h
+++ libc/src/string/memory_utils/op_generic.h
@@ -331,11 +331,13 @@
// Equality: returns true iff values at locations (p1 + offset) and (p2 +
// offset) compare equal.
-template <typename T> static bool eq(CPtr p1, CPtr p2, size_t offset);
+template <typename T>
+LIBC_INLINE static bool eq(CPtr p1, CPtr p2, size_t offset);
// Not equals: returns non-zero iff values at locations (p1 + offset) and (p2 +
// offset) differ.
-template <typename T> static uint32_t neq(CPtr p1, CPtr p2, size_t offset);
+template <typename T>
+LIBC_INLINE static uint32_t neq(CPtr p1, CPtr p2, size_t offset);
// Lexicographic comparison:
// - returns 0 iff values at locations (p1 + offset) and (p2 + offset) compare
@@ -345,7 +347,7 @@
// - returns a positive value if value at location (p1 + offset) is
// lexicographically greater than value at (p2 + offset).
template <typename T>
-static MemcmpReturnType cmp(CPtr p1, CPtr p2, size_t offset);
+LIBC_INLINE static MemcmpReturnType cmp(CPtr p1, CPtr p2, size_t offset);
// Lexicographic comparison of non-equal values:
// - returns a negative value if value at location (p1 + offset) is
@@ -353,7 +355,7 @@
// - returns a positive value if value at location (p1 + offset) is
// lexicographically greater than value at (p2 + offset).
template <typename T>
-static MemcmpReturnType cmp_neq(CPtr p1, CPtr p2, size_t offset);
+LIBC_INLINE static MemcmpReturnType cmp_neq(CPtr p1, CPtr p2, size_t offset);
///////////////////////////////////////////////////////////////////////////////
// Memcmp implementation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152865.531314.patch
Type: text/x-patch
Size: 3500 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230614/27fd9fe1/attachment.bin>
More information about the libc-commits
mailing list