mirror of
https://github.com/simdjson/simdjson
synced 2026-06-08 17:27:07 +00:00
f46a0f64f2
* Initial PPC64 support * Add travis CI * Fix outdated cmake version for travis * Fix indendtation * Try another workaround for outdated cmake in travis * Try beta cmake * Add dash before beta * Use builtin snaps * Use cmake as rocksdb * Test cmake on bionic * Remove unnecessary things from travis * Remove unnecessary things from travis * Another try of compiler install * Add all major compilers * Add all major compilers * Add all major compilers * Tweak travis a bit * Typo * More robust travis * Typos typos typos * Add fewer compilers, add non specific build for clang and gcc, should be the final config * CMAKE_FLAGS is in incorrect place * Remove default implementation * Limit build thread number * Fall back prefix_xor to a usual implementation, no performance boost is noticed * Test for power9 as it is the main architecture for OpenPOWER right now * Add to documentation to build with power9 as the implementation is compatible but compiler optimizations is not * Replace ARM with PPC in the comment
43 lines
1.4 KiB
C++
43 lines
1.4 KiB
C++
#ifndef SIMDJSON_PPC64_BITMASK_H
|
|
#define SIMDJSON_PPC64_BITMASK_H
|
|
|
|
namespace simdjson {
|
|
namespace SIMDJSON_IMPLEMENTATION {
|
|
namespace {
|
|
|
|
//
|
|
// Perform a "cumulative bitwise xor," flipping bits each time a 1 is
|
|
// encountered.
|
|
//
|
|
// For example, prefix_xor(00100100) == 00011100
|
|
//
|
|
simdjson_really_inline uint64_t prefix_xor(uint64_t bitmask) {
|
|
// You can use the version below, however gcc sometimes miscompiles
|
|
// vec_pmsum_be, it happens somewhere around between 8 and 9th version.
|
|
// The performance boost was not noticeable, falling back to a usual
|
|
// implementation.
|
|
// __vector unsigned long long all_ones = {~0ull, ~0ull};
|
|
// __vector unsigned long long mask = {bitmask, 0};
|
|
// // Clang and GCC return different values for pmsum for ull so cast it to one.
|
|
// // Generally it is not specified by ALTIVEC ISA what is returned by
|
|
// // vec_pmsum_be.
|
|
// #if defined(__LITTLE_ENDIAN__)
|
|
// return (uint64_t)(((__vector unsigned long long)vec_pmsum_be(all_ones, mask))[0]);
|
|
// #else
|
|
// return (uint64_t)(((__vector unsigned long long)vec_pmsum_be(all_ones, mask))[1]);
|
|
// #endif
|
|
bitmask ^= bitmask << 1;
|
|
bitmask ^= bitmask << 2;
|
|
bitmask ^= bitmask << 4;
|
|
bitmask ^= bitmask << 8;
|
|
bitmask ^= bitmask << 16;
|
|
bitmask ^= bitmask << 32;
|
|
return bitmask;
|
|
}
|
|
|
|
} // unnamed namespace
|
|
} // namespace SIMDJSON_IMPLEMENTATION
|
|
} // namespace simdjson
|
|
|
|
#endif
|