about summary refs log tree commit diff
path: root/sysdeps/x86_64/fpu/math-tests-arch.h
diff options
context:
space:
mode:
authorAndrew Senkevich <andrew.senkevich@intel.com>2015-07-29 19:47:29 +0300
committerAndrew Senkevich <andrew.senkevich@intel.com>2015-07-29 19:47:29 +0300
commitfebce2ac5f46a0d5c67ca8b535a028425d421be4 (patch)
treeb4c8219af11da6b85662437157ef77222236f5d9 /sysdeps/x86_64/fpu/math-tests-arch.h
parent95d8f022bf0795cbac473c4f6182595e75cafe5f (diff)
downloadglibc-febce2ac5f46a0d5c67ca8b535a028425d421be4.tar.gz
glibc-febce2ac5f46a0d5c67ca8b535a028425d421be4.tar.xz
glibc-febce2ac5f46a0d5c67ca8b535a028425d421be4.zip
Added runtime check for AVX vector math tests.
    [BZ #18731]
    * sysdeps/x86_64/fpu/math-tests-arch.h: Added AVX runtime check.
    * sysdeps/x86_64/fpu/test-double-vlen4.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8.c: Likewise.
Diffstat (limited to 'sysdeps/x86_64/fpu/math-tests-arch.h')
-rw-r--r--sysdeps/x86_64/fpu/math-tests-arch.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/sysdeps/x86_64/fpu/math-tests-arch.h b/sysdeps/x86_64/fpu/math-tests-arch.h
index 56714f5142..e8833bfe0a 100644
--- a/sysdeps/x86_64/fpu/math-tests-arch.h
+++ b/sysdeps/x86_64/fpu/math-tests-arch.h
@@ -16,7 +16,29 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#if defined REQUIRE_AVX2
+#if defined REQUIRE_AVX
+# include <init-arch.h>
+
+/* Set to 1 if AVX supported.  */
+static int avx_usable;
+
+# define INIT_ARCH_EXT                                         \
+  do                                                           \
+    {                                                          \
+      __init_cpu_features ();                                  \
+      avx_usable = __cpu_features.feature[index_AVX_Usable]    \
+                   & bit_AVX_Usable;                           \
+    }                                                          \
+  while (0)
+
+# define CHECK_ARCH_EXT                                        \
+  do                                                           \
+    {                                                          \
+      if (!avx_usable) return;                                 \
+    }                                                          \
+  while (0)
+
+#elif defined REQUIRE_AVX2
 # include <init-arch.h>
 
   /* Set to 1 if AVX2 supported.  */