https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63743
--- Comment #4 from Zhenqiang Chen <zhenqiang.chen at arm dot com> --- (In reply to Jakub Jelinek from comment #3) > (In reply to Zhenqiang Chen from comment #2) > > (In reply to Jakub Jelinek from comment #1) > > > Were we swapping operands before? I mean, if you rewrite the testcase to > > > swap the * arguments in the source, did you get the same more efficient > > > code > > > in the past? > > > > Yes. I tried the test case: > > > > double > > test1 (double x, double y) > > { > > return x * (x + y); > > } > > double > > test2 (double x, double y) > > { > > return (x + y) * x; > > } > > > > Without r216728, I got efficient codes for both functions. But with r216728, > > I got inefficient codes for both functions. > > What about > double > test3 (double x, double y) > { > return (x + y) * (x - y); > } > ? At least from quick looking at ppc -msoft-float -O2 -m32, I see the same > issue there, add called first, sub called second, and result of second > returned in the same registers as used for the first argument. So something > to handle at expansion or RA rather than in GIMPLE anyway IMHO. Same issue for the case on Thumb1.