https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109892
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org Status|NEW |ASSIGNED Summary|SLP failure with explicit |SLP reduction failure with |fma |explicit fma --- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- Vectorization of the following works with -O2 -mfma void f(double x[restrict], double *y, double *z) { x[0] = __builtin_fma (x[0], y[0], z[0]); x[1] = __builtin_fma (x[1], y[1], z[1]); } so SLP of fma() works. The issue is that the FMA is not supported as reduction operation: t3.c:4:12: note: vect_is_simple_use: operand r1_23 = PHI <r1_12(7), 0.0(6)>, type of def: reduction t3.c:4:12: missed: no reduc code for scalar code. Same for g() with -ffp-contract=on (and .FMA): t3.c:8:12: note: vect_is_simple_use: operand r1_23 = PHI <_12(7), 0.0(6)>, type of def: reduction t3.c:8:12: missed: no reduc code for scalar code. t3.c:5:8: missed: not vectorized: relevant stmt not supported: r1_23 = PHI <_12(7), 0.0(6)> t3.c:8:12: note: unsupported SLP instance starting from: _12 = .FMA (_2, _2, r1_23); We currently only support .FMAX and .FMIN, I have a pach to add .FMA.