Delete wuffs_base__cpu_arch__x86_64__capabilities

This commit is contained in:
Nigel Tao committed 2021-02-18 13:30:28 +11:00
1 parent c8be16af3e
commit bbc720c261
3 files changed
+1 -89

No files matched your search

-43
View File
@@ -108,49 +108,6 @@ wuffs_base__cpu_arch__have_arm_neon() {
#endif // defined(WUFFS_BASE__CPU_ARCH__ARM_NEON)
}
// WUFFS_BASE__CPU_ARCH__X86_64__ETC are bits returned by
// wuffs_base__cpu_arch__x86_64__capabilities.
// - "SSE42" means all of SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, PCLMUL and
// POPCNT.
// - "AVX2" means all of AVX and AVX2.
// - "AVX512ETC" is reserved, pending need. Note that AVX-512 consists of
// multiple extensions that may be implemented independently.
#define WUFFS_BASE__CPU_ARCH__X86_64__SSE42 0x01
#define WUFFS_BASE__CPU_ARCH__X86_64__AVX2 0x02
static inline uint32_t //
wuffs_base__cpu_arch__x86_64__capabilities() {
#if defined(WUFFS_BASE__CPU_ARCH__X86_64)
uint32_t ret = 0;
unsigned int eax1 = 0;
unsigned int ebx1 = 0;
unsigned int ecx1 = 0;
unsigned int edx1 = 0;
if (__get_cpuid(1, &eax1, &ebx1, &ecx1, &edx1)) {
const unsigned int sse42_ecx1 = bit_PCLMUL | bit_POPCNT | bit_SSE4_2;
if ((ecx1 & sse42_ecx1) == sse42_ecx1) {
ret |= WUFFS_BASE__CPU_ARCH__X86_64__SSE42;
}
}
unsigned int eax7 = 0;
unsigned int ebx7 = 0;
unsigned int ecx7 = 0;
unsigned int edx7 = 0;
if (__get_cpuid_count(7, 0, &eax7, &ebx7, &ecx7, &edx7)) {
const unsigned int avx256_ebx7 = bit_AVX2;
if ((ebx7 & avx256_ebx7) == avx256_ebx7) {
ret |= WUFFS_BASE__CPU_ARCH__X86_64__AVX2;
}
}
return ret;
#else
return 0;
#endif // defined(WUFFS_BASE__CPU_ARCH__X86_64)
}
static inline bool //
wuffs_base__cpu_arch__have_sse42() {
#if defined(WUFFS_BASE__CPU_ARCH__X86_64)
+1 -3
View File
@@ -59,9 +59,7 @@ const BaseFundamentalPublicH = "" +
"" +
"// --------\n\n// Define WUFFS_CONFIG__STATIC_FUNCTIONS to make all of Wuffs' functions have\n// static storage. The motivation is discussed in the \"ALLOW STATIC\n// IMPLEMENTATION\" section of\n// https://raw.githubusercontent.com/nothings/stb/master/docs/stb_howto.txt\n#if defined(WUFFS_CONFIG__STATIC_FUNCTIONS)\n#define WUFFS_BASE__MAYBE_STATIC static\n#else\n#define WUFFS_BASE__MAYBE_STATIC\n#endif // defined(WUFFS_CONFIG__STATIC_FUNCTIONS)\n\n" +
"" +
"// ---------------- CPU Architecture\n\nstatic inline bool //\nwuffs_base__cpu_arch__have_arm_crc32() {\n#if defined(WUFFS_BASE__CPU_ARCH__ARM_CRC32)\n return true;\n#else\n return false;\n#endif // defined(WUFFS_BASE__CPU_ARCH__ARM_CRC32)\n}\n\nstatic inline bool //\nwuffs_base__cpu_arch__have_arm_neon() {\n#if defined(WUFFS_BASE__CPU_ARCH__ARM_NEON)\n return true;\n#else\n return false;\n#endif // defined(WUFFS_BASE__CPU_ARCH__ARM_NEON)\n}\n\n// WUFFS_BASE__CPU_ARCH__X86_64__ETC are bits returned by\n// wuffs_base__cpu_arch__x86_64__capabilities.\n// - \"SSE42\" means all of SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, PCLMUL and\n// POPCNT.\n// - \"AVX2\" means all of AVX and AVX2.\n// - \"AVX512ETC\" is reserved, pending need. Note that AVX-512 consists of\n// multiple extensions that may be implemented independently.\n#define WUFFS_BASE__CPU_ARCH__X86_64__SSE42 0x01\n#define WUFFS_BASE__CPU_ARCH__X86_64__AVX2 0x02\n\nstatic inline uint32_t //\nwuffs_base__cpu_arch__x86_64__capabilities() {\n#if defined(WUFFS_BASE__CPU_ARCH__X86_64)\n" +
" uint32_t ret = 0;\n\n unsigned int eax1 = 0;\n unsigned int ebx1 = 0;\n unsigned int ecx1 = 0;\n unsigned int edx1 = 0;\n if (__get_cpuid(1, &eax1, &ebx1, &ecx1, &edx1)) {\n const unsigned int sse42_ecx1 = bit_PCLMUL | bit_POPCNT | bit_SSE4_2;\n if ((ecx1 & sse42_ecx1) == sse42_ecx1) {\n ret |= WUFFS_BASE__CPU_ARCH__X86_64__SSE42;\n }\n }\n\n unsigned int eax7 = 0;\n unsigned int ebx7 = 0;\n unsigned int ecx7 = 0;\n unsigned int edx7 = 0;\n if (__get_cpuid_count(7, 0, &eax7, &ebx7, &ecx7, &edx7)) {\n const unsigned int avx256_ebx7 = bit_AVX2;\n if ((ebx7 & avx256_ebx7) == avx256_ebx7) {\n ret |= WUFFS_BASE__CPU_ARCH__X86_64__AVX2;\n }\n }\n\n return ret;\n#else\n return 0;\n#endif // defined(WUFFS_BASE__CPU_ARCH__X86_64)\n}\n\nstatic inline bool //\nwuffs_base__cpu_arch__have_sse42() {\n#if defined(WUFFS_BASE__CPU_ARCH__X86_64)\n unsigned int eax1 = 0;\n unsigned int ebx1 = 0;\n unsigned int ecx1 = 0;\n unsigned int edx1 = 0;\n if (__get_cpuid(1, &eax1, &ebx1, &ecx1, &edx1)) {\n const unsigned" +
" int sse42_ecx1 = bit_PCLMUL | bit_POPCNT | bit_SSE4_2;\n return (ecx1 & sse42_ecx1) == sse42_ecx1;\n }\n#endif // defined(WUFFS_BASE__CPU_ARCH__X86_64)\n return false;\n}\n\n" +
"// ---------------- CPU Architecture\n\nstatic inline bool //\nwuffs_base__cpu_arch__have_arm_crc32() {\n#if defined(WUFFS_BASE__CPU_ARCH__ARM_CRC32)\n return true;\n#else\n return false;\n#endif // defined(WUFFS_BASE__CPU_ARCH__ARM_CRC32)\n}\n\nstatic inline bool //\nwuffs_base__cpu_arch__have_arm_neon() {\n#if defined(WUFFS_BASE__CPU_ARCH__ARM_NEON)\n return true;\n#else\n return false;\n#endif // defined(WUFFS_BASE__CPU_ARCH__ARM_NEON)\n}\n\nstatic inline bool //\nwuffs_base__cpu_arch__have_sse42() {\n#if defined(WUFFS_BASE__CPU_ARCH__X86_64)\n unsigned int eax1 = 0;\n unsigned int ebx1 = 0;\n unsigned int ecx1 = 0;\n unsigned int edx1 = 0;\n if (__get_cpuid(1, &eax1, &ebx1, &ecx1, &edx1)) {\n const unsigned int sse42_ecx1 = bit_PCLMUL | bit_POPCNT | bit_SSE4_2;\n return (ecx1 & sse42_ecx1) == sse42_ecx1;\n }\n#endif // defined(WUFFS_BASE__CPU_ARCH__X86_64)\n return false;\n}\n\n" +
"" +
"// ---------------- Fundamentals\n\n// Wuffs assumes that:\n// - converting a uint32_t to a size_t will never overflow.\n// - converting a size_t to a uint64_t will never overflow.\n#ifdef __WORDSIZE\n#if (__WORDSIZE != 32) && (__WORDSIZE != 64)\n#error \"Wuffs requires a word size of either 32 or 64 bits\"\n#endif\n#endif\n\n#if defined(__clang__)\n#define WUFFS_BASE__POTENTIALLY_UNUSED_FIELD __attribute__((unused))\n#else\n#define WUFFS_BASE__POTENTIALLY_UNUSED_FIELD\n#endif\n\n// Clang also defines \"__GNUC__\".\n#if defined(__GNUC__)\n#define WUFFS_BASE__POTENTIALLY_UNUSED __attribute__((unused))\n#define WUFFS_BASE__WARN_UNUSED_RESULT __attribute__((warn_unused_result))\n#else\n#define WUFFS_BASE__POTENTIALLY_UNUSED\n#define WUFFS_BASE__WARN_UNUSED_RESULT\n#endif\n\n" +
"" +
-43
View File
@@ -142,49 +142,6 @@ wuffs_base__cpu_arch__have_arm_neon() {
#endif // defined(WUFFS_BASE__CPU_ARCH__ARM_NEON)
}
// WUFFS_BASE__CPU_ARCH__X86_64__ETC are bits returned by
// wuffs_base__cpu_arch__x86_64__capabilities.
// - "SSE42" means all of SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, PCLMUL and
// POPCNT.
// - "AVX2" means all of AVX and AVX2.
// - "AVX512ETC" is reserved, pending need. Note that AVX-512 consists of
// multiple extensions that may be implemented independently.
#define WUFFS_BASE__CPU_ARCH__X86_64__SSE42 0x01
#define WUFFS_BASE__CPU_ARCH__X86_64__AVX2 0x02
static inline uint32_t //
wuffs_base__cpu_arch__x86_64__capabilities() {
#if defined(WUFFS_BASE__CPU_ARCH__X86_64)
uint32_t ret = 0;
unsigned int eax1 = 0;
unsigned int ebx1 = 0;
unsigned int ecx1 = 0;
unsigned int edx1 = 0;
if (__get_cpuid(1, &eax1, &ebx1, &ecx1, &edx1)) {
const unsigned int sse42_ecx1 = bit_PCLMUL | bit_POPCNT | bit_SSE4_2;
if ((ecx1 & sse42_ecx1) == sse42_ecx1) {
ret |= WUFFS_BASE__CPU_ARCH__X86_64__SSE42;
}
}
unsigned int eax7 = 0;
unsigned int ebx7 = 0;
unsigned int ecx7 = 0;
unsigned int edx7 = 0;
if (__get_cpuid_count(7, 0, &eax7, &ebx7, &ecx7, &edx7)) {
const unsigned int avx256_ebx7 = bit_AVX2;
if ((ebx7 & avx256_ebx7) == avx256_ebx7) {
ret |= WUFFS_BASE__CPU_ARCH__X86_64__AVX2;
}
}
return ret;
#else
return 0;
#endif // defined(WUFFS_BASE__CPU_ARCH__X86_64)
}
static inline bool //
wuffs_base__cpu_arch__have_sse42() {
#if defined(WUFFS_BASE__CPU_ARCH__X86_64)