mirror of
https://github.com/simdjson/simdjson
synced 2026-06-08 17:27:07 +00:00
57 lines
2.2 KiB
C
57 lines
2.2 KiB
C
#ifndef SIMDJSON_IMPLEMENTATIONS_H
|
|
#define SIMDJSON_IMPLEMENTATIONS_H
|
|
|
|
#include "simdjson/implementation-base.h"
|
|
|
|
//
|
|
// First, figure out which implementations can be run. Doing it here makes it so we don't have to worry about the order
|
|
// in which we include them.
|
|
//
|
|
|
|
#ifndef SIMDJSON_IMPLEMENTATION_ARM64
|
|
#define SIMDJSON_IMPLEMENTATION_ARM64 (SIMDJSON_IS_ARM64)
|
|
#endif
|
|
#define SIMDJSON_CAN_ALWAYS_RUN_ARM64 SIMDJSON_IMPLEMENTATION_ARM64 && SIMDJSON_IS_ARM64
|
|
|
|
// Default Haswell to on if this is x86-64. Even if we're not compiled for it, it could be selected
|
|
// at runtime.
|
|
#ifndef SIMDJSON_IMPLEMENTATION_HASWELL
|
|
#define SIMDJSON_IMPLEMENTATION_HASWELL (SIMDJSON_IS_X86_64)
|
|
#endif
|
|
// To see why (__BMI__) && (__PCLMUL__) && (__LZCNT__) are not part of this next line, see
|
|
// https://github.com/simdjson/simdjson/issues/1247
|
|
#define SIMDJSON_CAN_ALWAYS_RUN_HASWELL ((SIMDJSON_IMPLEMENTATION_HASWELL) && (SIMDJSON_IS_X86_64) && (__AVX2__))
|
|
|
|
// Default Westmere to on if this is x86-64, unless we'll always select Haswell.
|
|
#ifndef SIMDJSON_IMPLEMENTATION_WESTMERE
|
|
#define SIMDJSON_IMPLEMENTATION_WESTMERE (SIMDJSON_IS_X86_64 && !SIMDJSON_REQUIRES_HASWELL)
|
|
#endif
|
|
#define SIMDJSON_CAN_ALWAYS_RUN_WESTMERE (SIMDJSON_IMPLEMENTATION_WESTMERE && SIMDJSON_IS_X86_64 && __SSE4_2__ && __PCLMUL__)
|
|
|
|
#ifndef SIMDJSON_IMPLEMENTATION_PPC64
|
|
#define SIMDJSON_IMPLEMENTATION_PPC64 (SIMDJSON_IS_PPC64)
|
|
#endif
|
|
#define SIMDJSON_CAN_ALWAYS_RUN_PPC64 SIMDJSON_IMPLEMENTATION_PPC64 && SIMDJSON_IS_PPC64
|
|
|
|
// Default Fallback to on unless a builtin implementation has already been selected.
|
|
#ifndef SIMDJSON_IMPLEMENTATION_FALLBACK
|
|
#define SIMDJSON_IMPLEMENTATION_FALLBACK 1 // (!SIMDJSON_CAN_ALWAYS_RUN_ARM64 && !SIMDJSON_CAN_ALWAYS_RUN_HASWELL && !SIMDJSON_CAN_ALWAYS_RUN_WESTMERE && !SIMDJSON_CAN_ALWAYS_RUN_PPC64)
|
|
#endif
|
|
#define SIMDJSON_CAN_ALWAYS_RUN_FALLBACK SIMDJSON_IMPLEMENTATION_FALLBACK
|
|
|
|
SIMDJSON_PUSH_DISABLE_WARNINGS
|
|
SIMDJSON_DISABLE_UNDESIRED_WARNINGS
|
|
|
|
// Implementations
|
|
#include "simdjson/arm64.h"
|
|
#include "simdjson/fallback.h"
|
|
#include "simdjson/haswell.h"
|
|
#include "simdjson/ppc64.h"
|
|
#include "simdjson/westmere.h"
|
|
|
|
// Builtin implementation
|
|
#include "simdjson/builtin.h"
|
|
|
|
SIMDJSON_POP_DISABLE_WARNINGS
|
|
|
|
#endif // SIMDJSON_IMPLEMENTATIONS_H
|