[llvm-commits] [llvm] r145161 - in /llvm/trunk: lib/Target/MBlaze/Disassembler/MBlazeDisassembler.cpp lib/Target/MBlaze/MBlazeInstrFormats.td lib/Target/MBlaze/MBlazeInstrInfo.td lib/Target/MBlaze/MCTargetDesc/MBlazeBaseInfo.h test/MC/Disassembler/MBlaze/mblaze_mbar.txt test/MC/Disassembler/MBlaze/mblaze_pattern.txt
Wesley Peck
peckw at wesleypeck.com
Sat Nov 26 21:16:58 PST 2011
Author: peckw
Date: Sat Nov 26 23:16:58 2011
New Revision: 145161
URL: http://llvm.org/viewvc/llvm-project?rev=145161&view=rev
Log:
Add several new instructions supported by the latest MicroBlaze.
These instructions are not generated by the backend yet, this will come in a later commit.
Added:
llvm/trunk/test/MC/Disassembler/MBlaze/mblaze_mbar.txt
Modified:
llvm/trunk/lib/Target/MBlaze/Disassembler/MBlazeDisassembler.cpp
llvm/trunk/lib/Target/MBlaze/MBlazeInstrFormats.td
llvm/trunk/lib/Target/MBlaze/MBlazeInstrInfo.td
llvm/trunk/lib/Target/MBlaze/MCTargetDesc/MBlazeBaseInfo.h
llvm/trunk/test/MC/Disassembler/MBlaze/mblaze_pattern.txt
Modified: llvm/trunk/lib/Target/MBlaze/Disassembler/MBlazeDisassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MBlaze/Disassembler/MBlazeDisassembler.cpp?rev=145161&r1=145160&r2=145161&view=diff
==============================================================================
--- llvm/trunk/lib/Target/MBlaze/Disassembler/MBlazeDisassembler.cpp (original)
+++ llvm/trunk/lib/Target/MBlaze/Disassembler/MBlazeDisassembler.cpp Sat Nov 26 23:16:58 2011
@@ -123,6 +123,7 @@
case 0x41: return MBlaze::SRL;
case 0x21: return MBlaze::SRC;
case 0x01: return MBlaze::SRA;
+ case 0xE0: return MBlaze::CLZ;
}
}
@@ -176,6 +177,13 @@
}
static unsigned decodeBRI(uint32_t insn) {
+ switch (insn&0x3FFFFFF) {
+ default: break;
+ case 0x0020004: return MBlaze::IDMEMBAR;
+ case 0x0220004: return MBlaze::DMEMBAR;
+ case 0x0420004: return MBlaze::IMEMBAR;
+ }
+
switch ((insn>>16)&0x1F) {
default: return UNSUPPORTED;
case 0x00: return MBlaze::BRI;
@@ -531,6 +539,9 @@
default:
return Fail;
+ case MBlazeII::FC:
+ break;
+
case MBlazeII::FRRRR:
if (RD == UNSUPPORTED || RA == UNSUPPORTED || RB == UNSUPPORTED)
return Fail;
@@ -547,6 +558,13 @@
instr.addOperand(MCOperand::CreateReg(RB));
break;
+ case MBlazeII::FRR:
+ if (RD == UNSUPPORTED || RA == UNSUPPORTED)
+ return Fail;
+ instr.addOperand(MCOperand::CreateReg(RD));
+ instr.addOperand(MCOperand::CreateReg(RA));
+ break;
+
case MBlazeII::FRI:
switch (opcode) {
default:
Modified: llvm/trunk/lib/Target/MBlaze/MBlazeInstrFormats.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MBlaze/MBlazeInstrFormats.td?rev=145161&r1=145160&r2=145161&view=diff
==============================================================================
--- llvm/trunk/lib/Target/MBlaze/MBlazeInstrFormats.td (original)
+++ llvm/trunk/lib/Target/MBlaze/MBlazeInstrFormats.td Sat Nov 26 23:16:58 2011
@@ -35,6 +35,7 @@
def FRRRR : Format<18>; // RSUB, FRSUB
def FRI : Format<19>; // RSUB, FRSUB
def FC : Format<20>; // NOP
+def FRR : Format<21>; // CLZ
//===----------------------------------------------------------------------===//
// Describe MBlaze instructions format
@@ -202,3 +203,26 @@
let Inst{11-16} = flags;
let Inst{17-31} = imm15;
}
+
+//===----------------------------------------------------------------------===//
+// TCLZ instruction class in MBlaze : <|opcode|rd|imm15|>
+//===----------------------------------------------------------------------===//
+class TCLZ<bits<6> op, bits<16> flags, dag outs, dag ins, string asmstr,
+ list<dag> pattern, InstrItinClass itin> :
+ MBlazeInst<op, FRR, outs, ins, asmstr, pattern, itin> {
+ bits<5> rd;
+ bits<5> ra;
+
+ let Inst{6-10} = rd;
+ let Inst{11-15} = ra;
+ let Inst{16-31} = flags;
+}
+
+//===----------------------------------------------------------------------===//
+// MBAR instruction class in MBlaze : <|opcode|rd|imm15|>
+//===----------------------------------------------------------------------===//
+class MBAR<bits<6> op, bits<26> flags, dag outs, dag ins, string asmstr,
+ list<dag> pattern, InstrItinClass itin> :
+ MBlazeInst<op, FC, outs, ins, asmstr, pattern, itin> {
+ let Inst{6-31} = flags;
+}
Modified: llvm/trunk/lib/Target/MBlaze/MBlazeInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MBlaze/MBlazeInstrInfo.td?rev=145161&r1=145160&r2=145161&view=diff
==============================================================================
--- llvm/trunk/lib/Target/MBlaze/MBlazeInstrInfo.td (original)
+++ llvm/trunk/lib/Target/MBlaze/MBlazeInstrInfo.td Sat Nov 26 23:16:58 2011
@@ -594,9 +594,18 @@
//===----------------------------------------------------------------------===//
let neverHasSideEffects = 1 in {
- def NOP : MBlazeInst< 0x20, FC, (outs), (ins), "nop ", [], IIC_ALU>;
+ def NOP : MBlazeInst<0x20, FC, (outs), (ins), "nop ", [], IIC_ALU>;
}
+let Predicates=[HasPatCmp] in {
+ def CLZ : TCLZ<0x24, 0x00E0, (outs GPR:$dst), (ins GPR:$src),
+ "clz $dst, $src", [], IIC_ALU>;
+}
+
+def IMEMBAR : MBAR<0x2E, 0x0420004, (outs), (ins), "mbar 2", [], IIC_ALU>;
+def DMEMBAR : MBAR<0x2E, 0x0220004, (outs), (ins), "mbar 1", [], IIC_ALU>;
+def IDMEMBAR : MBAR<0x2E, 0x0020004, (outs), (ins), "mbar 0", [], IIC_ALU>;
+
let usesCustomInserter = 1 in {
def Select_CC : MBlazePseudo<(outs GPR:$dst),
(ins GPR:$T, GPR:$F, GPR:$CMP, i32imm:$CC), // F T reversed
Modified: llvm/trunk/lib/Target/MBlaze/MCTargetDesc/MBlazeBaseInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MBlaze/MCTargetDesc/MBlazeBaseInfo.h?rev=145161&r1=145160&r2=145161&view=diff
==============================================================================
--- llvm/trunk/lib/Target/MBlaze/MCTargetDesc/MBlazeBaseInfo.h (original)
+++ llvm/trunk/lib/Target/MBlaze/MCTargetDesc/MBlazeBaseInfo.h Sat Nov 26 23:16:58 2011
@@ -51,6 +51,7 @@
FRRRR,
FRI,
FC,
+ FRR,
FormMask = 63
//===------------------------------------------------------------------===//
Added: llvm/trunk/test/MC/Disassembler/MBlaze/mblaze_mbar.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/MBlaze/mblaze_mbar.txt?rev=145161&view=auto
==============================================================================
--- llvm/trunk/test/MC/Disassembler/MBlaze/mblaze_mbar.txt (added)
+++ llvm/trunk/test/MC/Disassembler/MBlaze/mblaze_mbar.txt Sat Nov 26 23:16:58 2011
@@ -0,0 +1,14 @@
+# RUN: llvm-mc --disassemble %s -triple=mblaze-unknown-unknown | FileCheck %s
+
+################################################################################
+# Memory Barrier instructions
+################################################################################
+
+# CHECK: mbar 0
+0xB8 0x02 0x00 0x04
+
+# CHECK: mbar 1
+0xB8 0x22 0x00 0x04
+
+# CHECK: mbar 2
+0xB8 0x42 0x00 0x04
Modified: llvm/trunk/test/MC/Disassembler/MBlaze/mblaze_pattern.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/MBlaze/mblaze_pattern.txt?rev=145161&r1=145160&r2=145161&view=diff
==============================================================================
--- llvm/trunk/test/MC/Disassembler/MBlaze/mblaze_pattern.txt (original)
+++ llvm/trunk/test/MC/Disassembler/MBlaze/mblaze_pattern.txt Sat Nov 26 23:16:58 2011
@@ -12,3 +12,6 @@
# CHECK: pcmpeq r0, r1, r2
0x88 0x01 0x14 0x00
+
+# CHECK: clz r0, r1
+0x90 0x01 0x00 0xE0
More information about the llvm-commits
mailing list