llvm.org GIT mirror llvm / 8208615
[mips][mips64r6] Add bc[12](eq|ne)z Summary: Depends on D3691 Reviewers: jkolek, zoran.jovanovic, vmedic Reviewed By: vmedic Differential Revision: http://reviews.llvm.org/D3760 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209292 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Sanders 6 years ago
5 changed file(s) with 91 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
193193 unsigned RegNo,
194194 uint64_t Address,
195195 const void *Decoder);
196
197 static DecodeStatus DecodeCOP2RegisterClass(MCInst &Inst,
198 unsigned RegNo,
199 uint64_t Address,
200 const void *Decoder);
196201
197202 static DecodeStatus DecodeBranchTarget(MCInst &Inst,
198203 unsigned Offset,
845850 return MCDisassembler::Success;
846851 }
847852
853 static DecodeStatus DecodeCOP2RegisterClass(MCInst &Inst,
854 unsigned RegNo,
855 uint64_t Address,
856 const void *Decoder) {
857 if (RegNo > 31)
858 return MCDisassembler::Fail;
859
860 unsigned Reg = getReg(Decoder, Mips::COP2RegClassID, RegNo);
861 Inst.addOperand(MCOperand::CreateReg(Reg));
862 return MCDisassembler::Success;
863 }
864
848865 static DecodeStatus DecodeBranchTarget(MCInst &Inst,
849866 unsigned Offset,
850867 uint64_t Address,
2323 //===----------------------------------------------------------------------===//
2424
2525 def OPGROUP_COP1 { bits<6> Value = 0b010001; }
26 def OPGROUP_COP2 { bits<6> Value = 0b010010; }
2627 def OPGROUP_AUI { bits<6> Value = 0b001111; }
2728 def OPGROUP_DAUI { bits<6> Value = 0b011101; }
2829 def OPGROUP_PCREL { bits<6> Value = 0b111011; }
4445 def OPCODE5_AUIPC : OPCODE5<0b11110>;
4546 def OPCODE5_DAHI : OPCODE5<0b00110>;
4647 def OPCODE5_DATI : OPCODE5<0b11110>;
48 def OPCODE5_BC1EQZ : OPCODE5<0b01001>;
49 def OPCODE5_BC1NEZ : OPCODE5<0b01101>;
50 def OPCODE5_BC2EQZ : OPCODE5<0b01001>;
51 def OPCODE5_BC2NEZ : OPCODE5<0b01101>;
4752
4853 class OPCODE6 Val> {
4954 bits<6> Value = Val;
137142 let Inst{5-0} = funct;
138143 }
139144
145 class COP1_BCCZ_FM : MipsR6Inst {
146 bits<5> ft;
147 bits<16> offset;
148
149 bits<32> Inst;
150
151 let Inst{31-26} = OPGROUP_COP1.Value;
152 let Inst{25-21} = Operation.Value;
153 let Inst{20-16} = ft;
154 let Inst{15-0} = offset;
155 }
156
157 class COP2_BCCZ_FM : MipsR6Inst {
158 bits<5> ct;
159 bits<16> offset;
160
161 bits<32> Inst;
162
163 let Inst{31-26} = OPGROUP_COP2.Value;
164 let Inst{25-21} = Operation.Value;
165 let Inst{20-16} = ct;
166 let Inst{15-0} = offset;
167 }
168
140169 class PCREL16_FM : MipsR6Inst {
141170 bits<5> rs;
142171 bits<16> imm;
106106 class BGEZALC_ENC : CMP_BRANCH_OFF16_FM<0b000110>;
107107 class BNEZC_ENC : CMP_BRANCH_OFF21_FM<0b111110>;
108108
109 class BC1EQZ_ENC : COP1_BCCZ_FM;
110 class BC1NEZ_ENC : COP1_BCCZ_FM;
111 class BC2EQZ_ENC : COP2_BCCZ_FM;
112 class BC2NEZ_ENC : COP2_BCCZ_FM;
113
109114 class JIALC_ENC : JMP_IDX_COMPACT_FM<0b111110>;
110115 class JIC_ENC : JMP_IDX_COMPACT_FM<0b110110>;
111116
325330 class BEQZC_DESC : CMP_CBR_EQNE_Z_DESC_BASE<"beqzc", brtarget21, GPR32Opnd>;
326331 class BNEZC_DESC : CMP_CBR_EQNE_Z_DESC_BASE<"bnezc", brtarget21, GPR32Opnd>;
327332
333 class COP1_BCCZ_DESC_BASE : BRANCH_DESC_BASE {
334 dag InOperandList = (ins FGR64Opnd:$ft, brtarget:$offset);
335 dag OutOperandList = (outs);
336 string AsmString = instr_asm;
337 bit hasDelaySlot = 1;
338 }
339
340 class BC1EQZ_DESC : COP1_BCCZ_DESC_BASE<"bc1eqz $ft, $offset">;
341 class BC1NEZ_DESC : COP1_BCCZ_DESC_BASE<"bc1nez $ft, $offset">;
342
343 class COP2_BCCZ_DESC_BASE : BRANCH_DESC_BASE {
344 dag InOperandList = (ins COP2Opnd:$ct, brtarget:$offset);
345 dag OutOperandList = (outs);
346 string AsmString = instr_asm;
347 bit hasDelaySlot = 1;
348 }
349
350 class BC2EQZ_DESC : COP2_BCCZ_DESC_BASE<"bc2eqz $ct, $offset">;
351 class BC2NEZ_DESC : COP2_BCCZ_DESC_BASE<"bc2nez $ct, $offset">;
352
328353 class JMP_IDX_COMPACT_DESC_BASE
329354 RegisterOperand GPROpnd> {
330355 dag InOperandList = (ins GPROpnd:$rt, opnd:$offset);
483508 def AUI : AUI_ENC, AUI_DESC, ISA_MIPS32R6;
484509 def AUIPC : AUIPC_ENC, AUIPC_DESC, ISA_MIPS32R6;
485510 def BALC : BALC_ENC, BALC_DESC, ISA_MIPS32R6;
486 def BC1EQZ;
487 def BC1NEZ;
488 def BC2EQZ;
489 def BC2NEZ;
511 def BC1EQZ : BC1EQZ_ENC, BC1EQZ_DESC, ISA_MIPS32R6;
512 def BC1NEZ : BC1NEZ_ENC, BC1NEZ_DESC, ISA_MIPS32R6;
513 def BC2EQZ : BC2EQZ_ENC, BC2EQZ_DESC, ISA_MIPS32R6;
514 def BC2NEZ : BC2NEZ_ENC, BC2NEZ_DESC, ISA_MIPS32R6;
490515 def BC : BC_ENC, BC_DESC, ISA_MIPS32R6;
491516 def BEQC : BEQC_ENC, BEQC_DESC, ISA_MIPS32R6;
492517 def BEQZALC : BEQZALC_ENC, BEQZALC_DESC, ISA_MIPS32R6;
1010 auipc $3, -1 # CHECK: auipc $3, -1 # encoding: [0xec,0x7e,0xff,0xff]
1111 balc 14572256 # CHECK: balc 14572256 # encoding: [0xe8,0x37,0x96,0xb8]
1212 bc 14572256 # CHECK: bc 14572256 # encoding: [0xc8,0x37,0x96,0xb8]
13 bc1eqz $f0,4 # CHECK: bc1eqz $f0, 4 # encoding: [0x45,0x20,0x00,0x01]
14 bc1eqz $f31,4 # CHECK: bc1eqz $f31, 4 # encoding: [0x45,0x3f,0x00,0x01]
15 bc1nez $f0,4 # CHECK: bc1nez $f0, 4 # encoding: [0x45,0xa0,0x00,0x01]
16 bc1nez $f31,4 # CHECK: bc1nez $f31, 4 # encoding: [0x45,0xbf,0x00,0x01]
17 bc2eqz $0,8 # CHECK: bc2eqz $0, 8 # encoding: [0x49,0x20,0x00,0x02]
18 bc2eqz $31,8 # CHECK: bc2eqz $31, 8 # encoding: [0x49,0x3f,0x00,0x02]
19 bc2nez $0,8 # CHECK: bc2nez $0, 8 # encoding: [0x49,0xa0,0x00,0x02]
20 bc2nez $31,8 # CHECK: bc2nez $31, 8 # encoding: [0x49,0xbf,0x00,0x02]
1321 beqc $5, $6, 256 # CHECK: beqc $5, $6, 256 # encoding: [0x20,0xa6,0x00,0x40]
1422 beqzalc $2, 1332 # CHECK: beqzalc $2, 1332 # encoding: [0x20,0x02,0x01,0x4d]
1523 bnec $5, $6, 256 # CHECK: bnec $5, $6, 256 # encoding: [0x60,0xa6,0x00,0x40]
1010 auipc $3, -1 # CHECK: auipc $3, -1 # encoding: [0xec,0x7e,0xff,0xff]
1111 balc 14572256 # CHECK: balc 14572256 # encoding: [0xe8,0x37,0x96,0xb8]
1212 bc 14572256 # CHECK: bc 14572256 # encoding: [0xc8,0x37,0x96,0xb8]
13 bc1eqz $f0,4 # CHECK: bc1eqz $f0, 4 # encoding: [0x45,0x20,0x00,0x01]
14 bc1eqz $f31,4 # CHECK: bc1eqz $f31, 4 # encoding: [0x45,0x3f,0x00,0x01]
15 bc1nez $f0,4 # CHECK: bc1nez $f0, 4 # encoding: [0x45,0xa0,0x00,0x01]
16 bc1nez $f31,4 # CHECK: bc1nez $f31, 4 # encoding: [0x45,0xbf,0x00,0x01]
17 bc2eqz $0,8 # CHECK: bc2eqz $0, 8 # encoding: [0x49,0x20,0x00,0x02]
18 bc2eqz $31,8 # CHECK: bc2eqz $31, 8 # encoding: [0x49,0x3f,0x00,0x02]
19 bc2nez $0,8 # CHECK: bc2nez $0, 8 # encoding: [0x49,0xa0,0x00,0x02]
20 bc2nez $31,8 # CHECK: bc2nez $31, 8 # encoding: [0x49,0xbf,0x00,0x02]
1321 beqc $5, $6, 256 # CHECK: beqc $5, $6, 256 # encoding: [0x20,0xa6,0x00,0x40]
1422 beqzalc $2, 1332 # CHECK: beqzalc $2, 1332 # encoding: [0x20,0x02,0x01,0x4d]
1523 bnec $5, $6, 256 # CHECK: bnec $5, $6, 256 # encoding: [0x60,0xa6,0x00,0x40]