mirror of
https://github.com/official-stockfish/Stockfish.git
synced 2026-07-23 05:07:14 +00:00
port get_changed_pieces to ARM NEON
passed STC: LLR: 2.94 (-2.94,2.94) <0.00,2.00> Total: 71968 W: 18833 L: 18489 D: 34646 Ptnml(0-2): 192, 7310, 20643, 7640, 199 https://tests.stockfishchess.org/tests/view/69509e5c572093c1986d7a0a closes https://github.com/official-stockfish/Stockfish/pull/6512 No functional change
This commit is contained in:
committed by
Joost VandeVondele
parent
ced9f69834
commit
aeb3bf33a9
@@ -645,6 +645,18 @@ Bitboard get_changed_pieces(const std::array<Piece, SQUARE_NB>& oldPieces,
|
||||
sameBB |= static_cast<Bitboard>(equalMask) << i;
|
||||
}
|
||||
return ~sameBB;
|
||||
#elif defined(USE_NEON)
|
||||
uint8x16x4_t old_v = vld4q_u8(reinterpret_cast<const uint8_t*>(oldPieces.data()));
|
||||
uint8x16x4_t new_v = vld4q_u8(reinterpret_cast<const uint8_t*>(newPieces.data()));
|
||||
auto cmp = [=](const int i) { return vceqq_u8(old_v.val[i], new_v.val[i]); };
|
||||
|
||||
uint8x16_t cmp0_1 = vsriq_n_u8(cmp(1), cmp(0), 1);
|
||||
uint8x16_t cmp2_3 = vsriq_n_u8(cmp(3), cmp(2), 1);
|
||||
uint8x16_t merged = vsriq_n_u8(cmp2_3, cmp0_1, 2);
|
||||
merged = vsriq_n_u8(merged, merged, 4);
|
||||
uint8x8_t sameBB = vshrn_n_u16(vreinterpretq_u16_u8(merged), 4);
|
||||
|
||||
return ~vget_lane_u64(vreinterpret_u64_u8(sameBB), 0);
|
||||
#else
|
||||
Bitboard changed = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user