summaryrefslogtreecommitdiff
path: root/Zend/zend_cpuinfo.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-11-27 17:04:50 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-11-27 17:04:50 +0100
commit08919578ca1a537e3294f357b3551778898dc793 (patch)
treef30721da32e7461e0c27bfb6e470ff9604f5705e /Zend/zend_cpuinfo.c
parente5aae358554d09dff75b81970d2ab3f03968fe09 (diff)
parent3430d856acd7d9e7cd85fc871450eef24dc85d93 (diff)
downloadphp-git-08919578ca1a537e3294f357b3551778898dc793.tar.gz
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: Fix build for non-x86
Diffstat (limited to 'Zend/zend_cpuinfo.c')
-rw-r--r--Zend/zend_cpuinfo.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/Zend/zend_cpuinfo.c b/Zend/zend_cpuinfo.c
index 1b268931ed..529ab529a3 100644
--- a/Zend/zend_cpuinfo.c
+++ b/Zend/zend_cpuinfo.c
@@ -73,20 +73,21 @@ static void __zend_cpuid(uint32_t func, uint32_t subfunc, zend_cpu_info *cpuinfo
}
#endif
+#if defined(__i386__) || defined(__x86_64__)
/* Function based on compiler-rt implementation. */
static unsigned get_xcr0_eax() {
-#if defined(__GNUC__) || defined(__clang__)
+# if defined(__GNUC__) || defined(__clang__)
// Check xgetbv; this uses a .byte sequence instead of the instruction
// directly because older assemblers do not include support for xgetbv and
// there is no easy way to conditionally compile based on the assembler used.
unsigned eax, edx;
__asm__(".byte 0x0f, 0x01, 0xd0" : "=a"(eax), "=d"(edx) : "c"(0));
return eax;
-#elif defined(ZEND_WIN32) && defined(_XCR_XFEATURE_ENABLED_MASK)
+# elif defined(ZEND_WIN32) && defined(_XCR_XFEATURE_ENABLED_MASK)
return _xgetbv(_XCR_XFEATURE_ENABLED_MASK);
-#else
+# else
return 0;
-#endif
+# endif
}
static zend_bool is_avx_supported() {
@@ -104,6 +105,11 @@ static zend_bool is_avx_supported() {
}
return 1;
}
+#else
+static zend_bool is_avx_supported() {
+ return 0;
+}
+#endif
void zend_cpu_startup(void)
{