This change modifies a couple of unit tests to allow movzbl or movzwl instructions to be generated for
byte and word loads, as well as the existing instructions the test allowed (which were movb, movw).
This is first of several test updates to allow this generality/freedom in code generation for X86.
This is part of test suite changes needed to give compiler the freedom to choose either the zero extending
instructions or the plain byte/word instructions, since either are correct.
Details
Diff Detail
Event Timeline
I'm concerned if we're adding variability where there was none before. I'm not sure if we have policy/guidelines on that, so adding some more experienced reviewers.
It would be nice to see how it's going to work at a higher level. Eg, will there be a new CPU attribute for partial register stalls that is used to trigger the different codegen? If so, can we replace the -mcpu for the test case and add a RUN line that has that attribute instead of using regex in these tests?
If this is related to PR23155, please note that here and in the commit message, so we'll have a paper trail for the motivation.
Changed title, and explanation as Sanjay suggested. My expectation is that these tests should allow either the zero-extending
loads, or the plain byte/short instructions, as either are correct for the cpus specified.
Hi,
I agree with Sanjay that we shouldn’t add variability here.
Either we have a clear flag to choose one of the variants or we stick to just one.
Yes, both variants are correct here, but generating one or the other without being aware that another commit changes it sounds worrisome to me.
Cheers,
-Quentin
There are a handful (6-8) tests that currently are checking for movw, where either movzwl or movw would be legal choices. There are quite a few more that specifically expect movb where movzbl would also be legal. My intent was to add a test that tested for the specific movb vs movzbl or movw vs movzwl when the transformations to change these opcodes got added.
My intent with this change-set was to get started changing tests where the test wasn't specifically trying to test ffor one or the other, where the test was simply testing for what the compiler currently did, rather than what it was legal to do. It seems like the principal of these unit tests should be to accept all legal outputs, except for the key place where they were checking for a specific piece of the implementation. That way the tests are not so fragile as heuristic changes are made. It seems wrong to have so many tests dependent on this choice, when that is really tangential to what they seem to be intending to check.
I was doing this to try to make these changes in small, easy to review pieces.