[libc-commits] [libc] 5cc2559 - [libc] Fix warning with -fno-lax-vector-conversions
Guillaume Chatelet via libc-commits
libc-commits at lists.llvm.org
Wed Dec 7 02:33:58 PST 2022
Author: Guillaume Chatelet
Date: 2022-12-07T10:33:31Z
New Revision: 5cc2559a33594daf521c729218a3f5f07a26548a
URL: https://github.com/llvm/llvm-project/commit/5cc2559a33594daf521c729218a3f5f07a26548a
DIFF: https://github.com/llvm/llvm-project/commit/5cc2559a33594daf521c729218a3f5f07a26548a.diff
LOG: [libc] Fix warning with -fno-lax-vector-conversions
Added:
Modified:
libc/src/string/memory_utils/op_x86.h
Removed:
################################################################################
diff --git a/libc/src/string/memory_utils/op_x86.h b/libc/src/string/memory_utils/op_x86.h
index d2bf0e4c0738a..f68af00cca874 100644
--- a/libc/src/string/memory_utils/op_x86.h
+++ b/libc/src/string/memory_utils/op_x86.h
@@ -101,7 +101,8 @@ namespace sse2 {
static inline BcmpReturnType bcmp16(CPtr p1, CPtr p2) {
using T = char __attribute__((__vector_size__(16)));
// A mask indicating which bytes
diff er after loading 16 bytes from p1 and p2.
- const int mask = _mm_movemask_epi8(load<T>(p1) != load<T>(p2));
+ const int mask =
+ _mm_movemask_epi8(cpp::bit_cast<__m128i>(load<T>(p1) != load<T>(p2)));
return static_cast<uint32_t>(mask);
}
template <size_t Size> using Bcmp = BcmpImpl<Size, 16, bcmp16>;
@@ -111,7 +112,8 @@ namespace avx2 {
static inline BcmpReturnType bcmp32(CPtr p1, CPtr p2) {
using T = char __attribute__((__vector_size__(32)));
// A mask indicating which bytes
diff er after loading 32 bytes from p1 and p2.
- const int mask = _mm256_movemask_epi8(load<T>(p1) != load<T>(p2));
+ const int mask =
+ _mm256_movemask_epi8(cpp::bit_cast<__m256i>(load<T>(p1) != load<T>(p2)));
// _mm256_movemask_epi8 returns an int but it is to be interpreted as a 32-bit
// mask.
return static_cast<uint32_t>(mask);
@@ -192,7 +194,8 @@ namespace sse2 {
static inline MemcmpReturnType memcmp16(CPtr p1, CPtr p2) {
using T = char __attribute__((__vector_size__(16)));
// A mask indicating which bytes
diff er after loading 16 bytes from p1 and p2.
- if (int mask = _mm_movemask_epi8(load<T>(p1) != load<T>(p2)))
+ if (int mask =
+ _mm_movemask_epi8(cpp::bit_cast<__m128i>(load<T>(p1) != load<T>(p2))))
return char_
diff _no_zero(p1, p2, mask);
return MemcmpReturnType::ZERO();
}
@@ -203,7 +206,8 @@ namespace avx2 {
static inline MemcmpReturnType memcmp32(CPtr p1, CPtr p2) {
using T = char __attribute__((__vector_size__(32)));
// A mask indicating which bytes
diff er after loading 32 bytes from p1 and p2.
- if (int mask = _mm256_movemask_epi8(load<T>(p1) != load<T>(p2)))
+ if (int mask = _mm256_movemask_epi8(
+ cpp::bit_cast<__m256i>(load<T>(p1) != load<T>(p2))))
return char_
diff _no_zero(p1, p2, mask);
return MemcmpReturnType::ZERO();
}
More information about the libc-commits
mailing list