Add sub reg-reg pattern
[oota-llvm.git] / lib / Target / SystemZ / SystemZInstrInfo.td
1 //===- SystemZInstrInfo.td - SystemZ 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 SystemZ instructions in TableGen format.
11 //
12 //===----------------------------------------------------------------------===//
13
14 include "SystemZInstrFormats.td"
15
16 //===----------------------------------------------------------------------===//
17 // SystemZ Specific Node Definitions.
18 //===----------------------------------------------------------------------===//
19 def SystemZretflag : SDNode<"SystemZISD::RET_FLAG", SDTNone,
20                      [SDNPHasChain, SDNPOptInFlag]>;
21
22 let neverHasSideEffects = 1 in
23 def NOP : Pseudo<(outs), (ins), "# no-op", []>;
24
25 //===----------------------------------------------------------------------===//
26 //  Control Flow Instructions...
27 //
28
29 // FIXME: Provide proper encoding!
30 let isReturn = 1, isTerminator = 1 in {
31   def RET : Pseudo<(outs), (ins), "br\t%r14", [(SystemZretflag)]>;
32 }
33
34 //===----------------------------------------------------------------------===//
35 // Move Instructions
36
37 // FIXME: Provide proper encoding!
38 let neverHasSideEffects = 1 in {
39 def MOV64rr : Pseudo<(outs GR64:$dst), (ins GR64:$src),
40                      "lgr\t{$dst, $src}",
41                      []>;
42 }
43
44 // FIXME: Provide proper encoding!
45 let isReMaterializable = 1, isAsCheapAsAMove = 1 in {
46 def MOV64ri : Pseudo<(outs GR64:$dst), (ins i64imm:$src),
47                      "lghi\t{$dst, $src}",
48                      [(set GR64:$dst, imm:$src)]>;
49 }
50
51 //===----------------------------------------------------------------------===//
52 // Arithmetic Instructions
53
54 let isTwoAddress = 1 in {
55
56 let Defs = [PSW] in {
57
58 let isCommutable = 1 in { // X = ADD Y, Z  == X = ADD Z, Y
59 // FIXME: Provide proper encoding!
60 def ADD64rr : Pseudo<(outs GR64:$dst), (ins GR64:$src1, GR64:$src2),
61                      "agr\t{$dst, $src2}",
62                      [(set GR64:$dst, (add GR64:$src1, GR64:$src2)),
63                       (implicit PSW)]>;
64 }
65
66 // FIXME: Provide proper encoding!
67 def ADD64ri : Pseudo<(outs GR64:$dst), (ins GR64:$src1, i64imm:$src2),
68                      "aghi\t{$dst, $src2}",
69                      [(set GR64:$dst, (add GR64:$src1, imm:$src2)),
70                       (implicit PSW)]>;
71
72 let isCommutable = 1 in { // X = OR Y, Z  == X = OR Z, Y
73 // FIXME: Provide proper encoding!
74 def OR64rr : Pseudo<(outs GR64:$dst), (ins GR64:$src1, GR64:$src2),
75                     "ogr\t{$dst, $src2}",
76                     [(set GR64:$dst, (or GR64:$src1, GR64:$src2))]>;
77 }
78 // FIXME: provide patterns for masked or-with-imm
79
80 // FIXME: Provide proper encoding!
81 def SUB64rr : Pseudo<(outs GR64:$dst), (ins GR64:$src1, GR64:$src2),
82                      "sgr\t{$dst, $src2}",
83                      [(set GR64:$dst, (sub GR64:$src1, GR64:$src2))]>;
84
85
86 let isCommutable = 1 in { // X = XOR Y, Z  == X = XOR Z, Y
87 // FIXME: Provide proper encoding!
88 def XOR64rr : Pseudo<(outs GR64:$dst), (ins GR64:$src1, GR64:$src2),
89                      "xgr\t{$dst, $src2}",
90                      [(set GR64:$dst, (xor GR64:$src1, GR64:$src2))]>;
91 }
92
93 } // Defs = [PSW]
94 } // isTwoAddress = 1