This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add UNIMP instruction (32- and 16-bit forms)
ClosedPublic

Authored by luismarques on Nov 9 2018, 7:30 AM.

Details

Summary

The UNIMP instruction isn't at the moment documented in the RISC-V ISA manual, but it's a GNU binutils de facto standard
for an instruction that's known not to be implemented, as thus one which will generate a trap, assuming your system generates such traps at all.

This patch adds support for UNIMP in both 32- and 16-bit forms. The 32-bit form can be seen as a variant of the ECALL/EBREAK/etc. family of instructions. The 16-bit form is just all zeroes, which isn't a valid RISC-V instruction, but still follows the 16-bit instruction form (i.e. bits 0-1 != 11).

Diff Detail

Repository
rL LLVM

Event Timeline

luismarques created this revision.Nov 9 2018, 7:30 AM
asb added a comment.EditedNov 28 2018, 8:27 AM

I think this is fine, but c.unimp should be proposed on the RISC-V sw-dev mailing list or similar. As we discussed, it seems to make total sense to have this instruction (every other compressed instruction is nameable with c.something). But we should get community feedback first before merging in to LLVM. It's probably also worth highlighting the fact that "unimp" isn't actually guaranteed to trap according to the current RISC-V specs...

So that's a LGTM, but blocked on external discussion. Thanks!

asb accepted this revision.Nov 30 2018, 5:38 AM

Thanks to Luís, there is agreement on c.unimp on the sw-dev mailing list, it's now documented in the RISC-V asm manual, and binutils now supports c.unimp too (courtesy of Jim Wilson).

Therefore, this is good to land. Many thanks!

This revision is now accepted and ready to land.Nov 30 2018, 5:38 AM
This revision was automatically updated to reflect the committed changes.