Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently fold_divmod's translation of
(MULT_HI(x, N) + x) >> M --> MULT_HI(x, N) >> M
assumes that x and N will be in that order inside of the MULT_HI, however that assumption fails for some MWCC code. This PR just allows for either argument to be equal to what's being added for this translation, which allows for a lot more of the divisions to be picked up on MWCC.There's still a couple of other issues with MWCC for fold_divmod I'd like to try figure out too:
((u32) MULT_HI(0x55555556, sp8) >> 0x1FU)
into(sp8 / 6442450941)
early, which means that the outer error removal((x / N) + ((x / N) >> 31)) --> x / N
can't take place (the statement is(MULT_HI(0x55555556, sp8) + (sp8 / 6442450941))
by the time this runs). I'm not sure I understand the logic & flow of this enough to know how to fix this, so any advice there would be appreciated