On Tue, Oct 14, 2025 at 1:42 PM Robin Dapp <[email protected]> wrote:
> > If we go with your patch or something similar, I would at least suggest > > handling ZERO_EXTEND in a similar manner. I suspect what you're really > after > > is whether or not the result of the extension is used in the second set > and > > never again. So you may want to restrict to cases where the > destination of > > the first set dies in the second set. > > > > Whether or not you extend to other forms extensions may take (shift > > pairs, logical and) would seem to be less important. ie, it's unlikely > > we'll see targets with zicond, but without zbb. > > What I remembered is that the multiple-set conversion also takes care of > the > swap-idiom recognition which could also include zero/sign extensions. We > need > to make sure to not disturb that but I'm not sure we even have a test for > that > right now. > Thanks! I’ll extend the patch to handle zero extension as well and add a check to ensure that the destination of the first set dies in the second set. Regarding the swap idiom. I think the condition "destination of the first set dies in the second set" already excludes the swap idiom like insns. But I can prepare a separate patch with a test that includes a swap idiom involving zero/sign extension, to make sure the new patches don’t interfere with that case. Additionally, I can add a safeguard to preserve the usual behavior for swap idiom patterns. For example, if the source of the first set is a register or a zero/sign extension, we’ll keep the usual behavior. Best, Nikita
