[mips][microMIPS] Create microMIPS64r6 subtarget and implement DALIGN, DAUI, DAHI...
[oota-llvm.git] / lib / Target / Mips / MicroMips64r6InstrInfo.td
1 //=-  MicroMips64r6InstrInfo.td - 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 MicroMips64r6 instructions.
11 //
12 //===----------------------------------------------------------------------===//
13
14 //===----------------------------------------------------------------------===//
15 //
16 // Instruction Encodings
17 //
18 //===----------------------------------------------------------------------===//
19
20 class DAUI_MMR6_ENC : DAUI_FM_MMR6;
21 class DAHI_MMR6_ENC : POOL32I_ADD_IMM_FM_MMR6<0b10001>;
22 class DATI_MMR6_ENC : POOL32I_ADD_IMM_FM_MMR6<0b10000>;
23 class DEXT_MMR6_ENC : POOL32S_EXTBITS_FM_MMR6<0b101100>;
24 class DEXTM_MMR6_ENC : POOL32S_EXTBITS_FM_MMR6<0b100100>;
25 class DEXTU_MMR6_ENC : POOL32S_EXTBITS_FM_MMR6<0b010100>;
26 class DALIGN_MMR6_ENC : POOL32S_DALIGN_FM_MMR6;
27
28 //===----------------------------------------------------------------------===//
29 //
30 // Instruction Descriptions
31 //
32 //===----------------------------------------------------------------------===//
33
34 class DAUI_MMR6_DESC_BASE<string instr_asm, RegisterOperand GPROpnd>
35     : MMR6Arch<instr_asm>, MipsR6Inst {
36   dag OutOperandList = (outs GPROpnd:$rt);
37   dag InOperandList = (ins GPROpnd:$rs, simm16:$imm);
38   string AsmString = !strconcat(instr_asm, "\t$rt, $rs, $imm");
39   list<dag> Pattern = [];
40 }
41 class DAUI_MMR6_DESC : DAUI_MMR6_DESC_BASE<"daui", GPR64Opnd>;
42
43 class DAHI_DATI_DESC_BASE<string instr_asm, RegisterOperand GPROpnd>
44     : MMR6Arch<instr_asm>, MipsR6Inst {
45   dag OutOperandList = (outs GPROpnd:$rs);
46   dag InOperandList = (ins GPROpnd:$rt, simm16:$imm);
47   string AsmString = !strconcat(instr_asm, "\t$rt, $imm");
48   string Constraints = "$rs = $rt";
49 }
50 class DAHI_MMR6_DESC : DAHI_DATI_DESC_BASE<"dahi", GPR64Opnd>;
51 class DATI_MMR6_DESC : DAHI_DATI_DESC_BASE<"dati", GPR64Opnd>;
52
53 class EXTBITS_DESC_BASE<string instr_asm, RegisterOperand RO, Operand PosOpnd,
54     SDPatternOperator Op = null_frag> : MMR6Arch<instr_asm>, MipsR6Inst {
55   dag OutOperandList = (outs RO:$rt);
56   dag InOperandList = (ins RO:$rs, PosOpnd:$pos, size_ext:$size);
57   string AsmString = !strconcat(instr_asm, "\t$rt, $rs, $pos, $size");
58   list<dag> Pattern = [(set RO:$rt, (Op RO:$rs, imm:$pos, imm:$size))];
59   InstrItinClass Itinerary = II_EXT;
60   Format Form = FrmR;
61   string BaseOpcode = instr_asm;
62 }
63 class DEXT_MMR6_DESC : EXTBITS_DESC_BASE<"dext", GPR64Opnd, uimm6,
64                                                  MipsExt>;
65 class DEXTM_MMR6_DESC : EXTBITS_DESC_BASE<"dextm", GPR64Opnd, uimm6,
66                                                   MipsExt>;
67 class DEXTU_MMR6_DESC : EXTBITS_DESC_BASE<"dextu", GPR64Opnd, uimm6,
68                                                   MipsExt>;
69
70 class DALIGN_DESC_BASE<string instr_asm, RegisterOperand GPROpnd,
71                       Operand ImmOpnd> : MMR6Arch<instr_asm>, MipsR6Inst {
72   dag OutOperandList = (outs GPROpnd:$rd);
73   dag InOperandList = (ins GPROpnd:$rs, GPROpnd:$rt, ImmOpnd:$bp);
74   string AsmString = !strconcat(instr_asm, "\t$rd, $rs, $rt, $bp");
75   list<dag> Pattern = [];
76 }
77
78 class DALIGN_MMR6_DESC : DALIGN_DESC_BASE<"dalign", GPR64Opnd, uimm3>;
79
80 //===----------------------------------------------------------------------===//
81 //
82 // Instruction Definitions
83 //
84 //===----------------------------------------------------------------------===//
85
86 let DecoderNamespace = "MicroMipsR6" in {
87   def DAUI_MM64R6 : StdMMR6Rel, DAUI_MMR6_DESC, DAUI_MMR6_ENC, ISA_MICROMIPS64R6;
88   def DAHI_MM64R6 : StdMMR6Rel, DAHI_MMR6_DESC, DAHI_MMR6_ENC, ISA_MICROMIPS64R6;
89   def DATI_MM64R6 : StdMMR6Rel, DATI_MMR6_DESC, DATI_MMR6_ENC, ISA_MICROMIPS64R6;
90   def DEXT_MM64R6 : StdMMR6Rel, DEXT_MMR6_DESC, DEXT_MMR6_ENC,
91                     ISA_MICROMIPS64R6;
92   def DEXTM_MM64R6 : StdMMR6Rel, DEXTM_MMR6_DESC, DEXTM_MMR6_ENC,
93                      ISA_MICROMIPS64R6;
94   def DEXTU_MM64R6 : StdMMR6Rel, DEXTU_MMR6_DESC, DEXTU_MMR6_ENC,
95                      ISA_MICROMIPS64R6;
96   def DALIGN_MM64R6 : StdMMR6Rel, DALIGN_MMR6_DESC, DALIGN_MMR6_ENC,
97                       ISA_MICROMIPS64R6;
98 }