f0f6df82b7ae28dfea93a6616ac67a6cfaacb761
[oota-llvm.git] / lib / Target / Mips / Mips32r6InstrInfo.td
1 //=- Mips32r6InstrInfo.td - Mips32r6 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 Mips32r6 instructions.
11 //
12 //===----------------------------------------------------------------------===//
13
14 include "Mips32r6InstrFormats.td"
15
16 // Notes about removals/changes from MIPS32r6:
17 // Unclear: ssnop
18 // Reencoded: cache, pref
19 // Reencoded: clo, clz
20 // Reencoded: jr -> jalr
21 // Reencoded: jr.hb -> jalr.hb
22 // Reencoded: ldc2
23 // Reencoded: ll, sc
24 // Reencoded: lwc2
25 // Reencoded: sdbbp
26 // Reencoded: sdc2
27 // Reencoded: swc2
28 // Removed: /.ps$/, cvt.ps.s, cvt.ps.pw
29 // Removed: addi
30 // Removed: bc1any2, bc1any4
31 // Removed: bc2[ft]
32 // Removed: bc2f, bc2t
33 // Removed: bgezal
34 // Removed: bltzal
35 // Removed: c.cond.fmt, bc1[ft]
36 // Removed: div, divu
37 // Removed: jalx
38 // Removed: ldxc1
39 // Removed: luxc1
40 // Removed: lwl, lwr, lwle, lwre, swl, swr, swle, swre
41 // Removed: lwxc1
42 // Removed: madd.[ds], nmadd.[ds], nmsub.[ds], sub.[ds]
43 // Removed: mfhi, mflo, mthi, mtlo, madd, maddu, msub, msubu, mul
44 // Removed: movf, movt
45 // Removed: movf.fmt, movt.fmt, movn.fmt, movz.fmt
46 // Removed: movn, movz
47 // Removed: mult, multu
48 // Removed: prefx
49 // Removed: sdxc1
50 // Removed: suxc1
51 // Removed: swxc1
52 // Removed: teqi, tgei, tgeiu, tlti, tltiu, tnei
53 // Rencoded: [ls][wd]c2
54
55 //===----------------------------------------------------------------------===//
56 //
57 // Instruction Encodings
58 //
59 //===----------------------------------------------------------------------===//
60
61 class DIV_ENC    : SPECIAL_3R_FM<0b00010, 0b011010>;
62 class DIVU_ENC   : SPECIAL_3R_FM<0b00010, 0b011011>;
63 class MOD_ENC    : SPECIAL_3R_FM<0b00011, 0b011010>;
64 class MODU_ENC   : SPECIAL_3R_FM<0b00011, 0b011011>;
65 class MUH_ENC    : SPECIAL_3R_FM<0b00011, 0b011000>;
66 class MUHU_ENC   : SPECIAL_3R_FM<0b00011, 0b011001>;
67 class MUL_R6_ENC : SPECIAL_3R_FM<0b00010, 0b011000>;
68 class MULU_ENC   : SPECIAL_3R_FM<0b00010, 0b011001>;
69 class SEL_D_ENC  : COP1_3R_FM<0b010000, FIELD_FMT_D>;
70 class SEL_S_ENC  : COP1_3R_FM<0b010000, FIELD_FMT_S>;
71
72 //===----------------------------------------------------------------------===//
73 //
74 // Instruction Descriptions
75 //
76 //===----------------------------------------------------------------------===//
77
78 class DIVMOD_DESC_BASE<string instr_asm, RegisterOperand GPROpnd> {
79   dag OutOperandList = (outs GPROpnd:$rd);
80   dag InOperandList = (ins GPROpnd:$rs, GPROpnd:$rt);
81   string AsmString = !strconcat(instr_asm, "\t$rd, $rs, $rt");
82   list<dag> Pattern = [];
83 }
84
85 class DIV_DESC  : DIVMOD_DESC_BASE<"div", GPR32Opnd>;
86 class DIVU_DESC : DIVMOD_DESC_BASE<"divu", GPR32Opnd>;
87 class MOD_DESC  : DIVMOD_DESC_BASE<"mod", GPR32Opnd>;
88 class MODU_DESC : DIVMOD_DESC_BASE<"modu", GPR32Opnd>;
89
90 class MUL_R6_DESC_BASE<string instr_asm, RegisterOperand GPROpnd> {
91   dag OutOperandList = (outs GPROpnd:$rd);
92   dag InOperandList = (ins GPROpnd:$rs, GPROpnd:$rt);
93   string AsmString = !strconcat(instr_asm, "\t$rd, $rs, $rt");
94   list<dag> Pattern = [];
95 }
96
97 class MUH_DESC    : MUL_R6_DESC_BASE<"muh", GPR32Opnd>;
98 class MUHU_DESC   : MUL_R6_DESC_BASE<"muhu", GPR32Opnd>;
99 class MUL_R6_DESC : MUL_R6_DESC_BASE<"mul", GPR32Opnd>;
100 class MULU_DESC   : MUL_R6_DESC_BASE<"mulu", GPR32Opnd>;
101
102 class SEL_DESC_BASE<string instr_asm, RegisterOperand FGROpnd> {
103   dag OutOperandList = (outs FGROpnd:$fd);
104   dag InOperandList = (ins FGROpnd:$fd_in, FGROpnd:$fs, FGROpnd:$ft);
105   string AsmString = !strconcat(instr_asm, "\t$fd, $fs, $ft");
106   list<dag> Pattern = [];
107   string Constraints = "$fd_in = $fd";
108 }
109
110 class SEL_D_DESC : SEL_DESC_BASE<"sel.d", FGR64Opnd>;
111 class SEL_S_DESC : SEL_DESC_BASE<"sel.s", FGR32Opnd>;
112
113 //===----------------------------------------------------------------------===//
114 //
115 // Instruction Definitions
116 //
117 //===----------------------------------------------------------------------===//
118
119 def ADDIUPC;
120 def ALIGN; // Known as as BALIGN in DSP ASE
121 def ALUIPC;
122 def AUI;
123 def AUIPC;
124 def BALC;
125 def BC1EQZ;
126 def BC1NEZ;
127 def BC2EQZ;
128 def BC2NEZ;
129 def BC;
130 def BEQC;
131 def BEQZALC;
132 def BEQZC;
133 def BGEC;  // Also aliased to blec with operands swapped
134 def BGEUC; // Also aliased to bleuc with operands swapped
135 def BGEZALC;
136 def BGEZC;
137 def BGTZALC;
138 def BGTZC;
139 def BITSWAP; // Known as BITREV in DSP ASE
140 def BLEZALC;
141 def BLEZC;
142 def BLTC; // Also aliased to bgtc with operands swapped
143 def BLTUC; // Also aliased to bgtuc with operands swapped
144 def BLTZALC;
145 def BLTZC;
146 def BNEC;
147 def BNEZALC;
148 def BNEZC;
149 def BNVC;
150 def BOVC;
151 def CLASS_D;
152 def CLASS_S;
153 def CMP_CC_D;
154 def CMP_CC_S;
155 def DIV : DIV_ENC, DIV_DESC, ISA_MIPS32R6;
156 def DIVU : DIVU_ENC, DIVU_DESC, ISA_MIPS32R6;
157 def JIALC;
158 def JIC;
159 // def LSA; // See MSA
160 def LWPC;
161 def LWUPC;
162 def MADDF;
163 def MAXA_D;
164 def MAXA_S;
165 def MAX_D;
166 def MAX_S;
167 def MINA_D;
168 def MINA_S;
169 def MIN_D;
170 def MOD : MOD_ENC, MOD_DESC, ISA_MIPS32R6;
171 def MODU : MODU_ENC, MODU_DESC, ISA_MIPS32R6;
172 def MSUBF;
173 def MUH    : MUH_ENC, MUH_DESC, ISA_MIPS32R6;
174 def MUHU   : MUHU_ENC, MUHU_DESC, ISA_MIPS32R6;
175 def MUL_R6 : MUL_R6_ENC, MUL_R6_DESC, ISA_MIPS32R6;
176 def MULU   : MULU_ENC, MULU_DESC, ISA_MIPS32R6;
177 def NAL; // BAL with rd=0
178 def RINT_D;
179 def RINT_S;
180 def SELEQZ;
181 def SELEQZ_D;
182 def SELEQZ_S;
183 def SELNEZ;
184 def SELNEZ_D;
185 def SELNEZ_S;
186 def SEL_D : SEL_D_ENC, SEL_D_DESC, ISA_MIPS32R6;
187 def SEL_S : SEL_S_ENC, SEL_S_DESC, ISA_MIPS32R6;