This is an archive of the discontinued LLVM Phabricator instance.

[mips] Implement .set dspr2 directive
ClosedPublic

Authored by mstojanovic on Oct 4 2017, 4:05 AM.

Details

Summary

Implement .set dspr2 directive with appropriate feature bits. This directive is a counterpart of -mattr=dspr2 command line option with the exception that it does not influence elf header flags.

Diff Detail

Repository
rL LLVM

Event Timeline

mstojanovic created this revision.Oct 4 2017, 4:05 AM
sdardis accepted this revision.Oct 4 2017, 10:40 AM

LGTM.

This revision is now accepted and ready to land.Oct 4 2017, 10:40 AM
petarj added inline comments.Oct 4 2017, 3:24 PM
test/MC/Mips/set-nodsp.s
1 ↗(On Diff #117656)

-mattr=+dsp seems redundant in presence of -mattr=+dspr2

Furthermore, DSP extension requires Rev2 at least, so the test should probable have -mcpu=mips32r2

GCC has a warning like:

"Warning: the `dsp' extension requires MIPS32 revision 2 or greater'"

It seems that LLVM does not do that. Maybe it should?

sdardis added inline comments.Oct 5 2017, 5:44 AM
test/MC/Mips/set-nodsp.s
1 ↗(On Diff #117656)

-mattr=+dsp seems redundant in presence of -mattr=+dspr2

Well spotted, though the test would have to be altered to test for the differences between dsp / dspr2.

GCC has a warning like:

"Warning: the `dsp' extension requires MIPS32 revision 2 or greater'"

It seems that LLVM does not do that. Maybe it should?

I believe we should. I think we should be stricter but binutils already accepts code that combination of options so we should at least be as compatible / informative.

Some quick testing shows that gas 2.24 only warns on the first instance of a particular error in the test cases I've tried for mixing directives to change the ISA revision.

I'm leaning towards giving warnings where an ASE is enabled that requires a higher ISA revision by an assembler directive at every occurrence, along with a warning for incoherent command-line options, though that may be a bit verbose. Thoughts?

Adding warnings for incompatible ASE/ISA revisions should be submitted as a separate patch.

petarj added inline comments.Oct 5 2017, 6:00 AM
test/MC/Mips/set-nodsp.s
1 ↗(On Diff #117656)

I'm leaning towards giving warnings where an ASE is enabled that requires a higher ISA revision by an assembler directive at every occurrence, along with a warning for incoherent command-line options, though that may be a bit verbose. Thoughts?

I do not have a strong opinion about it, I would probably vote for mimicking what gas does.

Removed -mattr=dsp from set-nodsp.s test.

This revision was automatically updated to reflect the committed changes.