x86_amd.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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_AMD_H
  9. #define BOOST_PREDEF_HARDWARE_SIMD_X86_AMD_H
  10. #include <boost/predef/version_number.h>
  11. #include <boost/predef/hardware/simd/x86_amd/versions.h>
  12. /*`
  13. [heading `BOOST_HW_SIMD_X86_AMD`]
  14. The SIMD extension for x86 (AMD) (*if detected*).
  15. Version number depends on the most recent detected extension.
  16. [table
  17. [[__predef_symbol__] [__predef_version__]]
  18. [[`__SSE4A__`] [__predef_detection__]]
  19. [[`__FMA4__`] [__predef_detection__]]
  20. [[`__XOP__`] [__predef_detection__]]
  21. [[`BOOST_HW_SIMD_X86`] [__predef_detection__]]
  22. ]
  23. [table
  24. [[__predef_symbol__] [__predef_version__]]
  25. [[`__SSE4A__`] [BOOST_HW_SIMD_X86_SSE4A_VERSION]]
  26. [[`__FMA4__`] [BOOST_HW_SIMD_X86_FMA4_VERSION]]
  27. [[`__XOP__`] [BOOST_HW_SIMD_X86_XOP_VERSION]]
  28. [[`BOOST_HW_SIMD_X86`] [BOOST_HW_SIMD_X86]]
  29. ]
  30. [note This predef includes every other x86 SIMD extensions and also has other
  31. more specific extensions (FMA4, XOP, SSE4a). You should use this predef
  32. instead of `BOOST_HW_SIMD_X86` to test if those specific extensions have
  33. been detected.]
  34. */
  35. #define BOOST_HW_SIMD_X86_AMD BOOST_VERSION_NUMBER_NOT_AVAILABLE
  36. // AMD CPUs also use x86 architecture. We first try to detect if any AMD
  37. // specific extension are detected, if yes, then try to detect more recent x86
  38. // common extensions.
  39. #undef BOOST_HW_SIMD_X86_AMD
  40. #if !defined(BOOST_HW_SIMD_X86_AMD) && defined(__XOP__)
  41. # define BOOST_HW_SIMD_X86_AMD BOOST_HW_SIMD_X86_AMD_XOP_VERSION
  42. #endif
  43. #if !defined(BOOST_HW_SIMD_X86_AMD) && defined(__FMA4__)
  44. # define BOOST_HW_SIMD_X86_AMD BOOST_HW_SIMD_X86_AMD_FMA4_VERSION
  45. #endif
  46. #if !defined(BOOST_HW_SIMD_X86_AMD) && defined(__SSE4A__)
  47. # define BOOST_HW_SIMD_X86_AMD BOOST_HW_SIMD_X86_AMD_SSE4A_VERSION
  48. #endif
  49. #if !defined(BOOST_HW_SIMD_X86_AMD)
  50. # define BOOST_HW_SIMD_X86_AMD BOOST_VERSION_NUMBER_NOT_AVAILABLE
  51. #else
  52. // At this point, we know that we have an AMD CPU, we do need to check for
  53. // other x86 extensions to determine the final version number.
  54. # include <boost/predef/hardware/simd/x86.h>
  55. # if BOOST_HW_SIMD_X86 > BOOST_HW_SIMD_X86_AMD
  56. # undef BOOST_HW_SIMD_X86_AMD
  57. # define BOOST_HW_SIMD_X86_AMD BOOST_HW_SIMD_X86
  58. # endif
  59. # define BOOST_HW_SIMD_X86_AMD_AVAILABLE
  60. #endif
  61. #define BOOST_HW_SIMD_X86_AMD_NAME "x86 (AMD) SIMD"
  62. #endif
  63. #include <boost/predef/detail/test.h>
  64. BOOST_PREDEF_DECLARE_TEST(BOOST_HW_SIMD_X86_AMD, BOOST_HW_SIMD_X86_AMD_NAME)