Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/scripts/windows/build_task.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,18 @@ if %errorlevel% neq 0 exit /b 3
if "%THREAD_SAFE%" equ "0" set ADD_CONF=%ADD_CONF% --disable-zts
if "%INTRINSICS%" neq "" set ADD_CONF=%ADD_CONF% --enable-native-intrinsics=%INTRINSICS%
if "%ASAN%" equ "1" set ADD_CONF=%ADD_CONF% --enable-sanitizer --enable-debug-pack
if "%CLANG_TOOLSET%" equ "1" set ADD_CONF=%ADD_CONF% --with-toolset=clang

rem C4018: comparison: signed/unsigned mismatch
rem C4146: unary minus operator applied to unsigned type
rem C4244: type conversion, possible loss of data
rem C4267: 'size_t' type conversion, possible loss of data
set CFLAGS=/W3 /WX /wd4018 /wd4146 /wd4244 /wd4267
if "%CLANG_TOOLSET%" equ "1" (
rem Clang is much stricter than MSVC, produces too many warnings that would fail the build with /WX
set CFLAGS=/W3 /wd4018 /wd4146 /wd4244 /wd4267
) else (
set CFLAGS=/W3 /WX /wd4018 /wd4146 /wd4244 /wd4267
)

cmd /c configure.bat ^
--enable-snapshot-build ^
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,35 @@ jobs:
run: .github/scripts/windows/build.bat
- name: Test
run: .github/scripts/windows/test.bat
WINDOWS_CLANG:
if: ${{ fromJson(inputs.branch).jobs.WINDOWS }}
name: "WINDOWS_X64_ZTS_CLANG"
runs-on: windows-2022
env:
PHP_BUILD_CACHE_BASE_DIR: C:\build-cache
PHP_BUILD_OBJ_DIR: C:\obj
PHP_BUILD_CACHE_SDK_DIR: C:\build-cache\sdk
PHP_BUILD_SDK_BRANCH: php-sdk-2.5.0
PHP_BUILD_CRT: ${{ fromJson(inputs.branch).jobs.WINDOWS.config.vs_crt_version }}
PLATFORM: x64
THREAD_SAFE: "1"
INTRINSICS: "AVX2"
PARALLEL: -j2
OPCACHE: "1"
CLANG_TOOLSET: "1"
steps:
- name: git config
run: git config --global core.autocrlf false && git config --global core.eol lf
- name: git checkout
uses: actions/checkout@v6
with:
ref: ${{ fromJson(inputs.branch).ref }}
- name: Setup
uses: ./.github/actions/setup-windows
- name: Build
run: .github/scripts/windows/build.bat
- name: Test
run: .github/scripts/windows/test.bat
FREEBSD:
if: ${{ fromJson(inputs.branch).jobs.FREEBSD }}
strategy:
Expand Down
7 changes: 6 additions & 1 deletion TSRM/TSRM.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,14 @@ TSRM_API bool tsrm_is_managed_thread(void);
#define TSRMG_BULK_STATIC(id, type) ((type) (*((void ***) TSRMLS_CACHE))[TSRM_UNSHUFFLE_RSRC_ID(id)])
#define TSRMG_FAST_STATIC(offset, type, element) (TSRMG_FAST_BULK_STATIC(offset, type)->element)
#define TSRMG_FAST_BULK_STATIC(offset, type) ((type) (((char*) TSRMLS_CACHE)+(offset)))
#ifdef __cplusplus
#define TSRMLS_MAIN_CACHE_EXTERN() extern "C" { extern TSRM_TLS void *TSRMLS_CACHE TSRM_TLS_MODEL_ATTR; }
#define TSRMLS_CACHE_EXTERN() extern "C" { extern TSRM_TLS void *TSRMLS_CACHE; }
#else
#define TSRMLS_MAIN_CACHE_EXTERN() extern TSRM_TLS void *TSRMLS_CACHE TSRM_TLS_MODEL_ATTR;
#define TSRMLS_MAIN_CACHE_DEFINE() TSRM_TLS void *TSRMLS_CACHE TSRM_TLS_MODEL_ATTR = NULL;
#define TSRMLS_CACHE_EXTERN() extern TSRM_TLS void *TSRMLS_CACHE;
#endif
#define TSRMLS_MAIN_CACHE_DEFINE() TSRM_TLS void *TSRMLS_CACHE TSRM_TLS_MODEL_ATTR = NULL;
#define TSRMLS_CACHE_DEFINE() TSRM_TLS void *TSRMLS_CACHE = NULL;
#define TSRMLS_CACHE_UPDATE() TSRMLS_CACHE = tsrm_get_ls_cache()
#define TSRMLS_CACHE _tsrm_ls_cache
Expand Down
105 changes: 55 additions & 50 deletions win32/build/confutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3363,7 +3363,7 @@ function toolset_setup_common_cflags()

ADD_FLAG("CFLAGS", "/Zc:wchar_t");
} else if (CLANG_TOOLSET) {
ADD_FLAG("CFLAGS", "-Wno-deprecated-declarations");
ADD_FLAG("CFLAGS", "-Wno-deprecated-declarations -Wno-microsoft-enum-forward-reference");
if (TARGET_ARCH == 'x86') {
ADD_FLAG('CFLAGS', '-m32');
} else {
Expand Down Expand Up @@ -3397,24 +3397,24 @@ function toolset_setup_intrinsic_cflags()
/* From oldest to newest. */
var scale = new Array("sse", "sse2", "sse3", "ssse3", "sse4.1", "sse4.2", "avx", "avx2", "avx512");

if (VS_TOOLSET) {
if ("disabled" == PHP_NATIVE_INTRINSICS) {
ERROR("Can't enable intrinsics, --with-codegen-arch passed with an incompatible option. ")
}
if ("disabled" == PHP_NATIVE_INTRINSICS || "no" == PHP_NATIVE_INTRINSICS) {
return;
}

if (TARGET_ARCH == 'arm64') {
/* arm64 supports neon */
configure_subst.Add("PHP_SIMD_SCALE", 'NEON');
/* all officially supported arm64 cpu supports crc32 (TODO: to be confirmed) */
AC_DEFINE('HAVE_ARCH64_CRC32', 1);
return;
}
if (TARGET_ARCH == 'arm64') {
/* arm64 supports neon */
configure_subst.Add("PHP_SIMD_SCALE", 'NEON');
/* all officially supported arm64 cpu supports crc32 (TODO: to be confirmed) */
AC_DEFINE('HAVE_ARCH64_CRC32', 1);
return;
}

if ("no" == PHP_NATIVE_INTRINSICS || "yes" == PHP_NATIVE_INTRINSICS) {
PHP_NATIVE_INTRINSICS = default_enabled;
}
if ("yes" == PHP_NATIVE_INTRINSICS) {
PHP_NATIVE_INTRINSICS = default_enabled;
}

if ("all" == PHP_NATIVE_INTRINSICS) {
if ("all" == PHP_NATIVE_INTRINSICS) {
if (VS_TOOLSET) {
var list = (new VBArray(avail.Keys())).toArray();

for (var i in list) {
Expand All @@ -3423,42 +3423,47 @@ function toolset_setup_intrinsic_cflags()

/* All means all. __AVX__, __AVX2__, and __AVX512*__ are defined by compiler. */
ADD_FLAG("CFLAGS","/arch:AVX512");
configure_subst.Add("PHP_SIMD_SCALE", "AVX512");
} 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) && "avx512" != it && "avx2" != it && "avx" != it) {
WARNING("Unknown intrinsic name '" + it + "' ignored");
}
}
}
if (TARGET_ARCH == 'x86') {
/* SSE2 is currently the default on 32-bit. It could change later,
for now no need to pass it. But, if SSE only was chosen,
/arch:SSE is required. */
if ("sse" == scale[j]) {
ADD_FLAG("CFLAGS","/arch:SSE");
} else if (CLANG_TOOLSET) {
ADD_FLAG("CFLAGS","-mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl");
}
configure_subst.Add("PHP_SIMD_SCALE", "AVX512");
} 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) && "avx512" != it && "avx2" != it && "avx" != it) {
WARNING("Unknown intrinsic name '" + it + "' ignored");
}
}
configure_subst.Add("PHP_SIMD_SCALE", scale[j].toUpperCase());
/* There is no explicit way to enable intrinsics between SSE3 and SSE4.2.
The declared macros therefore won't affect the code generation,
but will enable the guarded code parts. */
if ("avx512" == scale[j]) {
ADD_FLAG("CFLAGS","/arch:AVX512");
j -= 3;
} else if ("avx2" == scale[j]) {
ADD_FLAG("CFLAGS","/arch:AVX2");
j -= 2;
} else if ("avx" == scale[j]) {
ADD_FLAG("CFLAGS","/arch:AVX");
j -= 1;
}
}
if (TARGET_ARCH == 'x86') {
/* SSE2 is currently the default on 32-bit. It could change later,
for now no need to pass it. But, if SSE only was chosen,
/arch:SSE is required. */
if ("sse" == scale[j]) {
ADD_FLAG("CFLAGS", VS_TOOLSET ? "/arch:SSE" : "-msse");
}
}
configure_subst.Add("PHP_SIMD_SCALE", scale[j].toUpperCase());
/* There is no explicit way to enable intrinsics between SSE3 and SSE4.2.
The declared macros therefore won't affect the code generation,
but will enable the guarded code parts. */
if ("avx512" == scale[j]) {
ADD_FLAG("CFLAGS", VS_TOOLSET ? "/arch:AVX512" : "-mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl");
j -= 3;
} else if ("avx2" == scale[j]) {
ADD_FLAG("CFLAGS", VS_TOOLSET ? "/arch:AVX2" : "-mavx2");
j -= 2;
} else if ("avx" == scale[j]) {
ADD_FLAG("CFLAGS", VS_TOOLSET ? "/arch:AVX" : "-mavx");
j -= 1;
}
if (VS_TOOLSET) {
/* MSVC doesn't auto-define SSE macros; clang does with -m flags */
for (var i = 0; i <= j; i++) {
var it = scale[i];
AC_DEFINE(avail.Item(it), 1);
Expand Down
Loading