shithub: libvpx

Download patch

ref: ab71db65a5e8aeb107e0eb4d5fd3e03ec7452b86
parent: 0e6ab498a109dcd1f9e0bf7e78e750d76dd7ccad
author: Tom Finegan <[email protected]>
date: Fri Jun 15 06:58:11 EDT 2018

Clean up avx512 compiler support test.

Moves the check into a function, check_gcc_avx512_compiles,
that behaves somewhat similarly to check_gcc_machine_options.

Change-Id: I2bef3ddd98e636eef12d9d5e548c43282fac7826

--- a/build/make/configure.sh
+++ b/build/make/configure.sh
@@ -426,6 +426,26 @@
   fi
 }
 
+check_gcc_avx512_compiles() {
+  if disabled gcc; then
+    return
+  fi
+
+  check_cc -mavx512f <<EOF
+#include <immintrin.h>
+void f(void) {
+  __m512i x = _mm512_set1_epi16(0);
+  (void)x;
+}
+EOF
+  compile_result=$?
+  if [ ${compile_result} -ne 0 ]; then
+    log_echo "    disabling avx512: not supported by compiler"
+    disable_feature avx512
+    RTCD_OPTIONS="${RTCD_OPTIONS}--disable-avx512 "
+  fi
+}
+
 write_common_config_banner() {
   print_webm_license config.mk "##" ""
   echo '# This file automatically generated by configure. Do not edit!' >> config.mk
@@ -1333,17 +1353,7 @@
         else
           if [ "$ext" = "avx512" ]; then
             check_gcc_machine_options $ext avx512f avx512cd avx512bw avx512dq avx512vl
-
-            # Confirm that the compiler really supports avx512.
-            if enabled gcc; then
-              check_cc -mavx512f <<EOF || RTCD_OPTIONS="${RTCD_OPTIONS}--disable-avx512 " && soft_disable avx512
-#include <immintrin.h>
-void f(void) {
-  __m512i x = _mm512_set1_epi16(0);
-  (void)x;
-}
-EOF
-            fi
+            check_gcc_avx512_compiles
           else
             # use the shortened version for the flag: sse4_1 -> sse4
             check_gcc_machine_option ${ext%_*} $ext