summaryrefslogtreecommitdiff
path: root/win32/build/confutils.js
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2018-01-29 18:24:27 +0100
committerAnatol Belski <ab@php.net>2018-01-29 18:26:03 +0100
commitacbd348969ea9f9a334c74dcc309da62e9bdc24e (patch)
tree02b2ec48a8a6c653344d615c9ebb18d87295c0c8 /win32/build/confutils.js
parente51aadcc4e48cdce049afda75e769bf1ff946ed3 (diff)
downloadphp-git-acbd348969ea9f9a334c74dcc309da62e9bdc24e.tar.gz
Implement configuration option for explicit native intrinsics
It mimics -march=native, AVX and more to go, if needed.
Diffstat (limited to 'win32/build/confutils.js')
-rw-r--r--win32/build/confutils.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/win32/build/confutils.js b/win32/build/confutils.js
index d588df78a7..c15af50a51 100644
--- a/win32/build/confutils.js
+++ b/win32/build/confutils.js
@@ -3219,6 +3219,53 @@ function toolset_setup_common_cflags()
}
}
+function toolset_setup_intrinsic_cflags()
+{
+ var default_enabled = "sse2";
+ /* XXX AVX and above needs to be reflected in /arch, for now SSE4.2 is
+ the best possible optimization.*/
+ var avail = WScript.CreateObject("Scripting.Dictionary");
+ avail.Add("sse", "__SSE__");
+ avail.Add("sse2", "__SSE2__");
+ avail.Add("sse3", "__SSE3__");
+ avail.Add("ssse3", "__SSSE3__");
+ avail.Add("sse4.1", "__SSE4_1__");
+ avail.Add("sse4.2", "__SSE4_2__");
+ /* From oldest to newest. */
+ var scale = new Array("sse", "sse2", "sse3", "ssse3", "sse4.1", "sse4.2");
+
+ if (VS_TOOLSET) {
+ if ("no" == PHP_NATIVE_INTRINSICS || "yes" == PHP_NATIVE_INTRINSICS) {
+ PHP_NATIVE_INTRINSICS = default_enabled;
+ }
+
+ if ("all" == PHP_NATIVE_INTRINSICS) {
+ var list = (new VBArray(avail.Keys())).toArray();
+
+ for (var i in list) {
+ AC_DEFINE(avail.Item(list[i]), 1);
+ }
+ } else {
+ var list = PHP_NATIVE_INTRINSICS.split(",");
+ var j = 0;
+ for (var k = 0; k < scale.length; k++) {
+ for (var i = 0; i < list.length; i++) {
+ var it = list[i].toLowerCase();
+ if (scale[k] == it) {
+ j = k > j ? k : j;
+ } else if (!avail.Exists(it)) {
+ WARNING("Unknown intrinsic name '" + it + "' ignored");
+ }
+ }
+ }
+ for (var i = 0; i <= j; i++) {
+ var it = scale[i];
+ AC_DEFINE(avail.Item(it), 1);
+ }
+ }
+ }
+}
+
function toolset_setup_common_ldlags()
{
// General DLL link flags