]> granicus.if.org Git - php/commitdiff
Rework --with-codegen-arch and --enable-native-intrinsics config
authorAnatol Belski <ab@php.net>
Fri, 16 Feb 2018 15:23:27 +0000 (16:23 +0100)
committerAnatol Belski <ab@php.net>
Fri, 16 Feb 2018 15:23:27 +0000 (16:23 +0100)
win32/build/config.w32
win32/build/confutils.js

index 7697838bb151141f35ff2fe78533a84cca94b516..8eccd14d271fa79c658e5ea9911f696d6808a9ad 100644 (file)
@@ -325,7 +325,7 @@ if (CLANG_TOOLSET) {
        }
 }
 
-ARG_WITH("codegen-arch", "Architecture for code generation: ia32, sse, sse2, avx, avx2", "no");
+ARG_WITH("codegen-arch", "Architecture for code generation: ia32. Use --enable-native-intrinsics to enable SIMD optimizations.", "no");
 toolset_setup_codegen_arch();
 
 ARG_WITH("all-shared", "Force all the non obligatory extensions to be shared", "no");
@@ -343,9 +343,10 @@ ARG_WITH("test-ini-ext-exclude", "Comma separated list of shared extensions to \
                be excluded from the test.ini", "no");
 
 ARG_ENABLE("native-intrinsics", "Comma separated list of intrinsic optimizations to enable. \
-       Available optimization names are sse, sse2, sse4.1, sse4.2. SSE and SSE2 are enabled \
-       by default. The best optimization specified will automatically enable all the older \
-       optimizations. Note, that the produced binary might not work properly, if the \
-       optimizations are not available on the target processor.", "no");
+       Available optimization names are sse, sse2, sse3, ssse3, sse4.1, sse4.2, avx, avx2. \
+       SSE and SSE2 are enabled by default. The best optimization specified will \
+       automatically enable all the older optimizations. Note, that the produced binary \
+       might not work properly, if the optimizations are not available on the target \
+       processor.", "no");
 toolset_setup_intrinsic_cflags();
 
index 41d1541bd9f8664e6ed407d796d22d3c8eedc8ba..2115078bea689219921f5fc7612268dc0ee5747c 100644 (file)
@@ -3122,16 +3122,20 @@ function toolset_setup_arch()
 
 function toolset_setup_codegen_arch()
 {
-       if("no" == PHP_CODEGEN_ARCH) {
+       if("no" == PHP_CODEGEN_ARCH || "yes" == PHP_CODEGEN_ARCH) {
                return;
        }
 
        if (VS_TOOLSET) {
                var arc = PHP_CODEGEN_ARCH.toUpperCase();
 
-               if ("AVX2" == arc || "AVX" == arc || "SSE2" == arc || "SSE" == arc || "IA32" == arc) {
-                       ADD_FLAG("CFLAGS", "/arch:" + arc);
+               if ("IA32" != arc) {
+                       ERROR("Only IA32 arch is supported by --with-codegen-arch, got '" + arc + "'");
+               } else if (X64) {
+                       ERROR("IA32 arch is only supported with 32-bit build");
                }
+               ADD_FLAG("CFLAGS", "/arch:" + arc);
+               PHP_NATIVE_INTRINSICS = "disabled";
        }
 }
 
@@ -3236,6 +3240,10 @@ function toolset_setup_intrinsic_cflags()
        var scale = new Array("sse", "sse2", "sse3", "ssse3", "sse4.1", "sse4.2", "avx", "avx2");
 
        if (VS_TOOLSET) {
+               if ("disabled" == PHP_NATIVE_INTRINSICS) {
+                       ERROR("Can't enable intrinsics, --with-codegen-arch passed with an incompatible option. ")
+               }
+
                if ("no" == PHP_NATIVE_INTRINSICS || "yes" == PHP_NATIVE_INTRINSICS) {
                        PHP_NATIVE_INTRINSICS = default_enabled;
                }