Add hint to nop
[oota-llvm.git] / lib / Target / MSP430 / MSP430InstrInfo.td
1 //===- MSP430InstrInfo.td - MSP430 Instruction defs -----------*- tblgen-*-===//
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 the MSP430 instructions in TableGen format.
11 //
12 //===----------------------------------------------------------------------===//
13
14 include "MSP430InstrFormats.td"
15
16 //===----------------------------------------------------------------------===//
17 // Type Constraints.
18 //===----------------------------------------------------------------------===//
19 class SDTCisI8<int OpNum> : SDTCisVT<OpNum, i8>;
20 class SDTCisI16<int OpNum> : SDTCisVT<OpNum, i16>;
21
22 //===----------------------------------------------------------------------===//
23 // Type Profiles.
24 //===----------------------------------------------------------------------===//
25
26 //===----------------------------------------------------------------------===//
27 // MSP430 Specific Node Definitions.
28 //===----------------------------------------------------------------------===//
29 def MSP430retflag : SDNode<"MSP430ISD::RET_FLAG", SDTNone,
30                      [SDNPHasChain, SDNPOptInFlag]>;
31
32 def MSP430rra     : SDNode<"MSP430ISD::RRA", SDTIntUnaryOp, []>;
33
34 //===----------------------------------------------------------------------===//
35 // Pseudo Instructions
36 //===----------------------------------------------------------------------===//
37
38 let neverHasSideEffects = 1 in
39 def NOP : Pseudo<(outs), (ins), "nop", []>;
40
41 //===----------------------------------------------------------------------===//
42 // Real Instructions
43 //===----------------------------------------------------------------------===//
44
45 // FIXME: Provide proper encoding!
46 let isReturn = 1, isTerminator = 1 in {
47   def RETI : Pseudo<(outs), (ins), "ret", [(MSP430retflag)]>;
48 }
49
50 //===----------------------------------------------------------------------===//
51 // Move Instructions
52
53 // FIXME: Provide proper encoding!
54 let neverHasSideEffects = 1 in {
55 def MOV16rr : Pseudo<(outs GR16:$dst), (ins GR16:$src),
56                      "mov.w\t{$src, $dst|$dst, $src}",
57                      []>;
58 }
59
60 // FIXME: Provide proper encoding!
61 let isReMaterializable = 1, isAsCheapAsAMove = 1 in {
62 def MOV16ri : Pseudo<(outs GR16:$dst), (ins i16imm:$src),
63                      "mov.w\t{$src, $dst|$dst, $src}",
64                      [(set GR16:$dst, imm:$src)]>;
65 }
66
67 //===----------------------------------------------------------------------===//
68 // Arithmetic Instructions
69
70 let isTwoAddress = 1 in {
71
72 let Defs = [SR] in {
73
74 let isCommutable = 1 in { // X = ADD Y, Z  == X = ADD Z, Y
75 // FIXME: Provide proper encoding!
76 def ADD16rr : Pseudo<(outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
77                      "add.w\t{$src2, $dst|$dst, $src2}",
78                      [(set GR16:$dst, (add GR16:$src1, GR16:$src2)),
79                       (implicit SR)]>;
80
81 let Uses = [SR] in {
82 def ADC16rr : Pseudo<(outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
83                      "addc.w\t{$src2, $dst|$dst, $src2}",
84                      [(set GR16:$dst, (adde GR16:$src1, GR16:$src2)),
85                       (implicit SR)]>;
86 }
87 }
88
89 let isCommutable = 1 in { // X = AND Y, Z  == X = AND Z, Y
90 def AND16rr : Pseudo<(outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
91                      "and.w\t{$src2, $dst|$dst, $src2}",
92                      [(set GR16:$dst, (and GR16:$src1, GR16:$src2)),
93                       (implicit SR)]>;
94 }
95
96 let isCommutable = 1 in { // X = AND Y, Z  == X = AND Z, Y
97 def XOR16rr : Pseudo<(outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
98                      "xor.w\t{$src2, $dst|$dst, $src2}",
99                      [(set GR16:$dst, (xor GR16:$src1, GR16:$src2)),
100                       (implicit SR)]>;
101 }
102
103
104 def SUB16rr : Pseudo<(outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
105                      "sub.w\t{$src2, $dst|$dst, $src2}",
106                      [(set GR16:$dst, (sub GR16:$src1, GR16:$src2)),
107                       (implicit SR)]>;
108
109 let Uses = [SR] in {
110 def SBC16rr : Pseudo<(outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
111                      "subc.w\t{$src2, $dst|$dst, $src2}",
112                      [(set GR16:$dst, (sube GR16:$src1, GR16:$src2)),
113                       (implicit SR)]>;
114 }
115
116 // FIXME: Provide proper encoding!
117 def SAR16r1 : Pseudo<(outs GR16:$dst), (ins GR16:$src),
118                      "rra.w\t$dst",
119                      [(set GR16:$dst, (MSP430rra GR16:$src)),
120                       (implicit SR)]>;
121 } // Defs = [SR]
122 } // isTwoAddress = 1