You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.9KB

  1. /*
  2. * DISTRHO Cardinal Plugin
  3. * Copyright (C) 2021-2024 Filipe Coelho <falktx@falktx.com>
  4. * SPDX-License-Identifier: GPL-3.0-or-later
  5. */
  6. #pragma once
  7. // native up to SSE3
  8. #if (defined(_M_X64) || defined(__amd64__) || defined(__SSE2__) || (defined(_M_IX86_FP) && _M_IX86_FP == 2)) && !defined(__EMSCRIPTEN__) && !defined(CARDINAL_NOSIMD)
  9. # define SIMDE_X86_MMX_NATIVE
  10. # define SIMDE_X86_SSE_NATIVE
  11. # define SIMDE_X86_SSE2_NATIVE
  12. # define SIMDE_X86_SSE3_NATIVE
  13. #else
  14. # define SIMDE_X86_MMX_NO_NATIVE
  15. # define SIMDE_X86_SSE_NO_NATIVE
  16. # define SIMDE_X86_SSE2_NO_NATIVE
  17. # define SIMDE_X86_SSE3_NO_NATIVE
  18. #endif
  19. // everything else is emulated
  20. #define SIMDE_X86_SSSE3_NO_NATIVE
  21. #define SIMDE_X86_SSE4_1_NO_NATIVE
  22. #define SIMDE_X86_SSE4_2_NO_NATIVE
  23. #define SIMDE_X86_XOP_NO_NATIVE
  24. #define SIMDE_X86_AVX_NO_NATIVE
  25. #define SIMDE_X86_AVX2_NO_NATIVE
  26. #define SIMDE_X86_FMA_NO_NATIVE
  27. #define SIMDE_X86_AVX512F_NO_NATIVE
  28. #define SIMDE_X86_AVX512BF16_NO_NATIVE
  29. #define SIMDE_X86_AVX512BW_NO_NATIVE
  30. #define SIMDE_X86_AVX512VL_NO_NATIVE
  31. #define SIMDE_X86_AVX512DQ_NO_NATIVE
  32. #define SIMDE_X86_AVX512CD_NO_NATIVE
  33. #define SIMDE_X86_AVX5124VNNIW_NO_NATIVE
  34. #define SIMDE_X86_AVX512VNNI_NO_NATIVE
  35. #define SIMDE_X86_AVX512VBMI2_NO_NATIVE
  36. #define SIMDE_X86_AVX512VBMI_NO_NATIVE
  37. #define SIMDE_X86_AVX512BITALG_NO_NATIVE
  38. #define SIMDE_X86_AVX512VPOPCNTDQ_NO_NATIVE
  39. #define SIMDE_X86_AVX512VP2INTERSECT_NO_NATIVE
  40. #define SIMDE_X86_SVML_NO_NATIVE
  41. // control wasm simd state
  42. #ifdef __EMSCRIPTEN__
  43. # ifdef CARDINAL_NOSIMD
  44. # define SIMDE_WASM_SIMD128_NO_NATIVE
  45. # else
  46. # define SIMDE_WASM_SIMD128_NATIVE
  47. # endif
  48. #endif
  49. // fix win32 build
  50. #ifdef _WIN32
  51. static inline
  52. float simde_math_roundevenf(float v) {
  53. float rounded = __builtin_roundf(v);
  54. float diff = rounded - v;
  55. if (__builtin_expect(!!(__builtin_fabsf(diff) == 0.5f) && ((int)rounded & 1), 0)) {
  56. rounded = v - diff;
  57. }
  58. return rounded;
  59. }
  60. #define simde_math_roundevenf simde_math_roundevenf
  61. #endif