This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/82405] Function not inlined for switch and suboptimal assembly is generated


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82405

--- Comment #8 from Antony Polukhin <antoshkka at gmail dot com> ---
Yes, in the isolated test case constants are first:

static inline double eval_square2(double r) { return 4 * r * r; }
static inline double eval_circle2(double r) { return 3.1415 * r * r; }

double test_switch_native_slow(int shape, double r) {
    if (shape == 123)
      return eval_circle2(r);
    else
      return eval_square2(r);
}

So multiplying r at the beginning is not good.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]