test-fenv-clear-sse.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* Test fesetenv (FE_DFL_ENV) and fesetenv (FE_NOMASK_ENV) clear
  2. exceptions (bug 19181). SSE version.
  3. Copyright (C) 2015-2019 Free Software Foundation, Inc.
  4. This file is part of the GNU C Library.
  5. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with the GNU C Library; if not, see
  15. <http://www.gnu.org/licenses/>. */
  16. #include <cpuid.h>
  17. #include <stdbool.h>
  18. static bool
  19. have_sse2 (void)
  20. {
  21. unsigned int eax, ebx, ecx, edx;
  22. if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
  23. return false;
  24. return (edx & bit_SSE2) != 0;
  25. }
  26. #define CHECK_CAN_TEST \
  27. do \
  28. { \
  29. if (!have_sse2 ()) \
  30. { \
  31. puts ("CPU does not support SSE2, cannot test"); \
  32. return 0; \
  33. } \
  34. } \
  35. while (0)
  36. #include <test-fenv-clear-main.c>