This is an archive of the discontinued LLVM Phabricator instance.

[mips][microMIPS] Implement PAUSE, RDHWR, RDPGPR, SDBBP, SSNOP, SYNC, SYNCI and WAIT instructions
ClosedPublic

Authored by hvarga on Sep 4 2015, 12:26 AM.

Details

Summary

The patch implements microMIPS32r6 PAUSE, RDHWR, RDPGPR, SDBBP, SIGRIE, SSNOP, SYNC, SYNCI and WAIT instructions.

Diff Detail

Repository
rL LLVM

Event Timeline

hvarga updated this revision to Diff 34015.Sep 4 2015, 12:26 AM
hvarga retitled this revision from to [mips][microMIPS] Implement PAUSE, RDHWR, RDPGPR, SDBBP, SIGRIE, SSNOP, SYNC, SYNCI and WAIT instructions.
hvarga updated this object.
hvarga added subscribers: llvm-commits, petarj.
dsanders requested changes to this revision.Sep 16 2015, 5:36 AM
dsanders edited edge metadata.
dsanders added inline comments.
lib/Target/Mips/Disassembler/MipsDisassembler.cpp
265–267 ↗(On Diff #34015)

Indentation

1172–1174 ↗(On Diff #34015)

Indentation

lib/Target/Mips/MicroMips32r6InstrFormats.td
127–200 ↗(On Diff #34015)

All but one of these need to be renamed to follow the convention of <major-opcode-name>_<string>_FM_MMR6.

POOL32A_RDHWR_FM_MMR6 is correct.

lib/Target/Mips/MicroMips32r6InstrInfo.td
298–308 ↗(On Diff #34015)

You don't need separate a *_DESC_BASE class if there's only one subclass.

299 ↗(On Diff #34015)

Indentation

308 ↗(On Diff #34015)

Indentation

336–365 ↗(On Diff #34015)

You don't need a separate *_DESC_BASE class if there's only one subclass.

351 ↗(On Diff #34015)

Is this under 80 cols?

464 ↗(On Diff #34015)

Indentation

lib/Target/Mips/MicroMipsInstrInfo.td
870 ↗(On Diff #34015)

Why is this changed? You don't mention TLBWR in your commit message.

876 ↗(On Diff #34015)

Indentation

test/MC/Mips/micromips-control-instructions.s
14 ↗(On Diff #34015)

Have you fixed the emission of the .set's or have you only removed the checks?
If it's the former, can you point me at the fix? I don't think I've seen it.
If it's the latter, I'd rather leave them in and turn them into CHECK-NOT's when we fix it.

This revision now requires changes to proceed.Sep 16 2015, 5:36 AM
hvarga updated this revision to Diff 37561.Oct 16 2015, 12:50 AM
hvarga edited edge metadata.

Fix according the comments from dsanders.

hvarga added inline comments.Oct 16 2015, 1:02 AM
lib/Target/Mips/MicroMipsInstrInfo.td
945 ↗(On Diff #37561)

I don't know why I changed the TLBWR_MM. This was a mistake. Probably I was trying experimenting with something unrelated. Thank you for pointing this out.

test/MC/Mips/micromips-control-instructions.s
14 ↗(On Diff #37561)

According to https://dmz-portal.mips.com/bugz/show_bug.cgi?id=459, mips32r2 version of RDHWR emits those directives in mips32 mode. I had a disscussion with zoran.jovanovic quite some time ago and we agreed that there is no need for micromips version of RDHWR to emit those instructions.

This also helped me to implement the RDHWR for micromips32r6 just by setting NotInMicroMips in AdditionalPredicates for RDHWR definition in lib/Target/Mips/MipsInstrInfo.td. So by setting this I also removed directives that were expected for RDHWR assembler test in test/MC/Mips/micromips-control-instructions.s

hvarga retitled this revision from [mips][microMIPS] Implement PAUSE, RDHWR, RDPGPR, SDBBP, SIGRIE, SSNOP, SYNC, SYNCI and WAIT instructions to [mips][microMIPS] Implement PAUSE, RDHWR, RDPGPR, SDBBP, SSNOP, SYNC, SYNCI and WAIT instructions.Oct 16 2015, 1:10 AM
hvarga edited edge metadata.

I have removed SIGRIE from title since it is not implemented in this patch.

dsanders accepted this revision.Oct 27 2015, 10:32 AM
dsanders edited edge metadata.

Thanks. Just one small change and it will LGTM

test/MC/Mips/micromips-control-instructions.s
14 ↗(On Diff #37561)

I had a disscussion with zoran.jovanovic quite some time ago and we agreed that there is no need for micromips version of RDHWR to emit those instructions.

That's correct. In fact it goes a bit further than that since they aren't really required for any MIPS ISA on Linux (and possibly others). Although the instruction isn't strictly part of the older ISA's the Linux kernel will emulate it. The reason they're there is that the integrated assembler is currently too accurate in the predicates for RDHWR.

I see why they aren't emitted in this case now. It's simply that they are added to RDHWR and RDHWR64 in MipsInstPrinter.cpp. The conversion to microMIPS means that it's neither of those.

Please add CHECK-NOT's to ensure that they aren't emitted.

This revision is now accepted and ready to land.Oct 27 2015, 10:32 AM
This revision was automatically updated to reflect the committed changes.