Blender V5.0
BLI_simd.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
12
13#if (defined(__ARM_NEON) || (defined(_M_ARM64) && defined(_MSC_VER))) && \
14 defined(WITH_SSE2NEON) && !defined(DISABLE_SSE2NEON)
15/* SSE/SSE2 emulation on ARM Neon. Match SSE precision. */
16# if !defined(SSE2NEON_PRECISE_MINMAX)
17# define SSE2NEON_PRECISE_MINMAX 1
18# endif
19# if !defined(SSE2NEON_PRECISE_DIV)
20# define SSE2NEON_PRECISE_DIV 1
21# endif
22# if !defined(SSE2NEON_PRECISE_SQRT)
23# define SSE2NEON_PRECISE_SQRT 1
24# endif
25# include <sse2neon.h>
26# define BLI_HAVE_SSE2 1
27#elif defined(__SSE2__)
28/* Native SSE2 on Intel/AMD. */
29# include <emmintrin.h>
30# define BLI_HAVE_SSE2 1
31#else
32# define BLI_HAVE_SSE2 0
33#endif
34
35#if (defined(__ARM_NEON) || (defined(_M_ARM64) && defined(_MSC_VER))) && \
36 defined(WITH_SSE2NEON) && !defined(DISABLE_SSE2NEON)
37/* SSE4 is emulated via sse2neon. */
38# define BLI_HAVE_SSE4 1
39#elif defined(__SSE4_2__)
40/* Native SSE4.2. */
41# include <nmmintrin.h>
42# define BLI_HAVE_SSE4 1
43#else
44# define BLI_HAVE_SSE4 0
45#endif