x86.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*
  2. Copyright Charly Chevalier 2015
  3. Copyright Joel Falcou 2015
  4. Distributed under the Boost Software License, Version 1.0.
  5. (See accompanying file LICENSE_1_0.txt or copy at
  6. http://www.boost.org/LICENSE_1_0.txt)
  7. */
  8. #ifndef BOOST_PREDEF_HARDWARE_SIMD_X86_H
  9. #define BOOST_PREDEF_HARDWARE_SIMD_X86_H
  10. #include <boost/predef/version_number.h>
  11. #include <boost/predef/hardware/simd/x86/versions.h>
  12. /* tag::reference[]
  13. = `BOOST_HW_SIMD_X86`
  14. The SIMD extension for x86 (*if detected*).
  15. Version number depends on the most recent detected extension.
  16. [options="header"]
  17. |===
  18. | {predef_symbol} | {predef_version}
  19. | `+__SSE__+` | {predef_detection}
  20. | `+_M_X64+` | {predef_detection}
  21. | `_M_IX86_FP >= 1` | {predef_detection}
  22. | `+__SSE2__+` | {predef_detection}
  23. | `+_M_X64+` | {predef_detection}
  24. | `_M_IX86_FP >= 2` | {predef_detection}
  25. | `+__SSE3__+` | {predef_detection}
  26. | `+__SSSE3__+` | {predef_detection}
  27. | `+__SSE4_1__+` | {predef_detection}
  28. | `+__SSE4_2__+` | {predef_detection}
  29. | `+__AVX__+` | {predef_detection}
  30. | `+__FMA__+` | {predef_detection}
  31. | `+__AVX2__+` | {predef_detection}
  32. |===
  33. [options="header"]
  34. |===
  35. | {predef_symbol} | {predef_version}
  36. | `+__SSE__+` | BOOST_HW_SIMD_X86_SSE_VERSION
  37. | `+_M_X64+` | BOOST_HW_SIMD_X86_SSE_VERSION
  38. | `_M_IX86_FP >= 1` | BOOST_HW_SIMD_X86_SSE_VERSION
  39. | `+__SSE2__+` | BOOST_HW_SIMD_X86_SSE2_VERSION
  40. | `+_M_X64+` | BOOST_HW_SIMD_X86_SSE2_VERSION
  41. | `_M_IX86_FP >= 2` | BOOST_HW_SIMD_X86_SSE2_VERSION
  42. | `+__SSE3__+` | BOOST_HW_SIMD_X86_SSE3_VERSION
  43. | `+__SSSE3__+` | BOOST_HW_SIMD_X86_SSSE3_VERSION
  44. | `+__SSE4_1__+` | BOOST_HW_SIMD_X86_SSE4_1_VERSION
  45. | `+__SSE4_2__+` | BOOST_HW_SIMD_X86_SSE4_2_VERSION
  46. | `+__AVX__+` | BOOST_HW_SIMD_X86_AVX_VERSION
  47. | `+__FMA__+` | BOOST_HW_SIMD_X86_FMA3_VERSION
  48. | `+__AVX2__+` | BOOST_HW_SIMD_X86_AVX2_VERSION
  49. |===
  50. */ // end::reference[]
  51. #define BOOST_HW_SIMD_X86 BOOST_VERSION_NUMBER_NOT_AVAILABLE
  52. #undef BOOST_HW_SIMD_X86
  53. #if !defined(BOOST_HW_SIMD_X86) && defined(__MIC__)
  54. # define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_MIC_VERSION
  55. #endif
  56. #if !defined(BOOST_HW_SIMD_X86) && defined(__AVX2__)
  57. # define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_AVX2_VERSION
  58. #endif
  59. #if !defined(BOOST_HW_SIMD_X86) && defined(__AVX__)
  60. # define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_AVX_VERSION
  61. #endif
  62. #if !defined(BOOST_HW_SIMD_X86) && defined(__FMA__)
  63. # define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_FMA_VERSION
  64. #endif
  65. #if !defined(BOOST_HW_SIMD_X86) && defined(__SSE4_2__)
  66. # define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSE4_2_VERSION
  67. #endif
  68. #if !defined(BOOST_HW_SIMD_X86) && defined(__SSE4_1__)
  69. # define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSE4_1_VERSION
  70. #endif
  71. #if !defined(BOOST_HW_SIMD_X86) && defined(__SSSE3__)
  72. # define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSSE3_VERSION
  73. #endif
  74. #if !defined(BOOST_HW_SIMD_X86) && defined(__SSE3__)
  75. # define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSE3_VERSION
  76. #endif
  77. #if !defined(BOOST_HW_SIMD_X86) && (defined(__SSE2__) || defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 2))
  78. # define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSE2_VERSION
  79. #endif
  80. #if !defined(BOOST_HW_SIMD_X86) && (defined(__SSE__) || defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 1))
  81. # define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSE_VERSION
  82. #endif
  83. #if !defined(BOOST_HW_SIMD_X86) && defined(__MMX__)
  84. # define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_MMX_VERSION
  85. #endif
  86. #if !defined(BOOST_HW_SIMD_X86)
  87. # define BOOST_HW_SIMD_X86 BOOST_VERSION_NUMBER_NOT_AVAILABLE
  88. #else
  89. # define BOOST_HW_SIMD_X86_AVAILABLE
  90. #endif
  91. #define BOOST_HW_SIMD_X86_NAME "x86 SIMD"
  92. #endif
  93. #include <boost/predef/detail/test.h>
  94. BOOST_PREDEF_DECLARE_TEST(BOOST_HW_SIMD_X86, BOOST_HW_SIMD_X86_NAME)