mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-11-18 18:20:35 +03:00
remove Windows/ICC support
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
|
||||
#include "ue2common.h"
|
||||
|
||||
#if (defined(ARCH_IA32) || defined(ARCH_X86_64)) && !defined(_WIN32) && !defined(CPUID_H_)
|
||||
#if (defined(ARCH_IA32) || defined(ARCH_X86_64)) && !defined(CPUID_H_)
|
||||
#include <cpuid.h>
|
||||
/* system header doesn't have a header guard */
|
||||
#define CPUID_H_
|
||||
|
||||
@@ -42,64 +42,23 @@
|
||||
|
||||
static really_inline
|
||||
u32 clz32_impl(u32 x) {
|
||||
#if defined(_WIN32)
|
||||
unsigned long r;
|
||||
_BitScanReverse(&r, x);
|
||||
return 31 - r;
|
||||
#else
|
||||
return clz32_impl_c(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
static really_inline
|
||||
u32 clz64_impl(u64a x) {
|
||||
#if defined(_WIN64)
|
||||
unsigned long r;
|
||||
_BitScanReverse64(&r, x);
|
||||
return 63 - r;
|
||||
#elif defined(_WIN32)
|
||||
unsigned long x1 = (u32)x;
|
||||
unsigned long x2 = (u32)(x >> 32);
|
||||
unsigned long r;
|
||||
if (x2) {
|
||||
_BitScanReverse(&r, x2);
|
||||
return (u32)(31 - r);
|
||||
}
|
||||
_BitScanReverse(&r, (u32)x1);
|
||||
return (u32)(63 - r);
|
||||
#else
|
||||
return clz64_impl_c(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
// CTZ (count trailing zero) implementations.
|
||||
static really_inline
|
||||
u32 ctz32_impl(u32 x) {
|
||||
#if defined(_WIN32)
|
||||
unsigned long r;
|
||||
_BitScanForward(&r, x);
|
||||
return r;
|
||||
#else
|
||||
return ctz32_impl_c(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
static really_inline
|
||||
u32 ctz64_impl(u64a x) {
|
||||
#if defined(_WIN64)
|
||||
unsigned long r;
|
||||
_BitScanForward64(&r, x);
|
||||
return r;
|
||||
#elif defined(_WIN32)
|
||||
unsigned long r;
|
||||
if (_BitScanForward(&r, (u32)x)) {
|
||||
return (u32)r;
|
||||
}
|
||||
_BitScanForward(&r, x >> 32);
|
||||
return (u32)(r + 32);
|
||||
#else
|
||||
return ctz64_impl_c(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
static really_inline
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "hs_internal.h"
|
||||
#include "util/arch.h"
|
||||
|
||||
#if !defined(_WIN32) && !defined(CPUID_H_)
|
||||
#if !defined(CPUID_H_)
|
||||
#include <cpuid.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "ue2common.h"
|
||||
#include "util/arch/common/cpuid_flags.h"
|
||||
|
||||
#if !defined(_WIN32) && !defined(CPUID_H_)
|
||||
#if !defined(CPUID_H_)
|
||||
#include <cpuid.h>
|
||||
/* system header doesn't have a header guard */
|
||||
#define CPUID_H_
|
||||
@@ -46,16 +46,7 @@ extern "C"
|
||||
static inline
|
||||
void cpuid(unsigned int op, unsigned int leaf, unsigned int *eax,
|
||||
unsigned int *ebx, unsigned int *ecx, unsigned int *edx) {
|
||||
#ifndef _WIN32
|
||||
__cpuid_count(op, leaf, *eax, *ebx, *ecx, *edx);
|
||||
#else
|
||||
int a[4];
|
||||
__cpuidex(a, op, leaf);
|
||||
*eax = a[0];
|
||||
*ebx = a[1];
|
||||
*ecx = a[2];
|
||||
*edx = a[3];
|
||||
#endif
|
||||
}
|
||||
|
||||
// ECX
|
||||
@@ -95,9 +86,6 @@ void cpuid(unsigned int op, unsigned int leaf, unsigned int *eax,
|
||||
|
||||
static inline
|
||||
u64a xgetbv(u32 op) {
|
||||
#if defined(_WIN32) || defined(__INTEL_COMPILER)
|
||||
return _xgetbv(op);
|
||||
#else
|
||||
u32 a, d;
|
||||
__asm__ volatile (
|
||||
"xgetbv\n"
|
||||
@@ -105,14 +93,10 @@ u64a xgetbv(u32 op) {
|
||||
"=d"(d)
|
||||
: "c"(op));
|
||||
return ((u64a)d << 32) + a;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline
|
||||
int check_avx2(void) {
|
||||
#if defined(__INTEL_COMPILER)
|
||||
return _may_i_use_cpu_feature(_FEATURE_AVX2);
|
||||
#else
|
||||
unsigned int eax, ebx, ecx, edx;
|
||||
|
||||
cpuid(1, 0, &eax, &ebx, &ecx, &edx);
|
||||
@@ -141,7 +125,6 @@ int check_avx2(void) {
|
||||
}
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline
|
||||
@@ -149,9 +132,6 @@ int check_avx512(void) {
|
||||
/*
|
||||
* For our purposes, having avx512 really means "can we use AVX512BW?"
|
||||
*/
|
||||
#if defined(__INTEL_COMPILER)
|
||||
return _may_i_use_cpu_feature(_FEATURE_AVX512BW | _FEATURE_AVX512VL);
|
||||
#else
|
||||
unsigned int eax, ebx, ecx, edx;
|
||||
|
||||
cpuid(1, 0, &eax, &ebx, &ecx, &edx);
|
||||
@@ -184,14 +164,10 @@ int check_avx512(void) {
|
||||
}
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline
|
||||
int check_avx512vbmi(void) {
|
||||
#if defined(__INTEL_COMPILER)
|
||||
return _may_i_use_cpu_feature(_FEATURE_AVX512VBMI);
|
||||
#else
|
||||
unsigned int eax, ebx, ecx, edx;
|
||||
|
||||
cpuid(1, 0, &eax, &ebx, &ecx, &edx);
|
||||
@@ -229,7 +205,6 @@ int check_avx512vbmi(void) {
|
||||
}
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline
|
||||
|
||||
@@ -38,12 +38,12 @@
|
||||
#define HAVE_SIMD_128_BITS
|
||||
#endif
|
||||
|
||||
#if defined(__SSE4_1__) || (defined(_WIN32) && defined(__AVX__))
|
||||
#if defined(__SSE4_1__) || defined(__AVX__)
|
||||
#define HAVE_SSE41
|
||||
#define HAVE_SIMD_128_BITS
|
||||
#endif
|
||||
|
||||
#if defined(__SSE4_2__) || (defined(_WIN32) && defined(__AVX__))
|
||||
#if defined(__SSE4_2__) || defined(__AVX__)
|
||||
#define HAVE_SSE42
|
||||
#define HAVE_SIMD_128_BITS
|
||||
#endif
|
||||
@@ -78,30 +78,16 @@
|
||||
#define VECTORSIZE 16
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ICC and MSVC don't break out POPCNT or BMI/2 as separate pre-def macros
|
||||
*/
|
||||
#if defined(__POPCNT__) || \
|
||||
(defined(__INTEL_COMPILER) && defined(__SSE4_2__)) || \
|
||||
(defined(_WIN32) && defined(__AVX__))
|
||||
#if defined(__POPCNT__)
|
||||
#define HAVE_POPCOUNT_INSTR
|
||||
#endif
|
||||
|
||||
#if defined(__BMI__) || (defined(_WIN32) && defined(__AVX2__)) || \
|
||||
(defined(__INTEL_COMPILER) && defined(__AVX2__))
|
||||
#if defined(__BMI__)
|
||||
#define HAVE_BMI
|
||||
#endif
|
||||
|
||||
#if defined(__BMI2__) || (defined(_WIN32) && defined(__AVX2__)) || \
|
||||
(defined(__INTEL_COMPILER) && defined(__AVX2__))
|
||||
#if defined(__BMI2__)
|
||||
#define HAVE_BMI2
|
||||
#endif
|
||||
|
||||
/*
|
||||
* MSVC uses a different form of inline asm
|
||||
*/
|
||||
#if defined(_WIN32) && defined(_MSC_VER)
|
||||
#define NO_ASM
|
||||
#endif
|
||||
|
||||
#endif // UTIL_ARCH_X86_H_
|
||||
|
||||
Reference in New Issue
Block a user