about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/x86_64/fpu/math-tests-arch.h24
-rw-r--r--sysdeps/x86_64/fpu/test-double-vlen4.c2
-rw-r--r--sysdeps/x86_64/fpu/test-float-vlen8.c2
3 files changed, 27 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.  */
diff --git a/sysdeps/x86_64/fpu/test-double-vlen4.c b/sysdeps/x86_64/fpu/test-double-vlen4.c
index 679397fa20..f0813437b4 100644
--- a/sysdeps/x86_64/fpu/test-double-vlen4.c
+++ b/sysdeps/x86_64/fpu/test-double-vlen4.c
@@ -25,4 +25,6 @@
 #define TEST_VECTOR_exp 1
 #define TEST_VECTOR_pow 1
 
+#define REQUIRE_AVX
+
 #include "libm-test.c"
diff --git a/sysdeps/x86_64/fpu/test-float-vlen8.c b/sysdeps/x86_64/fpu/test-float-vlen8.c
index 581cbdec16..891e58ff88 100644
--- a/sysdeps/x86_64/fpu/test-float-vlen8.c
+++ b/sysdeps/x86_64/fpu/test-float-vlen8.c
@@ -25,4 +25,6 @@
 #define TEST_VECTOR_expf 1
 #define TEST_VECTOR_powf 1
 
+#define REQUIRE_AVX
+
 #include "libm-test.c"