Skip to content

Commit 3430d85

Browse files
committed
Fix build for non-x86
1 parent 4e30ab3 commit 3430d85

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Diff for: Zend/zend_cpuinfo.c

+10-4
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,21 @@ static void __zend_cpuid(uint32_t func, uint32_t subfunc, zend_cpu_info *cpuinfo
7373
}
7474
#endif
7575

76+
#if defined(__i386__) || defined(__x86_64__)
7677
/* Function based on compiler-rt implementation. */
7778
static unsigned get_xcr0_eax() {
78-
#if defined(__GNUC__) || defined(__clang__)
79+
# if defined(__GNUC__) || defined(__clang__)
7980
// Check xgetbv; this uses a .byte sequence instead of the instruction
8081
// directly because older assemblers do not include support for xgetbv and
8182
// there is no easy way to conditionally compile based on the assembler used.
8283
unsigned eax, edx;
8384
__asm__(".byte 0x0f, 0x01, 0xd0" : "=a"(eax), "=d"(edx) : "c"(0));
8485
return eax;
85-
#elif defined(ZEND_WIN32) && defined(_XCR_XFEATURE_ENABLED_MASK)
86+
# elif defined(ZEND_WIN32) && defined(_XCR_XFEATURE_ENABLED_MASK)
8687
return _xgetbv(_XCR_XFEATURE_ENABLED_MASK);
87-
#else
88+
# else
8889
return 0;
89-
#endif
90+
# endif
9091
}
9192

9293
static zend_bool is_avx_supported() {
@@ -104,6 +105,11 @@ static zend_bool is_avx_supported() {
104105
}
105106
return 1;
106107
}
108+
#else
109+
static zend_bool is_avx_supported() {
110+
return 0;
111+
}
112+
#endif
107113

108114
void zend_cpu_startup(void)
109115
{

0 commit comments

Comments
 (0)