https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116979
Bug ID: 116979 Summary: [12 regression] fma not always used in complex product Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: vincenzo.innocente at cern dot ch Target Milestone: --- since gcc 12 fma is not always used in the product of complex numbers. example in "mul" no fma is emitted while is emitted for the inline product in main (the fma result is more precise!) so that for gcc version 15.0.0 20240925 (experimental) [master r15-3869-g7cf85d137ba] (GCC) c++ -O3 cplxMul.cpp -mfma ./a.out 0x1.6912cap-41f -0x1.69020ap-41f 0x1.d16ed4p-85f 0x1.6b497ep-110f t1=(0x1.483bbap-125,-0x1.482c7ep-125) t2=(0x1.483bbcp-125,-0x1.482c7cp-125) assembler output in https://godbolt.org/z/q4bYMffKd #include <cstdio> #include <complex> // ./a.out 0x1.6912cap-41f -0x1.69020ap-41f 0x1.d16ed4p-85f 0x1.6b497ep-110f std::complex<float> __attribute__ ((noinline)) mul(std::complex<float> const & a, std::complex<float> const & b) { return a*b; } int main(int argc, char** argv) { std::complex<float> z1{atof(argv[1]),atof(argv[2])}; std::complex<float> z2{atof(argv[3]),atof(argv[4])}; std::complex<float> t1 = z1*z2; std::complex<float> t2 = mul(z1,z2); printf ("t1=(%a,%a)\n", t1.real(), t1.imag()); printf ("t2=(%a,%a)\n", t2.real(), t2.imag()); return 0; }