================
@@ -163,26 +165,22 @@ find_first_character(const unsigned char *s, unsigned 
char c, size_t n) {
 
   const cpp::simd<char> *loop_aligned;
   if (LOOP_BLOCK_SIZE <= 64 && n > LOOP_BLOCK_SIZE) {
-    if constexpr (LOOP_BLOCK_SIZE <= 64) {
-      // Align s down to LOOP_BLOCK_SIZE; all 4 vectors lie on the same page.
-      const cpp::simd<char> *block = reinterpret_cast<const cpp::simd<char> *>(
-          __builtin_align_down(s, LOOP_BLOCK_SIZE));
-      size_t offset = static_cast<size_t>(
-          s - reinterpret_cast<const unsigned char *>(block));
-      uint64_t combined = 0;
-      for (size_t i = 0; i < 4; ++i) {
-        cpp::simd_mask<char> m =
-            cpp::load<cpp::simd<char>>(block + i, /*aligned=*/true) == c_byte;
-        combined |=
-            static_cast<uint64_t>(cpp::bit_cast<cpp::simd_bitmask<char>>(m))
-            << (i * VEC_SIZE);
-      }
-      combined >>= offset;
-      if (LIBC_UNLIKELY(combined != 0))
-        return s + cpp::countr_zero(combined);
-      n -= LOOP_BLOCK_SIZE - offset;
-      loop_aligned = block + 4;
+    // Align s down to LOOP_BLOCK_SIZE; all 4 vectors lie on the same page.
+    const cpp::simd<char> *block = reinterpret_cast<const cpp::simd<char> *>(
+        __builtin_align_down(s, LOOP_BLOCK_SIZE));
+    size_t offset =
+        static_cast<size_t>(s - reinterpret_cast<const unsigned char 
*>(block));
+    uint64_t combined = 0;
+    for (size_t i = 0; i < 4; ++i) {
----------------
michaelrj-google wrote:

nit: the 4 here is a magic number, put it in a constant so the purpose is 
clearer.

https://github.com/llvm/llvm-project/pull/244469
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to