https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124802
Bug ID: 124802
Summary: [15/16 Regression] Wrong code at -O2 with AVX2 complex
double fmaddsub pattern
Product: gcc
Version: 15.2.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: Sarvesh.Chandra at amd dot com
CC: vekumar at gcc dot gnu.org
Target Milestone: ---
Host: x86_64-linux-gnu
Target: x86_64-linux-gnu
GCC 15/16 generates wrong code at -O2/-O3 for a complex double
multiply-accumulate kernel using _mm256_fmaddsub_pd. The attached
testcase aborts at runtime.
Compiles and runs correctly with GCC 14.2.0.
Adding -fno-tree-slp-vectorize works around the bug.
Bisected to r15-2816-gab18785840d "Rearrange SLP nodes with
duplicate statements [PR98138]". The parent r15-2815-g71aebb36174
produces correct results.
$ g++ -O2 -mavx2 -mfma pr98138-wrongcode.c -o test && ./test
Aborted
Tested on x86_64-linux-gnu (AMD Zen 4).