4471870fa316ae6a3857e18d54ca227906946498
[oota-llvm.git] / lib / Target / Mips / Mips32r6InstrFormats.td
1 //=- Mips32r6InstrFormats.td - Mips32r6 Instruction Formats -*- 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 instruction formats.
11 //
12 //===----------------------------------------------------------------------===//
13
14 class MipsR6Inst : MipsInst<(outs), (ins), "", [], NoItinerary, FrmOther>,
15                    PredicateControl {
16   let DecoderNamespace = "Mips32r6_64r6";
17   let EncodingPredicates = [HasStdEnc];
18 }
19
20 //===----------------------------------------------------------------------===//
21 //
22 // Field Values
23 //
24 //===----------------------------------------------------------------------===//
25
26 def OPGROUP_COP1 { bits<6> Value = 0b010001; }
27 def OPGROUP_SPECIAL { bits<6> Value = 0b000000; }
28
29 class FIELD_FMT<bits<5> Val> {
30   bits<5> Value = Val;
31 }
32 def FIELD_FMT_S : FIELD_FMT<0b10000>;
33 def FIELD_FMT_D : FIELD_FMT<0b10001>;
34
35 //===----------------------------------------------------------------------===//
36 //
37 // Encoding Formats
38 //
39 //===----------------------------------------------------------------------===//
40
41 class COP1_SEL_FM<FIELD_FMT Format> : MipsR6Inst {
42   bits<5> ft;
43   bits<5> fs;
44   bits<5> fd;
45
46   bits<32> Inst;
47
48   let Inst{31-26} = OPGROUP_COP1.Value;
49   let Inst{25-21} = Format.Value;
50   let Inst{20-16} = ft;
51   let Inst{15-11} = fs;
52   let Inst{10-6} = fd;
53   let Inst{5-0} = 0b010000;
54 }
55
56 class SPECIAL_3R_FM<bits<5> mulop, bits<6> funct> : MipsR6Inst {
57   bits<5> rd;
58   bits<5> rs;
59   bits<5> rt;
60
61   bits<32> Inst;
62
63   let Inst{31-26} = OPGROUP_SPECIAL.Value;
64   let Inst{25-21} = rs;
65   let Inst{20-16} = rt;
66   let Inst{15-11} = rd;
67   let Inst{10-6}  = mulop;
68   let Inst{5-0}   = funct;
69 }