Skip to content

Commit 800ff06

Browse files
committed
Move HAVE_ASM_GOTO and HAVE_AARCH64_CRC32
- HAVE_AARCH64_CRC32 is now defined in the ext/standard - HAVE_ASM_GOTO is now defined in the Zend
1 parent 82ebe22 commit 800ff06

File tree

6 files changed

+57
-58
lines changed

6 files changed

+57
-58
lines changed

cmake/Zend/CMakeLists.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,28 @@ cmake_pop_check_state()
418418
check_symbol_exists(pthread_stackseg_np "pthread.h" HAVE_PTHREAD_STACKSEG_NP)
419419
check_symbol_exists(sigsetjmp "setjmp.h" HAVE_SIGSETJMP)
420420

421+
message(CHECK_START "Checking for asm goto support")
422+
cmake_push_check_state(RESET)
423+
set(CMAKE_REQUIRED_QUIET TRUE)
424+
check_source_compiles(C [[
425+
int main(void)
426+
{
427+
#if defined(__x86_64__) || defined(__i386__)
428+
__asm__ goto("jmp %l0\n" :::: end);
429+
#elif defined(__aarch64__)
430+
__asm__ goto("b %l0\n" :::: end);
431+
#endif
432+
end:
433+
return 0;
434+
}
435+
]] HAVE_ASM_GOTO)
436+
cmake_pop_check_state()
437+
if(HAVE_ASM_GOTO)
438+
message(CHECK_PASS "yes")
439+
else()
440+
message(CHECK_FAIL "no")
441+
endif()
442+
421443
message(CHECK_START "Checking whether __cpuid_count is available")
422444
cmake_push_check_state(RESET)
423445
set(CMAKE_REQUIRED_QUIET TRUE)

cmake/Zend/zend_config.cmake.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
/* Define to 1 if _FPU_SETCW is present and usable. */
1111
#cmakedefine HAVE__FPU_SETCW 1
1212

13+
/* Define to 1 if asm goto support is available. */
14+
#cmakedefine HAVE_ASM_GOTO 1
15+
1316
/* Define to 1 if '__cpuid_count' is available. */
1417
#cmakedefine HAVE_CPUID_COUNT 1
1518

cmake/cmake/ConfigureChecks.cmake

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -251,29 +251,6 @@ include(PHP/CheckInline)
251251
# Check AVX-512 extensions.
252252
include(PHP/CheckAVX512)
253253

254-
# Check for asm goto.
255-
message(CHECK_START "Checking for asm goto support")
256-
cmake_push_check_state(RESET)
257-
set(CMAKE_REQUIRED_QUIET TRUE)
258-
check_source_compiles(C [[
259-
int main(void)
260-
{
261-
#if defined(__x86_64__) || defined(__i386__)
262-
__asm__ goto("jmp %l0\n" :::: end);
263-
#elif defined(__aarch64__)
264-
__asm__ goto("b %l0\n" :::: end);
265-
#endif
266-
end:
267-
return 0;
268-
}
269-
]] HAVE_ASM_GOTO)
270-
cmake_pop_check_state()
271-
if(HAVE_ASM_GOTO)
272-
message(CHECK_PASS "yes")
273-
else()
274-
message(CHECK_FAIL "no")
275-
endif()
276-
277254
################################################################################
278255
# Check functions.
279256
################################################################################
@@ -473,35 +450,6 @@ endif()
473450
# Check how flush should be called.
474451
include(PHP/CheckFlushIo)
475452

476-
# Check for aarch64 CRC32 API.
477-
message(CHECK_START "Checking for aarch64 CRC32 API availability")
478-
cmake_push_check_state(RESET)
479-
set(CMAKE_REQUIRED_QUIET TRUE)
480-
check_source_compiles(C [[
481-
#include <arm_acle.h>
482-
# if defined(__GNUC__)
483-
# if!defined(__clang__)
484-
# pragma GCC push_options
485-
# pragma GCC target ("+nothing+crc")
486-
# elif defined(__APPLE__)
487-
# pragma clang attribute push(__attribute__((target("crc"))), apply_to=function)
488-
# else
489-
# pragma clang attribute push(__attribute__((target("+nothing+crc"))), apply_to=function)
490-
# endif
491-
# endif
492-
int main(void)
493-
{
494-
__crc32d(0, 0);
495-
return 0;
496-
}
497-
]] HAVE_AARCH64_CRC32)
498-
cmake_pop_check_state()
499-
if(HAVE_AARCH64_CRC32)
500-
message(CHECK_PASS "yes")
501-
else()
502-
message(CHECK_FAIL "no")
503-
endif()
504-
505453
if(HAVE_ALLOCA_H)
506454
# Most *.nix systems.
507455
check_symbol_exists(alloca "alloca.h" HAVE_ALLOCA)

cmake/ext/standard/CMakeLists.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,35 @@ include(cmake/CheckFnmatch.cmake)
282282
# Check strptime().
283283
include(cmake/CheckStrptime.cmake)
284284

285+
# Check for aarch64 CRC32 API.
286+
message(CHECK_START "Checking for aarch64 CRC32 API availability")
287+
cmake_push_check_state(RESET)
288+
set(CMAKE_REQUIRED_QUIET TRUE)
289+
check_source_compiles(C [[
290+
#include <arm_acle.h>
291+
# if defined(__GNUC__)
292+
# if!defined(__clang__)
293+
# pragma GCC push_options
294+
# pragma GCC target ("+nothing+crc")
295+
# elif defined(__APPLE__)
296+
# pragma clang attribute push(__attribute__((target("crc"))), apply_to=function)
297+
# else
298+
# pragma clang attribute push(__attribute__((target("+nothing+crc"))), apply_to=function)
299+
# endif
300+
# endif
301+
int main(void)
302+
{
303+
__crc32d(0, 0);
304+
return 0;
305+
}
306+
]] HAVE_AARCH64_CRC32)
307+
cmake_pop_check_state()
308+
if(HAVE_AARCH64_CRC32)
309+
message(CHECK_PASS "yes")
310+
else()
311+
message(CHECK_FAIL "no")
312+
endif()
313+
285314
# Check if there is a support means of creating a new process and defining which
286315
# handles it receives.
287316
message(CHECK_START "Checking if OS can spawn processes with inherited handles")

cmake/ext/standard/config.cmake.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
/* Define to 1 to enable the 'chroot' function. */
1111
#cmakedefine ENABLE_CHROOT_FUNC 1
1212

13+
/* Define to 1 when aarch64 CRC32 API is available. */
14+
#cmakedefine HAVE_AARCH64_CRC32 1
15+
1316
/* Define to 1 if the system has the 'libargon2' library. */
1417
#cmakedefine HAVE_ARGON2LIB 1
1518

cmake/main/php_config.cmake.h.in

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@
5858
and to string "0" if they are not. */
5959
#define DEFAULT_SHORT_OPEN_TAG "@DEFAULT_SHORT_OPEN_TAG@"
6060

61-
/* Define to 1 when aarch64 CRC32 API is available. */
62-
#cmakedefine HAVE_AARCH64_CRC32 1
63-
6461
/* Define to 1 if the compiler supports '__alignof__'. */
6562
#cmakedefine HAVE_ALIGNOF 1
6663

@@ -82,9 +79,6 @@
8279
/* Define to 1 if you have the 'asctime_r' function. */
8380
#cmakedefine HAVE_ASCTIME_R 1
8481

85-
/* Define to 1 if asm goto support is available. */
86-
#cmakedefine HAVE_ASM_GOTO 1
87-
8882
/* Define to 1 if you have the 'asprintf' function. */
8983
#cmakedefine HAVE_ASPRINTF 1
9084

0 commit comments

Comments
 (0)