1 //===- ZPUInstrInfo.td - ZPU Register defs ---------------*- 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 //===----------------------------------------------------------------------===//
11 // Instruction format superclass
12 //===----------------------------------------------------------------------===//
14 include "ZPUInstrFormats.td"
16 def brtarget : Operand<OtherVT> {
17 let PrintMethod = "printOperand";
21 def memdst : Operand<i32> {
22 let PrintMethod = "printOperand";
23 let MIOperandInfo = (ops i32imm);
27 def memaddr : Operand<i32> {
28 let PrintMethod = "printOperand";
29 let MIOperandInfo = (ops i32imm);
33 def addr : ComplexPattern<i32, 2, "SelectAddr", [], []>;
36 def mem : Operand<i32> {
37 let PrintMethod = "printMemOperand";
38 let MIOperandInfo = (ops i32imm, CPURegs);
41 let isReMaterializable = 1, isAsCheapAsAMove = 1 in {
42 def ZPUIM : ZPUIm <(outs CPURegs:$dst), (ins i32imm:$a),
44 [(set CPURegs:$dst, imm:$a)]>;
46 def ADD : ZPUIm <(outs CPURegs:$dst), (ins CPURegs:$a, CPURegs:$b),
48 [(set CPURegs:$dst, (add CPURegs:$a, CPURegs:$b))]>;
50 // First operands, in the DAG the addressing modes
51 def ZPUSTORE : ZPUIm <(outs), (ins memdst:$dst, i32imm:$a),
53 [(store imm:$a, tglobaladdr:$dst)]>;
55 // First operands, in the DAG the addressing modes
56 def ZPUSTOREREG : ZPUIm <(outs), (ins memdst:$dst, CPURegs:$a),
58 [(store CPURegs:$a, tglobaladdr:$dst)]>;
62 def ZPULOAD : ZPUIm <(outs CPURegs:$dst), (ins CPURegs:$src),
64 [(set CPURegs:$dst, (load CPURegs:$src))]>;
66 def ZPUSTORSTACKSLOT : ZPUIm <(outs), (ins mem:$dst, CPURegs:$a),
67 "storestackslot $a $dst",
68 [(store CPURegs:$a, addr:$dst)]>;
70 def ZPULOADSTACKSLOT : ZPUIm <(outs CPURegs:$dst), (ins mem:$src),
71 "loadstackslot $src $dst",
72 [(set CPURegs:$dst, (load addr:$src))]>;
74 def ADDSP : ZPUIm <(outs), (ins mem:$dst, mem:$a, mem:$b),
76 [(store (add addr:$a, addr:$b), addr:$dst)]>;
78 def ZPUPSEUDOSTORESP : ZPUIm <(outs), (ins i32imm:$dst),
81 def ZPUPSEUDOLOADSP : ZPUIm <(outs), (ins i32imm:$src),
85 let isBranch=1, isTerminator=1, isBarrier = 1 in
87 def ZPUBRANCH : ZPUIm<(outs),(ins brtarget:$dst),"br $dst",[(br bb:$dst)]>;
89 def ZPUNEQBRANCH : ZPUIm<(outs), (ins CPURegs:$src, brtarget:$dst),"neqbranch $src $dst",[(brcond (setne CPURegs:$src, 0), bb:$dst)]>;
90 def ZPUEQBRANCH : ZPUIm<(outs), (ins CPURegs:$src, brtarget:$dst),"eqbranch $src $dst", [(brcond (seteq CPURegs:$src, 0), bb:$dst)]>;
94 def SETLT2 : ZPUIm <(outs CPURegs:$a), (ins CPURegs:$b, CPURegs:$c),
96 [(set CPURegs:$a, (setlt CPURegs:$b, CPURegs:$c))]>;
99 def SETGE2 : ZPUIm <(outs CPURegs:$a), (ins CPURegs:$b, CPURegs:$c),
101 [(set CPURegs:$a, (setge CPURegs:$b, CPURegs:$c))]>;
103 def : Pat<(brcond (setlt CPURegs:$lhs, CPURegs:$rhs), bb:$dst),
104 (ZPUNEQBRANCH (SETLT2 CPURegs:$lhs, CPURegs:$rhs), bb:$dst)>;
106 def : Pat<(brcond (setge CPURegs:$lhs, CPURegs:$rhs), bb:$dst),
107 (ZPUNEQBRANCH (SETGE2 CPURegs:$lhs, CPURegs:$rhs), bb:$dst)>;
109 def SDT_ZPUCMP : SDTypeProfile<1, 2, []>;
111 def ZPULESSTHAN : SDNode<"ZPUISD::LESSTHAN" , SDT_ZPUCMP, []>;
112 def ZPULESSTHANEQ : SDNode<"ZPUISD::LESSTHANEQ", SDT_ZPUCMP, []>;
113 def ZPUULESSTHAN : SDNode<"ZPUISD::ULESSTHAN" , SDT_ZPUCMP, []>;
114 def ZPUULESSTHANEQ : SDNode<"ZPUISD::ULESSTHANEQ", SDT_ZPUCMP, []>;
115 def ZPUEQ : SDNode<"ZPUISD::EQ", SDT_ZPUCMP, []>;
116 def ZPUNEQ : SDNode<"ZPUISD::NEQ", SDT_ZPUCMP, []>;
118 def LESSTHAN : ZPUIm<(outs CPURegs:$dst), (ins CPURegs:$src1, CPURegs:$src2),"lessthan ;$dst=$src1<$src2",
119 [(set CPURegs:$dst, (ZPULESSTHAN CPURegs:$src1,CPURegs:$src2))]>;