[Bug middle-end/104405] Inefficient register allocation on complex arithmetic

2022-02-06 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104405

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed||2022-02-06
   Keywords||ra
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW

--- Comment #2 from Andrew Pinski  ---
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?

[Bug middle-end/104405] Inefficient register allocation on complex arithmetic

2022-02-05 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104405

--- Comment #1 from Andrew Pinski  ---
I am almost positive there are duplicates of this bug already. It is similar to
the struct argument passing one too.