Index: llvm/lib/Target/M68k/AsmParser/M68kAsmParser.cpp =================================================================== --- llvm/lib/Target/M68k/AsmParser/M68kAsmParser.cpp +++ llvm/lib/Target/M68k/AsmParser/M68kAsmParser.cpp @@ -49,7 +49,7 @@ // Parser functions. void eatComma(); - bool isExpr() const; + bool isExpr(); OperandMatchResultTy parseImm(OperandVector &Operands); OperandMatchResultTy parseMemOp(OperandVector &Operands); @@ -581,11 +581,13 @@ return Result; } -bool M68kAsmParser::isExpr() const { +bool M68kAsmParser::isExpr() { switch (Parser.getTok().getKind()) { case AsmToken::Identifier: case AsmToken::Integer: return true; + case AsmToken::Minus: + return getLexer().peekTok().getKind() == AsmToken::Integer; default: return false; Index: llvm/test/MC/M68k/Arith/Classes/MxBiArOp_FMI.s =================================================================== --- /dev/null +++ llvm/test/MC/M68k/Arith/Classes/MxBiArOp_FMI.s @@ -0,0 +1,41 @@ +; RUN: llvm-mc -triple=m68k -show-encoding %s | FileCheck %s + .text + .globl MxBiArOp_FMI_ARII +; CHECK-LABEL: MxBiArOp_FMI_ARII: +MxBiArOp_FMI_ARII: + ; CHECK: add.b #-1, (0,%a0,%d0) + ; CHECK-SAME: encoding: [0x06,0x30,0x00,0xff,0x08,0x00] + add.b #-1, (0,%a0,%d0) + ; CHECK: add.b #0, (-1,%a3,%a1) + ; CHECK-SAME: encoding: [0x06,0x33,0x00,0x00,0x98,0xff] + add.b #0, (-1,%a3,%a1) + ; CHECK: add.l #-1, (13,%a2,%d1) + ; CHECK-SAME: encoding: [0x06,0xb2,0xff,0xff,0xff,0xff,0x18,0x0d] + add.l #-1, (13,%a2,%d1) + + .globl MxBiArOp_FMI_ARID +; CHECK-LABEL: MxBiArOp_FMI_ARID: +MxBiArOp_FMI_ARID: + ; CHECK: add.b #-1, (0,%a0) + ; CHECK-SAME: encoding: [0x06,0x28,0x00,0xff,0x00,0x00] + add.b #-1, (0,%a0) + ; CHECK: add.b #0, (-1,%a3) + ; CHECK-SAME: encoding: [0x06,0x2b,0x00,0x00,0xff,0xff] + add.b #0, (-1,%a3) + ; CHECK: add.l #-1, (13,%a2) + ; CHECK-SAME: encoding: [0x06,0xaa,0xff,0xff,0xff,0xff,0x00,0x0d] + add.l #-1, (13,%a2) + + .globl MxBiArOp_FMI_ARI +; CHECK-LABEL: MxBiArOp_FMI_ARI: +MxBiArOp_FMI_ARI: + ; CHECK: add.b #-1, (%a0) + ; CHECK-SAME: encoding: [0x06,0x10,0x00,0xff] + add.b #-1, (%a0) + ; CHECK: add.b #0, (%a3) + ; CHECK-SAME: encoding: [0x06,0x13,0x00,0x00] + add.b #0, (%a3) + ; CHECK: add.l #-1, (%a2) + ; CHECK-SAME: encoding: [0x06,0x92,0xff,0xff,0xff,0xff] + add.l #-1, (%a2) + Index: llvm/test/MC/M68k/Arith/Classes/MxBiArOp_FMR.s =================================================================== --- /dev/null +++ llvm/test/MC/M68k/Arith/Classes/MxBiArOp_FMR.s @@ -0,0 +1,38 @@ +; RUN: llvm-mc -triple=m68k -show-encoding %s | FileCheck %s + .text + .globl MxBiArOp_FMR_ARII +; CHECK-LABEL: MxBiArOp_FMR_ARII: +MxBiArOp_FMR_ARII: + ; CHECK: add.b %d0, (0,%a0,%d1) + ; CHECK-SAME: encoding: [0xd1,0x30,0x18,0x00] + add.b %d0, (0,%a0,%d1) + ; CHECK: add.b %d0, (-1,%a0,%d1) + ; CHECK-SAME: encoding: [0xd1,0x30,0x18,0xff] + add.b %d0, (-1,%a0,%d1) + ; CHECK: add.l %d0, (0,%a1,%d1) + ; CHECK-SAME: encoding: [0xd1,0xb1,0x18,0x00] + add.l %d0, (0,%a1,%d1) + ; CHECK: add.l %d1, (0,%a2,%a2) + ; CHECK-SAME: encoding: [0xd3,0xb2,0xa8,0x00] + add.l %d1, (0,%a2,%a2) + + .globl MxBiArOp_FMR_ARID +; CHECK-LABEL: MxBiArOp_FMR_ARID: +MxBiArOp_FMR_ARID: + ; CHECK: add.b %d0, (0,%a0) + ; CHECK-SAME: encoding: [0xd1,0x28,0x00,0x00] + add.b %d0, (0,%a0) + ; CHECK: add.l %d0, (-1,%a1) + ; CHECK-SAME: encoding: [0xd1,0xa9,0xff,0xff] + add.l %d0, (-1,%a1) + + .globl MxBiArOp_FMR_ARI +; CHECK-LABEL: MxBiArOp_FMR_ARI: +MxBiArOp_FMR_ARI: + ; CHECK: add.b %d0, (%a0) + ; CHECK-SAME: encoding: [0xd1,0x10] + add.b %d0, (%a0) + ; CHECK: add.l %d3, (%a1) + ; CHECK-SAME: encoding: [0xd7,0x91] + add.l %d3, (%a1) + Index: llvm/test/MC/M68k/Bits/Classes/MxBTST_MI.s =================================================================== --- /dev/null +++ llvm/test/MC/M68k/Bits/Classes/MxBTST_MI.s @@ -0,0 +1,52 @@ +; RUN: llvm-mc -triple=m68k -show-encoding %s | FileCheck %s + .text + .globl MxBTST_MI_PCI +; CHECK-LABEL: MxBTST_MI_PCI: +MxBTST_MI_PCI: + ; CHECK: btst #0, (-1,%pc,%d1) + ; CHECK-SAME: encoding: [0x08,0x3b,0x00,0x00,0x18,0xff] + btst #0, (-1,%pc,%d1) + ; CHECK: btst #1, (0,%pc,%d0) + ; CHECK-SAME: encoding: [0x08,0x3b,0x00,0x01,0x08,0x00] + btst #1, (0,%pc,%d0) + + .globl MxBTST_MI_PCD +; CHECK-LABEL: MxBTST_MI_PCD: +MxBTST_MI_PCD: + ; CHECK: btst #0, (0,%pc) + ; CHECK-SAME: encoding: [0x08,0x3a,0x00,0x00,0x00,0x00] + btst #0, (0,%pc) + ; CHECK: btst #-1, (-1,%pc) + ; CHECK-SAME: encoding: [0x08,0x3a,0x00,0xff,0xff,0xff] + btst #-1, (-1,%pc) + + .globl MxBTST_MI_ARII +; CHECK-LABEL: MxBTST_MI_ARII: +MxBTST_MI_ARII: + ; CHECK: btst #0, (-1,%a1,%a0) + ; CHECK-SAME: encoding: [0x08,0x31,0x00,0x00,0x88,0xff] + btst #0, (-1,%a1,%a0) + ; CHECK: btst #-1, (0,%a0,%a0) + ; CHECK-SAME: encoding: [0x08,0x30,0x00,0xff,0x88,0x00] + btst #-1, (0,%a0,%a0) + + .globl MxBTST_MI_ARID +; CHECK-LABEL: MxBTST_MI_ARID: +MxBTST_MI_ARID: + ; CHECK: btst #0, (-1,%a1) + ; CHECK-SAME: encoding: [0x08,0x29,0x00,0x00,0xff,0xff] + btst #0, (-1,%a1) + ; CHECK: btst #-1, (0,%a0) + ; CHECK-SAME: encoding: [0x08,0x28,0x00,0xff,0x00,0x00] + btst #-1, (0,%a0) + + .globl MxBTST_MI_ARI +; CHECK-LABEL: MxBTST_MI_ARI: +MxBTST_MI_ARI: + ; CHECK: btst #0, (%a1) + ; CHECK-SAME: encoding: [0x08,0x11,0x00,0x00] + btst #0, (%a1) + ; CHECK: btst #-1, (%a0) + ; CHECK-SAME: encoding: [0x08,0x10,0x00,0xff] + btst #-1, (%a0) + Index: llvm/test/MC/M68k/Bits/Classes/MxBTST_MR.s =================================================================== --- /dev/null +++ llvm/test/MC/M68k/Bits/Classes/MxBTST_MR.s @@ -0,0 +1,52 @@ +; RUN: llvm-mc -triple=m68k -show-encoding %s | FileCheck %s + .text + .globl MxBTST_MR_PCI +; CHECK-LABEL: MxBTST_MR_PCI: +MxBTST_MR_PCI: + ; CHECK: btst %d0, (-1,%pc,%d1) + ; CHECK-SAME: encoding: [0x01,0x3b,0x18,0xff] + btst %d0, (-1,%pc,%d1) + ; CHECK: btst %d1, (0,%pc,%d0) + ; CHECK-SAME: encoding: [0x03,0x3b,0x08,0x00] + btst %d1, (0,%pc,%d0) + + .globl MxBTST_MR_PCD +; CHECK-LABEL: MxBTST_MR_PCD: +MxBTST_MR_PCD: + ; CHECK: btst %d0, (0,%pc) + ; CHECK-SAME: encoding: [0x01,0x3a,0x00,0x00] + btst %d0, (0,%pc) + ; CHECK: btst %d1, (-1,%pc) + ; CHECK-SAME: encoding: [0x03,0x3a,0xff,0xff] + btst %d1, (-1,%pc) + + .globl MxBTST_MR_ARII +; CHECK-LABEL: MxBTST_MR_ARII: +MxBTST_MR_ARII: + ; CHECK: btst %d0, (-1,%a1,%a0) + ; CHECK-SAME: encoding: [0x01,0x31,0x88,0xff] + btst %d0, (-1,%a1,%a0) + ; CHECK: btst %d1, (0,%a0,%a0) + ; CHECK-SAME: encoding: [0x03,0x30,0x88,0x00] + btst %d1, (0,%a0,%a0) + + .globl MxBTST_MR_ARID +; CHECK-LABEL: MxBTST_MR_ARID: +MxBTST_MR_ARID: + ; CHECK: btst %d0, (-1,%a1) + ; CHECK-SAME: encoding: [0x01,0x29,0xff,0xff] + btst %d0, (-1,%a1) + ; CHECK: btst %d1, (0,%a0) + ; CHECK-SAME: encoding: [0x03,0x28,0x00,0x00] + btst %d1, (0,%a0) + + .globl MxBTST_MR_ARI +; CHECK-LABEL: MxBTST_MR_ARI: +MxBTST_MR_ARI: + ; CHECK: btst %d0, (%a1) + ; CHECK-SAME: encoding: [0x01,0x11] + btst %d0, (%a1) + ; CHECK: btst %d1, (%a0) + ; CHECK-SAME: encoding: [0x03,0x10] + btst %d1, (%a0) + Index: llvm/test/MC/M68k/Control/Classes/MxScc.s =================================================================== --- /dev/null +++ llvm/test/MC/M68k/Control/Classes/MxScc.s @@ -0,0 +1,106 @@ +; RUN: llvm-mc -triple=m68k -show-encoding %s | FileCheck %s + .text + .globl MxScc_D +; CHECK-LABEL: MxScc_D: +MxScc_D: + ; CHECK: st %d0 + ; CHECK-SAME: encoding: [0x50,0xc0] + st %d0 + ; CHECK: sf %d1 + ; CHECK-SAME: encoding: [0x51,0xc1] + sf %d1 + ; CHECK: shi %d2 + ; CHECK-SAME: encoding: [0x52,0xc2] + shi %d2 + ; CHECK: sls %d3 + ; CHECK-SAME: encoding: [0x53,0xc3] + sls %d3 + ; CHECK: scc %d4 + ; CHECK-SAME: encoding: [0x54,0xc4] + scc %d4 + ; CHECK: scs %d5 + ; CHECK-SAME: encoding: [0x55,0xc5] + scs %d5 + ; CHECK: sne %d6 + ; CHECK-SAME: encoding: [0x56,0xc6] + sne %d6 + ; CHECK: seq %d7 + ; CHECK-SAME: encoding: [0x57,0xc7] + seq %d7 + ; CHECK: svc %d0 + ; CHECK-SAME: encoding: [0x58,0xc0] + svc %d0 + ; CHECK: svs %d0 + ; CHECK-SAME: encoding: [0x59,0xc0] + svs %d0 + ; CHECK: spl %d0 + ; CHECK-SAME: encoding: [0x5a,0xc0] + spl %d0 + ; CHECK: smi %d0 + ; CHECK-SAME: encoding: [0x5b,0xc0] + smi %d0 + ; CHECK: sge %d0 + ; CHECK-SAME: encoding: [0x5c,0xc0] + sge %d0 + ; CHECK: slt %d0 + ; CHECK-SAME: encoding: [0x5d,0xc0] + slt %d0 + ; CHECK: sgt %d0 + ; CHECK-SAME: encoding: [0x5e,0xc0] + sgt %d0 + ; CHECK: sle %d0 + ; CHECK-SAME: encoding: [0x5f,0xc0] + sle %d0 + + .globl MxScc_ARID +; CHECK-LABEL: MxScc_ARID: +MxScc_ARID: + ; CHECK: st (-1,%a0) + ; CHECK-SAME: encoding: [0x50,0xe8,0xff,0xff] + st (-1,%a0) + ; CHECK: sf (42,%a1) + ; CHECK-SAME: encoding: [0x51,0xe9,0x00,0x2a] + sf (42,%a1) + ; CHECK: shi (0,%a2) + ; CHECK-SAME: encoding: [0x52,0xea,0x00,0x00] + shi (0,%a2) + ; CHECK: sls (0,%a3) + ; CHECK-SAME: encoding: [0x53,0xeb,0x00,0x00] + sls (0,%a3) + ; CHECK: scc (0,%a4) + ; CHECK-SAME: encoding: [0x54,0xec,0x00,0x00] + scc (0,%a4) + ; CHECK: scs (0,%a5) + ; CHECK-SAME: encoding: [0x55,0xed,0x00,0x00] + scs (0,%a5) + ; CHECK: sne (0,%a6) + ; CHECK-SAME: encoding: [0x56,0xee,0x00,0x00] + sne (0,%a6) + ; CHECK: seq (0,%a0) + ; CHECK-SAME: encoding: [0x57,0xe8,0x00,0x00] + seq (0,%a0) + ; CHECK: svc (0,%a0) + ; CHECK-SAME: encoding: [0x58,0xe8,0x00,0x00] + svc (0,%a0) + ; CHECK: svs (0,%a0) + ; CHECK-SAME: encoding: [0x59,0xe8,0x00,0x00] + svs (0,%a0) + ; CHECK: spl (0,%a0) + ; CHECK-SAME: encoding: [0x5a,0xe8,0x00,0x00] + spl (0,%a0) + ; CHECK: smi (0,%a0) + ; CHECK-SAME: encoding: [0x5b,0xe8,0x00,0x00] + smi (0,%a0) + ; CHECK: sge (0,%a0) + ; CHECK-SAME: encoding: [0x5c,0xe8,0x00,0x00] + sge (0,%a0) + ; CHECK: slt (0,%a0) + ; CHECK-SAME: encoding: [0x5d,0xe8,0x00,0x00] + slt (0,%a0) + ; CHECK: sgt (0,%a0) + ; CHECK-SAME: encoding: [0x5e,0xe8,0x00,0x00] + sgt (0,%a0) + ; CHECK: sle (0,%a0) + ; CHECK-SAME: encoding: [0x5f,0xe8,0x00,0x00] + sle (0,%a0) + Index: llvm/test/MC/M68k/Data/Classes/MxLEA.s =================================================================== --- /dev/null +++ llvm/test/MC/M68k/Data/Classes/MxLEA.s @@ -0,0 +1,32 @@ +; RUN: llvm-mc -triple=m68k -show-encoding %s | FileCheck %s + .text + .globl MxLEA_PCD +; CHECK-LABEL: MxLEA_PCD: +MxLEA_PCD: + ; CHECK: lea (0,%pc), %a0 + ; CHECK-SAME: encoding: [0x41,0xfa,0x00,0x00] + lea (0,%pc), %a0 + ; CHECK: lea (-1,%pc), %a0 + ; CHECK-SAME: encoding: [0x41,0xfa,0xff,0xff] + lea (-1,%pc), %a0 + + .globl MxLEA_ARII +; CHECK-LABEL: MxLEA_ARII: +MxLEA_ARII: + ; CHECK: lea (0,%a1,%d1), %a0 + ; CHECK-SAME: encoding: [0x41,0xf1,0x18,0x00] + lea (0,%a1,%d1), %a0 + ; CHECK: lea (0,%a2,%a2), %a1 + ; CHECK-SAME: encoding: [0x43,0xf2,0xa8,0x00] + lea (0,%a2,%a2), %a1 + + .globl MxLEA_ARID +; CHECK-LABEL: MxLEA_ARID: +MxLEA_ARID: + ; CHECK: lea (-1,%a1), %a0 + ; CHECK-SAME: encoding: [0x41,0xe9,0xff,0xff] + lea (-1,%a1), %a0 + ; CHECK: lea (-1,%a1), %a0 + ; CHECK-SAME: encoding: [0x41,0xe9,0xff,0xff] + lea (-1,%a1), %a0 + Index: llvm/test/MC/M68k/Data/Classes/MxMove_MI.s =================================================================== --- /dev/null +++ llvm/test/MC/M68k/Data/Classes/MxMove_MI.s @@ -0,0 +1,44 @@ +; RUN: llvm-mc -triple=m68k -show-encoding %s | FileCheck %s + .text + .globl MxMove_MI_ARII +; CHECK-LABEL: MxMove_MI_ARII: +MxMove_MI_ARII: + ; CHECK: move.b #-1, (0,%a0,%d1) + ; CHECK-SAME: encoding: [0x11,0xbc,0x00,0xff,0x18,0x00] + move.b #-1, (0,%a0,%d1) + ; CHECK: move.b #42, (-1,%a0,%d1) + ; CHECK-SAME: encoding: [0x11,0xbc,0x00,0x2a,0x18,0xff] + move.b #42, (-1,%a0,%d1) + ; CHECK: move.l #-1, (0,%a1,%d1) + ; CHECK-SAME: encoding: [0x23,0xbc,0xff,0xff,0xff,0xff,0x18,0x00] + move.l #-1, (0,%a1,%d1) + ; CHECK: move.l #0, (0,%a2,%a2) + ; CHECK-SAME: encoding: [0x25,0xbc,0x00,0x00,0x00,0x00,0xa8,0x00] + move.l #0, (0,%a2,%a2) + + .globl MxMove_MI_ARID +; CHECK-LABEL: MxMove_MI_ARID: +MxMove_MI_ARID: + ; CHECK: move.b #0, (0,%a0) + ; CHECK-SAME: encoding: [0x11,0x7c,0x00,0x00,0x00,0x00] + move.b #0, (0,%a0) + ; CHECK: move.l #0, (-1,%a1) + ; CHECK-SAME: encoding: [0x23,0x7c,0x00,0x00,0x00,0x00,0xff,0xff] + move.l #0, (-1,%a1) + ; CHECK: move.l #0, (-1,%a1) + ; CHECK-SAME: encoding: [0x23,0x7c,0x00,0x00,0x00,0x00,0xff,0xff] + move.l #0, (-1,%a1) + + .globl MxMove_MI_ARI +; CHECK-LABEL: MxMove_MI_ARI: +MxMove_MI_ARI: + ; CHECK: move.b #0, (%a0) + ; CHECK-SAME: encoding: [0x10,0xbc,0x00,0x00] + move.b #0, (%a0) + ; CHECK: move.l #0, (%a1) + ; CHECK-SAME: encoding: [0x22,0xbc,0x00,0x00,0x00,0x00] + move.l #0, (%a1) + ; CHECK: move.l #0, (%a1) + ; CHECK-SAME: encoding: [0x22,0xbc,0x00,0x00,0x00,0x00] + move.l #0, (%a1) +