[mips] Fix sync instruction definition
authorSimon Dardis <simon.dardis@imgtec.com>
Tue, 18 Oct 2016 14:42:13 +0000 (14:42 +0000)
committerSimon Dardis <simon.dardis@imgtec.com>
Tue, 18 Oct 2016 14:42:13 +0000 (14:42 +0000)
commitc4463c942c0914bc7c9f0bef16b14aef142cedad
tree64058c1a00163f205907a98a4b8711575f3fbf5f
parent197aa3192dd8d25330c23274a0d257c6130e4e09
[mips] Fix sync instruction definition

The 'sync' instruction for MIPS was defined in MIPS-II as taking no operands.
MIPS32 extended the define of 'sync' as taking an optional unsigned 5 bit
immediate.

This patch correct the definition of sync so that it is accepted with an
operand of 0 or no operand for MIPS-II to MIPS-V, and a 5 bit unsigned
immediate for MIPS32 and later revisions.

Additionally a clear error is given when the MIPS32 version of sync is
used when targeting pre MIPS32.

This partially resolves PR/30714.

Thanks to Daniel Sanders for reporting this issue!

Reveiwers: vkalintiris

Differential Revision: https://reviews.llvm.org/D25672

llvm-svn: 284483
llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
llvm/lib/Target/Mips/MipsInstrInfo.td
llvm/test/MC/Mips/mips2/invalid-mips32.s
llvm/test/MC/Mips/mips2/valid.s
llvm/test/MC/Mips/mips3/invalid-mips32.s
llvm/test/MC/Mips/mips3/valid.s
llvm/test/MC/Mips/mips4/invalid-mips32.s
llvm/test/MC/Mips/mips4/valid.s
llvm/test/MC/Mips/mips5/invalid-mips32.s
llvm/test/MC/Mips/mips5/valid.s