have_sse.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright 2018 The Abseil Authors.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // https://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. //
  15. // Shared config probing for SSE instructions used in Swiss tables.
  16. #ifndef ABSL_CONTAINER_INTERNAL_HAVE_SSE_H_
  17. #define ABSL_CONTAINER_INTERNAL_HAVE_SSE_H_
  18. #ifndef ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSE2
  19. #if defined(__SSE2__) || \
  20. (defined(_MSC_VER) && \
  21. (defined(_M_X64) || (defined(_M_IX86) && _M_IX86_FP >= 2)))
  22. #define ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSE2 1
  23. #else
  24. #define ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSE2 0
  25. #endif
  26. #endif
  27. #ifndef ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSSE3
  28. #ifdef __SSSE3__
  29. #define ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSSE3 1
  30. #else
  31. #define ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSSE3 0
  32. #endif
  33. #endif
  34. #if ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSSE3 && \
  35. !ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSE2
  36. #error "Bad configuration!"
  37. #endif
  38. #if ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSE2
  39. #include <emmintrin.h>
  40. #endif
  41. #if ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSSE3
  42. #include <tmmintrin.h>
  43. #endif
  44. #endif // ABSL_CONTAINER_INTERNAL_HAVE_SSE_H_