Skip to content

Commit f02babe

Browse files
committed
Adding analysis by @sebpop from simdjson#391 (comment)
1 parent fc6133b commit f02babe

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/arm64/bitmask.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,19 @@ namespace simdjson::arm64 {
1616
// For example, prefix_xor(00100100) == 00011100
1717
//
1818
really_inline uint64_t prefix_xor(uint64_t bitmask) {
19-
//
19+
/////////////
2020
// We could do this with PMULL, but it is apparently slow.
2121
//
2222
//#ifdef __ARM_FEATURE_CRYPTO // some ARM processors lack this extension
2323
//return vmull_p64(-1ULL, bitmask);
2424
//#else
25+
// Analysis by @sebpop:
26+
// When diffing the assembly for src/stage1_find_marks.cpp I see that the eors are all spread out
27+
// in between other vector code, so effectively the extra cycles of the sequence do not matter
28+
// because the GPR units are idle otherwise and the critical path is on the FP side.
29+
// Also the PMULL requires two extra fmovs: GPR->FP (3 cycles in N1, 5 cycles in A72 )
30+
// and FP->GPR (2 cycles on N1 and 5 cycles on A72.)
31+
///////////
2532
bitmask ^= bitmask << 1;
2633
bitmask ^= bitmask << 2;
2734
bitmask ^= bitmask << 4;

0 commit comments

Comments
 (0)