This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Add addtional test that retroactively catches PR47259
ClosedPublic

Authored by Bdragon28 on Aug 24 2020, 2:42 PM.

Details

Summary

Due to the unfortunate way the bug could only be triggered when reading SPRG[0-3] into a register lower than %r4 with the "mfsprg %rX, 0" syntax, the tests did not detect it.

(It could not be triggered for "mfsprg0, %r2" because that pattern was already in the table, so the earlier "correct" match took effect)

As a canary, add an intentionally ambiguous "mfsprg 2, 2" and "mtsprg 2, 2" check that would have caught the problem.

Diff Detail

Event Timeline

Bdragon28 created this revision.Aug 24 2020, 2:42 PM
Bdragon28 requested review of this revision.Aug 24 2020, 2:42 PM
Bdragon28 edited the summary of this revision. (Show Details)Aug 24 2020, 2:44 PM
ZhangKang added inline comments.Aug 24 2020, 6:31 PM
llvm/test/MC/PowerPC/ppc64-encoding-ext.s
3611

I think it's better to use mtsprg 2, %r2

Bdragon28 added inline comments.Aug 25 2020, 12:09 PM
llvm/test/MC/PowerPC/ppc64-encoding-ext.s
3611

*normally* I would agree here, but the whole point of the test is to catch a screwed up interpretation of instruction alias matching, so making it as vauge as possible is part of the point of the test.

ZhangKang accepted this revision.Aug 25 2020, 10:26 PM

LGTM. Thank for adding the test.

This revision is now accepted and ready to land.Aug 25 2020, 10:26 PM