a0f5dd84cdf0ac0bb319dddb5189e38759058ea7
[oota-llvm.git] / lib / Target / Mips / MicroMips32r6InstrInfo.td
1 //=- MicroMips32r6InstrInfo.td - MicroMips r6 Instruction Information -*- tablegen -*-=//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file describes microMIPSr6 instructions.
11 //
12 //===----------------------------------------------------------------------===//
13
14 //===----------------------------------------------------------------------===//
15 //
16 // Instruction Encodings
17 //
18 //===----------------------------------------------------------------------===//
19 class ADD_MMR6_ENC : ARITH_FM_MMR6<"add", 0x110>;
20 class ADDIU_MMR6_ENC : ADDI_FM_MMR6<"addiu", 0xc>;
21 class ADDU_MMR6_ENC : ARITH_FM_MMR6<"addu", 0x150>;
22 class BALC_MMR6_ENC  : BRANCH_OFF26_FM<0b101101>;
23 class BC_MMR6_ENC : BRANCH_OFF26_FM<0b100101>;
24 class BITSWAP_MMR6_ENC : POOL32A_BITSWAP_FM_MMR6<0b101100>;
25 class CACHE_MMR6_ENC : CACHE_PREF_FM_MMR6<0b001000, 0b0110>;
26 class PREF_MMR6_ENC : CACHE_PREF_FM_MMR6<0b011000, 0b0010>;
27 class SUB_MMR6_ENC : ARITH_FM_MMR6<"sub", 0x190>;
28 class SUBU_MMR6_ENC : ARITH_FM_MMR6<"subu", 0x1d0>;
29
30 //===----------------------------------------------------------------------===//
31 //
32 // Instruction Descriptions
33 //
34 //===----------------------------------------------------------------------===//
35
36 class ADD_MMR6_DESC : ArithLogicR<"add", GPR32Opnd>;
37 class ADDIU_MMR6_DESC : ArithLogicI<"addiu", simm16, GPR32Opnd>;
38 class ADDU_MMR6_DESC : ArithLogicR<"addu", GPR32Opnd>;
39
40 class BC_MMR6_DESC_BASE<string instr_asm, DAGOperand opnd>
41     : BRANCH_DESC_BASE, MMR6Arch<instr_asm> {
42   dag InOperandList = (ins opnd:$offset);
43   dag OutOperandList = (outs);
44   string AsmString = !strconcat(instr_asm, "\t$offset");
45   bit isBarrier = 1;
46 }
47
48 class BALC_MMR6_DESC : BC_MMR6_DESC_BASE<"balc", brtarget26> {
49   bit isCall = 1;
50   list<Register> Defs = [RA];
51 }
52 class BC_MMR6_DESC : BC_MMR6_DESC_BASE<"bc", brtarget26>;
53 class SUB_MMR6_DESC : ArithLogicR<"sub", GPR32Opnd>;
54 class SUBU_MMR6_DESC : ArithLogicR<"subu", GPR32Opnd>;
55
56 class BITSWAP_MMR6_DESC_BASE<string instr_asm, RegisterOperand GPROpnd>
57     : MMR6Arch<instr_asm> {
58   dag OutOperandList = (outs GPROpnd:$rd);
59   dag InOperandList = (ins GPROpnd:$rt);
60   string AsmString = !strconcat(instr_asm, "\t$rd, $rt");
61   list<dag> Pattern = [];
62 }
63
64 class BITSWAP_MMR6_DESC : BITSWAP_MMR6_DESC_BASE<"bitswap", GPR32Opnd>;
65
66 class CACHE_HINT_MMR6_DESC<string instr_asm, Operand MemOpnd,
67                            RegisterOperand GPROpnd> : MMR6Arch<instr_asm> {
68   dag OutOperandList = (outs);
69   dag InOperandList = (ins MemOpnd:$addr, uimm5:$hint);
70   string AsmString = !strconcat(instr_asm, "\t$hint, $addr");
71   list<dag> Pattern = [];
72   string DecoderMethod = "DecodeCacheOpMM";
73 }
74
75 class CACHE_MMR6_DESC : CACHE_HINT_MMR6_DESC<"cache", mem_mm_12, GPR32Opnd>;
76 class PREF_MMR6_DESC : CACHE_HINT_MMR6_DESC<"pref", mem_mm_12, GPR32Opnd>;
77
78 //===----------------------------------------------------------------------===//
79 //
80 // Instruction Definitions
81 //
82 //===----------------------------------------------------------------------===//
83
84 let DecoderNamespace = "MicroMips32r6" in {
85 def ADD_MMR6 : StdMMR6Rel, ADD_MMR6_DESC, ADD_MMR6_ENC, ISA_MICROMIPS32R6;
86 def ADDIU_MMR6 : StdMMR6Rel, ADDIU_MMR6_DESC, ADDIU_MMR6_ENC, ISA_MICROMIPS32R6;
87 def ADDU_MMR6 : StdMMR6Rel, ADDU_MMR6_DESC, ADDU_MMR6_ENC, ISA_MICROMIPS32R6;
88 def BALC_MMR6 : R6MMR6Rel, BALC_MMR6_ENC, BALC_MMR6_DESC, ISA_MICROMIPS32R6;
89 def BC_MMR6 : R6MMR6Rel, BC_MMR6_ENC, BC_MMR6_DESC, ISA_MICROMIPS32R6;
90 def BITSWAP_MMR6 : R6MMR6Rel, BITSWAP_MMR6_ENC, BITSWAP_MMR6_DESC,
91                    ISA_MICROMIPS32R6;
92 def CACHE_MMR6 : R6MMR6Rel, CACHE_MMR6_ENC, CACHE_MMR6_DESC, ISA_MICROMIPS32R6;
93 def PREF_MMR6 : R6MMR6Rel, PREF_MMR6_ENC, PREF_MMR6_DESC, ISA_MICROMIPS32R6;
94 def SUB_MMR6 : StdMMR6Rel, SUB_MMR6_DESC, SUB_MMR6_ENC, ISA_MICROMIPS32R6;
95 def SUBU_MMR6 : StdMMR6Rel, SUBU_MMR6_DESC, SUBU_MMR6_ENC, ISA_MICROMIPS32R6;
96 }