summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/zend_portability.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h
index 02286da37b..4bbe023bdf 100644
--- a/Zend/zend_portability.h
+++ b/Zend/zend_portability.h
@@ -538,7 +538,12 @@ static zend_always_inline double _zend_get_nan(void) /* {{{ */
# define PHP_HAVE_SSE4_2
# endif
-# if PHP_HAVE_AVX2_INSTRUCTIONS && defined(HAVE_IMMINTRIN_H)
+/*
+ * AVX2 support was added in gcc 4.7, but AVX2 intrinsics don't work in
+ * __attribute__((target("avx2"))) functions until gcc 4.9.
+ */
+# if PHP_HAVE_AVX2_INSTRUCTIONS && defined(HAVE_IMMINTRIN_H) && \
+ (defined(__llvm__) || defined(__clang__) || (defined(__GNUC__) && ZEND_GCC_VERSION >= 4009))
# define PHP_HAVE_AVX2
# endif
#endif