Skip to content

Commit 778bdd5

Browse files
committed
@arnaud-lb suggestion, define HAVE_ZEND_CPU_SUPPORTS_CLDEMOTE to deduplicate lengthy #if checks
1 parent 99c5aa3 commit 778bdd5

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Zend/zend_cpuinfo.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ static inline int zend_cpu_supports_pclmul(void) {
289289

290290
/* __builtin_cpu_supports has cldemote from gcc11 and clang 19 */
291291
#if defined(PHP_HAVE_BUILTIN_CPU_SUPPORTS) && ((defined(__clang__) && (__clang_major__ >= 19)) || (!defined(__clang__) && defined(__GNUC__) && (ZEND_GCC_VERSION >= 11000)))
292+
#define HAVE_ZEND_CPU_SUPPORTS_CLDEMOTE 1
292293
ZEND_NO_SANITIZE_ADDRESS
293294
static inline int zend_cpu_supports_cldemote(void) {
294295
#ifdef PHP_HAVE_BUILTIN_CPU_INIT

ext/opcache/jit/zend_jit_ir.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* +----------------------------------------------------------------------+
1717
*/
1818

19+
#include "Zend/zend_cpuinfo.h"
1920
#include "Zend/zend_types.h"
2021
#include "Zend/zend_type_info.h"
2122
#include "jit/ir/ir.h"
@@ -3396,7 +3397,7 @@ static void zend_jit_setup(bool reattached)
33963397
if (zend_cpu_supports_avx()) {
33973398
allowed_opt_flags |= ZEND_JIT_CPU_AVX;
33983399
}
3399-
# if defined(PHP_HAVE_BUILTIN_CPU_SUPPORTS) && ((defined(__clang__) && (__clang_major__ >= 19)) || (!defined(__clang__) && defined(__GNUC__) && (ZEND_GCC_VERSION >= 11000)))
3400+
# ifdef HAVE_ZEND_CPU_SUPPORTS_CLDEMOTE
34003401
if (zend_cpu_supports_cldemote()) {
34013402
default_mflags |= IR_X86_CLDEMOTE;
34023403
}

0 commit comments

Comments
 (0)