Skip to content

Commit

Permalink
vec_char_find_CRLF
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengxwen committed Dec 12, 2024
1 parent 37391d0 commit 932ec44
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: SeqArray
Type: Package
Title: Data Management of Large-Scale Whole-Genome Sequence Variant Calls
Version: 1.46.0
Date: 2024-11-10
Version: 1.46.1
Date: 2024-12-11
Depends: R (>= 3.5.0), gdsfmt (>= 1.31.1)
Imports: methods, parallel, IRanges, GenomicRanges, GenomeInfoDb, Biostrings,
S4Vectors
Expand Down
21 changes: 11 additions & 10 deletions src/vectorization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1826,7 +1826,6 @@ size_t vec_f64_num_notfinite(const double p[], size_t n)

const char *vec_char_find_CRLF(const char *p, size_t n)
{
/*
#ifdef COREARRAY_SIMD_SSE2

// header 1, 16-byte aligned
Expand All @@ -1847,24 +1846,31 @@ const char *vec_char_find_CRLF(const char *p, size_t n)
__m128i c1 = _mm_cmpeq_epi8(v, mask1);
__m128i c2 = _mm_cmpeq_epi8(v, mask2);
if (_mm_movemask_epi8(_mm_or_si128(c1, c2)))
goto tail;
{
for (; n > 0; n--, p++)
if (*p=='\n' || *p=='\r') break;
return p;
}
n -= 16; p += 16;
}

// body, AVX2
const __m256i mask3 = _mm256_set1_epi8('\n');
const __m256i mask4 = _mm256_set1_epi8('\r');
for (; n >= 32; n-=32, p+=32)
{
__m256i v = _mm256_load_si256((__m256i const*)p);
__m256i c1 = _mm256_cmpeq_epi8(v, mask3);
__m256i c2 = _mm256_cmpeq_epi8(v, mask4);
if (_mm256_movemask_epi8(_mm256_or_si256(c1, c2)))
goto tail;
{
for (; n > 0; n--, p++)
if (*p=='\n' || *p=='\r') break;
return p;
}
}

#endif
# endif

for (; n >= 16; n-=16, p+=16)
{
Expand All @@ -1875,16 +1881,11 @@ const char *vec_char_find_CRLF(const char *p, size_t n)
break;
}

#ifdef COREARRAY_SIMD_AVX2
tail:
#endif

#endif
*/
// tail
for (; n > 0; n--, p++)
if (*p=='\n' || *p=='\r') break;

return p;
}

Expand Down

0 comments on commit 932ec44

Please # to comment.