https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106902
--- Comment #22 from Alexander Monakov <amonakov at gcc dot gnu.org> --- Created attachment 55105 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55105&action=edit patch 1/3 (In reply to Richard Biener from comment #21) > > Sounds reasonable. Though I wouldn't use GENERIC folding but instead > some folding-like code in c-family/ that for example would get invoked > by genericization or via the gimplification hook? If we'd add GENERIC > folding in fold-const.cc or match.pd the chance is that it will pick up > FMAs "late". Agreed, thank you. I'm working on it. The attached patch implements this via c_gimplify_expr and passes bootstrap+regtest under 'configure --with-cpu=znver2' (i.e. with fma available by default).