Don't include target flags if the compiler already has them on
This commit is contained in:
parent
f51d50399c
commit
633161fe86
|
@ -1,28 +1,7 @@
|
||||||
#ifndef SIMDJSON_BUILTIN_H
|
#ifndef SIMDJSON_BUILTIN_H
|
||||||
#define SIMDJSON_BUILTIN_H
|
#define SIMDJSON_BUILTIN_H
|
||||||
|
|
||||||
#include "simdjson/implementation-base.h"
|
#include "simdjson/implementations.h"
|
||||||
|
|
||||||
#ifndef SIMDJSON_BUILTIN_IMPLEMENTATION
|
|
||||||
#if SIMDJSON_CAN_ALWAYS_RUN_HASWELL
|
|
||||||
#define SIMDJSON_BUILTIN_IMPLEMENTATION haswell
|
|
||||||
#include "simdjson/haswell.h"
|
|
||||||
#elif SIMDJSON_CAN_ALWAYS_RUN_WESTMERE
|
|
||||||
#define SIMDJSON_BUILTIN_IMPLEMENTATION westmere
|
|
||||||
#include "simdjson/westmere.h"
|
|
||||||
#elif SIMDJSON_CAN_ALWAYS_RUN_ARM64
|
|
||||||
#define SIMDJSON_BUILTIN_IMPLEMENTATION arm64
|
|
||||||
#include "simdjson/arm64.h"
|
|
||||||
#elif SIMDJSON_CAN_ALWAYS_RUN_PPC64
|
|
||||||
#define SIMDJSON_BUILTIN_IMPLEMENTATION ppc64
|
|
||||||
#include "simdjson/ppc64.h"
|
|
||||||
#elif SIMDJSON_CAN_ALWAYS_RUN_FALLBACK
|
|
||||||
#define SIMDJSON_BUILTIN_IMPLEMENTATION fallback
|
|
||||||
#include "simdjson/fallback.h"
|
|
||||||
#else
|
|
||||||
#error "All possible implementations (including fallback) have been disabled! simdjson will not run."
|
|
||||||
#endif
|
|
||||||
#endif // SIMDJSON_BUILTIN_IMPLEMENTATION
|
|
||||||
|
|
||||||
namespace simdjson {
|
namespace simdjson {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,7 +5,13 @@
|
||||||
|
|
||||||
#if SIMDJSON_IMPLEMENTATION_HASWELL
|
#if SIMDJSON_IMPLEMENTATION_HASWELL
|
||||||
|
|
||||||
|
#ifndef SIMDJSON_CAN_ALWAYS_RUN_HASWELL
|
||||||
#define SIMDJSON_TARGET_HASWELL SIMDJSON_TARGET_REGION("avx2,bmi,pclmul,lzcnt")
|
#define SIMDJSON_TARGET_HASWELL SIMDJSON_TARGET_REGION("avx2,bmi,pclmul,lzcnt")
|
||||||
|
#define SIMDJSON_UNTARGET_HASWELL SIMDJSON_UNTARGET_REGION
|
||||||
|
#else
|
||||||
|
#define SIMDJSON_TARGET_HASWELL
|
||||||
|
#define SIMDJSON_UNTARGET_HASWELL
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace simdjson {
|
namespace simdjson {
|
||||||
/**
|
/**
|
||||||
|
@ -16,7 +22,7 @@ namespace haswell {
|
||||||
} // namespace simdjson
|
} // namespace simdjson
|
||||||
|
|
||||||
//
|
//
|
||||||
// These two need to be included outside SIMDJSON_TARGET_REGION
|
// These two need to be included outside SIMDJSON_TARGET_HASWELL
|
||||||
//
|
//
|
||||||
#include "simdjson/haswell/implementation.h"
|
#include "simdjson/haswell/implementation.h"
|
||||||
#include "simdjson/haswell/intrinsics.h"
|
#include "simdjson/haswell/intrinsics.h"
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
SIMDJSON_UNTARGET_REGION
|
SIMDJSON_UNTARGET_HASWELL
|
||||||
#undef SIMDJSON_IMPLEMENTATION
|
#undef SIMDJSON_IMPLEMENTATION
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "simdjson/implementation.h"
|
#include "simdjson/implementation.h"
|
||||||
|
|
||||||
// The constructor may be executed on any host, so we take care not to use SIMDJSON_TARGET_REGION
|
// The constructor may be executed on any host, so we take care not to use SIMDJSON_TARGET_HASWELL
|
||||||
namespace simdjson {
|
namespace simdjson {
|
||||||
namespace haswell {
|
namespace haswell {
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ SIMDJSON_TARGET_HASWELL
|
||||||
static simdjson_really_inline uint64_t _blsr_u64(uint64_t n) {
|
static simdjson_really_inline uint64_t _blsr_u64(uint64_t n) {
|
||||||
return (n - 1) & n;
|
return (n - 1) & n;
|
||||||
}
|
}
|
||||||
SIMDJSON_UNTARGET_REGION
|
SIMDJSON_UNTARGET_HASWELL
|
||||||
#endif // _blsr_u64
|
#endif // _blsr_u64
|
||||||
#endif // SIMDJSON_CLANG_VISUAL_STUDIO
|
#endif // SIMDJSON_CLANG_VISUAL_STUDIO
|
||||||
|
|
||||||
|
|
|
@ -51,4 +51,21 @@
|
||||||
#endif
|
#endif
|
||||||
#define SIMDJSON_CAN_ALWAYS_RUN_FALLBACK SIMDJSON_IMPLEMENTATION_FALLBACK
|
#define SIMDJSON_CAN_ALWAYS_RUN_FALLBACK SIMDJSON_IMPLEMENTATION_FALLBACK
|
||||||
|
|
||||||
|
// Determine the best builtin implementation
|
||||||
|
#ifndef SIMDJSON_BUILTIN_IMPLEMENTATION
|
||||||
|
#if SIMDJSON_CAN_ALWAYS_RUN_HASWELL
|
||||||
|
#define SIMDJSON_BUILTIN_IMPLEMENTATION haswell
|
||||||
|
#elif SIMDJSON_CAN_ALWAYS_RUN_WESTMERE
|
||||||
|
#define SIMDJSON_BUILTIN_IMPLEMENTATION westmere
|
||||||
|
#elif SIMDJSON_CAN_ALWAYS_RUN_ARM64
|
||||||
|
#define SIMDJSON_BUILTIN_IMPLEMENTATION arm64
|
||||||
|
#elif SIMDJSON_CAN_ALWAYS_RUN_PPC64
|
||||||
|
#define SIMDJSON_BUILTIN_IMPLEMENTATION ppc64
|
||||||
|
#elif SIMDJSON_CAN_ALWAYS_RUN_FALLBACK
|
||||||
|
#define SIMDJSON_BUILTIN_IMPLEMENTATION fallback
|
||||||
|
#else
|
||||||
|
#error "All possible implementations (including fallback) have been disabled! simdjson will not run."
|
||||||
|
#endif
|
||||||
|
#endif // SIMDJSON_BUILTIN_IMPLEMENTATION
|
||||||
|
|
||||||
#endif // SIMDJSON_IMPLEMENTATION_BASE_H
|
#endif // SIMDJSON_IMPLEMENTATION_BASE_H
|
|
@ -5,7 +5,13 @@
|
||||||
|
|
||||||
#if SIMDJSON_IMPLEMENTATION_WESTMERE
|
#if SIMDJSON_IMPLEMENTATION_WESTMERE
|
||||||
|
|
||||||
|
#ifndef SIMDJSON_CAN_ALWAYS_RUN_WESTMERE
|
||||||
#define SIMDJSON_TARGET_WESTMERE SIMDJSON_TARGET_REGION("sse4.2,pclmul")
|
#define SIMDJSON_TARGET_WESTMERE SIMDJSON_TARGET_REGION("sse4.2,pclmul")
|
||||||
|
#define SIMDJSON_UNTARGET_WESTMERE SIMDJSON_UNTARGET_REGION
|
||||||
|
#else
|
||||||
|
#define SIMDJSON_TARGET_WESTMERE
|
||||||
|
#define SIMDJSON_UNTARGET_WESTMERE
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace simdjson {
|
namespace simdjson {
|
||||||
/**
|
/**
|
||||||
|
@ -16,7 +22,7 @@ namespace westmere {
|
||||||
} // namespace simdjson
|
} // namespace simdjson
|
||||||
|
|
||||||
//
|
//
|
||||||
// These two need to be included outside SIMDJSON_TARGET_REGION
|
// These two need to be included outside SIMDJSON_TARGET_WESTMERE
|
||||||
//
|
//
|
||||||
#include "simdjson/westmere/implementation.h"
|
#include "simdjson/westmere/implementation.h"
|
||||||
#include "simdjson/westmere/intrinsics.h"
|
#include "simdjson/westmere/intrinsics.h"
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
SIMDJSON_UNTARGET_REGION
|
SIMDJSON_UNTARGET_WESTMERE
|
||||||
#undef SIMDJSON_IMPLEMENTATION
|
#undef SIMDJSON_IMPLEMENTATION
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "simdjson/implementation.h"
|
#include "simdjson/implementation.h"
|
||||||
|
|
||||||
// The constructor may be executed on any host, so we take care not to use SIMDJSON_TARGET_REGION
|
// The constructor may be executed on any host, so we take care not to use SIMDJSON_TARGET_WESTMERE
|
||||||
namespace simdjson {
|
namespace simdjson {
|
||||||
namespace westmere {
|
namespace westmere {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue