This is an archive of the discontinued LLVM Phabricator instance.

PR 23155: Change test to allow movzbl,movzwl in place of movb,movw instructions
AbandonedPublic

Authored by kbsmith1 on Sep 4 2015, 4:46 PM.

Details

Summary

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.

Diff Detail

Event Timeline

kbsmith1 updated this revision to Diff 34093.Sep 4 2015, 4:46 PM
kbsmith1 retitled this revision from to Change test to allow movzbl,movzwl in place of movb,movw instructions.
kbsmith1 updated this object.
kbsmith1 added reviewers: DavidKreitzer, spatel.
kbsmith1 added a subscriber: llvm-commits.

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.

kbsmith1 retitled this revision from Change test to allow movzbl,movzwl in place of movb,movw instructions to PR 23155: Change test to allow movzbl,movzwl in place of movb,movw instructions.Sep 8 2015, 9:32 AM
kbsmith1 updated this object.
kbsmith1 edited edge metadata.

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.

qcolombet edited edge metadata.Sep 8 2015, 5:04 PM

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.

kbsmith1 abandoned this revision.Sep 9 2015, 1:02 PM

Abandoned changes due to Quentin's opposition.