Rework --with-codegen-arch and --enable-native-intrinsics config

This commit is contained in:
Anatol Belski 2018-02-16 16:23:27 +01:00
parent abf5534113
commit d9994ff7b2
2 changed files with 17 additions and 8 deletions

View 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();

View 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;
}