未验证 提交 0d7b4e1c 编写于 作者: J Jim 提交者: GitHub

Merge pull request #3006 from mr-c/simde_20200529

libos: Freshen SIMDe code copy
......@@ -132,6 +132,10 @@ elseif(LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64(le)?")
else()
set(NEEDS_SIMDE "1")
add_definitions(-DNEEDS_SIMDE=1)
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp-simd -DSIMDE_ENABLE_OPENMP")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp-simd -DSIMDE_ENABLE_OPENMP")
endif()
set(ARCH_SIMD_FLAGS "")
message(STATUS "No Native SSE2 SIMD Support - Using SIMDE")
endif()
......
This is a slightly modified version of https://github.com/nemequ/simde/commit/cafec4b952fa5a31a51a10326f97c2e7c9067771
sse{,2}.h and mmx.h was moved down from the original "x86" subdirectory,
subsequently the '#include "../simde-common.h"' line in mmx.h was changed to '#include "simde-common.h"'
Then the code was reformatted using the "formatcode.sh" script in the root of this repository.
......@@ -6,6 +6,8 @@
* copyright and related or neighboring rights to this code. For
* details, see the Creative Commons Zero 1.0 Universal license at
* https://creativecommons.org/publicdomain/zero/1.0/
*
* SPDX-License-Identifier: CC0-1.0
*/
#if !defined(SIMDE_CHECK_H)
......@@ -15,6 +17,7 @@
#define SIMDE_NDEBUG 1
#endif
#include "hedley.h"
#include <stdint.h>
#if !defined(_WIN32)
......@@ -32,24 +35,47 @@
#endif
#if defined(_MSC_VER) && (_MSC_VER >= 1500)
#define SIMDE__PUSH_DISABLE_MSVC_C4127 \
#define SIMDE_PUSH_DISABLE_MSVC_C4127_ \
__pragma(warning(push)) __pragma(warning(disable : 4127))
#define SIMDE__POP_DISABLE_MSVC_C4127 __pragma(warning(pop))
#define SIMDE_POP_DISABLE_MSVC_C4127_ __pragma(warning(pop))
#else
#define SIMDE__PUSH_DISABLE_MSVC_C4127
#define SIMDE__POP_DISABLE_MSVC_C4127
#define SIMDE_PUSH_DISABLE_MSVC_C4127_
#define SIMDE_POP_DISABLE_MSVC_C4127_
#endif
#if !defined(simde_errorf)
#if defined(__has_include)
#if __has_include(<stdio.h>)
#include <stdio.h>
#endif
#elif defined(SIMDE_STDC_HOSTED)
#if SIMDE_STDC_HOSTED == 1
#include <stdio.h>
#include <stdlib.h>
#endif
#elif defined(__STDC_HOSTED__)
#if __STDC_HOSTETD__ == 1
#include <stdio.h>
#endif
#endif
#include "debug-trap.h"
HEDLEY_DIAGNOSTIC_PUSH
SIMDE_DIAGNOSTIC_DISABLE_VARIADIC_MACROS_
#if defined(EOF)
#define simde_errorf(format, ...) \
(fprintf(stderr, format, __VA_ARGS__), abort())
#else
#define simde_errorf(format, ...) (simde_trap())
#endif
HEDLEY_DIAGNOSTIC_POP
#endif
#define simde_error(msg) simde_errorf("%s", msg)
#if defined(SIMDE_NDEBUG)
#if defined(SIMDE_NDEBUG) || \
(defined(__cplusplus) && (__cplusplus < 201103L)) || \
(defined(__STDC__) && (__STDC__ < 199901L))
#if defined(SIMDE_CHECK_FAIL_DEFINED)
#define simde_assert(expr)
#else
......@@ -78,8 +104,8 @@
if (!HEDLEY_LIKELY(expr)) { \
simde_error("assertion failed: " #expr "\n"); \
} \
SIMDE__PUSH_DISABLE_MSVC_C4127 \
} while (0) SIMDE__POP_DISABLE_MSVC_C4127
SIMDE_PUSH_DISABLE_MSVC_C4127_ \
} while (0) SIMDE_POP_DISABLE_MSVC_C4127_
#define simde_assert_true(expr) \
do { \
......@@ -87,8 +113,8 @@
simde_error("assertion failed: " #expr \
" is not true\n"); \
} \
SIMDE__PUSH_DISABLE_MSVC_C4127 \
} while (0) SIMDE__POP_DISABLE_MSVC_C4127
SIMDE_PUSH_DISABLE_MSVC_C4127_ \
} while (0) SIMDE_POP_DISABLE_MSVC_C4127_
#define simde_assert_false(expr) \
do { \
......@@ -96,8 +122,8 @@
simde_error("assertion failed: " #expr \
" is not false\n"); \
} \
SIMDE__PUSH_DISABLE_MSVC_C4127 \
} while (0) SIMDE__POP_DISABLE_MSVC_C4127
SIMDE_PUSH_DISABLE_MSVC_C4127_ \
} while (0) SIMDE_POP_DISABLE_MSVC_C4127_
#define simde_assert_type_full(prefix, suffix, T, fmt, a, op, b) \
do { \
......@@ -110,8 +136,8 @@
#a, #op, #b, simde_tmp_a_, #op, \
simde_tmp_b_); \
} \
SIMDE__PUSH_DISABLE_MSVC_C4127 \
} while (0) SIMDE__POP_DISABLE_MSVC_C4127
SIMDE_PUSH_DISABLE_MSVC_C4127_ \
} while (0) SIMDE_POP_DISABLE_MSVC_C4127_
#define simde_assert_double_equal(a, b, precision) \
do { \
......@@ -127,8 +153,8 @@
"g == %0." #precision "g)\n", \
#a, #b, simde_tmp_a_, simde_tmp_b_); \
} \
SIMDE__PUSH_DISABLE_MSVC_C4127 \
} while (0) SIMDE__POP_DISABLE_MSVC_C4127
SIMDE_PUSH_DISABLE_MSVC_C4127_ \
} while (0) SIMDE_POP_DISABLE_MSVC_C4127_
#include <string.h>
#define simde_assert_string_equal(a, b) \
......@@ -141,8 +167,8 @@
"assertion failed: string %s == %s (\"%s\" == \"%s\")\n", \
#a, #b, simde_tmp_a_, simde_tmp_b_); \
} \
SIMDE__PUSH_DISABLE_MSVC_C4127 \
} while (0) SIMDE__POP_DISABLE_MSVC_C4127
SIMDE_PUSH_DISABLE_MSVC_C4127_ \
} while (0) SIMDE_POP_DISABLE_MSVC_C4127_
#define simde_assert_string_not_equal(a, b) \
do { \
......@@ -154,8 +180,8 @@
"assertion failed: string %s != %s (\"%s\" == \"%s\")\n", \
#a, #b, simde_tmp_a_, simde_tmp_b_); \
} \
SIMDE__PUSH_DISABLE_MSVC_C4127 \
} while (0) SIMDE__POP_DISABLE_MSVC_C4127
SIMDE_PUSH_DISABLE_MSVC_C4127_ \
} while (0) SIMDE_POP_DISABLE_MSVC_C4127_
#define simde_assert_memory_equal(size, a, b) \
do { \
......@@ -180,8 +206,8 @@
} \
} \
} \
SIMDE__PUSH_DISABLE_MSVC_C4127 \
} while (0) SIMDE__POP_DISABLE_MSVC_C4127
SIMDE_PUSH_DISABLE_MSVC_C4127_ \
} while (0) SIMDE_POP_DISABLE_MSVC_C4127_
#define simde_assert_memory_not_equal(size, a, b) \
do { \
......@@ -197,8 +223,8 @@
"u bytes)\n", \
#a, #b, simde_tmp_size_); \
} \
SIMDE__PUSH_DISABLE_MSVC_C4127 \
} while (0) SIMDE__POP_DISABLE_MSVC_C4127
SIMDE_PUSH_DISABLE_MSVC_C4127_ \
} while (0) SIMDE_POP_DISABLE_MSVC_C4127_
#endif
#define simde_assert_type(T, fmt, a, op, b) \
......
/* Debugging assertions and traps
* Portable Snippets - https://gitub.com/nemequ/portable-snippets
* Created by Evan Nemerson <evan@nemerson.com>
*
* To the extent possible under law, the authors have waived all
* copyright and related or neighboring rights to this code. For
* details, see the Creative Commons Zero 1.0 Universal license at
* https://creativecommons.org/publicdomain/zero/1.0/
*
* SPDX-License-Identifier: CC0-1.0
*/
#if !defined(SIMDE_DEBUG_TRAP_H)
#define SIMDE_DEBUG_TRAP_H
#if !defined(SIMDE_NDEBUG) && defined(NDEBUG) && !defined(SIMDE_DEBUG)
#define SIMDE_NDEBUG 1
#endif
#if defined(__has_builtin) && !defined(__ibmxl__)
#if __has_builtin(__builtin_debugtrap)
#define simde_trap() __builtin_debugtrap()
#elif __has_builtin(__debugbreak)
#define simde_trap() __debugbreak()
#endif
#endif
#if !defined(simde_trap)
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
#define simde_trap() __debugbreak()
#elif defined(__ARMCC_VERSION)
#define simde_trap() __breakpoint(42)
#elif defined(__ibmxl__) || defined(__xlC__)
#include <builtins.h>
#define simde_trap() __trap(42)
#elif defined(__DMC__) && defined(_M_IX86)
static inline void simde_trap(void)
{
__asm int 3h;
}
#elif defined(__i386__) || defined(__x86_64__)
static inline void simde_trap(void)
{
__asm__ __volatile__("int $03");
}
#elif defined(__thumb__)
static inline void simde_trap(void)
{
__asm__ __volatile__(".inst 0xde01");
}
#elif defined(__aarch64__)
static inline void simde_trap(void)
{
__asm__ __volatile__(".inst 0xd4200000");
}
#elif defined(__arm__)
static inline void simde_trap(void)
{
__asm__ __volatile__(".inst 0xe7f001f0");
}
#elif defined(__alpha__) && !defined(__osf__)
static inline void simde_trap(void)
{
__asm__ __volatile__("bpt");
}
#elif defined(_54_)
static inline void simde_trap(void)
{
__asm__ __volatile__("ESTOP");
}
#elif defined(_55_)
static inline void simde_trap(void)
{
__asm__ __volatile__(
";\n .if (.MNEMONIC)\n ESTOP_1\n .else\n ESTOP_1()\n .endif\n NOP");
}
#elif defined(_64P_)
static inline void simde_trap(void)
{
__asm__ __volatile__("SWBP 0");
}
#elif defined(_6x_)
static inline void simde_trap(void)
{
__asm__ __volatile__("NOP\n .word 0x10000000");
}
#elif defined(__STDC_HOSTED__) && (__STDC_HOSTED__ == 0) && defined(__GNUC__)
#define simde_trap() __builtin_trap()
#else
#include <signal.h>
#if defined(SIGTRAP)
#define simde_trap() raise(SIGTRAP)
#else
#define simde_trap() raise(SIGABRT)
#endif
#endif
#endif
#if defined(HEDLEY_LIKELY)
#define SIMDE_DBG_LIKELY(expr) HEDLEY_LIKELY(expr)
#elif defined(__GNUC__) && (__GNUC__ >= 3)
#define SIMDE_DBG_LIKELY(expr) __builtin_expect(!!(expr), 1)
#else
#define SIMDE_DBG_LIKELY(expr) (!!(expr))
#endif
#if !defined(SIMDE_NDEBUG) || (SIMDE_NDEBUG == 0)
#define simde_dbg_assert(expr) \
do { \
if (!SIMDE_DBG_LIKELY(expr)) { \
simde_trap(); \
} \
} while (0)
#else
#define simde_dbg_assert(expr)
#endif
#endif /* !defined(SIMDE_DEBUG_TRAP_H) */
此差异已折叠。
此差异已折叠。
......@@ -6,6 +6,8 @@
* details, see the Creative Commons Zero 1.0 Universal license at
* <https://creativecommons.org/publicdomain/zero/1.0/>
*
* SPDX-License-Identifier: CC0-1.0
*
* Different compilers define different preprocessor macros for the
* same architecture. This is an attempt to provide a single
* interface which is usable on any compiler.
......@@ -53,6 +55,11 @@
#define SIMDE_ARCH_ALPHA 1
#endif
#endif
#if defined(SIMDE_ARCH_ALPHA)
#define SIMDE_ARCH_ALPHA_CHECK(version) ((version) <= SIMDE_ARCH_ALPHA)
#else
#define SIMDE_ARCH_ALPHA_CHECK(version) (0)
#endif
/* Atmel AVR
<https://en.wikipedia.org/wiki/Atmel_AVR> */
......@@ -64,7 +71,7 @@
<https://en.wikipedia.org/wiki/X86-64> */
#if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || \
defined(__x86_64) || defined(_M_X66) || defined(_M_AMD64)
#define SIMDE_ARCH_AMD64 1
#define SIMDE_ARCH_AMD64 1000
#endif
/* ARM
......@@ -93,11 +100,30 @@
defined(_ARM) || defined(_M_ARM) || defined(_M_ARM)
#define SIMDE_ARCH_ARM 1
#endif
#if defined(SIMDE_ARCH_ARM)
#define SIMDE_ARCH_ARM_CHECK(version) ((version) <= SIMDE_ARCH_ARM)
#else
#define SIMDE_ARCH_ARM_CHECK(version) (0)
#endif
/* AArch64
<https://en.wikipedia.org/wiki/ARM_architecture> */
#if defined(__aarch64__) || defined(_M_ARM64)
#define SIMDE_ARCH_AARCH64 10
#define SIMDE_ARCH_AARCH64 1000
#endif
#if defined(SIMDE_ARCH_AARCH64)
#define SIMDE_ARCH_AARCH64_CHECK(version) ((version) <= SIMDE_ARCH_AARCH64)
#else
#define SIMDE_ARCH_AARCH64_CHECK(version) (0)
#endif
/* ARM SIMD ISA extensions */
#if defined(__ARM_NEON)
#if defined(SIMDE_ARCH_AARCH64)
#define SIMDE_ARCH_ARM_NEON SIMDE_ARCH_AARCH64
#elif defined(SIMDE_ARCH_ARM)
#define SIMDE_ARCH_ARM_NEON SIMDE_ARCH_ARM
#endif
#endif
/* Blackfin
......@@ -128,6 +154,11 @@
#elif defined(__convex__)
#define SIMDE_ARCH_CONVEX 1
#endif
#if defined(SIMDE_ARCH_CONVEX)
#define SIMDE_ARCH_CONVEX_CHECK(version) ((version) <= SIMDE_ARCH_CONVEX)
#else
#define SIMDE_ARCH_CONVEX_CHECK(version) (0)
#endif
/* Adapteva Epiphany
<https://en.wikipedia.org/wiki/Adapteva_Epiphany> */
......@@ -159,6 +190,11 @@
#elif defined(__hppa__) || defined(__HPPA__) || defined(__hppa)
#define SIMDE_ARCH_HPPA 1
#endif
#if defined(SIMDE_ARCH_HPPA)
#define SIMDE_ARCH_HPPA_CHECK(version) ((version) <= SIMDE_ARCH_HPPA)
#else
#define SIMDE_ARCH_HPPA_CHECK(version) (0)
#endif
/* x86
<https://en.wikipedia.org/wiki/X86> */
......@@ -177,6 +213,88 @@
#elif defined(_X86_) || defined(__X86__) || defined(__THW_INTEL__)
#define SIMDE_ARCH_X86 3
#endif
#if defined(SIMDE_ARCH_X86)
#define SIMDE_ARCH_X86_CHECK(version) ((version) <= SIMDE_ARCH_X86)
#else
#define SIMDE_ARCH_X86_CHECK(version) (0)
#endif
/* SIMD ISA extensions for x86/x86_64 */
#if defined(SIMDE_ARCH_X86) || defined(SIMDE_ARCH_AMD64)
#if defined(_M_IX86_FP)
#define SIMDE_ARCH_X86_MMX
#if (_M_IX86_FP >= 1)
#define SIMDE_ARCH_X86_SSE 1
#endif
#if (_M_IX86_FP >= 2)
#define SIMDE_ARCH_X86_SSE2 1
#endif
#elif defined(_M_X64)
#define SIMDE_ARCH_X86_SSE 1
#define SIMDE_ARCH_X86_SSE2 1
#else
#if defined(__MMX__)
#define SIMDE_ARCH_X86_MMX 1
#endif
#if defined(__SSE__)
#define SIMDE_ARCH_X86_SSE 1
#endif
#if defined(__SSE2__)
#define SIMDE_ARCH_X86_SSE2 1
#endif
#endif
#if defined(__SSE3__)
#define SIMDE_ARCH_X86_SSE3 1
#endif
#if defined(__SSSE3__)
#define SIMDE_ARCH_X86_SSSE3 1
#endif
#if defined(__SSE4_1__)
#define SIMDE_ARCH_X86_SSE4_1 1
#endif
#if defined(__SSE4_2__)
#define SIMDE_ARCH_X86_SSE4_2 1
#endif
#if defined(__AVX__)
#define SIMDE_ARCH_X86_AVX 1
#if !defined(SIMDE_ARCH_X86_SSE3)
#define SIMDE_ARCH_X86_SSE3 1
#endif
#if !defined(SIMDE_ARCH_X86_SSE4_1)
#define SIMDE_ARCH_X86_SSE4_1 1
#endif
#if !defined(SIMDE_ARCH_X86_SSE4_1)
#define SIMDE_ARCH_X86_SSE4_2 1
#endif
#endif
#if defined(__AVX2__)
#define SIMDE_ARCH_X86_AVX2 1
#endif
#if defined(__FMA__)
#define SIMDE_ARCH_X86_FMA 1
#if !defined(SIMDE_ARCH_X86_AVX)
#define SIMDE_ARCH_X86_AVX 1
#endif
#endif
#if defined(__AVX512BW__)
#define SIMDE_ARCH_X86_AVX512BW 1
#endif
#if defined(__AVX512CD__)
#define SIMDE_ARCH_X86_AVX512CD 1
#endif
#if defined(__AVX512DQ__)
#define SIMDE_ARCH_X86_AVX512DQ 1
#endif
#if defined(__AVX512F__)
#define SIMDE_ARCH_X86_AVX512F 1
#endif
#if defined(__AVX512VL__)
#define SIMDE_ARCH_X86_AVX512VL 1
#endif
#if defined(__GFNI__)
#define SIMDE_ARCH_X86_GFNI 1
#endif
#endif
/* Itanium
<https://en.wikipedia.org/wiki/Itanium> */
......@@ -206,6 +324,11 @@
#elif defined(__mc68000__) || defined(__MC68000__)
#define SIMDE_ARCH_M68K 68000
#endif
#if defined(SIMDE_ARCH_M68K)
#define SIMDE_ARCH_M68K_CHECK(version) ((version) <= SIMDE_ARCH_M68K)
#else
#define SIMDE_ARCH_M68K_CHECK(version) (0)
#endif
/* Xilinx MicroBlaze
<https://en.wikipedia.org/wiki/MicroBlaze> */
......@@ -234,6 +357,11 @@
#elif defined(_MIPS_ISA_MIPS) || defined(__mips) || defined(__MIPS__)
#define SIMDE_ARCH_MIPS 1
#endif
#if defined(SIMDE_ARCH_MIPS)
#define SIMDE_ARCH_MIPS_CHECK(version) ((version) <= SIMDE_ARCH_MIPS)
#else
#define SIMDE_ARCH_MIPS_CHECK(version) (0)
#endif
/* Matsushita MN10300
<https://en.wikipedia.org/wiki/MN103> */
......@@ -245,6 +373,8 @@
<https://en.wikipedia.org/wiki/IBM_POWER_Instruction_Set_Architecture> */
#if defined(_M_PPC)
#define SIMDE_ARCH_POWER _M_PPC
#elif defined(_ARCH_PWR9)
#define SIMDE_ARCH_POWER 900
#elif defined(_ARCH_PWR8)
#define SIMDE_ARCH_POWER 800
#elif defined(_ARCH_PWR7)
......@@ -274,6 +404,20 @@
defined(__ppc)
#define SIMDE_ARCH_POWER 1
#endif
#if defined(SIMDE_ARCH_POWER)
#define SIMDE_ARCH_POWER_CHECK(version) ((version) <= SIMDE_ARCH_POWER)
#else
#define SIMDE_ARCH_POWER_CHECK(version) (0)
#endif
#if defined(__ALTIVEC__)
#define SIMDE_ARCH_POWER_ALTIVEC SIMDE_ARCH_POWER
#endif
#if defined(SIMDE_ARCH_POWER)
#define SIMDE_ARCH_POWER_ALTIVEC_CHECK(version) ((version) <= SIMDE_ARCH_POWER)
#else
#define SIMDE_ARCH_POWER_ALTIVEC_CHECK(version) (0)
#endif
/* SPARC
<https://en.wikipedia.org/wiki/SPARC> */
......@@ -298,6 +442,11 @@
#elif defined(__sparc__) || defined(__sparc)
#define SIMDE_ARCH_SPARC 1
#endif
#if defined(SIMDE_ARCH_SPARC)
#define SIMDE_ARCH_SPARC_CHECK(version) ((version) <= SIMDE_ARCH_SPARC)
#else
#define SIMDE_ARCH_SPARC_CHECK(version) (0)
#endif
/* SuperH
<https://en.wikipedia.org/wiki/SuperH> */
......@@ -345,6 +494,20 @@
#elif defined(_TMS320C28X) || defined(__TMS320C28X__)
#define SIMDE_ARCH_TMS320 280
#endif
#if defined(SIMDE_ARCH_TMS320)
#define SIMDE_ARCH_TMS320_CHECK(version) ((version) <= SIMDE_ARCH_TMS320)
#else
#define SIMDE_ARCH_TMS320_CHECK(version) (0)
#endif
/* WebAssembly */
#if defined(__wasm__)
#define SIMDE_ARCH_WASM 1
#endif
#if defined(SIMDE_ARCH_WASM) && defined(__wasm_simd128__)
#define SIMDE_ARCH_WASM_SIMD128
#endif
/* Xtensa
<https://en.wikipedia.org/wiki/> */
......
此差异已折叠。
/* SPDX-License-Identifier: MIT
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Copyright:
* 2017-2020 Evan Nemerson <evan@nemerson.com>
*/
/* SIMDe targets a very wide range of standards and compilers, and our
* goal is to compile cleanly even with extremely aggressive warnings
* (i.e., -Weverything in clang, -Wextra in GCC, /W4 for MSVC, etc.)
* treated as errors.
*
* While our preference is to resolve the underlying issue a given
* diagnostic is warning us about, sometimes that's not possible.
* Fixing a warning in one compiler may cause problems in another.
* Sometimes a warning doesn't really apply to us (false positives),
* and sometimes adhering to a warning would mean dropping a feature
* we *know* the compiler supports since we have tested specifically
* for the compiler or feature.
*
* When practical, warnings are only disabled for specific code. For
* a list of warnings which are enabled by default in all SIMDe code,
* see SIMDE_DISABLE_UNWANTED_DIAGNOSTICS. Note that we restore the
* warning stack when SIMDe is done parsing, so code which includes
* SIMDe is not deprived of these warnings.
*/
#if !defined(SIMDE_DIAGNOSTIC_H)
#include "hedley.h"
/* This is only to help us implement functions like _mm_undefined_ps. */
#if defined(SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_)
#undef SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_
#endif
#if HEDLEY_HAS_WARNING("-Wuninitialized")
#define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ \
_Pragma("clang diagnostic ignored \"-Wuninitialized\"")
#elif HEDLEY_GCC_VERSION_CHECK(4, 2, 0)
#define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ \
_Pragma("GCC diagnostic ignored \"-Wuninitialized\"")
#elif HEDLEY_PGI_VERSION_CHECK(19, 10, 0)
#define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ _Pragma("diag_suppress 549")
#elif HEDLEY_SUNPRO_VERSION_CHECK(5, 14, 0) && defined(__cplusplus)
#define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ \
_Pragma("error_messages(off,SEC_UNINITIALIZED_MEM_READ,SEC_UNDEFINED_RETURN_VALUE,unassigned)")
#elif HEDLEY_SUNPRO_VERSION_CHECK(5, 14, 0)
#define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ \
_Pragma("error_messages(off,SEC_UNINITIALIZED_MEM_READ,SEC_UNDEFINED_RETURN_VALUE)")
#elif HEDLEY_SUNPRO_VERSION_CHECK(5, 12, 0) && defined(__cplusplus)
#define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ \
_Pragma("error_messages(off,unassigned)")
#elif HEDLEY_TI_VERSION_CHECK(16, 9, 9) || \
HEDLEY_TI_CL6X_VERSION_CHECK(8, 0, 0) || \
HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \
HEDLEY_TI_CLPRU_VERSION_CHECK(2, 3, 2)
#define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ _Pragma("diag_suppress 551")
#elif HEDLEY_INTEL_VERSION_CHECK(13, 0, 0)
#define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ _Pragma("warning(disable:592)")
#elif HEDLEY_MSVC_VERSION_CHECK(19, 0, 0) && !defined(__MSVC_RUNTIME_CHECKS)
#define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ \
__pragma(warning(disable : 4700))
#endif
/* GCC emits a lot of "notes" about the ABI being different for things
* in newer versions of GCC. We don't really care because all our
* functions are inlined and don't generate ABI. */
#if HEDLEY_GCC_VERSION_CHECK(7, 0, 0)
#define SIMDE_DIAGNOSTIC_DISABLE_PSABI_ \
_Pragma("GCC diagnostic ignored \"-Wpsabi\"")
#else
#define SIMDE_DIAGNOSTIC_DISABLE_PSABI_
#endif
/* Since MMX uses x87 FP registers, you're supposed to call _mm_empty()
* after each MMX function before any floating point instructions.
* Some compilers warn about functions which use MMX functions but
* don't call _mm_empty(). However, since SIMDe is implementyng the
* MMX API we shouldn't be calling _mm_empty(); we leave it to the
* caller to invoke simde_mm_empty(). */
#if HEDLEY_INTEL_VERSION_CHECK(19, 0, 0)
#define SIMDE_DIAGNOSTIC_DISABLE_NO_EMMS_INSTRUCTION_ \
_Pragma("warning(disable:13200 13203)")
#elif defined(HEDLEY_MSVC_VERSION)
#define SIMDE_DIAGNOSTIC_DISABLE_NO_EMMS_INSTRUCTION_ \
__pragma(warning(disable : 4799))
#else
#define SIMDE_DIAGNOSTIC_DISABLE_NO_EMMS_INSTRUCTION_
#endif
/* Intel is pushing people to use OpenMP SIMD instead of Cilk+, so they
* emit a diagnostic if you use #pragma simd instead of
* #pragma omp simd. SIMDe supports OpenMP SIMD, you just need to
* compile with -qopenmp or -qopenmp-simd and define
* SIMDE_ENABLE_OPENMP. Cilk+ is just a fallback. */
#if HEDLEY_INTEL_VERSION_CHECK(18, 0, 0)
#define SIMDE_DIAGNOSTIC_DISABLE_SIMD_PRAGMA_DEPRECATED_ \
_Pragma("warning(disable:3948)")
#else
#define SIMDE_DIAGNOSTIC_DISABLE_SIMD_PRAGMA_DEPRECATED_
#endif
#if defined(HEDLEY_MSVC_VERSION)
#define SIMDE_DIAGNOSTIC_DISABLE_NON_CONSTANT_AGGREGATE_INITIALIZER_ \
__pragma(warning(disable : 4204))
#else
#define SIMDE_DIAGNOSTIC_DISABLE_NON_CONSTANT_AGGREGATE_INITIALIZER_
#endif
/* This warning needs a lot of work. It is triggered if all you do is
* pass the value to memcpy/__builtin_memcpy, or if you initialize a
* member of the union, even if that member takes up the entire union.
* Last tested with clang-10, hopefully things will improve in the
* future; if clang fixes this I'd love to enable it. */
#if HEDLEY_HAS_WARNING("-Wconditional-uninitialized")
#define SIMDE_DIAGNOSTIC_DISABLE_CONDITIONAL_UNINITIALIZED_ \
_Pragma("clang diagnostic ignored \"-Wconditional-uninitialized\"")
#else
#define SIMDE_DIAGNOSTIC_DISABLE_CONDITIONAL_UNINITIALIZED_
#endif
/* This warning is meant to catch things like `0.3 + 0.4 == 0.7`, which
* will is false. However, SIMDe uses these operations exclusively
* for things like _mm_cmpeq_ps, for which we really do want to check
* for equality (or inequality).
*
* If someone wants to put together a SIMDE_FLOAT_EQUAL(a, op, b) macro
* which just wraps a check in some code do disable this diagnostic I'd
* be happy to accept it. */
#if HEDLEY_HAS_WARNING("-Wfloat-equal") || HEDLEY_GCC_VERSION_CHECK(3, 0, 0)
#define SIMDE_DIAGNOSTIC_DISABLE_FLOAT_EQUAL_ \
_Pragma("GCC diagnostic ignored \"-Wfloat-equal\"")
#else
#define SIMDE_DIAGNOSTIC_DISABLE_FLOAT_EQUAL_
#endif
/* This is because we use HEDLEY_STATIC_ASSERT for static assertions.
* If Hedley can't find an implementation it will preprocess to
* nothing, which means there will be a trailing semi-colon. */
#if HEDLEY_HAS_WARNING("-Wextra-semi")
#define SIMDE_DIAGNOSTIC_DISABLE_EXTRA_SEMI_ \
_Pragma("clang diagnostic ignored \"-Wextra-semi\"")
#elif HEDLEY_GCC_VERSION_CHECK(8, 1, 0) && defined(__cplusplus)
#define SIMDE_DIAGNOSTIC_DISABLE_EXTRA_SEMI_ \
_Pragma("GCC diagnostic ignored \"-Wextra-semi\"")
#else
#define SIMDE_DIAGNOSTIC_DISABLE_EXTRA_SEMI_
#endif
/* We do use a few variadic macros, which technically aren't available
* until C99 and C++11, but every compiler I'm aware of has supported
* them for much longer. That said, usage is isolated to the test
* suite and compilers known to support them. */
#if HEDLEY_HAS_WARNING("-Wvariadic-macros") || HEDLEY_GCC_VERSION_CHECK(4, 0, 0)
#if HEDLEY_HAS_WARNING("-Wc++98-compat-pedantic")
#define SIMDE_DIAGNOSTIC_DISABLE_VARIADIC_MACROS_ \
_Pragma("clang diagnostic ignored \"-Wvariadic-macros\"") _Pragma( \
"clang diagnostic ignored \"-Wc++98-compat-pedantic\"")
#else
#define SIMDE_DIAGNOSTIC_DISABLE_VARIADIC_MACROS_ \
_Pragma("GCC diagnostic ignored \"-Wvariadic-macros\"")
#endif
#else
#define SIMDE_DIAGNOSTIC_DISABLE_VARIADIC_MACROS_
#endif
/* Triggered when assigning a float to a double implicitly. We use
* explicit casts in SIMDe, this is only used in the test suite. */
#if HEDLEY_HAS_WARNING("-Wdouble-promotion")
#define SIMDE_DIAGNOSTIC_DISABLE_DOUBLE_PROMOTION_ \
_Pragma("clang diagnostic ignored \"-Wdouble-promotion\"")
#else
#define SIMDE_DIAGNOSTIC_DISABLE_DOUBLE_PROMOTION_
#endif
/* Several compilers treat conformant array parameters as VLAs. We
* test to make sure we're in C mode (C++ doesn't support CAPs), and
* that the version of the standard supports CAPs. We also blacklist
* some buggy compilers like MSVC (the logic is in Hedley if you want
* to take a look), but with certain warnings enabled some compilers
* still like to emit a diagnostic. */
#if HEDLEY_HAS_WARNING("-Wvla")
#define SIMDE_DIAGNOSTIC_DISABLE_VLA_ \
_Pragma("clang diagnostic ignored \"-Wvla\"")
#elif HEDLEY_GCC_VERSION_CHECK(4, 3, 0)
#define SIMDE_DIAGNOSTIC_DISABLE_VLA_ \
_Pragma("GCC diagnostic ignored \"-Wvla\"")
#else
#define SIMDE_DIAGNOSTIC_DISABLE_VLA_
#endif
#if HEDLEY_HAS_WARNING("-Wused-but-marked-unused")
#define SIMDE_DIAGNOSTIC_DISABLE_USED_BUT_MARKED_UNUSED_ \
_Pragma("clang diagnostic ignored \"-Wused-but-marked-unused\"")
#else
#define SIMDE_DIAGNOSTIC_DISABLE_USED_BUT_MARKED_UNUSED_
#endif
#if HEDLEY_HAS_WARNING("-Wunused-function")
#define SIMDE_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION_ \
_Pragma("clang diagnostic ignored \"-Wunused-function\"")
#elif HEDLEY_GCC_VERSION_CHECK(3, 4, 0)
#define SIMDE_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION_ \
_Pragma("GCC diagnostic ignored \"-Wunused-function\"")
#else
#define SIMDE_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION_
#endif
#if HEDLEY_HAS_WARNING("-Wpass-failed")
#define SIMDE_DIAGNOSTIC_DISABLE_PASS_FAILED_ \
_Pragma("clang diagnostic ignored \"-Wpass-failed\"")
#else
#define SIMDE_DIAGNOSTIC_DISABLE_PASS_FAILED_
#endif
/* https://github.com/nemequ/simde/issues/277 */
#if defined(HEDLEY_GCC_VERSION) && HEDLEY_GCC_VERSION_CHECK(4, 6, 0) && \
!HEDLEY_GCC_VERSION_CHECK(6, 0, 0) && defined(__cplusplus)
#define SIMDE_DIAGNOSTIC_DISABLE_BUGGY_UNUSED_BUT_SET_VARIBALE \
_Pragma("GCC diagnostic ignored \"-Wunused-but-set-variable\"")
#else
#define SIMDE_DIAGNOSTIC_DISABLE_BUGGY_UNUSED_BUT_SET_VARIBALE
#endif
/* Some compilers, such as clang, may use `long long` for 64-bit
* integers, but `long long` triggers a diagnostic with
* -Wc++98-compat-pedantic which says 'long long' is incompatible with
* C++98. */
#if HEDLEY_HAS_WARNING("-Wc++98-compat-pedantic")
#define SIMDE_DIAGNOSTIC_DISABLE_CPP98_COMPAT_PEDANTIC \
_Pragma("clang diagnostic ignored \"-Wc++98-compat-pedantic\"")
#else
#define SIMDE_DIAGNOSTIC_DISABLE_CPP98_COMPAT_PEDANTIC
#endif
#define SIMDE_DISABLE_UNWANTED_DIAGNOSTICS \
SIMDE_DIAGNOSTIC_DISABLE_PSABI_ \
SIMDE_DIAGNOSTIC_DISABLE_NO_EMMS_INSTRUCTION_ \
SIMDE_DIAGNOSTIC_DISABLE_SIMD_PRAGMA_DEPRECATED_ \
SIMDE_DIAGNOSTIC_DISABLE_CONDITIONAL_UNINITIALIZED_ \
SIMDE_DIAGNOSTIC_DISABLE_FLOAT_EQUAL_ \
SIMDE_DIAGNOSTIC_DISABLE_NON_CONSTANT_AGGREGATE_INITIALIZER_ \
SIMDE_DIAGNOSTIC_DISABLE_EXTRA_SEMI_ \
SIMDE_DIAGNOSTIC_DISABLE_VLA_ \
SIMDE_DIAGNOSTIC_DISABLE_USED_BUT_MARKED_UNUSED_ \
SIMDE_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION_ \
SIMDE_DIAGNOSTIC_DISABLE_PASS_FAILED_ \
SIMDE_DIAGNOSTIC_DISABLE_CPP98_COMPAT_PEDANTIC \
SIMDE_DIAGNOSTIC_DISABLE_BUGGY_UNUSED_BUT_SET_VARIBALE
#endif
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册