This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/82405] Function not inlined for switch and suboptimal assembly is generated
- From: "antoshkka at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 03 Oct 2017 16:07:22 +0000
- Subject: [Bug c++/82405] Function not inlined for switch and suboptimal assembly is generated
- Auto-submitted: auto-generated
- References: <bug-82405-4@http.gcc.gnu.org/bugzilla/>
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.