Skip to content

Commit 87b7e6d

Browse files
committed
Only disable SLP autovectorization for gcc10+
Disabling SLP autovectorization is a performance regression for earlier versions of GCC.
1 parent 45c447b commit 87b7e6d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Python/ceval.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -948,11 +948,13 @@ _PyObjectArray_Free(PyObject **array, PyObject **scratch)
948948
#include "generated_cases.c.h"
949949
#endif
950950

951-
#if (defined(__GNUC__) && !defined(__clang__)) && defined(__x86_64__)
951+
#if (defined(__GNUC__) && !defined(__clang__)) && defined(__x86_64__) && (__GNUC__ >= 10)
952952
/*
953-
* gh-129987: The SLP autovectorizer can cause poor code generation for opcode
954-
* dispatch, negating any benefit we get from vectorization elsewhere in the
955-
* interpreter loop.
953+
* gh-129987: The SLP autovectorizer in GCC can cause poor code generation for
954+
* opcode dispatch in GCC 12 onwards, negating any benefit we get from
955+
* vectorization elsewhere in the interpreter loop. Disabling autovectorization
956+
* doesn't affect performance in versions 10 and 11, but it regresses
957+
* performance in earlier versions of GCC.
956958
*/
957959
#define DONT_SLP_VECTORIZE __attribute__((optimize ("no-tree-slp-vectorize")))
958960
#else

0 commit comments

Comments
 (0)