diff --git a/lib/Target/ARM64/ARM64InstrFormats.td b/lib/Target/ARM64/ARM64InstrFormats.td index 378b698909e13..ee82419371689 100644 --- a/lib/Target/ARM64/ARM64InstrFormats.td +++ b/lib/Target/ARM64/ARM64InstrFormats.td @@ -774,22 +774,6 @@ def sys_cr_op : Operand { let ParserMatchClass = SysCRAsmOperand; } -class SystemI - : SimpleSystemI, - Sched<[WriteSys]> { - bits<3> op1; - bits<4> Cn; - bits<4> Cm; - bits<3> op2; - let Inst{20-19} = 0b01; - let Inst{18-16} = op1; - let Inst{15-12} = Cn; - let Inst{11-8} = Cm; - let Inst{7-5} = op2; -} - class SystemXtI : RtSystemI; // Generic system instructions -def SYS : SystemI<0, "sys">; def SYSxt : SystemXtI<0, "sys">; def SYSLxt : SystemLXtI<1, "sysl">; +def : InstAlias<"sys $op1, $Cn, $Cm, $op2", + (SYSxt imm0_7:$op1, sys_cr_op:$Cn, + sys_cr_op:$Cm, imm0_7:$op2, XZR)>; + //===----------------------------------------------------------------------===// // Move immediate instructions. //===----------------------------------------------------------------------===// diff --git a/lib/Target/ARM64/InstPrinter/ARM64InstPrinter.cpp b/lib/Target/ARM64/InstPrinter/ARM64InstPrinter.cpp index 82beb6bbebd8e..8c0e6fa917910 100644 --- a/lib/Target/ARM64/InstPrinter/ARM64InstPrinter.cpp +++ b/lib/Target/ARM64/InstPrinter/ARM64InstPrinter.cpp @@ -56,7 +56,7 @@ void ARM64InstPrinter::printInst(const MCInst *MI, raw_ostream &O, unsigned Opcode = MI->getOpcode(); - if (Opcode == ARM64::SYS || Opcode == ARM64::SYSxt) + if (Opcode == ARM64::SYSxt) if (printSysAlias(MI, O)) { printAnnotation(O, Annot); return; @@ -750,8 +750,7 @@ void ARM64AppleInstPrinter::printInst(const MCInst *MI, raw_ostream &O, bool ARM64InstPrinter::printSysAlias(const MCInst *MI, raw_ostream &O) { #ifndef NDEBUG unsigned Opcode = MI->getOpcode(); - assert((Opcode == ARM64::SYS || Opcode == ARM64::SYSxt) && - "Invalid opcode for SYS alias!"); + assert(Opcode == ARM64::SYSxt && "Invalid opcode for SYS alias!"); #endif const char *Asm = 0; @@ -961,9 +960,11 @@ bool ARM64InstPrinter::printSysAlias(const MCInst *MI, raw_ostream &O) { } if (Asm) { + unsigned Reg = MI->getOperand(4).getReg(); + O << '\t' << Asm; - if (MI->getNumOperands() == 5) - O << ", " << getRegisterName(MI->getOperand(4).getReg()); + if (StringRef(Asm).lower().find("all") == StringRef::npos) + O << ", " << getRegisterName(Reg); } return Asm != 0; diff --git a/test/MC/Disassembler/ARM64/system.txt b/test/MC/Disassembler/ARM64/system.txt index 53b4a6cd69aa7..9027a60dd30dc 100644 --- a/test/MC/Disassembler/ARM64/system.txt +++ b/test/MC/Disassembler/ARM64/system.txt @@ -32,6 +32,8 @@ # CHECK: dmb osh 0x9f 0x37 0x03 0xd5 # CHECK: dsb nsh + 0x3f 0x76 0x08 0xd5 +# CHECK: dc ivac #----------------------------------------------------------------------------- # Generic system instructions