This is an archive of the discontinued LLVM Phabricator instance.

[Sparc] Add membar assembler tags
ClosedPublic

Authored by dcederman on Oct 22 2018, 5:20 AM.

Details

Summary

The Sparc V9 membar instruction can enforce different types of memory orderings depending on the value in its immediate field. In the architectural manual the type is selected by combining different assembler tags into a mask. This patch adds support for these tags.

Diff Detail

Event Timeline

dcederman created this revision.Oct 22 2018, 5:20 AM

Probably worth adding a range check on the membar operand when it's specified as an integer that it's actually in the range 0 <= val <= 127.

And perhaps something on the printing side too. GNU as just reports it as an unknown instruction in that case, but printing the raw integer would be fine too I think.

dcederman updated this revision to Diff 178050.Dec 13 2018, 6:50 AM

Added a check to make sure that the integer mask is between 0 and 127 when parsing. The immediate is now printed as an integer when outside the valid range. Also fixed a disassembly issue and added some more tests.

jyknight accepted this revision.Dec 13 2018, 7:16 AM
jyknight added inline comments.
test/MC/Sparc/sparc-asm-errors.s
1–2

You can use two check prefixes, e.g.: "--check-prefix=CHECK --check-prefix=V8", so as not to have to duplicate the common lines.

This revision is now accepted and ready to land.Dec 13 2018, 7:16 AM
dcederman marked an inline comment as done.Dec 13 2018, 7:25 AM
dcederman added inline comments.
test/MC/Sparc/sparc-asm-errors.s
1–2

Ok, I will fix that. Thanks for the review!

This revision was automatically updated to reflect the committed changes.