https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123322
--- Comment #3 from Jeffrey A. Law <law at gcc dot gnu.org> --- So Daniel and I have a patch in this space. It's not quite ready yet and I need to do some more testing. But the basic idea is: 1. Use match.pd to guide towards a conditional move sequence. 2. Adjust the conditional move expander in the risc-v backend to make it more friendly for sign extension elimination. -- My worry with #1 is it generates gimple that I worry is going to expand to the problematic sequences we saw on either x86 or aarch64. So we need to reach some kind of conclusion on that. It's pretty easy to show that other operators regress in the same manner, so the pattern needs to be generalized. And we probably need a special pattern for bit-and and multiply since the neutral value for those isn't 0, but -1 and 1 respectively. For reasons I don't know yet, the match.pd pattern seems to get in an infinite loop with the :c modifier enabled. I still need to debug that.
