8000 Use non-interleaved map() to make structurals clearer (#304) · JavaScriptExpert/simdjson@7f249cd · GitHub
[go: up one dir, main page]

Skip to content

Commit 7f249cd

Browse files
jkeiserlemire
authored andcommitted
Use non-interleaved map() to make structurals clearer (simdjson#304)
1 parent aef3f4b commit 7f249cd

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/haswell/stage1 8000 _find_marks.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,12 @@ really_inline void find_whitespace_and_structurals(simd_input<ARCHITECTURE> in,
7272

7373
whitespace = MAP_BITMASK( in, _mm256_cmpeq_epi8(_in, _mm256_shuffle_epi8(white_table, _in)) );
7474

75-
auto r1 = MAP_CHUNKS( in, _mm256_add_epi8(struct_offset, _in) );
76-
auto r2 = MAP_CHUNKS( in, _mm256_or_si256(_in, struct_mask) );
77-
auto r3 = MAP_CHUNKS( r1, _mm256_shuffle_epi8(structural_table, _r1) );
78-
structurals = MAP_BITMASK2( r2, r3, _mm256_cmpeq_epi8(_r2, _r3) );
75+
structurals = in.map([&](auto _in) {
76+
const __m256i r1 = _mm256_add_epi8(struct_offset, _in);
77+
const __m256i r2 = _mm256_or_si256(_in, struct_mask);
78+
const __m256i r3 = _mm256_shuffle_epi8(structural_table, r1);
79+
return _mm256_cmpeq_epi8(r2, r3);
80+
}).to_bitmask();
7981

8082
#endif // else SIMDJSON_NAIVE_STRUCTURAL
8183
}

src/westmere/stage1_find_marks.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@ really_inline void find_whitespace_and_structurals(simd_input<ARCHITECTURE> in,
3030

3131
whitespace = MAP_BITMASK( in, _mm_cmpeq_epi8(_in, _mm_shuffle_epi8(white_table, _in)) );
3232

33-
auto r1 = MAP_CHUNKS( in, _mm_add_epi8(struct_offset, _in) );
34-
auto r2 = MAP_CHUNKS( in, _mm_or_si128(_in, struct_mask) );
35-
auto r3 = MAP_CHUNKS( r1, _mm_shuffle_epi8(structural_table, _r1) );
36-
structurals = MAP_BITMASK2( r2, r3, _mm_cmpeq_epi8(_r2, _r3) );
33+
structurals = in.map([&](auto _in) {
34+
const __m128i r1 = _mm_add_epi8(struct_offset, _in);
35+
const __m128i r2 = _mm_or_si128(_in, struct_mask);
36+
const __m128i r3 = _mm_shuffle_epi8(structural_table, r1);
37+
return _mm_cmpeq_epi8(r2, r3);
38+
}).to_bitmask();
3739
}
3840

3941
#include "generic/stage1_find_marks_flatten.h"

0 commit comments

Comments
 (0)
0