https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54089
--- Comment #56 from Alexander Klepikov <klepikov.alex+bugs at gmail dot com> --- > > Regarding testsuite. There's execute fails, but this is due to lack of > > multilib. I'll rebuild and retest. > > > > There's also fail in pr64345-1.c, in this function: > > [...] > > > > But it looks more like it's not a fail, but an optimization. > > Yeah, that looks like an improvement. There might be some SH specific tests > that scan for particular assembler outputs like that one. Those tests would > need to be adjusted of course. I checked and that one was the only one. > In that test you can see the unnecessary push/pop of PR. This is because > initially it wanted to expand as a library call, but then your patterns > decided to change the insns. This can or can't be avoided, depending on the > case. That's an valuable observation, thank you! I found why. Sometimes 'collapsed libcall' instruction is emitted in combine pass and 'clobber PR' is set then. I commented this out and checked that file and it seems to be OK. I will rerun testsuite again to be sure. Now regarding tests that fail on vanilla GCC and pass with patch. It looks like something was changed in the middle of GCC and it started to produce other instruction patterns that cannot be catched by existing isns and thus expanded to library calls. The patch simply fixed it.