comparison lib/Target/Mips/Mips64InstrInfo.td @ 120:1172e4bd9c6f

update 4.0.0
author mir3636
date Fri, 25 Nov 2016 19:14:25 +0900
parents 7d135dc70f03
children 803732b1fca8
comparison
equal deleted inserted replaced
101:34baf5011add 120:1172e4bd9c6f
13 13
14 //===----------------------------------------------------------------------===// 14 //===----------------------------------------------------------------------===//
15 // Mips Operand, Complex Patterns and Transformations Definitions. 15 // Mips Operand, Complex Patterns and Transformations Definitions.
16 //===----------------------------------------------------------------------===// 16 //===----------------------------------------------------------------------===//
17 17
18 // Unsigned Operand
19 def uimm16_64 : Operand<i64> {
20 let PrintMethod = "printUnsignedImm";
21 }
22
23 // Signed Operand
24 def simm10_64 : Operand<i64>;
25
26 // Transformation Function - get Imm - 32.
27 def Subtract32 : SDNodeXForm<imm, [{
28 return getImm(N, (unsigned)N->getZExtValue() - 32);
29 }]>;
30
31 // shamt must fit in 6 bits. 18 // shamt must fit in 6 bits.
32 def immZExt6 : ImmLeaf<i32, [{return Imm == (Imm & 0x3f);}]>; 19 def immZExt6 : ImmLeaf<i32, [{return Imm == (Imm & 0x3f);}]>;
33 20
34 // Node immediate fits as 10-bit sign extended on target immediate. 21 // Node immediate fits as 10-bit sign extended on target immediate.
35 // e.g. seqi, snei 22 // e.g. seqi, snei
36 def immSExt10_64 : PatLeaf<(i64 imm), 23 def immSExt10_64 : PatLeaf<(i64 imm),
37 [{ return isInt<10>(N->getSExtValue()); }]>; 24 [{ return isInt<10>(N->getSExtValue()); }]>;
38 25
39 def immZExt16_64 : PatLeaf<(i64 imm), 26 def immZExt16_64 : PatLeaf<(i64 imm),
40 [{ return isInt<16>(N->getZExtValue()); }]>; 27 [{ return isUInt<16>(N->getZExtValue()); }]>;
41 28
42 def immZExt5_64 : ImmLeaf<i64, [{ return Imm == (Imm & 0x1f); }]>; 29 def immZExt5_64 : ImmLeaf<i64, [{ return Imm == (Imm & 0x1f); }]>;
43 30
44 // Transformation function: get log2 of low 32 bits of immediate 31 // Transformation function: get log2 of low 32 bits of immediate
45 def Log2LO : SDNodeXForm<imm, [{ 32 def Log2LO : SDNodeXForm<imm, [{
69 } 56 }
70 else 57 else
71 return false; 58 return false;
72 }]>; 59 }]>;
73 60
61 def assertzext_lt_i32 : PatFrag<(ops node:$src), (assertzext node:$src), [{
62 return cast<VTSDNode>(N->getOperand(1))->getVT().bitsLT(MVT::i32);
63 }]>;
64
74 //===----------------------------------------------------------------------===// 65 //===----------------------------------------------------------------------===//
75 // Instructions specific format 66 // Instructions specific format
76 //===----------------------------------------------------------------------===// 67 //===----------------------------------------------------------------------===//
77 let usesCustomInserter = 1 in { 68 let usesCustomInserter = 1 in {
78 def ATOMIC_LOAD_ADD_I64 : Atomic2Ops<atomic_load_add_64, GPR64>; 69 def ATOMIC_LOAD_ADD_I64 : Atomic2Ops<atomic_load_add_64, GPR64>;
84 def ATOMIC_SWAP_I64 : Atomic2Ops<atomic_swap_64, GPR64>; 75 def ATOMIC_SWAP_I64 : Atomic2Ops<atomic_swap_64, GPR64>;
85 def ATOMIC_CMP_SWAP_I64 : AtomicCmpSwap<atomic_cmp_swap_64, GPR64>; 76 def ATOMIC_CMP_SWAP_I64 : AtomicCmpSwap<atomic_cmp_swap_64, GPR64>;
86 } 77 }
87 78
88 /// Pseudo instructions for loading and storing accumulator registers. 79 /// Pseudo instructions for loading and storing accumulator registers.
89 let isPseudo = 1, isCodeGenOnly = 1 in { 80 let isPseudo = 1, isCodeGenOnly = 1, hasNoSchedulingInfo = 1 in {
90 def LOAD_ACC128 : Load<"", ACC128>; 81 def LOAD_ACC128 : Load<"", ACC128>;
91 def STORE_ACC128 : Store<"", ACC128>; 82 def STORE_ACC128 : Store<"", ACC128>;
92 } 83 }
93 84
94 //===----------------------------------------------------------------------===// 85 //===----------------------------------------------------------------------===//
95 // Instruction definition 86 // Instruction definition
96 //===----------------------------------------------------------------------===// 87 //===----------------------------------------------------------------------===//
97 let DecoderNamespace = "Mips64" in { 88 let DecoderNamespace = "Mips64" in {
98 /// Arithmetic Instructions (ALU Immediate) 89 /// Arithmetic Instructions (ALU Immediate)
99 def DADDi : ArithLogicI<"daddi", simm16_64, GPR64Opnd>, ADDI_FM<0x18>, 90 def DADDi : ArithLogicI<"daddi", simm16_64, GPR64Opnd, II_DADDI>,
100 ISA_MIPS3_NOT_32R6_64R6; 91 ADDI_FM<0x18>, ISA_MIPS3_NOT_32R6_64R6;
101 def DADDiu : ArithLogicI<"daddiu", simm16_64, GPR64Opnd, II_DADDIU, 92 let AdditionalPredicates = [NotInMicroMips] in {
102 immSExt16, add>, 93 def DADDiu : StdMMR6Rel, ArithLogicI<"daddiu", simm16_64, GPR64Opnd,
103 ADDI_FM<0x19>, IsAsCheapAsAMove, ISA_MIPS3; 94 II_DADDIU, immSExt16, add>,
95 ADDI_FM<0x19>, IsAsCheapAsAMove, ISA_MIPS3;
96 }
104 97
105 let isCodeGenOnly = 1 in { 98 let isCodeGenOnly = 1 in {
106 def SLTi64 : SetCC_I<"slti", setlt, simm16_64, immSExt16, GPR64Opnd>, 99 def SLTi64 : SetCC_I<"slti", setlt, simm16_64, immSExt16, GPR64Opnd>,
107 SLTI_FM<0xa>; 100 SLTI_FM<0xa>;
108 def SLTiu64 : SetCC_I<"sltiu", setult, simm16_64, immSExt16, GPR64Opnd>, 101 def SLTiu64 : SetCC_I<"sltiu", setult, simm16_64, immSExt16, GPR64Opnd>,
111 ADDI_FM<0xc>; 104 ADDI_FM<0xc>;
112 def ORi64 : ArithLogicI<"ori", uimm16_64, GPR64Opnd, II_OR, immZExt16, or>, 105 def ORi64 : ArithLogicI<"ori", uimm16_64, GPR64Opnd, II_OR, immZExt16, or>,
113 ADDI_FM<0xd>; 106 ADDI_FM<0xd>;
114 def XORi64 : ArithLogicI<"xori", uimm16_64, GPR64Opnd, II_XOR, immZExt16, xor>, 107 def XORi64 : ArithLogicI<"xori", uimm16_64, GPR64Opnd, II_XOR, immZExt16, xor>,
115 ADDI_FM<0xe>; 108 ADDI_FM<0xe>;
116 def LUi64 : LoadUpper<"lui", GPR64Opnd, uimm16_64>, LUI_FM; 109 def LUi64 : LoadUpper<"lui", GPR64Opnd, uimm16_64_relaxed>, LUI_FM;
117 } 110 }
118 111
119 /// Arithmetic Instructions (3-Operand, R-Type) 112 /// Arithmetic Instructions (3-Operand, R-Type)
120 def DADD : ArithLogicR<"dadd", GPR64Opnd, 1, II_DADD>, ADD_FM<0, 0x2c>, 113 let AdditionalPredicates = [NotInMicroMips] in {
121 ISA_MIPS3; 114 def DADD : StdMMR6Rel, ArithLogicR<"dadd", GPR64Opnd, 1, II_DADD>,
122 def DADDu : ArithLogicR<"daddu", GPR64Opnd, 1, II_DADDU, add>, ADD_FM<0, 0x2d>, 115 ADD_FM<0, 0x2c>, ISA_MIPS3;
123 ISA_MIPS3; 116 def DADDu : StdMMR6Rel, ArithLogicR<"daddu", GPR64Opnd, 1, II_DADDU, add>,
124 def DSUBu : ArithLogicR<"dsubu", GPR64Opnd, 0, II_DSUBU, sub>, ADD_FM<0, 0x2f>, 117 ADD_FM<0, 0x2d>, ISA_MIPS3;
125 ISA_MIPS3; 118 def DSUBu : StdMMR6Rel, ArithLogicR<"dsubu", GPR64Opnd, 0, II_DSUBU, sub>, ADD_FM<0, 0x2f>,
126 def DSUB : ArithLogicR<"dsub", GPR64Opnd, 0, II_DSUB>, ADD_FM<0, 0x2e>, 119 ISA_MIPS3;
127 ISA_MIPS3; 120 def DSUB : StdMMR6Rel, ArithLogicR<"dsub", GPR64Opnd, 0, II_DSUB>, ADD_FM<0, 0x2e>,
121 ISA_MIPS3;
122 }
128 123
129 let isCodeGenOnly = 1 in { 124 let isCodeGenOnly = 1 in {
130 def SLT64 : SetCC_R<"slt", setlt, GPR64Opnd>, ADD_FM<0, 0x2a>; 125 def SLT64 : SetCC_R<"slt", setlt, GPR64Opnd>, ADD_FM<0, 0x2a>;
131 def SLTu64 : SetCC_R<"sltu", setult, GPR64Opnd>, ADD_FM<0, 0x2b>; 126 def SLTu64 : SetCC_R<"sltu", setult, GPR64Opnd>, ADD_FM<0, 0x2b>;
132 def AND64 : ArithLogicR<"and", GPR64Opnd, 1, II_AND, and>, ADD_FM<0, 0x24>; 127 def AND64 : ArithLogicR<"and", GPR64Opnd, 1, II_AND, and>, ADD_FM<0, 0x24>;
134 def XOR64 : ArithLogicR<"xor", GPR64Opnd, 1, II_XOR, xor>, ADD_FM<0, 0x26>; 129 def XOR64 : ArithLogicR<"xor", GPR64Opnd, 1, II_XOR, xor>, ADD_FM<0, 0x26>;
135 def NOR64 : LogicNOR<"nor", GPR64Opnd>, ADD_FM<0, 0x27>; 130 def NOR64 : LogicNOR<"nor", GPR64Opnd>, ADD_FM<0, 0x27>;
136 } 131 }
137 132
138 /// Shift Instructions 133 /// Shift Instructions
139 def DSLL : shift_rotate_imm<"dsll", uimm6, GPR64Opnd, II_DSLL, shl, immZExt6>, 134 let AdditionalPredicates = [NotInMicroMips] in {
135 def DSLL : StdMMR6Rel, shift_rotate_imm<"dsll", uimm6, GPR64Opnd, II_DSLL,
136 shl, immZExt6>,
140 SRA_FM<0x38, 0>, ISA_MIPS3; 137 SRA_FM<0x38, 0>, ISA_MIPS3;
141 def DSRL : shift_rotate_imm<"dsrl", uimm6, GPR64Opnd, II_DSRL, srl, immZExt6>, 138 def DSRL : StdMMR6Rel, shift_rotate_imm<"dsrl", uimm6, GPR64Opnd, II_DSRL,
139 srl, immZExt6>,
142 SRA_FM<0x3a, 0>, ISA_MIPS3; 140 SRA_FM<0x3a, 0>, ISA_MIPS3;
143 def DSRA : shift_rotate_imm<"dsra", uimm6, GPR64Opnd, II_DSRA, sra, immZExt6>, 141 def DSRA : StdMMR6Rel, shift_rotate_imm<"dsra", uimm6, GPR64Opnd, II_DSRA,
142 sra, immZExt6>,
144 SRA_FM<0x3b, 0>, ISA_MIPS3; 143 SRA_FM<0x3b, 0>, ISA_MIPS3;
145 def DSLLV : shift_rotate_reg<"dsllv", GPR64Opnd, II_DSLLV, shl>, 144 def DSLLV : StdMMR6Rel, shift_rotate_reg<"dsllv", GPR64Opnd, II_DSLLV, shl>,
146 SRLV_FM<0x14, 0>, ISA_MIPS3; 145 SRLV_FM<0x14, 0>, ISA_MIPS3;
147 def DSRLV : shift_rotate_reg<"dsrlv", GPR64Opnd, II_DSRLV, srl>, 146 def DSRAV : StdMMR6Rel, shift_rotate_reg<"dsrav", GPR64Opnd, II_DSRAV, sra>,
148 SRLV_FM<0x16, 0>, ISA_MIPS3; 147 SRLV_FM<0x17, 0>, ISA_MIPS3;
149 def DSRAV : shift_rotate_reg<"dsrav", GPR64Opnd, II_DSRAV, sra>, 148 def DSRLV : StdMMR6Rel, shift_rotate_reg<"dsrlv", GPR64Opnd, II_DSRLV, srl>,
150 SRLV_FM<0x17, 0>, ISA_MIPS3; 149 SRLV_FM<0x16, 0>, ISA_MIPS3;
151 def DSLL32 : shift_rotate_imm<"dsll32", uimm5, GPR64Opnd, II_DSLL32>, 150 def DSLL32 : StdMMR6Rel, shift_rotate_imm<"dsll32", uimm5, GPR64Opnd,
152 SRA_FM<0x3c, 0>, ISA_MIPS3; 151 II_DSLL32>,
153 def DSRL32 : shift_rotate_imm<"dsrl32", uimm5, GPR64Opnd, II_DSRL32>, 152 SRA_FM<0x3c, 0>, ISA_MIPS3;
154 SRA_FM<0x3e, 0>, ISA_MIPS3; 153 def DSRL32 : StdMMR6Rel, shift_rotate_imm<"dsrl32", uimm5, GPR64Opnd,
155 def DSRA32 : shift_rotate_imm<"dsra32", uimm5, GPR64Opnd, II_DSRA32>, 154 II_DSRL32>,
156 SRA_FM<0x3f, 0>, ISA_MIPS3; 155 SRA_FM<0x3e, 0>, ISA_MIPS3;
156 def DSRA32 : StdMMR6Rel, shift_rotate_imm<"dsra32", uimm5, GPR64Opnd,
157 II_DSRA32>,
158 SRA_FM<0x3f, 0>, ISA_MIPS3;
157 159
158 // Rotate Instructions 160 // Rotate Instructions
159 def DROTR : shift_rotate_imm<"drotr", uimm6, GPR64Opnd, II_DROTR, rotr, 161 def DROTR : StdMMR6Rel, shift_rotate_imm<"drotr", uimm6, GPR64Opnd, II_DROTR,
160 immZExt6>, 162 rotr, immZExt6>,
161 SRA_FM<0x3a, 1>, ISA_MIPS64R2; 163 SRA_FM<0x3a, 1>, ISA_MIPS64R2;
162 def DROTRV : shift_rotate_reg<"drotrv", GPR64Opnd, II_DROTRV, rotr>, 164 def DROTRV : StdMMR6Rel, shift_rotate_reg<"drotrv", GPR64Opnd, II_DROTRV,
163 SRLV_FM<0x16, 1>, ISA_MIPS64R2; 165 rotr>,
164 def DROTR32 : shift_rotate_imm<"drotr32", uimm5, GPR64Opnd, II_DROTR32>, 166 SRLV_FM<0x16, 1>, ISA_MIPS64R2;
165 SRA_FM<0x3e, 1>, ISA_MIPS64R2; 167 def DROTR32 : StdMMR6Rel, shift_rotate_imm<"drotr32", uimm5, GPR64Opnd,
168 II_DROTR32>,
169 SRA_FM<0x3e, 1>, ISA_MIPS64R2;
170 }
166 171
167 /// Load and Store Instructions 172 /// Load and Store Instructions
168 /// aligned 173 /// aligned
169 let isCodeGenOnly = 1 in { 174 let isCodeGenOnly = 1 in {
170 def LB64 : Load<"lb", GPR64Opnd, sextloadi8, II_LB>, LW_FM<0x20>; 175 def LB64 : Load<"lb", GPR64Opnd, sextloadi8, II_LB>, LW_FM<0x20>;
175 def SB64 : Store<"sb", GPR64Opnd, truncstorei8, II_SB>, LW_FM<0x28>; 180 def SB64 : Store<"sb", GPR64Opnd, truncstorei8, II_SB>, LW_FM<0x28>;
176 def SH64 : Store<"sh", GPR64Opnd, truncstorei16, II_SH>, LW_FM<0x29>; 181 def SH64 : Store<"sh", GPR64Opnd, truncstorei16, II_SH>, LW_FM<0x29>;
177 def SW64 : Store<"sw", GPR64Opnd, truncstorei32, II_SW>, LW_FM<0x2b>; 182 def SW64 : Store<"sw", GPR64Opnd, truncstorei32, II_SW>, LW_FM<0x2b>;
178 } 183 }
179 184
180 def LWu : Load<"lwu", GPR64Opnd, zextloadi32, II_LWU>, LW_FM<0x27>, ISA_MIPS3; 185 let AdditionalPredicates = [NotInMicroMips] in {
181 def LD : Load<"ld", GPR64Opnd, load, II_LD>, LW_FM<0x37>, ISA_MIPS3; 186 def LWu : StdMMR6Rel, MMRel, Load<"lwu", GPR64Opnd, zextloadi32, II_LWU>,
182 def SD : Store<"sd", GPR64Opnd, store, II_SD>, LW_FM<0x3f>, ISA_MIPS3; 187 LW_FM<0x27>, ISA_MIPS3;
188 def LD : StdMMR6Rel, LoadMemory<"ld", GPR64Opnd, mem_simm16, load, II_LD>,
189 LW_FM<0x37>, ISA_MIPS3;
190 def SD : StdMMR6Rel, StoreMemory<"sd", GPR64Opnd, mem_simm16, store, II_SD>,
191 LW_FM<0x3f>, ISA_MIPS3;
192 }
193
194
183 195
184 /// load/store left/right 196 /// load/store left/right
185 let isCodeGenOnly = 1 in { 197 let isCodeGenOnly = 1 in {
186 def LWL64 : LoadLeftRight<"lwl", MipsLWL, GPR64Opnd, II_LWL>, LW_FM<0x22>; 198 def LWL64 : LoadLeftRight<"lwl", MipsLWL, GPR64Opnd, II_LWL>, LW_FM<0x22>;
187 def LWR64 : LoadLeftRight<"lwr", MipsLWR, GPR64Opnd, II_LWR>, LW_FM<0x26>; 199 def LWR64 : LoadLeftRight<"lwr", MipsLWR, GPR64Opnd, II_LWR>, LW_FM<0x26>;
197 ISA_MIPS3_NOT_32R6_64R6; 209 ISA_MIPS3_NOT_32R6_64R6;
198 def SDR : StoreLeftRight<"sdr", MipsSDR, GPR64Opnd, II_SDR>, LW_FM<0x2d>, 210 def SDR : StoreLeftRight<"sdr", MipsSDR, GPR64Opnd, II_SDR>, LW_FM<0x2d>,
199 ISA_MIPS3_NOT_32R6_64R6; 211 ISA_MIPS3_NOT_32R6_64R6;
200 212
201 /// Load-linked, Store-conditional 213 /// Load-linked, Store-conditional
202 def LLD : LLBase<"lld", GPR64Opnd>, LW_FM<0x34>, ISA_MIPS3_NOT_32R6_64R6; 214 let AdditionalPredicates = [NotInMicroMips] in {
215 def LLD : StdMMR6Rel, LLBase<"lld", GPR64Opnd, mem_simm16>, LW_FM<0x34>,
216 ISA_MIPS3_NOT_32R6_64R6;
217 }
203 def SCD : SCBase<"scd", GPR64Opnd>, LW_FM<0x3c>, ISA_MIPS3_NOT_32R6_64R6; 218 def SCD : SCBase<"scd", GPR64Opnd>, LW_FM<0x3c>, ISA_MIPS3_NOT_32R6_64R6;
219
220 let AdditionalPredicates = [NotInMicroMips],
221 DecoderNamespace = "Mips32_64_PTR64" in {
222 def LL64 : LLBase<"ll", GPR32Opnd>, LW_FM<0x30>, PTR_64,
223 ISA_MIPS2_NOT_32R6_64R6;
224 def SC64 : SCBase<"sc", GPR32Opnd>, LW_FM<0x38>, PTR_64,
225 ISA_MIPS2_NOT_32R6_64R6;
226 def JR64 : IndirectBranch<"jr", GPR64Opnd>, MTLO_FM<8>, PTR_64;
227 }
228
229 def JALR64 : JumpLinkReg<"jalr", GPR64Opnd>, JALR_FM;
204 230
205 /// Jump and Branch Instructions 231 /// Jump and Branch Instructions
206 let isCodeGenOnly = 1 in { 232 let isCodeGenOnly = 1 in {
207 def JR64 : IndirectBranch<"jr", GPR64Opnd>, MTLO_FM<8>;
208 def BEQ64 : CBranch<"beq", brtarget, seteq, GPR64Opnd>, BEQ_FM<4>; 233 def BEQ64 : CBranch<"beq", brtarget, seteq, GPR64Opnd>, BEQ_FM<4>;
209 def BNE64 : CBranch<"bne", brtarget, setne, GPR64Opnd>, BEQ_FM<5>; 234 def BNE64 : CBranch<"bne", brtarget, setne, GPR64Opnd>, BEQ_FM<5>;
210 def BGEZ64 : CBranchZero<"bgez", brtarget, setge, GPR64Opnd>, BGEZ_FM<1, 1>; 235 def BGEZ64 : CBranchZero<"bgez", brtarget, setge, GPR64Opnd>, BGEZ_FM<1, 1>;
211 def BGTZ64 : CBranchZero<"bgtz", brtarget, setgt, GPR64Opnd>, BGEZ_FM<7, 0>; 236 def BGTZ64 : CBranchZero<"bgtz", brtarget, setgt, GPR64Opnd>, BGEZ_FM<7, 0>;
212 def BLEZ64 : CBranchZero<"blez", brtarget, setle, GPR64Opnd>, BGEZ_FM<6, 0>; 237 def BLEZ64 : CBranchZero<"blez", brtarget, setle, GPR64Opnd>, BGEZ_FM<6, 0>;
213 def BLTZ64 : CBranchZero<"bltz", brtarget, setlt, GPR64Opnd>, BGEZ_FM<1, 0>; 238 def BLTZ64 : CBranchZero<"bltz", brtarget, setlt, GPR64Opnd>, BGEZ_FM<1, 0>;
214 def JALR64 : JumpLinkReg<"jalr", GPR64Opnd>, JALR_FM;
215 def JALR64Pseudo : JumpLinkRegPseudo<GPR64Opnd, JALR, RA, GPR32Opnd>; 239 def JALR64Pseudo : JumpLinkRegPseudo<GPR64Opnd, JALR, RA, GPR32Opnd>;
216 def TAILCALL64_R : TailCallReg<GPR64Opnd, JR, GPR32Opnd>; 240 }
217 } 241
242 def TAILCALLREG64 : TailCallReg<GPR64Opnd>;
218 243
219 def PseudoReturn64 : PseudoReturnBase<GPR64Opnd>; 244 def PseudoReturn64 : PseudoReturnBase<GPR64Opnd>;
220 def PseudoIndirectBranch64 : PseudoIndirectBranchBase<GPR64Opnd>; 245 def PseudoIndirectBranch64 : PseudoIndirectBranchBase<GPR64Opnd>;
221 246
222 /// Multiply and Divide Instructions. 247 /// Multiply and Divide Instructions.
223 def DMULT : Mult<"dmult", II_DMULT, GPR64Opnd, [HI0_64, LO0_64]>, 248 let AdditionalPredicates = [NotInMicroMips] in {
224 MULT_FM<0, 0x1c>, ISA_MIPS3_NOT_32R6_64R6; 249 def DMULT : Mult<"dmult", II_DMULT, GPR64Opnd, [HI0_64, LO0_64]>,
225 def DMULTu : Mult<"dmultu", II_DMULTU, GPR64Opnd, [HI0_64, LO0_64]>, 250 MULT_FM<0, 0x1c>, ISA_MIPS3_NOT_32R6_64R6;
226 MULT_FM<0, 0x1d>, ISA_MIPS3_NOT_32R6_64R6; 251 def DMULTu : Mult<"dmultu", II_DMULTU, GPR64Opnd, [HI0_64, LO0_64]>,
252 MULT_FM<0, 0x1d>, ISA_MIPS3_NOT_32R6_64R6;
253 }
227 def PseudoDMULT : MultDivPseudo<DMULT, ACC128, GPR64Opnd, MipsMult, 254 def PseudoDMULT : MultDivPseudo<DMULT, ACC128, GPR64Opnd, MipsMult,
228 II_DMULT>, ISA_MIPS3_NOT_32R6_64R6; 255 II_DMULT>, ISA_MIPS3_NOT_32R6_64R6;
229 def PseudoDMULTu : MultDivPseudo<DMULTu, ACC128, GPR64Opnd, MipsMultu, 256 def PseudoDMULTu : MultDivPseudo<DMULTu, ACC128, GPR64Opnd, MipsMultu,
230 II_DMULTU>, ISA_MIPS3_NOT_32R6_64R6; 257 II_DMULTU>, ISA_MIPS3_NOT_32R6_64R6;
231 def DSDIV : Div<"ddiv", II_DDIV, GPR64Opnd, [HI0_64, LO0_64]>, 258 let AdditionalPredicates = [NotInMicroMips] in {
232 MULT_FM<0, 0x1e>, ISA_MIPS3_NOT_32R6_64R6; 259 def DSDIV : Div<"ddiv", II_DDIV, GPR64Opnd, [HI0_64, LO0_64]>,
233 def DUDIV : Div<"ddivu", II_DDIVU, GPR64Opnd, [HI0_64, LO0_64]>, 260 MULT_FM<0, 0x1e>, ISA_MIPS3_NOT_32R6_64R6;
234 MULT_FM<0, 0x1f>, ISA_MIPS3_NOT_32R6_64R6; 261 def DUDIV : Div<"ddivu", II_DDIVU, GPR64Opnd, [HI0_64, LO0_64]>,
262 MULT_FM<0, 0x1f>, ISA_MIPS3_NOT_32R6_64R6;
263 }
235 def PseudoDSDIV : MultDivPseudo<DSDIV, ACC128, GPR64Opnd, MipsDivRem, 264 def PseudoDSDIV : MultDivPseudo<DSDIV, ACC128, GPR64Opnd, MipsDivRem,
236 II_DDIV, 0, 1, 1>, ISA_MIPS3_NOT_32R6_64R6; 265 II_DDIV, 0, 1, 1>, ISA_MIPS3_NOT_32R6_64R6;
237 def PseudoDUDIV : MultDivPseudo<DUDIV, ACC128, GPR64Opnd, MipsDivRemU, 266 def PseudoDUDIV : MultDivPseudo<DUDIV, ACC128, GPR64Opnd, MipsDivRemU,
238 II_DDIVU, 0, 1, 1>, ISA_MIPS3_NOT_32R6_64R6; 267 II_DDIVU, 0, 1, 1>, ISA_MIPS3_NOT_32R6_64R6;
239 268
258 def SEH64 : SignExtInReg<"seh", i16, GPR64Opnd, II_SEH>, SEB_FM<0x18, 0x20>, 287 def SEH64 : SignExtInReg<"seh", i16, GPR64Opnd, II_SEH>, SEB_FM<0x18, 0x20>,
259 ISA_MIPS32R2; 288 ISA_MIPS32R2;
260 } 289 }
261 290
262 /// Count Leading 291 /// Count Leading
263 def DCLZ : CountLeading0<"dclz", GPR64Opnd>, CLO_FM<0x24>, ISA_MIPS64_NOT_64R6; 292 let AdditionalPredicates = [NotInMicroMips] in {
264 def DCLO : CountLeading1<"dclo", GPR64Opnd>, CLO_FM<0x25>, ISA_MIPS64_NOT_64R6; 293 def DCLZ : StdMMR6Rel, CountLeading0<"dclz", GPR64Opnd, II_DCLZ>,
294 CLO_FM<0x24>, ISA_MIPS64_NOT_64R6;
295 def DCLO : StdMMR6Rel, CountLeading1<"dclo", GPR64Opnd, II_DCLO>,
296 CLO_FM<0x25>, ISA_MIPS64_NOT_64R6;
265 297
266 /// Double Word Swap Bytes/HalfWords 298 /// Double Word Swap Bytes/HalfWords
267 def DSBH : SubwordSwap<"dsbh", GPR64Opnd>, SEB_FM<2, 0x24>, ISA_MIPS64R2; 299 def DSBH : SubwordSwap<"dsbh", GPR64Opnd, II_DSBH>, SEB_FM<2, 0x24>,
268 def DSHD : SubwordSwap<"dshd", GPR64Opnd>, SEB_FM<5, 0x24>, ISA_MIPS64R2; 300 ISA_MIPS64R2;
301 def DSHD : SubwordSwap<"dshd", GPR64Opnd, II_DSHD>, SEB_FM<5, 0x24>,
302 ISA_MIPS64R2;
303 }
269 304
270 def LEA_ADDiu64 : EffectiveAddress<"daddiu", GPR64Opnd>, LW_FM<0x19>; 305 def LEA_ADDiu64 : EffectiveAddress<"daddiu", GPR64Opnd>, LW_FM<0x19>;
271 306
272 let isCodeGenOnly = 1 in 307 let isCodeGenOnly = 1 in
273 def RDHWR64 : ReadHardware<GPR64Opnd, HWRegsOpnd>, RDHWR_FM; 308 def RDHWR64 : ReadHardware<GPR64Opnd, HWRegsOpnd>, RDHWR_FM;
274 309
275 let AdditionalPredicates = [NotInMicroMips] in { 310 let AdditionalPredicates = [NotInMicroMips] in {
276 // TODO: Add 'pos + size' constraint check to dext* instructions 311 // The 'pos + size' constraints are enforced by the code that lowers into
277 // DEXT: 0 < pos + size <= 63 312 // MipsISD::Ext.
278 // DEXTM, DEXTU: 32 < pos + size <= 64 313 def DEXT : ExtBase<"dext", GPR64Opnd, uimm5_report_uimm6, uimm5_plus1,
279 def DEXT : ExtBase<"dext", GPR64Opnd, uimm5, uimm5_plus1, MipsExt>, 314 immZExt5, immZExt5Plus1, MipsExt>, EXT_FM<3>,
280 EXT_FM<3>; 315 ISA_MIPS64R2;
281 def DEXTM : ExtBase<"dextm", GPR64Opnd, uimm5, uimm5_plus33, MipsExt>, 316 def DEXTM : ExtBase<"dextm", GPR64Opnd, uimm5, uimm5_plus33, immZExt5,
282 EXT_FM<1>; 317 immZExt5Plus33, MipsExt>, EXT_FM<1>, ISA_MIPS64R2;
283 def DEXTU : ExtBase<"dextu", GPR64Opnd, uimm5_plus32, uimm5_plus1, 318 def DEXTU : ExtBase<"dextu", GPR64Opnd, uimm5_plus32, uimm5_plus1,
284 MipsExt>, EXT_FM<2>; 319 immZExt5Plus32, immZExt5Plus1, MipsExt>, EXT_FM<2>,
285 } 320 ISA_MIPS64R2;
286 321 def DINS : InsBase<"dins", GPR64Opnd, uimm6, uimm5_inssize_plus1, MipsIns>,
287 def DINS : InsBase<"dins", GPR64Opnd, uimm6, MipsIns>, EXT_FM<7>; 322 EXT_FM<7>, ISA_MIPS64R2;
288 def DINSU : InsBase<"dinsu", GPR64Opnd, uimm5_plus32>, EXT_FM<6>; 323 def DINSU : InsBase<"dinsu", GPR64Opnd, uimm5_plus32, uimm5_inssize_plus1>,
289 def DINSM : InsBase<"dinsm", GPR64Opnd, uimm5>, EXT_FM<5>; 324 EXT_FM<6>, ISA_MIPS64R2;
325 def DINSM : InsBase<"dinsm", GPR64Opnd, uimm5, uimm5_inssize_plus1>,
326 EXT_FM<5>, ISA_MIPS64R2;
327 }
290 328
291 let isCodeGenOnly = 1, rs = 0, shamt = 0 in { 329 let isCodeGenOnly = 1, rs = 0, shamt = 0 in {
292 def DSLL64_32 : FR<0x00, 0x3c, (outs GPR64:$rd), (ins GPR32:$rt), 330 def DSLL64_32 : FR<0x00, 0x3c, (outs GPR64:$rd), (ins GPR32:$rt),
293 "dsll\t$rd, $rt, 32", [], II_DSLL>; 331 "dsll\t$rd, $rt, 32", [], II_DSLL>;
294 def SLL64_32 : FR<0x0, 0x00, (outs GPR64:$rd), (ins GPR32:$rt), 332 def SLL64_32 : FR<0x0, 0x00, (outs GPR64:$rd), (ins GPR32:$rt),
307 def LONG_BRANCH_DADDiu : PseudoSE<(outs GPR64Opnd:$dst), 345 def LONG_BRANCH_DADDiu : PseudoSE<(outs GPR64Opnd:$dst),
308 (ins GPR64Opnd:$src, brtarget:$tgt, brtarget:$baltgt), []>; 346 (ins GPR64Opnd:$src, brtarget:$tgt, brtarget:$baltgt), []>;
309 347
310 // Cavium Octeon cnMIPS instructions 348 // Cavium Octeon cnMIPS instructions
311 let DecoderNamespace = "CnMips", 349 let DecoderNamespace = "CnMips",
312 EncodingPredicates = []<Predicate>, // FIXME: The lack of HasStdEnc is probably a bug 350 // FIXME: The lack of HasStdEnc is probably a bug
313 AdditionalPredicates = [HasCnMips] in { 351 EncodingPredicates = []<Predicate> in {
314 352
315 class Count1s<string opstr, RegisterOperand RO>: 353 class Count1s<string opstr, RegisterOperand RO>:
316 InstSE<(outs RO:$rd), (ins RO:$rs), !strconcat(opstr, "\t$rd, $rs"), 354 InstSE<(outs RO:$rd), (ins RO:$rs), !strconcat(opstr, "\t$rd, $rs"),
317 [(set RO:$rd, (ctpop RO:$rs))], II_POP, FrmR, opstr> { 355 [(set RO:$rd, (ctpop RO:$rs))], II_POP, FrmR, opstr> {
318 let TwoOperandAliasConstraint = "$rd = $rs"; 356 let TwoOperandAliasConstraint = "$rd = $rs";
319 } 357 }
320 358
321 class ExtsCins<string opstr, SDPatternOperator Op = null_frag>: 359 class ExtsCins<string opstr, InstrItinClass itin,
360 SDPatternOperator Op = null_frag>:
322 InstSE<(outs GPR64Opnd:$rt), (ins GPR64Opnd:$rs, uimm5:$pos, uimm5:$lenm1), 361 InstSE<(outs GPR64Opnd:$rt), (ins GPR64Opnd:$rs, uimm5:$pos, uimm5:$lenm1),
323 !strconcat(opstr, " $rt, $rs, $pos, $lenm1"), 362 !strconcat(opstr, " $rt, $rs, $pos, $lenm1"),
324 [(set GPR64Opnd:$rt, (Op GPR64Opnd:$rs, imm:$pos, imm:$lenm1))], 363 [(set GPR64Opnd:$rt, (Op GPR64Opnd:$rs, imm:$pos, imm:$lenm1))],
325 NoItinerary, FrmR, opstr> { 364 itin, FrmR, opstr> {
326 let TwoOperandAliasConstraint = "$rt = $rs"; 365 let TwoOperandAliasConstraint = "$rt = $rs";
327 } 366 }
328 367
329 class SetCC64_R<string opstr, PatFrag cond_op> : 368 class SetCC64_R<string opstr, PatFrag cond_op> :
330 InstSE<(outs GPR64Opnd:$rd), (ins GPR64Opnd:$rs, GPR64Opnd:$rt), 369 InstSE<(outs GPR64Opnd:$rd), (ins GPR64Opnd:$rs, GPR64Opnd:$rt),
354 let isTerminator = 1; 393 let isTerminator = 1;
355 let hasDelaySlot = 1; 394 let hasDelaySlot = 1;
356 let Defs = [AT]; 395 let Defs = [AT];
357 } 396 }
358 397
359 class MFC2OP<string asmstr, RegisterOperand RO> : 398 class MFC2OP<string asmstr, RegisterOperand RO, InstrItinClass itin> :
360 InstSE<(outs RO:$rt, uimm16:$imm16), (ins), 399 InstSE<(outs RO:$rt, uimm16:$imm16), (ins),
361 !strconcat(asmstr, "\t$rt, $imm16"), [], NoItinerary, FrmFR>; 400 !strconcat(asmstr, "\t$rt, $imm16"), [], itin, FrmFR>;
362 401
363 // Unsigned Byte Add 402 // Unsigned Byte Add
364 let Pattern = [(set GPR64Opnd:$rd,
365 (and (add GPR64Opnd:$rs, GPR64Opnd:$rt), 255))] in
366 def BADDu : ArithLogicR<"baddu", GPR64Opnd, 1, II_BADDU>, 403 def BADDu : ArithLogicR<"baddu", GPR64Opnd, 1, II_BADDU>,
367 ADD_FM<0x1c, 0x28>; 404 ADD_FM<0x1c, 0x28>, ASE_CNMIPS {
405 let Pattern = [(set GPR64Opnd:$rd,
406 (and (add GPR64Opnd:$rs, GPR64Opnd:$rt), 255))];
407 }
368 408
369 // Branch on Bit Clear /+32 409 // Branch on Bit Clear /+32
370 def BBIT0 : CBranchBitNum<"bbit0", brtarget, seteq, GPR64Opnd, 410 def BBIT0 : CBranchBitNum<"bbit0", brtarget, seteq, GPR64Opnd,
371 uimm5_64_report_uimm6>, BBIT_FM<0x32>; 411 uimm5_64_report_uimm6>, BBIT_FM<0x32>, ASE_CNMIPS;
372 def BBIT032: CBranchBitNum<"bbit032", brtarget, seteq, GPR64Opnd, uimm5_64, 412 def BBIT032: CBranchBitNum<"bbit032", brtarget, seteq, GPR64Opnd, uimm5_64,
373 0x100000000>, 413 0x100000000>, BBIT_FM<0x36>, ASE_CNMIPS;
374 BBIT_FM<0x36>;
375 414
376 // Branch on Bit Set /+32 415 // Branch on Bit Set /+32
377 def BBIT1 : CBranchBitNum<"bbit1", brtarget, setne, GPR64Opnd, 416 def BBIT1 : CBranchBitNum<"bbit1", brtarget, setne, GPR64Opnd,
378 uimm5_64_report_uimm6>, BBIT_FM<0x3a>; 417 uimm5_64_report_uimm6>, BBIT_FM<0x3a>, ASE_CNMIPS;
379 def BBIT132: CBranchBitNum<"bbit132", brtarget, setne, GPR64Opnd, uimm5_64, 418 def BBIT132: CBranchBitNum<"bbit132", brtarget, setne, GPR64Opnd, uimm5_64,
380 0x100000000>, BBIT_FM<0x3e>; 419 0x100000000>, BBIT_FM<0x3e>, ASE_CNMIPS;
381 420
382 // Multiply Doubleword to GPR 421 // Multiply Doubleword to GPR
383 let Defs = [HI0, LO0, P0, P1, P2] in
384 def DMUL : ArithLogicR<"dmul", GPR64Opnd, 1, II_DMUL, mul>, 422 def DMUL : ArithLogicR<"dmul", GPR64Opnd, 1, II_DMUL, mul>,
385 ADD_FM<0x1c, 0x03>; 423 ADD_FM<0x1c, 0x03>, ASE_CNMIPS {
424 let Defs = [HI0, LO0, P0, P1, P2];
425 }
386 426
387 // Extract a signed bit field /+32 427 // Extract a signed bit field /+32
388 def EXTS : ExtsCins<"exts">, EXTS_FM<0x3a>; 428 def EXTS : ExtsCins<"exts", II_EXT>, EXTS_FM<0x3a>, ASE_CNMIPS;
389 def EXTS32: ExtsCins<"exts32">, EXTS_FM<0x3b>; 429 def EXTS32: ExtsCins<"exts32", II_EXT>, EXTS_FM<0x3b>, ASE_CNMIPS;
390 430
391 // Clear and insert a bit field /+32 431 // Clear and insert a bit field /+32
392 def CINS : ExtsCins<"cins">, EXTS_FM<0x32>; 432 def CINS : ExtsCins<"cins", II_INS>, EXTS_FM<0x32>, ASE_CNMIPS;
393 def CINS32: ExtsCins<"cins32">, EXTS_FM<0x33>; 433 def CINS32: ExtsCins<"cins32", II_INS>, EXTS_FM<0x33>, ASE_CNMIPS;
394 434
395 // Move to multiplier/product register 435 // Move to multiplier/product register
396 def MTM0 : MoveToLOHI<"mtm0", GPR64Opnd, [MPL0, P0, P1, P2]>, MTMR_FM<0x08>; 436 def MTM0 : MoveToLOHI<"mtm0", GPR64Opnd, [MPL0, P0, P1, P2]>, MTMR_FM<0x08>,
397 def MTM1 : MoveToLOHI<"mtm1", GPR64Opnd, [MPL1, P0, P1, P2]>, MTMR_FM<0x0c>; 437 ASE_CNMIPS;
398 def MTM2 : MoveToLOHI<"mtm2", GPR64Opnd, [MPL2, P0, P1, P2]>, MTMR_FM<0x0d>; 438 def MTM1 : MoveToLOHI<"mtm1", GPR64Opnd, [MPL1, P0, P1, P2]>, MTMR_FM<0x0c>,
399 def MTP0 : MoveToLOHI<"mtp0", GPR64Opnd, [P0]>, MTMR_FM<0x09>; 439 ASE_CNMIPS;
400 def MTP1 : MoveToLOHI<"mtp1", GPR64Opnd, [P1]>, MTMR_FM<0x0a>; 440 def MTM2 : MoveToLOHI<"mtm2", GPR64Opnd, [MPL2, P0, P1, P2]>, MTMR_FM<0x0d>,
401 def MTP2 : MoveToLOHI<"mtp2", GPR64Opnd, [P2]>, MTMR_FM<0x0b>; 441 ASE_CNMIPS;
442 def MTP0 : MoveToLOHI<"mtp0", GPR64Opnd, [P0]>, MTMR_FM<0x09>, ASE_CNMIPS;
443 def MTP1 : MoveToLOHI<"mtp1", GPR64Opnd, [P1]>, MTMR_FM<0x0a>, ASE_CNMIPS;
444 def MTP2 : MoveToLOHI<"mtp2", GPR64Opnd, [P2]>, MTMR_FM<0x0b>, ASE_CNMIPS;
402 445
403 // Count Ones in a Word/Doubleword 446 // Count Ones in a Word/Doubleword
404 def POP : Count1s<"pop", GPR32Opnd>, POP_FM<0x2c>; 447 def POP : Count1s<"pop", GPR32Opnd>, POP_FM<0x2c>, ASE_CNMIPS;
405 def DPOP : Count1s<"dpop", GPR64Opnd>, POP_FM<0x2d>; 448 def DPOP : Count1s<"dpop", GPR64Opnd>, POP_FM<0x2d>, ASE_CNMIPS;
406 449
407 // Set on equal/not equal 450 // Set on equal/not equal
408 def SEQ : SetCC64_R<"seq", seteq>, SEQ_FM<0x2a>; 451 def SEQ : SetCC64_R<"seq", seteq>, SEQ_FM<0x2a>, ASE_CNMIPS;
409 def SEQi : SetCC64_I<"seqi", seteq>, SEQI_FM<0x2e>; 452 def SEQi : SetCC64_I<"seqi", seteq>, SEQI_FM<0x2e>, ASE_CNMIPS;
410 def SNE : SetCC64_R<"sne", setne>, SEQ_FM<0x2b>; 453 def SNE : SetCC64_R<"sne", setne>, SEQ_FM<0x2b>, ASE_CNMIPS;
411 def SNEi : SetCC64_I<"snei", setne>, SEQI_FM<0x2f>; 454 def SNEi : SetCC64_I<"snei", setne>, SEQI_FM<0x2f>, ASE_CNMIPS;
412 455
413 // 192-bit x 64-bit Unsigned Multiply and Add 456 // 192-bit x 64-bit Unsigned Multiply and Add
414 let Defs = [P0, P1, P2] in 457 def V3MULU: ArithLogicR<"v3mulu", GPR64Opnd, 0, II_DMUL>, ADD_FM<0x1c, 0x11>,
415 def V3MULU: ArithLogicR<"v3mulu", GPR64Opnd, 0, II_DMUL>, 458 ASE_CNMIPS {
416 ADD_FM<0x1c, 0x11>; 459 let Defs = [P0, P1, P2];
460 }
417 461
418 // 64-bit Unsigned Multiply and Add Move 462 // 64-bit Unsigned Multiply and Add Move
419 let Defs = [MPL0, P0, P1, P2] in 463 def VMM0 : ArithLogicR<"vmm0", GPR64Opnd, 0, II_DMUL>, ADD_FM<0x1c, 0x10>,
420 def VMM0 : ArithLogicR<"vmm0", GPR64Opnd, 0, II_DMUL>, 464 ASE_CNMIPS {
421 ADD_FM<0x1c, 0x10>; 465 let Defs = [MPL0, P0, P1, P2];
466 }
422 467
423 // 64-bit Unsigned Multiply and Add 468 // 64-bit Unsigned Multiply and Add
424 let Defs = [MPL1, MPL2, P0, P1, P2] in 469 def VMULU : ArithLogicR<"vmulu", GPR64Opnd, 0, II_DMUL>, ADD_FM<0x1c, 0x0f>,
425 def VMULU : ArithLogicR<"vmulu", GPR64Opnd, 0, II_DMUL>, 470 ASE_CNMIPS {
426 ADD_FM<0x1c, 0x0f>; 471 let Defs = [MPL1, MPL2, P0, P1, P2];
472 }
427 473
428 // Move between CPU and coprocessor registers 474 // Move between CPU and coprocessor registers
429 def DMFC2_OCTEON : MFC2OP<"dmfc2", GPR64Opnd>, MFC2OP_FM<0x12, 1>; 475 def DMFC2_OCTEON : MFC2OP<"dmfc2", GPR64Opnd, II_DMFC2>, MFC2OP_FM<0x12, 1>,
430 def DMTC2_OCTEON : MFC2OP<"dmtc2", GPR64Opnd>, MFC2OP_FM<0x12, 5>; 476 ASE_CNMIPS;
477 def DMTC2_OCTEON : MFC2OP<"dmtc2", GPR64Opnd, II_DMTC2>, MFC2OP_FM<0x12, 5>,
478 ASE_CNMIPS;
431 } 479 }
432 480
433 } 481 }
434 482
435 /// Move between CPU and coprocessor registers 483 /// Move between CPU and coprocessor registers
436 let DecoderNamespace = "Mips64", Predicates = [HasMips64] in { 484 let DecoderNamespace = "Mips64", Predicates = [HasMips64] in {
437 def DMFC0 : MFC3OP<"dmfc0", GPR64Opnd, COP0Opnd>, MFC3OP_FM<0x10, 1>, ISA_MIPS3; 485 def DMFC0 : MFC3OP<"dmfc0", GPR64Opnd, COP0Opnd, II_DMFC0>, MFC3OP_FM<0x10, 1>,
438 def DMTC0 : MTC3OP<"dmtc0", COP0Opnd, GPR64Opnd>, MFC3OP_FM<0x10, 5>, ISA_MIPS3; 486 ISA_MIPS3;
439 def DMFC2 : MFC3OP<"dmfc2", GPR64Opnd, COP2Opnd>, MFC3OP_FM<0x12, 1>, ISA_MIPS3; 487 def DMTC0 : MTC3OP<"dmtc0", COP0Opnd, GPR64Opnd, II_DMTC0>, MFC3OP_FM<0x10, 5>,
440 def DMTC2 : MTC3OP<"dmtc2", COP2Opnd, GPR64Opnd>, MFC3OP_FM<0x12, 5>, ISA_MIPS3; 488 ISA_MIPS3;
489 def DMFC2 : MFC3OP<"dmfc2", GPR64Opnd, COP2Opnd, II_DMFC2>, MFC3OP_FM<0x12, 1>,
490 ISA_MIPS3;
491 def DMTC2 : MTC3OP<"dmtc2", COP2Opnd, GPR64Opnd, II_DMTC2>, MFC3OP_FM<0x12, 5>,
492 ISA_MIPS3;
441 } 493 }
442 494
443 //===----------------------------------------------------------------------===// 495 //===----------------------------------------------------------------------===//
444 // Arbitrary patterns that map to one or more instructions 496 // Arbitrary patterns that map to one or more instructions
445 //===----------------------------------------------------------------------===// 497 //===----------------------------------------------------------------------===//
498
499 // Materialize i64 constants.
500 defm : MaterializeImms<i64, ZERO_64, DADDiu, LUi64, ORi64>;
501
502 def : MipsPat<(i64 immZExt32Low16Zero:$imm),
503 (DSLL (ORi64 ZERO_64, (HI16 imm:$imm)), 16)>;
504
505 def : MipsPat<(i64 immZExt32:$imm),
506 (ORi64 (DSLL (ORi64 ZERO_64, (HI16 imm:$imm)), 16),
507 (LO16 imm:$imm))>;
446 508
447 // extended loads 509 // extended loads
448 def : MipsPat<(i64 (extloadi1 addr:$src)), (LB64 addr:$src)>; 510 def : MipsPat<(i64 (extloadi1 addr:$src)), (LB64 addr:$src)>;
449 def : MipsPat<(i64 (extloadi8 addr:$src)), (LB64 addr:$src)>; 511 def : MipsPat<(i64 (extloadi8 addr:$src)), (LB64 addr:$src)>;
450 def : MipsPat<(i64 (extloadi16 addr:$src)), (LH64 addr:$src)>; 512 def : MipsPat<(i64 (extloadi16 addr:$src)), (LH64 addr:$src)>;
456 def : MipsPat<(MipsHi tjumptable:$in), (LUi64 tjumptable:$in)>; 518 def : MipsPat<(MipsHi tjumptable:$in), (LUi64 tjumptable:$in)>;
457 def : MipsPat<(MipsHi tconstpool:$in), (LUi64 tconstpool:$in)>; 519 def : MipsPat<(MipsHi tconstpool:$in), (LUi64 tconstpool:$in)>;
458 def : MipsPat<(MipsHi tglobaltlsaddr:$in), (LUi64 tglobaltlsaddr:$in)>; 520 def : MipsPat<(MipsHi tglobaltlsaddr:$in), (LUi64 tglobaltlsaddr:$in)>;
459 def : MipsPat<(MipsHi texternalsym:$in), (LUi64 texternalsym:$in)>; 521 def : MipsPat<(MipsHi texternalsym:$in), (LUi64 texternalsym:$in)>;
460 522
461 def : MipsPat<(MipsLo tglobaladdr:$in), (DADDiu ZERO_64, tglobaladdr:$in)>; 523 let AdditionalPredicates = [NotInMicroMips] in {
462 def : MipsPat<(MipsLo tblockaddress:$in), (DADDiu ZERO_64, tblockaddress:$in)>; 524 def : MipsPat<(MipsLo tglobaladdr:$in), (DADDiu ZERO_64, tglobaladdr:$in)>;
463 def : MipsPat<(MipsLo tjumptable:$in), (DADDiu ZERO_64, tjumptable:$in)>; 525 def : MipsPat<(MipsLo tblockaddress:$in),
464 def : MipsPat<(MipsLo tconstpool:$in), (DADDiu ZERO_64, tconstpool:$in)>; 526 (DADDiu ZERO_64, tblockaddress:$in)>;
465 def : MipsPat<(MipsLo tglobaltlsaddr:$in), 527 def : MipsPat<(MipsLo tjumptable:$in), (DADDiu ZERO_64, tjumptable:$in)>;
466 (DADDiu ZERO_64, tglobaltlsaddr:$in)>; 528 def : MipsPat<(MipsLo tconstpool:$in), (DADDiu ZERO_64, tconstpool:$in)>;
467 def : MipsPat<(MipsLo texternalsym:$in), (DADDiu ZERO_64, texternalsym:$in)>; 529 def : MipsPat<(MipsLo tglobaltlsaddr:$in),
468 530 (DADDiu ZERO_64, tglobaltlsaddr:$in)>;
469 def : MipsPat<(add GPR64:$hi, (MipsLo tglobaladdr:$lo)), 531 def : MipsPat<(MipsLo texternalsym:$in), (DADDiu ZERO_64, texternalsym:$in)>;
470 (DADDiu GPR64:$hi, tglobaladdr:$lo)>; 532
471 def : MipsPat<(add GPR64:$hi, (MipsLo tblockaddress:$lo)), 533 def : MipsPat<(add GPR64:$hi, (MipsLo tglobaladdr:$lo)),
472 (DADDiu GPR64:$hi, tblockaddress:$lo)>; 534 (DADDiu GPR64:$hi, tglobaladdr:$lo)>;
473 def : MipsPat<(add GPR64:$hi, (MipsLo tjumptable:$lo)), 535 def : MipsPat<(add GPR64:$hi, (MipsLo tblockaddress:$lo)),
474 (DADDiu GPR64:$hi, tjumptable:$lo)>; 536 (DADDiu GPR64:$hi, tblockaddress:$lo)>;
475 def : MipsPat<(add GPR64:$hi, (MipsLo tconstpool:$lo)), 537 def : MipsPat<(add GPR64:$hi, (MipsLo tjumptable:$lo)),
476 (DADDiu GPR64:$hi, tconstpool:$lo)>; 538 (DADDiu GPR64:$hi, tjumptable:$lo)>;
477 def : MipsPat<(add GPR64:$hi, (MipsLo tglobaltlsaddr:$lo)), 539 def : MipsPat<(add GPR64:$hi, (MipsLo tconstpool:$lo)),
478 (DADDiu GPR64:$hi, tglobaltlsaddr:$lo)>; 540 (DADDiu GPR64:$hi, tconstpool:$lo)>;
479 541 def : MipsPat<(add GPR64:$hi, (MipsLo tglobaltlsaddr:$lo)),
480 def : WrapperPat<tglobaladdr, DADDiu, GPR64>; 542 (DADDiu GPR64:$hi, tglobaltlsaddr:$lo)>;
481 def : WrapperPat<tconstpool, DADDiu, GPR64>; 543
482 def : WrapperPat<texternalsym, DADDiu, GPR64>; 544 def : WrapperPat<tglobaladdr, DADDiu, GPR64>;
483 def : WrapperPat<tblockaddress, DADDiu, GPR64>; 545 def : WrapperPat<tconstpool, DADDiu, GPR64>;
484 def : WrapperPat<tjumptable, DADDiu, GPR64>; 546 def : WrapperPat<texternalsym, DADDiu, GPR64>;
485 def : WrapperPat<tglobaltlsaddr, DADDiu, GPR64>; 547 def : WrapperPat<tblockaddress, DADDiu, GPR64>;
486 548 def : WrapperPat<tjumptable, DADDiu, GPR64>;
487 defm : BrcondPats<GPR64, BEQ64, BNE64, SLT64, SLTu64, SLTi64, SLTiu64, 549 def : WrapperPat<tglobaltlsaddr, DADDiu, GPR64>;
550 }
551
552 defm : BrcondPats<GPR64, BEQ64, BEQ, BNE64, SLT64, SLTu64, SLTi64, SLTiu64,
488 ZERO_64>; 553 ZERO_64>;
489
490 def : MipsPat<(brcond (i32 (setlt i64:$lhs, 1)), bb:$dst), 554 def : MipsPat<(brcond (i32 (setlt i64:$lhs, 1)), bb:$dst),
491 (BLEZ64 i64:$lhs, bb:$dst)>; 555 (BLEZ64 i64:$lhs, bb:$dst)>;
492 def : MipsPat<(brcond (i32 (setgt i64:$lhs, -1)), bb:$dst), 556 def : MipsPat<(brcond (i32 (setgt i64:$lhs, -1)), bb:$dst),
493 (BGEZ64 i64:$lhs, bb:$dst)>; 557 (BGEZ64 i64:$lhs, bb:$dst)>;
494 558
495 // setcc patterns 559 // setcc patterns
496 defm : SeteqPats<GPR64, SLTiu64, XOR64, SLTu64, ZERO_64>; 560 let AdditionalPredicates = [NotInMicroMips] in {
497 defm : SetlePats<GPR64, SLT64, SLTu64>; 561 defm : SeteqPats<GPR64, SLTiu64, XOR64, SLTu64, ZERO_64>;
498 defm : SetgtPats<GPR64, SLT64, SLTu64>; 562 defm : SetlePats<GPR64, XORi, SLT64, SLTu64>;
499 defm : SetgePats<GPR64, SLT64, SLTu64>; 563 defm : SetgtPats<GPR64, SLT64, SLTu64>;
500 defm : SetgeImmPats<GPR64, SLTi64, SLTiu64>; 564 defm : SetgePats<GPR64, XORi, SLT64, SLTu64>;
501 565 defm : SetgeImmPats<GPR64, XORi, SLTi64, SLTiu64>;
566 }
502 // truncate 567 // truncate
503 def : MipsPat<(trunc (assertsext GPR64:$src)), 568 def : MipsPat<(trunc (assertsext GPR64:$src)),
504 (EXTRACT_SUBREG GPR64:$src, sub_32)>; 569 (EXTRACT_SUBREG GPR64:$src, sub_32)>;
505 def : MipsPat<(trunc (assertzext GPR64:$src)), 570 // The forward compatibility strategy employed by MIPS requires us to treat
571 // values as being sign extended to an infinite number of bits. This allows
572 // existing software to run without modification on any future MIPS
573 // implementation (e.g. 128-bit, or 1024-bit). Being compatible with this
574 // strategy requires that truncation acts as a sign-extension for values being
575 // fed into instructions operating on 32-bit values. Such instructions have
576 // undefined results if this is not true.
577 // For our case, this means that we can't issue an extract_subreg for nodes
578 // such as (trunc:i32 (assertzext:i64 X, i32)), because the sign-bit of the
579 // lower subreg would not be replicated into the upper half.
580 def : MipsPat<(trunc (assertzext_lt_i32 GPR64:$src)),
506 (EXTRACT_SUBREG GPR64:$src, sub_32)>; 581 (EXTRACT_SUBREG GPR64:$src, sub_32)>;
507 def : MipsPat<(i32 (trunc GPR64:$src)), 582 def : MipsPat<(i32 (trunc GPR64:$src)),
508 (SLL (EXTRACT_SUBREG GPR64:$src, sub_32), 0)>; 583 (SLL (EXTRACT_SUBREG GPR64:$src, sub_32), 0)>;
509 584
510 // variable shift instructions patterns 585 // variable shift instructions patterns
512 (DSLLV GPR64:$rt, (EXTRACT_SUBREG GPR64:$rs, sub_32))>; 587 (DSLLV GPR64:$rt, (EXTRACT_SUBREG GPR64:$rs, sub_32))>;
513 def : MipsPat<(srl GPR64:$rt, (i32 (trunc GPR64:$rs))), 588 def : MipsPat<(srl GPR64:$rt, (i32 (trunc GPR64:$rs))),
514 (DSRLV GPR64:$rt, (EXTRACT_SUBREG GPR64:$rs, sub_32))>; 589 (DSRLV GPR64:$rt, (EXTRACT_SUBREG GPR64:$rs, sub_32))>;
515 def : MipsPat<(sra GPR64:$rt, (i32 (trunc GPR64:$rs))), 590 def : MipsPat<(sra GPR64:$rt, (i32 (trunc GPR64:$rs))),
516 (DSRAV GPR64:$rt, (EXTRACT_SUBREG GPR64:$rs, sub_32))>; 591 (DSRAV GPR64:$rt, (EXTRACT_SUBREG GPR64:$rs, sub_32))>;
517 def : MipsPat<(rotr GPR64:$rt, (i32 (trunc GPR64:$rs))), 592 let AdditionalPredicates = [NotInMicroMips] in {
518 (DROTRV GPR64:$rt, (EXTRACT_SUBREG GPR64:$rs, sub_32))>; 593 def : MipsPat<(rotr GPR64:$rt, (i32 (trunc GPR64:$rs))),
594 (DROTRV GPR64:$rt, (EXTRACT_SUBREG GPR64:$rs, sub_32))>;
595 }
519 596
520 // 32-to-64-bit extension 597 // 32-to-64-bit extension
521 def : MipsPat<(i64 (anyext GPR32:$src)), (SLL64_32 GPR32:$src)>; 598 def : MipsPat<(i64 (anyext GPR32:$src)),
599 (INSERT_SUBREG (i64 (IMPLICIT_DEF)), GPR32:$src, sub_32)>;
522 def : MipsPat<(i64 (zext GPR32:$src)), (DSRL (DSLL64_32 GPR32:$src), 32)>; 600 def : MipsPat<(i64 (zext GPR32:$src)), (DSRL (DSLL64_32 GPR32:$src), 32)>;
523 def : MipsPat<(i64 (sext GPR32:$src)), (SLL64_32 GPR32:$src)>; 601 def : MipsPat<(i64 (sext GPR32:$src)), (SLL64_32 GPR32:$src)>;
524 602
525 // Sign extend in register 603 // Sign extend in register
526 def : MipsPat<(i64 (sext_inreg GPR64:$src, i32)), 604 def : MipsPat<(i64 (sext_inreg GPR64:$src, i32)),
528 606
529 // bswap MipsPattern 607 // bswap MipsPattern
530 def : MipsPat<(bswap GPR64:$rt), (DSHD (DSBH GPR64:$rt))>; 608 def : MipsPat<(bswap GPR64:$rt), (DSHD (DSBH GPR64:$rt))>;
531 609
532 // Carry pattern 610 // Carry pattern
533 def : MipsPat<(subc GPR64:$lhs, GPR64:$rhs), 611 let AdditionalPredicates = [NotInMicroMips] in {
534 (DSUBu GPR64:$lhs, GPR64:$rhs)>; 612 def : MipsPat<(subc GPR64:$lhs, GPR64:$rhs),
535 let AdditionalPredicates = [NotDSP] in { 613 (DSUBu GPR64:$lhs, GPR64:$rhs)>;
536 def : MipsPat<(addc GPR64:$lhs, GPR64:$rhs), 614 def : MipsPat<(addc GPR64:$lhs, GPR64:$rhs),
537 (DADDu GPR64:$lhs, GPR64:$rhs)>; 615 (DADDu GPR64:$lhs, GPR64:$rhs)>, ASE_NOT_DSP;
538 def : MipsPat<(addc GPR64:$lhs, immSExt16:$imm), 616 def : MipsPat<(addc GPR64:$lhs, immSExt16:$imm),
539 (DADDiu GPR64:$lhs, imm:$imm)>; 617 (DADDiu GPR64:$lhs, imm:$imm)>, ASE_NOT_DSP;
540 } 618 }
541 619
542 // Octeon bbit0/bbit1 MipsPattern 620 // Octeon bbit0/bbit1 MipsPattern
543 let Predicates = [HasMips64, HasCnMips] in {
544 def : MipsPat<(brcond (i32 (seteq (and i64:$lhs, PowerOf2LO:$mask), 0)), bb:$dst), 621 def : MipsPat<(brcond (i32 (seteq (and i64:$lhs, PowerOf2LO:$mask), 0)), bb:$dst),
545 (BBIT0 i64:$lhs, (Log2LO PowerOf2LO:$mask), bb:$dst)>; 622 (BBIT0 i64:$lhs, (Log2LO PowerOf2LO:$mask), bb:$dst)>, ASE_MIPS64_CNMIPS;
546 def : MipsPat<(brcond (i32 (seteq (and i64:$lhs, PowerOf2HI:$mask), 0)), bb:$dst), 623 def : MipsPat<(brcond (i32 (seteq (and i64:$lhs, PowerOf2HI:$mask), 0)), bb:$dst),
547 (BBIT032 i64:$lhs, (Log2HI PowerOf2HI:$mask), bb:$dst)>; 624 (BBIT032 i64:$lhs, (Log2HI PowerOf2HI:$mask), bb:$dst)>, ASE_MIPS64_CNMIPS;
548 def : MipsPat<(brcond (i32 (setne (and i64:$lhs, PowerOf2LO:$mask), 0)), bb:$dst), 625 def : MipsPat<(brcond (i32 (setne (and i64:$lhs, PowerOf2LO:$mask), 0)), bb:$dst),
549 (BBIT1 i64:$lhs, (Log2LO PowerOf2LO:$mask), bb:$dst)>; 626 (BBIT1 i64:$lhs, (Log2LO PowerOf2LO:$mask), bb:$dst)>, ASE_MIPS64_CNMIPS;
550 def : MipsPat<(brcond (i32 (setne (and i64:$lhs, PowerOf2HI:$mask), 0)), bb:$dst), 627 def : MipsPat<(brcond (i32 (setne (and i64:$lhs, PowerOf2HI:$mask), 0)), bb:$dst),
551 (BBIT132 i64:$lhs, (Log2HI PowerOf2HI:$mask), bb:$dst)>; 628 (BBIT132 i64:$lhs, (Log2HI PowerOf2HI:$mask), bb:$dst)>, ASE_MIPS64_CNMIPS;
552 }
553 629
554 // Atomic load patterns. 630 // Atomic load patterns.
555 def : MipsPat<(atomic_load_8 addr:$a), (LB64 addr:$a)>; 631 def : MipsPat<(atomic_load_8 addr:$a), (LB64 addr:$a)>;
556 def : MipsPat<(atomic_load_16 addr:$a), (LH64 addr:$a)>; 632 def : MipsPat<(atomic_load_16 addr:$a), (LH64 addr:$a)>;
557 def : MipsPat<(atomic_load_32 addr:$a), (LW64 addr:$a)>; 633 def : MipsPat<(atomic_load_32 addr:$a), (LW64 addr:$a)>;
564 def : MipsPat<(atomic_store_64 addr:$a, GPR64:$v), (SD GPR64:$v, addr:$a)>; 640 def : MipsPat<(atomic_store_64 addr:$a, GPR64:$v), (SD GPR64:$v, addr:$a)>;
565 641
566 //===----------------------------------------------------------------------===// 642 //===----------------------------------------------------------------------===//
567 // Instruction aliases 643 // Instruction aliases
568 //===----------------------------------------------------------------------===// 644 //===----------------------------------------------------------------------===//
569 def : MipsInstAlias<"move $dst, $src", 645 let AdditionalPredicates = [NotInMicroMips] in {
570 (OR64 GPR64Opnd:$dst, GPR64Opnd:$src, ZERO_64), 1>, 646 def : MipsInstAlias<"move $dst, $src",
571 GPR_64; 647 (OR64 GPR64Opnd:$dst, GPR64Opnd:$src, ZERO_64), 1>,
572 def : MipsInstAlias<"move $dst, $src", 648 GPR_64;
573 (DADDu GPR64Opnd:$dst, GPR64Opnd:$src, ZERO_64), 1>, 649 def : MipsInstAlias<"move $dst, $src",
574 GPR_64; 650 (DADDu GPR64Opnd:$dst, GPR64Opnd:$src, ZERO_64), 1>,
575 def : MipsInstAlias<"daddu $rs, $rt, $imm", 651 GPR_64;
576 (DADDiu GPR64Opnd:$rs, GPR64Opnd:$rt, simm16_64:$imm), 652 def : MipsInstAlias<"dadd $rs, $rt, $imm",
577 0>, ISA_MIPS3; 653 (DADDi GPR64Opnd:$rs, GPR64Opnd:$rt, simm16_64:$imm),
578 def : MipsInstAlias<"dadd $rs, $rt, $imm", 654 0>, ISA_MIPS3_NOT_32R6_64R6;
579 (DADDi GPR64Opnd:$rs, GPR64Opnd:$rt, simm16_64:$imm), 655 def : MipsInstAlias<"dadd $rs, $imm",
580 0>, ISA_MIPS3_NOT_32R6_64R6; 656 (DADDi GPR64Opnd:$rs, GPR64Opnd:$rs, simm16_64:$imm),
581 def : MipsInstAlias<"daddu $rs, $imm", 657 0>, ISA_MIPS3_NOT_32R6_64R6;
582 (DADDiu GPR64Opnd:$rs, GPR64Opnd:$rs, simm16_64:$imm), 658 def : MipsInstAlias<"daddu $rs, $rt, $imm",
583 0>, ISA_MIPS3; 659 (DADDiu GPR64Opnd:$rs, GPR64Opnd:$rt, simm16_64:$imm),
584 def : MipsInstAlias<"dadd $rs, $imm", 660 0>, ISA_MIPS3;
585 (DADDi GPR64Opnd:$rs, GPR64Opnd:$rs, simm16_64:$imm), 661 def : MipsInstAlias<"daddu $rs, $imm",
586 0>, ISA_MIPS3_NOT_32R6_64R6; 662 (DADDiu GPR64Opnd:$rs, GPR64Opnd:$rs, simm16_64:$imm),
663 0>, ISA_MIPS3;
664 }
587 def : MipsInstAlias<"dsll $rd, $rt, $rs", 665 def : MipsInstAlias<"dsll $rd, $rt, $rs",
588 (DSLLV GPR64Opnd:$rd, GPR64Opnd:$rt, GPR32Opnd:$rs), 0>, 666 (DSLLV GPR64Opnd:$rd, GPR64Opnd:$rt, GPR32Opnd:$rs), 0>,
589 ISA_MIPS3; 667 ISA_MIPS3;
590 def : MipsInstAlias<"dneg $rt, $rs", 668 let AdditionalPredicates = [NotInMicroMips] in {
591 (DSUB GPR64Opnd:$rt, ZERO_64, GPR64Opnd:$rs), 1>, 669 def : MipsInstAlias<"dneg $rt, $rs",
592 ISA_MIPS3; 670 (DSUB GPR64Opnd:$rt, ZERO_64, GPR64Opnd:$rs), 1>,
593 def : MipsInstAlias<"dneg $rt", 671 ISA_MIPS3;
594 (DSUB GPR64Opnd:$rt, ZERO_64, GPR64Opnd:$rt), 0>, 672 def : MipsInstAlias<"dneg $rt",
595 ISA_MIPS3; 673 (DSUB GPR64Opnd:$rt, ZERO_64, GPR64Opnd:$rt), 1>,
596 def : MipsInstAlias<"dnegu $rt, $rs", 674 ISA_MIPS3;
597 (DSUBu GPR64Opnd:$rt, ZERO_64, GPR64Opnd:$rs), 1>, 675 def : MipsInstAlias<"dnegu $rt, $rs",
598 ISA_MIPS3; 676 (DSUBu GPR64Opnd:$rt, ZERO_64, GPR64Opnd:$rs), 1>,
599 def : MipsInstAlias<"dsubu $rt, $rs, $imm", 677 ISA_MIPS3;
600 (DADDiu GPR64Opnd:$rt, GPR64Opnd:$rs, 678 def : MipsInstAlias<"dnegu $rt",
601 InvertedImOperand64:$imm), 0>, ISA_MIPS3; 679 (DSUBu GPR64Opnd:$rt, ZERO_64, GPR64Opnd:$rt), 1>,
680 ISA_MIPS3;
681 }
602 def : MipsInstAlias<"dsubi $rs, $rt, $imm", 682 def : MipsInstAlias<"dsubi $rs, $rt, $imm",
603 (DADDi GPR64Opnd:$rs, GPR64Opnd:$rt, 683 (DADDi GPR64Opnd:$rs, GPR64Opnd:$rt,
604 InvertedImOperand64:$imm), 684 InvertedImOperand64:$imm),
605 0>, ISA_MIPS3_NOT_32R6_64R6; 685 0>, ISA_MIPS3_NOT_32R6_64R6;
606 def : MipsInstAlias<"dsubi $rs, $imm", 686 def : MipsInstAlias<"dsubi $rs, $imm",
613 0>, ISA_MIPS3_NOT_32R6_64R6; 693 0>, ISA_MIPS3_NOT_32R6_64R6;
614 def : MipsInstAlias<"dsub $rs, $imm", 694 def : MipsInstAlias<"dsub $rs, $imm",
615 (DADDi GPR64Opnd:$rs, GPR64Opnd:$rs, 695 (DADDi GPR64Opnd:$rs, GPR64Opnd:$rs,
616 InvertedImOperand64:$imm), 696 InvertedImOperand64:$imm),
617 0>, ISA_MIPS3_NOT_32R6_64R6; 697 0>, ISA_MIPS3_NOT_32R6_64R6;
618 def : MipsInstAlias<"dsubu $rs, $imm", 698 let AdditionalPredicates = [NotInMicroMips] in {
619 (DADDiu GPR64Opnd:$rs, GPR64Opnd:$rs, 699 def : MipsInstAlias<"dsubu $rt, $rs, $imm",
620 InvertedImOperand64:$imm), 700 (DADDiu GPR64Opnd:$rt, GPR64Opnd:$rs,
621 0>, ISA_MIPS3; 701 InvertedImOperand64:$imm), 0>, ISA_MIPS3;
702 def : MipsInstAlias<"dsubu $rs, $imm",
703 (DADDiu GPR64Opnd:$rs, GPR64Opnd:$rs,
704 InvertedImOperand64:$imm), 0>, ISA_MIPS3;
705 }
622 def : MipsInstAlias<"dsra $rd, $rt, $rs", 706 def : MipsInstAlias<"dsra $rd, $rt, $rs",
623 (DSRAV GPR64Opnd:$rd, GPR64Opnd:$rt, GPR32Opnd:$rs), 0>, 707 (DSRAV GPR64Opnd:$rd, GPR64Opnd:$rt, GPR32Opnd:$rs), 0>,
624 ISA_MIPS3; 708 ISA_MIPS3;
625 def : MipsInstAlias<"dsrl $rd, $rt, $rs", 709 let AdditionalPredicates = [NotInMicroMips] in {
626 (DSRLV GPR64Opnd:$rd, GPR64Opnd:$rt, GPR32Opnd:$rs), 0>, 710 def : MipsInstAlias<"dsrl $rd, $rt, $rs",
627 ISA_MIPS3; 711 (DSRLV GPR64Opnd:$rd, GPR64Opnd:$rt, GPR32Opnd:$rs), 0>,
712 ISA_MIPS3;
628 713
629 // Two operand (implicit 0 selector) versions: 714 // Two operand (implicit 0 selector) versions:
630 def : MipsInstAlias<"dmfc0 $rt, $rd", (DMFC0 GPR64Opnd:$rt, COP0Opnd:$rd, 0), 0>; 715 def : MipsInstAlias<"dmtc0 $rt, $rd",
631 def : MipsInstAlias<"dmtc0 $rt, $rd", (DMTC0 COP0Opnd:$rd, GPR64Opnd:$rt, 0), 0>; 716 (DMTC0 COP0Opnd:$rd, GPR64Opnd:$rt, 0), 0>;
717 def : MipsInstAlias<"dmfc0 $rt, $rd",
718 (DMFC0 GPR64Opnd:$rt, COP0Opnd:$rd, 0), 0>;
719 }
632 def : MipsInstAlias<"dmfc2 $rt, $rd", (DMFC2 GPR64Opnd:$rt, COP2Opnd:$rd, 0), 0>; 720 def : MipsInstAlias<"dmfc2 $rt, $rd", (DMFC2 GPR64Opnd:$rt, COP2Opnd:$rd, 0), 0>;
633 def : MipsInstAlias<"dmtc2 $rt, $rd", (DMTC2 COP2Opnd:$rd, GPR64Opnd:$rt, 0), 0>; 721 def : MipsInstAlias<"dmtc2 $rt, $rd", (DMTC2 COP2Opnd:$rd, GPR64Opnd:$rt, 0), 0>;
634 722
635 let Predicates = [HasMips64, HasCnMips] in { 723 def : MipsInstAlias<"synciobdma", (SYNC 0x2), 0>, ASE_MIPS64_CNMIPS;
636 def : MipsInstAlias<"synciobdma", (SYNC 0x2), 0>; 724 def : MipsInstAlias<"syncs", (SYNC 0x6), 0>, ASE_MIPS64_CNMIPS;
637 def : MipsInstAlias<"syncs", (SYNC 0x6), 0>; 725 def : MipsInstAlias<"syncw", (SYNC 0x4), 0>, ASE_MIPS64_CNMIPS;
638 def : MipsInstAlias<"syncw", (SYNC 0x4), 0>; 726 def : MipsInstAlias<"syncws", (SYNC 0x5), 0>, ASE_MIPS64_CNMIPS;
639 def : MipsInstAlias<"syncws", (SYNC 0x5), 0>;
640 }
641 727
642 // cnMIPS Aliases. 728 // cnMIPS Aliases.
643 729
644 // bbit* with $p 32-63 converted to bbit*32 with $p 0-31 730 // bbit* with $p 32-63 converted to bbit*32 with $p 0-31
645 def : MipsInstAlias<"bbit0 $rs, $p, $offset", 731 def : MipsInstAlias<"bbit0 $rs, $p, $offset",