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