Fix tblgen instruction errors exposed by MC asm parser tests

Fix minimum 16-bit signed value error exposed by MC asm parser tests
Add initial MC asm parser tests for the MBlaze backend


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118844 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Wesley Peck 2010-11-11 21:40:53 +00:00
parent 57dac88f77
commit ef5b390263
8 changed files with 910 additions and 30 deletions

View File

@ -297,17 +297,16 @@ class BranchLI<bits<6> op, bits<5> br, string instr_asm> :
//===----------------------------------------------------------------------===//
// Conditional Branch Instructions
//===----------------------------------------------------------------------===//
class BranchC<bits<6> op, bits<5> br, bits<11> flags, string instr_asm,
PatFrag cond_op> :
class BranchC<bits<6> op, bits<5> br, bits<11> flags, string instr_asm> :
TA<op, flags, (outs),
(ins GPR:$a, GPR:$b, brtarget:$offset),
!strconcat(instr_asm, " $a, $b, $offset"),
(ins GPR:$a, GPR:$b),
!strconcat(instr_asm, " $a, $b"),
[], IIBranch> {
let rd = br;
let Form = FCRR;
}
class BranchCI<bits<6> op, bits<5> br, string instr_asm, PatFrag cond_op> :
class BranchCI<bits<6> op, bits<5> br, string instr_asm> :
TB<op, (outs), (ins GPR:$a, brtarget:$offset),
!strconcat(instr_asm, " $a, $offset"),
[], IIBranch> {
@ -430,12 +429,12 @@ let isBranch = 1, isTerminator = 1, hasCtrlDep = 1, isBarrier = 1 in {
}
let isBranch = 1, isTerminator = 1, hasCtrlDep = 1 in {
def BEQI : BranchCI<0x2F, 0x00, "beqi ", seteq>;
def BNEI : BranchCI<0x2F, 0x01, "bnei ", setne>;
def BLTI : BranchCI<0x2F, 0x02, "blti ", setlt>;
def BLEI : BranchCI<0x2F, 0x03, "blei ", setle>;
def BGTI : BranchCI<0x2F, 0x04, "bgti ", setgt>;
def BGEI : BranchCI<0x2F, 0x05, "bgei ", setge>;
def BEQI : BranchCI<0x2F, 0x00, "beqi ">;
def BNEI : BranchCI<0x2F, 0x01, "bnei ">;
def BLTI : BranchCI<0x2F, 0x02, "blti ">;
def BLEI : BranchCI<0x2F, 0x03, "blei ">;
def BGTI : BranchCI<0x2F, 0x04, "bgti ">;
def BGEI : BranchCI<0x2F, 0x05, "bgei ">;
}
let isBranch = 1, isIndirectBranch = 1, isTerminator = 1, hasCtrlDep = 1,
@ -445,12 +444,12 @@ let isBranch = 1, isIndirectBranch = 1, isTerminator = 1, hasCtrlDep = 1,
}
let isBranch = 1, isIndirectBranch = 1, isTerminator = 1, hasCtrlDep = 1 in {
def BEQ : BranchC<0x27, 0x00, 0x000, "beq ", seteq>;
def BNE : BranchC<0x27, 0x01, 0x000, "bne ", setne>;
def BLT : BranchC<0x27, 0x02, 0x000, "blt ", setlt>;
def BLE : BranchC<0x27, 0x03, 0x000, "ble ", setle>;
def BGT : BranchC<0x27, 0x04, 0x000, "bgt ", setgt>;
def BGE : BranchC<0x27, 0x05, 0x000, "bge ", setge>;
def BEQ : BranchC<0x27, 0x00, 0x000, "beq ">;
def BNE : BranchC<0x27, 0x01, 0x000, "bne ">;
def BLT : BranchC<0x27, 0x02, 0x000, "blt ">;
def BLE : BranchC<0x27, 0x03, 0x000, "ble ">;
def BGT : BranchC<0x27, 0x04, 0x000, "bgt ">;
def BGE : BranchC<0x27, 0x05, 0x000, "bge ">;
}
let isBranch = 1, isTerminator = 1, hasDelaySlot = 1, hasCtrlDep = 1,
@ -460,12 +459,12 @@ let isBranch = 1, isTerminator = 1, hasDelaySlot = 1, hasCtrlDep = 1,
}
let isBranch = 1, isTerminator = 1, hasDelaySlot = 1, hasCtrlDep = 1 in {
def BEQID : BranchCI<0x2F, 0x10, "beqid ", seteq>;
def BNEID : BranchCI<0x2F, 0x11, "bneid ", setne>;
def BLTID : BranchCI<0x2F, 0x12, "bltid ", setlt>;
def BLEID : BranchCI<0x2F, 0x13, "bleid ", setle>;
def BGTID : BranchCI<0x2F, 0x14, "bgtid ", setgt>;
def BGEID : BranchCI<0x2F, 0x15, "bgeid ", setge>;
def BEQID : BranchCI<0x2F, 0x10, "beqid ">;
def BNEID : BranchCI<0x2F, 0x11, "bneid ">;
def BLTID : BranchCI<0x2F, 0x12, "bltid ">;
def BLEID : BranchCI<0x2F, 0x13, "bleid ">;
def BGTID : BranchCI<0x2F, 0x14, "bgtid ">;
def BGEID : BranchCI<0x2F, 0x15, "bgeid ">;
}
let isBranch = 1, isIndirectBranch = 1, isTerminator = 1,
@ -476,12 +475,12 @@ let isBranch = 1, isIndirectBranch = 1, isTerminator = 1,
let isBranch = 1, isIndirectBranch = 1, isTerminator = 1,
hasDelaySlot = 1, hasCtrlDep = 1 in {
def BEQD : BranchC<0x27, 0x10, 0x000, "beqd ", seteq>;
def BNED : BranchC<0x27, 0x11, 0x000, "bned ", setne>;
def BLTD : BranchC<0x27, 0x12, 0x000, "bltd ", setlt>;
def BLED : BranchC<0x27, 0x13, 0x000, "bled ", setle>;
def BGTD : BranchC<0x27, 0x14, 0x000, "bgtd ", setgt>;
def BGED : BranchC<0x27, 0x15, 0x000, "bged ", setge>;
def BEQD : BranchC<0x27, 0x10, 0x000, "beqd ">;
def BNED : BranchC<0x27, 0x11, 0x000, "bned ">;
def BLTD : BranchC<0x27, 0x12, 0x000, "bltd ">;
def BLED : BranchC<0x27, 0x13, 0x000, "bled ">;
def BGTD : BranchC<0x27, 0x14, 0x000, "bgtd ">;
def BGED : BranchC<0x27, 0x15, 0x000, "bged ">;
}
let isCall = 1, hasDelaySlot = 1, hasCtrlDep = 1, isBarrier = 1,

View File

@ -146,7 +146,7 @@ unsigned MBlazeMCCodeEmitter::getMachineOpValue(const MCInst &MI,
void MBlazeMCCodeEmitter::
EmitIMM(const MCOperand &imm, unsigned &CurByte, raw_ostream &OS) const {
int32_t val = (int32_t)imm.getImm();
if (val > 32767 || val < -32678) {
if (val > 32767 || val < -32768) {
EmitByte(0x0D, CurByte, OS);
EmitByte(0x00, CurByte, OS);
EmitRawByte((val >> 24) & 0xFF, CurByte, OS);

5
test/MC/MBlaze/dg.exp Normal file
View File

@ -0,0 +1,5 @@
load_lib llvm.exp
if { [llvm_supports_target MBlaze] } {
RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp,s}]]
}

245
test/MC/MBlaze/mblaze_fsl.s Normal file
View File

@ -0,0 +1,245 @@
# RUN: llvm-mc -triple mblaze-unknown-unknown -show-encoding %s | FileCheck %s
# Test to ensure that all FSL immediate operands and FSL instructions
# can be parsed by the assembly parser correctly.
# TYPE F: OPCODE RD NCTAE FSL
# BINARY: 011011 00000 000000 00000 000000 0000
# TYPE FD: OPCODE RD RB NCTAE
# BINARY: 011011 00000 00000 00000 0 00000 00000
# CHECK: get
# BINARY: 011011 00000 000000 00000 000000 0000
# CHECK: encoding: [0x6c,0x00,0x00,0x00]
get r0, rfsl0
# CHECK: nget
# BINARY: 011011 00000 000000 10000 000000 0000
# CHECK: encoding: [0x6c,0x00,0x40,0x00]
nget r0, rfsl0
# CHECK: cget
# BINARY: 011011 00000 000000 01000 000000 0000
# CHECK: encoding: [0x6c,0x00,0x20,0x00]
cget r0, rfsl0
# CHECK: ncget
# BINARY: 011011 00000 000000 11000 000000 0000
# CHECK: encoding: [0x6c,0x00,0x60,0x00]
ncget r0, rfsl0
# CHECK: tget
# BINARY: 011011 00000 000000 00100 000000 0000
# CHECK: encoding: [0x6c,0x00,0x10,0x00]
tget r0, rfsl0
# CHECK: tnget
# BINARY: 011011 00000 000000 10100 000000 0000
# CHECK: encoding: [0x6c,0x00,0x50,0x00]
tnget r0, rfsl0
# CHECK: tcget
# BINARY: 011011 00000 000000 01100 000000 0000
# CHECK: encoding: [0x6c,0x00,0x30,0x00]
tcget r0, rfsl0
# CHECK: tncget
# BINARY: 011011 00000 000000 11100 000000 0000
# CHECK: encoding: [0x6c,0x00,0x70,0x00]
tncget r0, rfsl0
# CHECK: aget
# BINARY: 011011 00000 000000 00010 000000 0000
# CHECK: encoding: [0x6c,0x00,0x08,0x00]
aget r0, rfsl0
# CHECK: naget
# BINARY: 011011 00000 000000 10010 000000 0000
# CHECK: encoding: [0x6c,0x00,0x48,0x00]
naget r0, rfsl0
# CHECK: caget
# BINARY: 011011 00000 000000 01010 000000 0000
# CHECK: encoding: [0x6c,0x00,0x28,0x00]
caget r0, rfsl0
# CHECK: ncaget
# BINARY: 011011 00000 000000 11010 000000 0000
# CHECK: encoding: [0x6c,0x00,0x68,0x00]
ncaget r0, rfsl0
# CHECK: taget
# BINARY: 011011 00000 000000 00110 000000 0000
# CHECK: encoding: [0x6c,0x00,0x18,0x00]
taget r0, rfsl0
# CHECK: tnaget
# BINARY: 011011 00000 000000 10110 000000 0000
# CHECK: encoding: [0x6c,0x00,0x58,0x00]
tnaget r0, rfsl0
# CHECK: tcaget
# BINARY: 011011 00000 000000 01110 000000 0000
# CHECK: encoding: [0x6c,0x00,0x38,0x00]
tcaget r0, rfsl0
# CHECK: tncaget
# BINARY: 011011 00000 000000 11110 000000 0000
# CHECK: encoding: [0x6c,0x00,0x78,0x00]
tncaget r0, rfsl0
# CHECK: eget
# BINARY: 011011 00000 000000 00001 000000 0000
# CHECK: encoding: [0x6c,0x00,0x04,0x00]
eget r0, rfsl0
# CHECK: neget
# BINARY: 011011 00000 000000 10001 000000 0000
# CHECK: encoding: [0x6c,0x00,0x44,0x00]
neget r0, rfsl0
# CHECK: ecget
# BINARY: 011011 00000 000000 01001 000000 0000
# CHECK: encoding: [0x6c,0x00,0x24,0x00]
ecget r0, rfsl0
# CHECK: necget
# BINARY: 011011 00000 000000 11001 000000 0000
# CHECK: encoding: [0x6c,0x00,0x64,0x00]
necget r0, rfsl0
# CHECK: teget
# BINARY: 011011 00000 000000 00101 000000 0000
# CHECK: encoding: [0x6c,0x00,0x14,0x00]
teget r0, rfsl0
# CHECK: tneget
# BINARY: 011011 00000 000000 10101 000000 0000
# CHECK: encoding: [0x6c,0x00,0x54,0x00]
tneget r0, rfsl0
# CHECK: tecget
# BINARY: 011011 00000 000000 01101 000000 0000
# CHECK: encoding: [0x6c,0x00,0x34,0x00]
tecget r0, rfsl0
# CHECK: tnecget
# BINARY: 011011 00000 000000 11101 000000 0000
# CHECK: encoding: [0x6c,0x00,0x74,0x00]
tnecget r0, rfsl0
# CHECK: eaget
# BINARY: 011011 00000 000000 00011 000000 0000
# CHECK: encoding: [0x6c,0x00,0x0c,0x00]
eaget r0, rfsl0
# CHECK: neaget
# BINARY: 011011 00000 000000 10011 000000 0000
# CHECK: encoding: [0x6c,0x00,0x4c,0x00]
neaget r0, rfsl0
# CHECK: ecaget
# BINARY: 011011 00000 000000 01011 000000 0000
# CHECK: encoding: [0x6c,0x00,0x2c,0x00]
ecaget r0, rfsl0
# CHECK: necaget
# BINARY: 011011 00000 000000 11011 000000 0000
# CHECK: encoding: [0x6c,0x00,0x6c,0x00]
necaget r0, rfsl0
# CHECK: teaget
# BINARY: 011011 00000 000000 00111 000000 0000
# CHECK: encoding: [0x6c,0x00,0x1c,0x00]
teaget r0, rfsl0
# CHECK: tneaget
# BINARY: 011011 00000 000000 10111 000000 0000
# CHECK: encoding: [0x6c,0x00,0x5c,0x00]
tneaget r0, rfsl0
# CHECK: tecaget
# BINARY: 011011 00000 000000 01111 000000 0000
# CHECK: encoding: [0x6c,0x00,0x3c,0x00]
tecaget r0, rfsl0
# CHECK: tnecaget
# BINARY: 011011 00000 000000 11111 000000 0000
# CHECK: encoding: [0x6c,0x00,0x7c,0x00]
tnecaget r0, rfsl0
# CHECK: get
# BINARY: 011011 00000 000000 00000 000000 0001
# CHECK: encoding: [0x6c,0x00,0x00,0x01]
get r0, rfsl1
# CHECK: get
# BINARY: 011011 00000 000000 00000 000000 0010
# CHECK: encoding: [0x6c,0x00,0x00,0x02]
get r0, rfsl2
# CHECK: get
# BINARY: 011011 00000 000000 00000 000000 0011
# CHECK: encoding: [0x6c,0x00,0x00,0x03]
get r0, rfsl3
# CHECK: get
# BINARY: 011011 00000 000000 00000 000000 0100
# CHECK: encoding: [0x6c,0x00,0x00,0x04]
get r0, rfsl4
# CHECK: get
# BINARY: 011011 00000 000000 00000 000000 0101
# CHECK: encoding: [0x6c,0x00,0x00,0x05]
get r0, rfsl5
# CHECK: get
# BINARY: 011011 00000 000000 00000 000000 0110
# CHECK: encoding: [0x6c,0x00,0x00,0x06]
get r0, rfsl6
# CHECK: get
# BINARY: 011011 00000 000000 00000 000000 0111
# CHECK: encoding: [0x6c,0x00,0x00,0x07]
get r0, rfsl7
# CHECK: get
# BINARY: 011011 00000 000000 00000 000000 1000
# CHECK: encoding: [0x6c,0x00,0x00,0x08]
get r0, rfsl8
# CHECK: get
# BINARY: 011011 00000 000000 00000 000000 1001
# CHECK: encoding: [0x6c,0x00,0x00,0x09]
get r0, rfsl9
# CHECK: get
# BINARY: 011011 00000 000000 00000 000000 1010
# CHECK: encoding: [0x6c,0x00,0x00,0x0a]
get r0, rfsl10
# CHECK: get
# BINARY: 011011 00000 000000 00000 000000 1011
# CHECK: encoding: [0x6c,0x00,0x00,0x0b]
get r0, rfsl11
# CHECK: get
# BINARY: 011011 00000 000000 00000 000000 1100
# CHECK: encoding: [0x6c,0x00,0x00,0x0c]
get r0, rfsl12
# CHECK: get
# BINARY: 011011 00000 000000 00000 000000 1101
# CHECK: encoding: [0x6c,0x00,0x00,0x0d]
get r0, rfsl13
# CHECK: get
# BINARY: 011011 00000 000000 00000 000000 1110
# CHECK: encoding: [0x6c,0x00,0x00,0x0e]
get r0, rfsl14
# CHECK: get
# BINARY: 011011 00000 000000 00000 000000 1111
# CHECK: encoding: [0x6c,0x00,0x00,0x0f]
get r0, rfsl15

194
test/MC/MBlaze/mblaze_imm.s Normal file
View File

@ -0,0 +1,194 @@
# RUN: llvm-mc -triple mblaze-unknown-unknown -show-encoding %s | FileCheck %s
# In the microblaze instruction set, any TYPE-B instruction with a
# signed immediate value requiring more than 16-bits must be prefixed
# with an IMM instruction that contains the high 16-bits. The higher
# 16-bits are then combined with the lower 16-bits in the original
# instruction to form a 32-bit immediate value.
#
# The generation of IMM instructions is handled automatically by the
# code emitter. Test to ensure that IMM instructions are generated
# when they are suppose to and are not generated when they are not
# needed.
# CHECK: addi
# BINARY: 001000 00000 00000 0000000000000000
# CHECK: encoding: [0x20,0x00,0x00,0x00]
addi r0, r0, 0x00000000
# CHECK: addi
# BINARY: 001000 00000 00000 0000000000000001
# CHECK: encoding: [0x20,0x00,0x00,0x01]
addi r0, r0, 0x00000001
# CHECK: addi
# BINARY: 001000 00000 00000 0000000000000010
# CHECK: encoding: [0x20,0x00,0x00,0x02]
addi r0, r0, 0x00000002
# CHECK: addi
# BINARY: 001000 00000 00000 0000000000000100
# CHECK: encoding: [0x20,0x00,0x00,0x04]
addi r0, r0, 0x00000004
# CHECK: addi
# BINARY: 001000 00000 00000 0000000000001000
# CHECK: encoding: [0x20,0x00,0x00,0x08]
addi r0, r0, 0x00000008
# CHECK: addi
# BINARY: 001000 00000 00000 0000000000010000
# CHECK: encoding: [0x20,0x00,0x00,0x10]
addi r0, r0, 0x00000010
# CHECK: addi
# BINARY: 001000 00000 00000 0000000000100000
# CHECK: encoding: [0x20,0x00,0x00,0x20]
addi r0, r0, 0x00000020
# CHECK: addi
# BINARY: 001000 00000 00000 0000000001000000
# CHECK: encoding: [0x20,0x00,0x00,0x40]
addi r0, r0, 0x00000040
# CHECK: addi
# BINARY: 001000 00000 00000 0000000010000000
# CHECK: encoding: [0x20,0x00,0x00,0x80]
addi r0, r0, 0x00000080
# CHECK: addi
# BINARY: 001000 00000 00000 0000000100000000
# CHECK: encoding: [0x20,0x00,0x01,0x00]
addi r0, r0, 0x00000100
# CHECK: addi
# BINARY: 001000 00000 00000 0000001000000000
# CHECK: encoding: [0x20,0x00,0x02,0x00]
addi r0, r0, 0x00000200
# CHECK: addi
# BINARY: 001000 00000 00000 0000010000000000
# CHECK: encoding: [0x20,0x00,0x04,0x00]
addi r0, r0, 0x00000400
# CHECK: addi
# BINARY: 001000 00000 00000 0000100000000000
# CHECK: encoding: [0x20,0x00,0x08,0x00]
addi r0, r0, 0x00000800
# CHECK: addi
# BINARY: 001000 00000 00000 0001000000000000
# CHECK: encoding: [0x20,0x00,0x10,0x00]
addi r0, r0, 0x00001000
# CHECK: addi
# BINARY: 001000 00000 00000 0010000000000000
# CHECK: encoding: [0x20,0x00,0x20,0x00]
addi r0, r0, 0x00002000
# CHECK: addi
# BINARY: 001000 00000 00000 0100000000000000
# CHECK: encoding: [0x20,0x00,0x40,0x00]
addi r0, r0, 0x00004000
# CHECK: addi
# BINARY: 101100 00000 00000 0000000000000000
# BINARY: 001000 00000 00000 1000000000000000
# CHECK: encoding: [0xb0,0x00,0x00,0x00,0x20,0x00,0x80,0x00]
addi r0, r0, 0x00008000
# CHECK: addi
# BINARY: 101100 00000 00000 0000000000000001
# 001000 00000 00000 0000000000000000
# CHECK: encoding: [0xb0,0x00,0x00,0x01,0x20,0x00,0x00,0x00]
addi r0, r0, 0x00010000
# CHECK: addi
# BINARY: 101100 00000 00000 0000000000000010
# 001000 00000 00000 0000000000000000
# CHECK: encoding: [0xb0,0x00,0x00,0x02,0x20,0x00,0x00,0x00]
addi r0, r0, 0x00020000
# CHECK: addi
# BINARY: 101100 00000 00000 0000000000000100
# 001000 00000 00000 0000000000000000
# CHECK: encoding: [0xb0,0x00,0x00,0x04,0x20,0x00,0x00,0x00]
addi r0, r0, 0x00040000
# CHECK: addi
# BINARY: 101100 00000 00000 0000000000001000
# 001000 00000 00000 0000000000000000
# CHECK: encoding: [0xb0,0x00,0x00,0x08,0x20,0x00,0x00,0x00]
addi r0, r0, 0x00080000
# CHECK: addi
# BINARY: 101100 00000 00000 0000000000010000
# 001000 00000 00000 0000000000000000
# CHECK: encoding: [0xb0,0x00,0x00,0x10,0x20,0x00,0x00,0x00]
addi r0, r0, 0x00100000
# CHECK: addi
# BINARY: 101100 00000 00000 0000000000100000
# 001000 00000 00000 0000000000000000
# CHECK: encoding: [0xb0,0x00,0x00,0x20,0x20,0x00,0x00,0x00]
addi r0, r0, 0x00200000
# CHECK: addi
# BINARY: 101100 00000 00000 0000000001000000
# 001000 00000 00000 0000000000000000
# CHECK: encoding: [0xb0,0x00,0x00,0x40,0x20,0x00,0x00,0x00]
addi r0, r0, 0x00400000
# CHECK: addi
# BINARY: 101100 00000 00000 0000000010000000
# 001000 00000 00000 0000000000000000
# CHECK: encoding: [0xb0,0x00,0x00,0x80,0x20,0x00,0x00,0x00]
addi r0, r0, 0x00800000
# CHECK: addi
# BINARY: 101100 00000 00000 0000000100000000
# 001000 00000 00000 0000000000000000
# CHECK: encoding: [0xb0,0x00,0x01,0x00,0x20,0x00,0x00,0x00]
addi r0, r0, 0x01000000
# CHECK: addi
# BINARY: 101100 00000 00000 0000001000000000
# 001000 00000 00000 0000000000000000
# CHECK: encoding: [0xb0,0x00,0x02,0x00,0x20,0x00,0x00,0x00]
addi r0, r0, 0x02000000
# CHECK: addi
# BINARY: 101100 00000 00000 0000010000000000
# 001000 00000 00000 0000000000000000
# CHECK: encoding: [0xb0,0x00,0x04,0x00,0x20,0x00,0x00,0x00]
addi r0, r0, 0x04000000
# CHECK: addi
# BINARY: 101100 00000 00000 0000100000000000
# 001000 00000 00000 0000000000000000
# CHECK: encoding: [0xb0,0x00,0x08,0x00,0x20,0x00,0x00,0x00]
addi r0, r0, 0x08000000
# CHECK: addi
# BINARY: 101100 00000 00000 0001000000000000
# 001000 00000 00000 0000000000000000
# CHECK: encoding: [0xb0,0x00,0x10,0x00,0x20,0x00,0x00,0x00]
addi r0, r0, 0x10000000
# CHECK: addi
# BINARY: 101100 00000 00000 0010000000000000
# 001000 00000 00000 0000000000000000
# CHECK: encoding: [0xb0,0x00,0x20,0x00,0x20,0x00,0x00,0x00]
addi r0, r0, 0x20000000
# CHECK: addi
# BINARY: 101100 00000 00000 0100000000000000
# 001000 00000 00000 0000000000000000
# CHECK: encoding: [0xb0,0x00,0x40,0x00,0x20,0x00,0x00,0x00]
addi r0, r0, 0x40000000
# CHECK: addi
# BINARY: 101100 00000 00000 1000000000000000
# 001000 00000 00000 0000000000000000
# CHECK: encoding: [0xb0,0x00,0x80,0x00,0x20,0x00,0x00,0x00]
addi r0, r0, 0x80000000

View File

@ -0,0 +1,328 @@
# RUN: llvm-mc -triple mblaze-unknown-unknown -show-encoding %s | FileCheck %s
# Test to ensure that all register and immediate operands can be parsed by
# the assembly parser correctly. Testing the parsing of FSL immediate
# values is done in a different test.
# TYPE A: OPCODE RD RA RB FLAGS
# BINARY: 000000 00000 00000 00000 00000000000
# CHECK: add
# BINARY: 000000 00000 00000 00000 00000000000
# CHECK: encoding: [0x00,0x00,0x00,0x00]
add r0, r0, r0
# CHECK: add
# BINARY: 000000 00001 00001 00001 00000000000
# CHECK: encoding: [0x00,0x21,0x08,0x00]
add r1, r1, r1
# CHECK: add
# BINARY: 000000 00010 00010 00010 00000000000
# CHECK: encoding: [0x00,0x42,0x10,0x00]
add r2, r2, r2
# CHECK: add
# BINARY: 000000 00011 00011 00011 00000000000
# CHECK: encoding: [0x00,0x63,0x18,0x00]
add r3, r3, r3
# CHECK: add
# BINARY: 000000 00100 00100 00100 00000000000
# CHECK: encoding: [0x00,0x84,0x20,0x00]
add r4, r4, r4
# CHECK: add
# BINARY: 000000 00101 00101 00101 00000000000
# CHECK: encoding: [0x00,0xa5,0x28,0x00]
add r5, r5, r5
# CHECK: add
# BINARY: 000000 00110 00110 00110 00000000000
# CHECK: encoding: [0x00,0xc6,0x30,0x00]
add r6, r6, r6
# CHECK: add
# BINARY: 000000 00111 00111 00111 00000000000
# CHECK: encoding: [0x00,0xe7,0x38,0x00]
add r7, r7, r7
# CHECK: add
# BINARY: 000000 01000 01000 01000 00000000000
# CHECK: encoding: [0x01,0x08,0x40,0x00]
add r8, r8, r8
# CHECK: add
# BINARY: 000000 01001 01001 01001 00000000000
# CHECK: encoding: [0x01,0x29,0x48,0x00]
add r9, r9, r9
# CHECK: add
# BINARY: 000000 01010 01010 01010 00000000000
# CHECK: encoding: [0x01,0x4a,0x50,0x00]
add r10, r10, r10
# CHECK: add
# BINARY: 000000 01011 01011 01011 00000000000
# CHECK: encoding: [0x01,0x6b,0x58,0x00]
add r11, r11, r11
# CHECK: add
# BINARY: 000000 01100 01100 01100 00000000000
# CHECK: encoding: [0x01,0x8c,0x60,0x00]
add r12, r12, r12
# CHECK: add
# BINARY: 000000 01101 01101 01101 00000000000
# CHECK: encoding: [0x01,0xad,0x68,0x00]
add r13, r13, r13
# CHECK: add
# BINARY: 000000 01110 01110 01110 00000000000
# CHECK: encoding: [0x01,0xce,0x70,0x00]
add r14, r14, r14
# CHECK: add
# BINARY: 000000 01111 01111 01111 00000000000
# CHECK: encoding: [0x01,0xef,0x78,0x00]
add r15, r15, r15
# CHECK: add
# BINARY: 000000 10000 10000 10000 00000000000
# CHECK: encoding: [0x02,0x10,0x80,0x00]
add r16, r16, r16
# CHECK: add
# BINARY: 000000 10001 10001 10001 00000000000
# CHECK: encoding: [0x02,0x31,0x88,0x00]
add r17, r17, r17
# CHECK: add
# BINARY: 000000 10010 10010 10010 00000000000
# CHECK: encoding: [0x02,0x52,0x90,0x00]
add r18, r18, r18
# CHECK: add
# BINARY: 000000 10011 10011 10011 00000000000
# CHECK: encoding: [0x02,0x73,0x98,0x00]
add r19, r19, r19
# CHECK: add
# BINARY: 000000 10100 10100 10100 00000000000
# CHECK: encoding: [0x02,0x94,0xa0,0x00]
add r20, r20, r20
# CHECK: add
# BINARY: 000000 10101 10101 10101 00000000000
# CHECK: encoding: [0x02,0xb5,0xa8,0x00]
add r21, r21, r21
# CHECK: add
# BINARY: 000000 10110 10110 10110 00000000000
# CHECK: encoding: [0x02,0xd6,0xb0,0x00]
add r22, r22, r22
# CHECK: add
# BINARY: 000000 10111 10111 10111 00000000000
# CHECK: encoding: [0x02,0xf7,0xb8,0x00]
add r23, r23, r23
# CHECK: add
# BINARY: 000000 11000 11000 11000 00000000000
# CHECK: encoding: [0x03,0x18,0xc0,0x00]
add r24, r24, r24
# CHECK: add
# BINARY: 000000 11001 11001 11001 00000000000
# CHECK: encoding: [0x03,0x39,0xc8,0x00]
add r25, r25, r25
# CHECK: add
# BINARY: 000000 11010 11010 11010 00000000000
# CHECK: encoding: [0x03,0x5a,0xd0,0x00]
add r26, r26, r26
# CHECK: add
# BINARY: 000000 11011 11011 11011 00000000000
# CHECK: encoding: [0x03,0x7b,0xd8,0x00]
add r27, r27, r27
# CHECK: add
# BINARY: 000000 11100 11100 11100 00000000000
# CHECK: encoding: [0x03,0x9c,0xe0,0x00]
add r28, r28, r28
# CHECK: add
# BINARY: 000000 11101 11101 11101 00000000000
# CHECK: encoding: [0x03,0xbd,0xe8,0x00]
add r29, r29, r29
# CHECK: add
# BINARY: 000000 11110 11110 11110 00000000000
# CHECK: encoding: [0x03,0xde,0xf0,0x00]
add r30, r30, r30
# CHECK: add
# BINARY: 000000 11111 11111 11111 00000000000
# CHECK: encoding: [0x03,0xff,0xf8,0x00]
add r31, r31, r31
# CHECK: addi
# BINARY: 001000 00000 00000 0000000000000000
# CHECK: encoding: [0x20,0x00,0x00,0x00]
addi r0, r0, 0
# CHECK: addi
# BINARY: 001000 00000 00000 0000000000000001
# CHECK: encoding: [0x20,0x00,0x00,0x01]
addi r0, r0, 1
# CHECK: addi
# BINARY: 001000 00000 00000 0000000000000010
# CHECK: encoding: [0x20,0x00,0x00,0x02]
addi r0, r0, 2
# CHECK: addi
# BINARY: 001000 00000 00000 0000000000000100
# CHECK: encoding: [0x20,0x00,0x00,0x04]
addi r0, r0, 4
# CHECK: addi
# BINARY: 001000 00000 00000 0000000000001000
# CHECK: encoding: [0x20,0x00,0x00,0x08]
addi r0, r0, 8
# CHECK: addi
# BINARY: 001000 00000 00000 0000000000010000
# CHECK: encoding: [0x20,0x00,0x00,0x10]
addi r0, r0, 16
# CHECK: addi
# BINARY: 001000 00000 00000 0000000000100000
# CHECK: encoding: [0x20,0x00,0x00,0x20]
addi r0, r0, 32
# CHECK: addi
# BINARY: 001000 00000 00000 0000000001000000
# CHECK: encoding: [0x20,0x00,0x00,0x40]
addi r0, r0, 64
# CHECK: addi
# BINARY: 001000 00000 00000 0000000010000000
# CHECK: encoding: [0x20,0x00,0x00,0x80]
addi r0, r0, 128
# CHECK: addi
# BINARY: 001000 00000 00000 0000000100000000
# CHECK: encoding: [0x20,0x00,0x01,0x00]
addi r0, r0, 256
# CHECK: addi
# BINARY: 001000 00000 00000 0000001000000000
# CHECK: encoding: [0x20,0x00,0x02,0x00]
addi r0, r0, 512
# CHECK: addi
# BINARY: 001000 00000 00000 0000010000000000
# CHECK: encoding: [0x20,0x00,0x04,0x00]
addi r0, r0, 1024
# CHECK: addi
# BINARY: 001000 00000 00000 0000100000000000
# CHECK: encoding: [0x20,0x00,0x08,0x00]
addi r0, r0, 2048
# CHECK: addi
# BINARY: 001000 00000 00000 0001000000000000
# CHECK: encoding: [0x20,0x00,0x10,0x00]
addi r0, r0, 4096
# CHECK: addi
# BINARY: 001000 00000 00000 0010000000000000
# CHECK: encoding: [0x20,0x00,0x20,0x00]
addi r0, r0, 8192
# CHECK: addi
# BINARY: 001000 00000 00000 0100000000000000
# CHECK: encoding: [0x20,0x00,0x40,0x00]
addi r0, r0, 16384
# CHECK: addi
# BINARY: 001000 00000 00000 1111111111111111
# CHECK: encoding: [0x20,0x00,0xff,0xff]
addi r0, r0, -1
# CHECK: addi
# BINARY: 001000 00000 00000 1111111111111110
# CHECK: encoding: [0x20,0x00,0xff,0xfe]
addi r0, r0, -2
# CHECK: addi
# BINARY: 001000 00000 00000 1111111111111100
# CHECK: encoding: [0x20,0x00,0xff,0xfc]
addi r0, r0, -4
# CHECK: addi
# BINARY: 001000 00000 00000 1111111111111000
# CHECK: encoding: [0x20,0x00,0xff,0xf8]
addi r0, r0, -8
# CHECK: addi
# BINARY: 001000 00000 00000 1111111111110000
# CHECK: encoding: [0x20,0x00,0xff,0xf0]
addi r0, r0, -16
# CHECK: addi
# BINARY: 001000 00000 00000 1111111111100000
# CHECK: encoding: [0x20,0x00,0xff,0xe0]
addi r0, r0, -32
# CHECK: addi
# BINARY: 001000 00000 00000 1111111111000000
# CHECK: encoding: [0x20,0x00,0xff,0xc0]
addi r0, r0, -64
# CHECK: addi
# BINARY: 001000 00000 00000 1111111110000000
# CHECK: encoding: [0x20,0x00,0xff,0x80]
addi r0, r0, -128
# CHECK: addi
# BINARY: 001000 00000 00000 1111111100000000
# CHECK: encoding: [0x20,0x00,0xff,0x00]
addi r0, r0, -256
# CHECK: addi
# BINARY: 001000 00000 00000 1111111000000000
# CHECK: encoding: [0x20,0x00,0xfe,0x00]
addi r0, r0, -512
# CHECK: addi
# BINARY: 001000 00000 00000 1111110000000000
# CHECK: encoding: [0x20,0x00,0xfc,0x00]
addi r0, r0, -1024
# CHECK: addi
# BINARY: 001000 00000 00000 1111100000000000
# CHECK: encoding: [0x20,0x00,0xf8,0x00]
addi r0, r0, -2048
# CHECK: addi
# BINARY: 001000 00000 00000 1111000000000000
# CHECK: encoding: [0x20,0x00,0xf0,0x00]
addi r0, r0, -4096
# CHECK: addi
# BINARY: 001000 00000 00000 1110000000000000
# CHECK: encoding: [0x20,0x00,0xe0,0x00]
addi r0, r0, -8192
# CHECK: addi
# BINARY: 001000 00000 00000 1100000000000000
# CHECK: encoding: [0x20,0x00,0xc0,0x00]
addi r0, r0, -16384
# CHECK: addi
# BINARY: 001000 00000 00000 1000000000000000
# CHECK: encoding: [0x20,0x00,0x80,0x00]
addi r0, r0, -32768

View File

@ -0,0 +1,72 @@
# RUN: llvm-mc -triple mblaze-unknown-unknown -show-encoding %s | FileCheck %s
# Test to make sure that all of the TYPE-A instructions supported by
# the Microblaze can be parsed by the assembly parser.
# TYPE A: OPCODE RD RA RB FLAGS
# BINARY: 000000 00000 00000 00000 00000000000
# CHECK: add
# BINARY: 000000 00001 00010 00011 00000000000
# CHECK: encoding: [0x00,0x22,0x18,0x00]
add r1, r2, r3
# CHECK: addc
# BINARY: 000010 00001 00010 00011 00000000000
# CHECK: encoding: [0x08,0x22,0x18,0x00]
addc r1, r2, r3
# CHECK: addk
# BINARY: 000100 00001 00010 00011 00000000000
# CHECK: encoding: [0x10,0x22,0x18,0x00]
addk r1, r2, r3
# CHECK: addkc
# BINARY: 000110 00001 00010 00011 00000000000
# CHECK: encoding: [0x18,0x22,0x18,0x00]
addkc r1, r2, r3
# CHECK: and
# BINARY: 100001 00001 00010 00011 00000000000
# CHECK: encoding: [0x84,0x22,0x18,0x00]
and r1, r2, r3
# CHECK: andn
# BINARY: 100011 00001 00010 00011 00000000000
# CHECK: encoding: [0x8c,0x22,0x18,0x00]
andn r1, r2, r3
# CHECK: beq
# BINARY: 100111 00000 00010 00011 00000000000
# CHECK: encoding: [0x9c,0x02,0x18,0x00]
beq r2, r3
# CHECK: bge
# BINARY: 100111 00101 00010 00011 00000000000
# CHECK: encoding: [0x9c,0xa2,0x18,0x00]
bge r2, r3
# CHECK: bgt
# BINARY: 100111 00100 00010 00011 00000000000
# CHECK: encoding: [0x9c,0x82,0x18,0x00]
bgt r2, r3
# CHECK: ble
# BINARY: 100111 00011 00010 00011 00000000000
# CHECK: encoding: [0x9c,0x62,0x18,0x00]
ble r2, r3
# CHECK: blt
# BINARY: 100111 00010 00010 00011 00000000000
# CHECK: encoding: [0x9c,0x42,0x18,0x00]
blt r2, r3
# CHECK: bne
# BINARY: 100111 00001 00010 00011 00000000000
# CHECK: encoding: [0x9c,0x22,0x18,0x00]
bne r2, r3
# CHECK: nop
# BINARY: 100000 00000 00000 00000 00000000000
# CHECK: encoding: [0x80,0x00,0x00,0x00]
nop

View File

@ -0,0 +1,37 @@
# RUN: llvm-mc -triple mblaze-unknown-unknown -show-encoding %s | FileCheck %s
# Test to make sure that all of the TYPE-B instructions supported by
# the Microblaze can be parsed by the assembly parser.
# TYPE B: OPCODE RD RA IMMEDIATE
# 000000 00000 00000 0000000000000000
# CHECK: addi
# BINARY: 001000 00001 00010 0000000000001111
# CHECK: encoding: [0x20,0x22,0x00,0x0f]
addi r1, r2, 0x000F
# CHECK: addic
# BINARY: 001010 00001 00010 0000000000001111
# CHECK: encoding: [0x28,0x22,0x00,0x0f]
addic r1, r2, 0x000F
# CHECK: addik
# BINARY: 001100 00001 00010 0000000000001111
# CHECK: encoding: [0x30,0x22,0x00,0x0f]
addik r1, r2, 0x000F
# CHECK: addikc
# BINARY: 001110 00001 00010 0000000000001111
# CHECK: encoding: [0x38,0x22,0x00,0x0f]
addikc r1, r2, 0x000F
# CHECK: andi
# BINARY: 101001 00001 00010 0000000000001111
# CHECK: encoding: [0xa4,0x22,0x00,0x0f]
andi r1, r2, 0x000F
# CHECK: andni
# BINARY: 101011 00001 00010 0000000000001111
# CHECK: encoding: [0xac,0x22,0x00,0x0f]
andni r1, r2, 0x000F