1 //===- Mips64InstrInfo.td - Mips64 Instruction Information -*- tablegen -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file describes Mips64 instructions.
12 //===----------------------------------------------------------------------===//
14 //===----------------------------------------------------------------------===//
15 // Mips64 Instruction Predicate Definitions.
16 //===----------------------------------------------------------------------===//
17 def HasMips64 : Predicate<"Subtarget.hasMips64()">;
18 def HasMips64r2 : Predicate<"Subtarget.hasMips64r2()">;
20 //===----------------------------------------------------------------------===//
21 // Mips Operand, Complex Patterns and Transformations Definitions.
22 //===----------------------------------------------------------------------===//
24 // Instruction operand types
25 def simm16_64 : Operand<i64>;
28 def uimm16_64 : Operand<i64> {
29 let PrintMethod = "printUnsignedImm";
32 //===----------------------------------------------------------------------===//
33 // Instructions specific format
34 //===----------------------------------------------------------------------===//
36 // Arithmetic 3 register operands
37 class ArithR64<bits<6> op, bits<6> func, string instr_asm, SDNode OpNode,
38 InstrItinClass itin, bit isComm = 0>:
39 FR<op, func, (outs CPU64Regs:$dst), (ins CPU64Regs:$b, CPU64Regs:$c),
40 !strconcat(instr_asm, "\t$dst, $b, $c"),
41 [(set CPU64Regs:$dst, (OpNode CPU64Regs:$b, CPU64Regs:$c))], itin> {
42 let isCommutable = isComm;
45 // Arithmetic 2 register operands
46 class ArithI64<bits<6> op, string instr_asm, SDNode OpNode,
47 Operand Od, PatLeaf imm_type> :
48 FI<op, (outs CPU64Regs:$dst), (ins CPU64Regs:$b, Od:$c),
49 !strconcat(instr_asm, "\t$dst, $b, $c"),
50 [(set CPU64Regs:$dst, (OpNode CPU64Regs:$b, imm_type:$c))], IIAlu>;
53 let isCommutable = 1 in
54 class LogicR64<bits<6> func, string instr_asm, SDNode OpNode>:
55 FR<0x00, func, (outs CPU64Regs:$dst), (ins CPU64Regs:$b, CPU64Regs:$c),
56 !strconcat(instr_asm, "\t$dst, $b, $c"),
57 [(set CPU64Regs:$dst, (OpNode CPU64Regs:$b, CPU64Regs:$c))], IIAlu>;
59 class LogicI64<bits<6> op, string instr_asm, SDNode OpNode>:
60 FI<op, (outs CPU64Regs:$dst), (ins CPU64Regs:$b, uimm16_64:$c),
61 !strconcat(instr_asm, "\t$dst, $b, $c"),
62 [(set CPU64Regs:$dst, (OpNode CPU64Regs:$b, immZExt16:$c))], IIAlu>;
64 //===----------------------------------------------------------------------===//
65 // Instruction definition
66 //===----------------------------------------------------------------------===//
68 /// Arithmetic Instructions (ALU Immediate)
69 def DADDiu : ArithI64<0x19, "daddiu", add, simm16_64, immSExt16>;
70 def DANDi : LogicI64<0x0c, "andi", and>;
71 def DORi : LogicI64<0x0d, "ori", or>;
72 def DXORi : LogicI64<0x0e, "xori", xor>;
74 /// Arithmetic Instructions (3-Operand, R-Type)
75 def DADDu : ArithR64<0x00, 0x2d, "daddu", add, IIAlu, 1>;
76 def DSUBu : ArithR64<0x00, 0x2f, "dsubu", sub, IIAlu, 1>;
77 def DAND : LogicR64<0x24, "and", and>;
78 def DOR : LogicR64<0x25, "or", or>;
79 def DXOR : LogicR64<0x26, "xor", xor>;