https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104405
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2022-02-06 Keywords| |ra Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- This has nothing to do with expansion of IMAGPART_EXPR here but rather the reuturn side. Note the x86 issue is different from the aarch64 issue Here is a testcase which shows it is just return side related: _Complex double f1 ( double ar, double ai, double br, double bi, double *t) { double _14, _16, _17, _3; _14 = ai * bi; _16 = ai * br; _17 = -(ar*br)+_14; _3 = (-(ar*bi)-_16); return __builtin_complex(_3, _17); } Also adding -fno-schedule-insns for the above testcase removes all of the extra move instructions. The big question becomes now is really an issue in real world code or just a toy benchmark which is testing argument/return passing optimizations?