diff options
| author | Rémi Verschelde | 2018-05-16 22:59:52 +0200 |
|---|---|---|
| committer | GitHub | 2018-05-16 22:59:52 +0200 |
| commit | 5e96eaf1622070312e42abb232277fca48219739 (patch) | |
| tree | 06e45b7ba0171d276a4f64233ebbd8cfd25d1871 /thirdparty/zstd/common/compiler.h | |
| parent | c31456b82173a7b0daff55237266466cd386eecc (diff) | |
| parent | 5c5918a52dd93489fcb61b84d07d07368151824a (diff) | |
| download | godot-5e96eaf1622070312e42abb232277fca48219739.tar.gz godot-5e96eaf1622070312e42abb232277fca48219739.tar.zst godot-5e96eaf1622070312e42abb232277fca48219739.zip | |
Diffstat (limited to 'thirdparty/zstd/common/compiler.h')
| -rw-r--r-- | thirdparty/zstd/common/compiler.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/thirdparty/zstd/common/compiler.h b/thirdparty/zstd/common/compiler.h index 3a7553c38..e90a3bcde 100644 --- a/thirdparty/zstd/common/compiler.h +++ b/thirdparty/zstd/common/compiler.h @@ -63,6 +63,31 @@ # endif #endif +/* target attribute */ +#ifndef __has_attribute + #define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */ +#endif +#if defined(__GNUC__) +# define TARGET_ATTRIBUTE(target) __attribute__((__target__(target))) +#else +# define TARGET_ATTRIBUTE(target) +#endif + +/* Enable runtime BMI2 dispatch based on the CPU. + * Enabled for clang & gcc >=4.8 on x86 when BMI2 isn't enabled by default. + */ +#ifndef DYNAMIC_BMI2 + #if (defined(__clang__) && __has_attribute(__target__)) \ + || (defined(__GNUC__) \ + && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))) \ + && (defined(__x86_64__) || defined(_M_X86)) \ + && !defined(__BMI2__) + # define DYNAMIC_BMI2 1 + #else + # define DYNAMIC_BMI2 0 + #endif +#endif + /* prefetch */ #if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_I86)) /* _mm_prefetch() is not defined outside of x86/x64 */ # include <mmintrin.h> /* https://msdn.microsoft.com/fr-fr/library/84szxsww(v=vs.90).aspx */ |
