annotate lib/Target/Hexagon/HexagonPseudo.td @ 134:3a76565eade5 LLVM5.0.1

update 5.0.1
author mir3636
date Sat, 17 Feb 2018 09:57:20 +0900
parents 803732b1fca8
children c2174574ed3a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
121
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
1 //===--- HexagonPseudo.td -------------------------------------------------===//
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
2 //
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
3 // The LLVM Compiler Infrastructure
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
4 //
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
5 // This file is distributed under the University of Illinois Open Source
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
6 // License. See LICENSE.TXT for details.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
7 //
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
8 //===----------------------------------------------------------------------===//
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
9
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
10 // The pat frags in the definitions below need to have a named register,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
11 // otherwise i32 will be assumed regardless of the register class. The
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
12 // name of the register does not matter.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
13 def I1 : PatLeaf<(i1 PredRegs:$R)>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
14 def I32 : PatLeaf<(i32 IntRegs:$R)>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
15 def I64 : PatLeaf<(i64 DoubleRegs:$R)>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
16 def F32 : PatLeaf<(f32 IntRegs:$R)>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
17 def F64 : PatLeaf<(f64 DoubleRegs:$R)>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
18
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
19 let PrintMethod = "printGlobalOperand" in {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
20 def globaladdress : Operand<i32>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
21 def globaladdressExt : Operand<i32>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
22 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
23
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
24 let isPseudo = 1 in {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
25 let isCodeGenOnly = 0 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
26 def A2_iconst : Pseudo<(outs IntRegs:$Rd32),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
27 (ins s27_2Imm:$Ii), "${Rd32}=iconst(#${Ii})">;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
28
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
29 def DUPLEX_Pseudo : InstHexagon<(outs),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
30 (ins s32_0Imm:$offset), "DUPLEX", [], "", DUPLEX, TypePSEUDO>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
31 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
32
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
33 let isExtendable = 1, opExtendable = 1, opExtentBits = 6,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
34 isAsmParserOnly = 1 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
35 def TFRI64_V2_ext : InstHexagon<(outs DoubleRegs:$dst),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
36 (ins s32_0Imm:$src1, s8_0Imm:$src2),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
37 "$dst=combine(#$src1,#$src2)", [], "",
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
38 A2_combineii.Itinerary, TypeALU32_2op>, OpcodeHexagon;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
39
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
40 // HI/LO Instructions
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
41 let isReMaterializable = 1, isMoveImm = 1, hasSideEffects = 0,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
42 hasNewValue = 1, opNewValue = 0 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
43 class REG_IMMED<string RegHalf, bit Rs, bits<3> MajOp, bit MinOp,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
44 InstHexagon rootInst>
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
45 : InstHexagon<(outs IntRegs:$dst),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
46 (ins u16_0Imm:$imm_value),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
47 "$dst"#RegHalf#"=#$imm_value", [], "",
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
48 rootInst.Itinerary, rootInst.Type>, OpcodeHexagon {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
49 bits<5> dst;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
50 bits<32> imm_value;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
51
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
52 let Inst{27} = Rs;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
53 let Inst{26-24} = MajOp;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
54 let Inst{21} = MinOp;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
55 let Inst{20-16} = dst;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
56 let Inst{23-22} = imm_value{15-14};
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
57 let Inst{13-0} = imm_value{13-0};
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
58 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
59
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
60 let isAsmParserOnly = 1 in {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
61 def LO : REG_IMMED<".l", 0b0, 0b001, 0b1, A2_tfril>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
62 def HI : REG_IMMED<".h", 0b0, 0b010, 0b1, A2_tfrih>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
63 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
64
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
65 let isReMaterializable = 1, isMoveImm = 1, isAsmParserOnly = 1 in {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
66 def CONST32 : CONSTLDInst<(outs IntRegs:$Rd), (ins i32imm:$v),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
67 "$Rd = CONST32(#$v)", []>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
68 def CONST64 : CONSTLDInst<(outs DoubleRegs:$Rd), (ins i64imm:$v),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
69 "$Rd = CONST64(#$v)", []>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
70 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
71
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
72 let hasSideEffects = 0, isReMaterializable = 1, isPseudo = 1,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
73 isCodeGenOnly = 1 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
74 def PS_true : InstHexagon<(outs PredRegs:$dst), (ins), "",
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
75 [(set I1:$dst, 1)], "", C2_orn.Itinerary, TypeCR>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
76
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
77 let hasSideEffects = 0, isReMaterializable = 1, isPseudo = 1,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
78 isCodeGenOnly = 1 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
79 def PS_false : InstHexagon<(outs PredRegs:$dst), (ins), "",
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
80 [(set I1:$dst, 0)], "", C2_andn.Itinerary, TypeCR>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
81
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
82 let Defs = [R29, R30], Uses = [R31, R30, R29], isPseudo = 1 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
83 def ADJCALLSTACKDOWN : Pseudo<(outs), (ins i32imm:$amt1, i32imm:$amt2),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
84 ".error \"should not emit\" ", []>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
85
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
86 let Defs = [R29, R30, R31], Uses = [R29], isPseudo = 1 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
87 def ADJCALLSTACKUP : Pseudo<(outs), (ins i32imm:$amt1, i32imm:$amt2),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
88 ".error \"should not emit\" ", []>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
89
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
90
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
91 let isBranch = 1, isTerminator = 1, hasSideEffects = 0,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
92 Defs = [PC, LC0], Uses = [SA0, LC0] in {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
93 def ENDLOOP0 : Endloop<(outs), (ins b30_2Imm:$offset),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
94 ":endloop0",
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
95 []>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
96 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
97
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
98 let isBranch = 1, isTerminator = 1, hasSideEffects = 0,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
99 Defs = [PC, LC1], Uses = [SA1, LC1] in {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
100 def ENDLOOP1 : Endloop<(outs), (ins b30_2Imm:$offset),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
101 ":endloop1",
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
102 []>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
103 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
104
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
105 let isExtendable = 1, isExtentSigned = 1, opExtentBits = 9, opExtentAlign = 2,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
106 opExtendable = 0, hasSideEffects = 0 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
107 class LOOP_iBase<string mnemonic, InstHexagon rootInst>
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
108 : InstHexagon <(outs), (ins b30_2Imm:$offset, u10_0Imm:$src2),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
109 #mnemonic#"($offset,#$src2)",
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
110 [], "", rootInst.Itinerary, rootInst.Type>, OpcodeHexagon {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
111 bits<9> offset;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
112 bits<10> src2;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
113
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
114 let IClass = 0b0110;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
115
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
116 let Inst{27-22} = 0b100100;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
117 let Inst{21} = !if (!eq(mnemonic, "loop0"), 0b0, 0b1);
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
118 let Inst{20-16} = src2{9-5};
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
119 let Inst{12-8} = offset{8-4};
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
120 let Inst{7-5} = src2{4-2};
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
121 let Inst{4-3} = offset{3-2};
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
122 let Inst{1-0} = src2{1-0};
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
123 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
124
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
125 let isExtendable = 1, isExtentSigned = 1, opExtentBits = 9, opExtentAlign = 2,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
126 opExtendable = 0, hasSideEffects = 0 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
127 class LOOP_rBase<string mnemonic, InstHexagon rootInst>
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
128 : InstHexagon<(outs), (ins b30_2Imm:$offset, IntRegs:$src2),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
129 #mnemonic#"($offset,$src2)",
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
130 [], "", rootInst.Itinerary, rootInst.Type>, OpcodeHexagon {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
131 bits<9> offset;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
132 bits<5> src2;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
133
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
134 let IClass = 0b0110;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
135
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
136 let Inst{27-22} = 0b000000;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
137 let Inst{21} = !if (!eq(mnemonic, "loop0"), 0b0, 0b1);
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
138 let Inst{20-16} = src2;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
139 let Inst{12-8} = offset{8-4};
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
140 let Inst{4-3} = offset{3-2};
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
141 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
142
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
143 let Defs = [SA0, LC0, USR], isCodeGenOnly = 1, isExtended = 1,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
144 opExtendable = 0 in {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
145 def J2_loop0iext : LOOP_iBase<"loop0", J2_loop0i>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
146 def J2_loop1iext : LOOP_iBase<"loop1", J2_loop1i>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
147 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
148
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
149 // Interestingly only loop0's appear to set usr.lpcfg
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
150 let Defs = [SA1, LC1], isCodeGenOnly = 1, isExtended = 1, opExtendable = 0 in {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
151 def J2_loop0rext : LOOP_rBase<"loop0", J2_loop0r>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
152 def J2_loop1rext : LOOP_rBase<"loop1", J2_loop1r>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
153 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
154
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
155 let isCall = 1, hasSideEffects = 1, isPredicable = 0,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
156 isExtended = 0, isExtendable = 1, opExtendable = 0,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
157 isExtentSigned = 1, opExtentBits = 24, opExtentAlign = 2 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
158 class T_Call<string ExtStr>
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
159 : InstHexagon<(outs), (ins a30_2Imm:$dst),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
160 "call " # ExtStr # "$dst", [], "", J2_call.Itinerary, TypeJ>,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
161 OpcodeHexagon {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
162 let BaseOpcode = "call";
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
163 bits<24> dst;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
164
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
165 let IClass = 0b0101;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
166 let Inst{27-25} = 0b101;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
167 let Inst{24-16,13-1} = dst{23-2};
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
168 let Inst{0} = 0b0;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
169 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
170
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
171 let isCodeGenOnly = 1, isCall = 1, hasSideEffects = 1, Defs = [R16],
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
172 isPredicable = 0 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
173 def CALLProfile : T_Call<"">;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
174
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
175 let isCodeGenOnly = 1, isCall = 1, hasSideEffects = 1,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
176 Defs = [PC, R31, R6, R7, P0] in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
177 def PS_call_stk : T_Call<"">;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
178
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
179 // Call, no return.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
180 let isCall = 1, hasSideEffects = 1, cofMax1 = 1, isCodeGenOnly = 1 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
181 def PS_callr_nr: InstHexagon<(outs), (ins IntRegs:$Rs),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
182 "callr $Rs", [], "", J2_callr.Itinerary, TypeJ>, OpcodeHexagon {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
183 bits<5> Rs;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
184 bits<2> Pu;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
185 let isPredicatedFalse = 1;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
186
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
187 let IClass = 0b0101;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
188 let Inst{27-21} = 0b0000101;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
189 let Inst{20-16} = Rs;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
190 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
191
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
192 let isCall = 1, hasSideEffects = 1,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
193 isExtended = 0, isExtendable = 1, opExtendable = 0, isCodeGenOnly = 1,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
194 BaseOpcode = "PS_call_nr", isExtentSigned = 1, opExtentAlign = 2 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
195 class Call_nr<bits<5> nbits, bit isPred, bit isFalse, dag iops,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
196 InstrItinClass itin>
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
197 : Pseudo<(outs), iops, "">, PredRel {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
198 bits<2> Pu;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
199 bits<17> dst;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
200 let opExtentBits = nbits;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
201 let isPredicable = 0; // !if(isPred, 0, 1);
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
202 let isPredicated = 0; // isPred;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
203 let isPredicatedFalse = isFalse;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
204 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
205
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
206 def PS_call_nr : Call_nr<24, 0, 0, (ins s32_0Imm:$Ii), J2_call.Itinerary>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
207 //def PS_call_nrt: Call_nr<17, 1, 0, (ins PredRegs:$Pu, s32_0Imm:$dst),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
208 // J2_callt.Itinerary>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
209 //def PS_call_nrf: Call_nr<17, 1, 1, (ins PredRegs:$Pu, s32_0Imm:$dst),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
210 // J2_callf.Itinerary>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
211
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
212 let isBranch = 1, isIndirectBranch = 1, isBarrier = 1, Defs = [PC],
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
213 isPredicable = 1, hasSideEffects = 0, InputType = "reg",
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
214 cofMax1 = 1 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
215 class T_JMPr <InstHexagon rootInst>
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
216 : InstHexagon<(outs), (ins IntRegs:$dst), "jumpr $dst", [],
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
217 "", rootInst.Itinerary, rootInst.Type>, OpcodeHexagon {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
218 bits<5> dst;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
219
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
220 let IClass = 0b0101;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
221 let Inst{27-21} = 0b0010100;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
222 let Inst{20-16} = dst;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
223 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
224
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
225 // A return through builtin_eh_return.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
226 let isReturn = 1, isTerminator = 1, isBarrier = 1, hasSideEffects = 0,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
227 isCodeGenOnly = 1, Defs = [PC], Uses = [R28], isPredicable = 0 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
228 def EH_RETURN_JMPR : T_JMPr<J2_jumpr>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
229
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
230 // Indirect tail-call.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
231 let isPseudo = 1, isCall = 1, isReturn = 1, isBarrier = 1, isPredicable = 0,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
232 isTerminator = 1, isCodeGenOnly = 1 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
233 def PS_tailcall_r : T_JMPr<J2_jumpr>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
234
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
235 //
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
236 // Direct tail-calls.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
237 let isPseudo = 1, isCall = 1, isReturn = 1, isBarrier = 1, isPredicable = 0,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
238 isTerminator = 1, isCodeGenOnly = 1 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
239 def PS_tailcall_i : Pseudo<(outs), (ins a30_2Imm:$dst), "", []>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
240
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
241 let isCodeGenOnly = 1, isPseudo = 1, Uses = [R30], hasSideEffects = 0 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
242 def PS_aligna : Pseudo<(outs IntRegs:$Rd), (ins u32_0Imm:$A), "", []>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
243
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
244 // Generate frameindex addresses. The main reason for the offset operand is
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
245 // that every instruction that is allowed to have frame index as an operand
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
246 // will then have that operand followed by an immediate operand (the offset).
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
247 // This simplifies the frame-index elimination code.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
248 //
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
249 let isMoveImm = 1, isAsCheapAsAMove = 1, isReMaterializable = 1,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
250 isPseudo = 1, isCodeGenOnly = 1, hasSideEffects = 0, isExtendable = 1,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
251 isExtentSigned = 1, opExtentBits = 16, opExtentAlign = 0 in {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
252 let opExtendable = 2 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
253 def PS_fi : Pseudo<(outs IntRegs:$Rd),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
254 (ins IntRegs:$fi, s32_0Imm:$off), "">;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
255 let opExtendable = 3 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
256 def PS_fia : Pseudo<(outs IntRegs:$Rd),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
257 (ins IntRegs:$Rs, IntRegs:$fi, s32_0Imm:$off), "">;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
258 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
259
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
260 class CondStr<string CReg, bit True, bit New> {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
261 string S = "if (" # !if(True,"","!") # CReg # !if(New,".new","") # ") ";
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
262 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
263 class JumpOpcStr<string Mnemonic, bit New, bit Taken> {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
264 string S = Mnemonic # !if(Taken, ":t", ":nt");
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
265 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
266 let isBranch = 1, isIndirectBranch = 1, Defs = [PC], isPredicated = 1,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
267 hasSideEffects = 0, InputType = "reg", cofMax1 = 1 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
268 class T_JMPr_c <bit PredNot, bit isPredNew, bit isTak, InstHexagon rootInst>
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
269 : InstHexagon<(outs), (ins PredRegs:$src, IntRegs:$dst),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
270 CondStr<"$src", !if(PredNot,0,1), isPredNew>.S #
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
271 JumpOpcStr<"jumpr", isPredNew, isTak>.S # " $dst",
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
272 [], "", rootInst.Itinerary, rootInst.Type>, OpcodeHexagon {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
273
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
274 let isTaken = isTak;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
275 let isPredicatedFalse = PredNot;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
276 let isPredicatedNew = isPredNew;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
277 bits<2> src;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
278 bits<5> dst;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
279
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
280 let IClass = 0b0101;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
281
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
282 let Inst{27-22} = 0b001101;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
283 let Inst{21} = PredNot;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
284 let Inst{20-16} = dst;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
285 let Inst{12} = isTak;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
286 let Inst{11} = isPredNew;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
287 let Inst{9-8} = src;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
288 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
289
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
290 let isTerminator = 1, hasSideEffects = 0, isReturn = 1, isCodeGenOnly = 1,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
291 isBarrier = 1, BaseOpcode = "JMPret" in {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
292 def PS_jmpret : T_JMPr<J2_jumpr>, PredNewRel;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
293 def PS_jmprett : T_JMPr_c<0, 0, 0, J2_jumprt>, PredNewRel;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
294 def PS_jmpretf : T_JMPr_c<1, 0, 0, J2_jumprf>, PredNewRel;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
295 def PS_jmprettnew : T_JMPr_c<0, 1, 0, J2_jumprtnew>, PredNewRel;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
296 def PS_jmpretfnew : T_JMPr_c<1, 1, 0, J2_jumprfnew>, PredNewRel;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
297 def PS_jmprettnewpt : T_JMPr_c<0, 1, 1, J2_jumprtnewpt>, PredNewRel;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
298 def PS_jmpretfnewpt : T_JMPr_c<1, 1, 1, J2_jumprfnewpt>, PredNewRel;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
299 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
300
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
301 //defm V6_vtran2x2_map : HexagonMapping<(outs HvxVR:$Vy32, HvxVR:$Vx32), (ins HvxVR:$Vx32in, IntRegs:$Rt32), "vtrans2x2(${Vy32},${Vx32},${Rt32})", (V6_vshuff HvxVR:$Vy32, HvxVR:$Vx32, HvxVR:$Vx32in, IntRegs:$Rt32)>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
302
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
303 // The reason for the custom inserter is to record all ALLOCA instructions
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
304 // in MachineFunctionInfo.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
305 let Defs = [R29], hasSideEffects = 1 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
306 def PS_alloca: Pseudo <(outs IntRegs:$Rd),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
307 (ins IntRegs:$Rs, u32_0Imm:$A), "", []>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
308
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
309 // Load predicate.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
310 let isExtendable = 1, opExtendable = 2, isExtentSigned = 1, opExtentBits = 13,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
311 isCodeGenOnly = 1, isPseudo = 1, hasSideEffects = 0 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
312 def LDriw_pred : LDInst<(outs PredRegs:$dst),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
313 (ins IntRegs:$addr, s32_0Imm:$off),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
314 ".error \"should not emit\"", []>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
315
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
316 // Load modifier.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
317 let isExtendable = 1, opExtendable = 2, isExtentSigned = 1, opExtentBits = 13,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
318 isCodeGenOnly = 1, isPseudo = 1, hasSideEffects = 0 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
319 def LDriw_mod : LDInst<(outs ModRegs:$dst),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
320 (ins IntRegs:$addr, s32_0Imm:$off),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
321 ".error \"should not emit\"", []>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
322
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
323
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
324 let isCodeGenOnly = 1, isPseudo = 1 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
325 def PS_pselect: InstHexagon<(outs DoubleRegs:$Rd),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
326 (ins PredRegs:$Pu, DoubleRegs:$Rs, DoubleRegs:$Rt),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
327 ".error \"should not emit\" ", [], "", A2_tfrpt.Itinerary, TypeALU32_2op>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
328
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
329 let isBranch = 1, isBarrier = 1, Defs = [PC], hasSideEffects = 0,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
330 isPredicable = 1,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
331 isExtendable = 1, opExtendable = 0, isExtentSigned = 1,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
332 opExtentBits = 24, opExtentAlign = 2, InputType = "imm" in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
333 class T_JMP: InstHexagon<(outs), (ins b30_2Imm:$dst),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
334 "jump $dst",
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
335 [], "", J2_jump.Itinerary, TypeJ>, OpcodeHexagon {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
336 bits<24> dst;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
337 let IClass = 0b0101;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
338
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
339 let Inst{27-25} = 0b100;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
340 let Inst{24-16} = dst{23-15};
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
341 let Inst{13-1} = dst{14-2};
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
342 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
343
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
344 // Restore registers and dealloc return function call.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
345 let isCall = 1, isBarrier = 1, isReturn = 1, isTerminator = 1,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
346 Defs = [R29, R30, R31, PC], isPredicable = 0, isAsmParserOnly = 1 in {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
347 def RESTORE_DEALLOC_RET_JMP_V4 : T_JMP;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
348
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
349 let isExtended = 1, opExtendable = 0 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
350 def RESTORE_DEALLOC_RET_JMP_V4_EXT : T_JMP;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
351
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
352 let Defs = [R14, R15, R28, R29, R30, R31, PC] in {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
353 def RESTORE_DEALLOC_RET_JMP_V4_PIC : T_JMP;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
354
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
355 let isExtended = 1, opExtendable = 0 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
356 def RESTORE_DEALLOC_RET_JMP_V4_EXT_PIC : T_JMP;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
357 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
358 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
359
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
360 // Restore registers and dealloc frame before a tail call.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
361 let isCall = 1, Defs = [R29, R30, R31, PC], isAsmParserOnly = 1 in {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
362 def RESTORE_DEALLOC_BEFORE_TAILCALL_V4 : T_Call<"">, PredRel;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
363
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
364 let isExtended = 1, opExtendable = 0 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
365 def RESTORE_DEALLOC_BEFORE_TAILCALL_V4_EXT : T_Call<"">, PredRel;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
366
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
367 let Defs = [R14, R15, R28, R29, R30, R31, PC] in {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
368 def RESTORE_DEALLOC_BEFORE_TAILCALL_V4_PIC : T_Call<"">, PredRel;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
369
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
370 let isExtended = 1, opExtendable = 0 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
371 def RESTORE_DEALLOC_BEFORE_TAILCALL_V4_EXT_PIC : T_Call<"">, PredRel;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
372 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
373 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
374
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
375 // Save registers function call.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
376 let isCall = 1, Uses = [R29, R31], isAsmParserOnly = 1 in {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
377 def SAVE_REGISTERS_CALL_V4 : T_Call<"">, PredRel;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
378
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
379 let isExtended = 1, opExtendable = 0 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
380 def SAVE_REGISTERS_CALL_V4_EXT : T_Call<"">, PredRel;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
381
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
382 let Defs = [P0] in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
383 def SAVE_REGISTERS_CALL_V4STK : T_Call<"">, PredRel;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
384
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
385 let Defs = [P0], isExtended = 1, opExtendable = 0 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
386 def SAVE_REGISTERS_CALL_V4STK_EXT : T_Call<"">, PredRel;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
387
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
388 let Defs = [R14, R15, R28] in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
389 def SAVE_REGISTERS_CALL_V4_PIC : T_Call<"">, PredRel;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
390
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
391 let Defs = [R14, R15, R28], isExtended = 1, opExtendable = 0 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
392 def SAVE_REGISTERS_CALL_V4_EXT_PIC : T_Call<"">, PredRel;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
393
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
394 let Defs = [R14, R15, R28, P0] in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
395 def SAVE_REGISTERS_CALL_V4STK_PIC : T_Call<"">, PredRel;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
396
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
397 let Defs = [R14, R15, R28, P0], isExtended = 1, opExtendable = 0 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
398 def SAVE_REGISTERS_CALL_V4STK_EXT_PIC : T_Call<"">, PredRel;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
399 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
400
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
401 // Vector store pseudos
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
402 let Predicates = [HasV60T, UseHVX], isPseudo = 1, isCodeGenOnly = 1,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
403 mayStore = 1, accessSize = HVXVectorAccess, hasSideEffects = 0 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
404 class STrivv_template<RegisterClass RC, InstHexagon rootInst>
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
405 : InstHexagon<(outs), (ins IntRegs:$addr, s32_0Imm:$off, RC:$src),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
406 "", [], "", rootInst.Itinerary, rootInst.Type>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
407
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
408 def PS_vstorerw_ai: STrivv_template<HvxWR, V6_vS32b_ai>,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
409 Requires<[HasV60T,UseHVX]>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
410 def PS_vstorerw_nt_ai: STrivv_template<HvxWR, V6_vS32b_nt_ai>,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
411 Requires<[HasV60T,UseHVX]>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
412 def PS_vstorerwu_ai: STrivv_template<HvxWR, V6_vS32Ub_ai>,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
413 Requires<[HasV60T,UseHVX]>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
414
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
415 let isPseudo = 1, isCodeGenOnly = 1, mayStore = 1, hasSideEffects = 0 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
416 def PS_vstorerq_ai: Pseudo<(outs),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
417 (ins IntRegs:$Rs, s32_0Imm:$Off, HvxQR:$Qt), "", []>,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
418 Requires<[HasV60T,UseHVX]>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
419
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
420 // Vector load pseudos
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
421 let Predicates = [HasV60T, UseHVX], isPseudo = 1, isCodeGenOnly = 1,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
422 mayLoad = 1, accessSize = HVXVectorAccess, hasSideEffects = 0 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
423 class LDrivv_template<RegisterClass RC, InstHexagon rootInst>
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
424 : InstHexagon<(outs RC:$dst), (ins IntRegs:$addr, s32_0Imm:$off),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
425 "", [], "", rootInst.Itinerary, rootInst.Type>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
426
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
427 def PS_vloadrw_ai: LDrivv_template<HvxWR, V6_vL32b_ai>,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
428 Requires<[HasV60T,UseHVX]>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
429 def PS_vloadrw_nt_ai: LDrivv_template<HvxWR, V6_vL32b_nt_ai>,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
430 Requires<[HasV60T,UseHVX]>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
431 def PS_vloadrwu_ai: LDrivv_template<HvxWR, V6_vL32Ub_ai>,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
432 Requires<[HasV60T,UseHVX]>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
433
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
434 let isPseudo = 1, isCodeGenOnly = 1, mayLoad = 1, hasSideEffects = 0 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
435 def PS_vloadrq_ai: Pseudo<(outs HvxQR:$Qd),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
436 (ins IntRegs:$Rs, s32_0Imm:$Off), "", []>,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
437 Requires<[HasV60T,UseHVX]>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
438
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
439
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
440 let isCodeGenOnly = 1, isPseudo = 1, hasSideEffects = 0 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
441 class VSELInst<dag outs, dag ins, InstHexagon rootInst>
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
442 : InstHexagon<outs, ins, "", [], "", rootInst.Itinerary, rootInst.Type>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
443
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
444 def PS_vselect: VSELInst<(outs HvxVR:$dst),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
445 (ins PredRegs:$src1, HvxVR:$src2, HvxVR:$src3), V6_vcmov>,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
446 Requires<[HasV60T,UseHVX]>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
447 def PS_wselect: VSELInst<(outs HvxWR:$dst),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
448 (ins PredRegs:$src1, HvxWR:$src2, HvxWR:$src3), V6_vccombine>,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
449 Requires<[HasV60T,UseHVX]>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
450
134
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
451 let hasSideEffects = 0, isReMaterializable = 1, isPseudo = 1,
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
452 isCodeGenOnly = 1 in {
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
453 def PS_qtrue: InstHexagon<(outs HvxQR:$Qd), (ins), "", [], "",
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
454 V6_veqw.Itinerary, TypeCVI_VA>;
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
455 def PS_qfalse: InstHexagon<(outs HvxQR:$Qd), (ins), "", [], "",
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
456 V6_vgtw.Itinerary, TypeCVI_VA>;
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
457 }
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
458
121
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
459 // Store predicate.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
460 let isExtendable = 1, opExtendable = 1, isExtentSigned = 1, opExtentBits = 13,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
461 isCodeGenOnly = 1, isPseudo = 1, hasSideEffects = 0 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
462 def STriw_pred : STInst<(outs),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
463 (ins IntRegs:$addr, s32_0Imm:$off, PredRegs:$src1),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
464 ".error \"should not emit\"", []>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
465 // Store modifier.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
466 let isExtendable = 1, opExtendable = 1, isExtentSigned = 1, opExtentBits = 13,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
467 isCodeGenOnly = 1, isPseudo = 1, hasSideEffects = 0 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
468 def STriw_mod : STInst<(outs),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
469 (ins IntRegs:$addr, s32_0Imm:$off, ModRegs:$src1),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
470 ".error \"should not emit\"", []>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
471
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
472 let isExtendable = 1, opExtendable = 1, opExtentBits = 6,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
473 isAsmParserOnly = 1 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
474 def TFRI64_V4 : InstHexagon<(outs DoubleRegs:$dst),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
475 (ins u64_0Imm:$src1),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
476 "$dst = #$src1", [], "",
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
477 A2_combineii.Itinerary, TypeALU32_2op>, OpcodeHexagon;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
478
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
479 // Hexagon doesn't have a vector multiply with C semantics.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
480 // Instead, generate a pseudo instruction that gets expaneded into two
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
481 // scalar MPYI instructions.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
482 // This is expanded by ExpandPostRAPseudos.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
483 let isPseudo = 1 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
484 def PS_vmulw : PseudoM<(outs DoubleRegs:$Rd),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
485 (ins DoubleRegs:$Rs, DoubleRegs:$Rt), "", []>;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
486
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
487 let isPseudo = 1 in
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
488 def PS_vmulw_acc : PseudoM<(outs DoubleRegs:$Rd),
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
489 (ins DoubleRegs:$Rx, DoubleRegs:$Rs, DoubleRegs:$Rt), "", [],
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
490 "$Rd = $Rx">;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
491
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
492 def DuplexIClass0: InstDuplex < 0 >;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
493 def DuplexIClass1: InstDuplex < 1 >;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
494 def DuplexIClass2: InstDuplex < 2 >;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
495 let isExtendable = 1 in {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
496 def DuplexIClass3: InstDuplex < 3 >;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
497 def DuplexIClass4: InstDuplex < 4 >;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
498 def DuplexIClass5: InstDuplex < 5 >;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
499 def DuplexIClass6: InstDuplex < 6 >;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
500 def DuplexIClass7: InstDuplex < 7 >;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
501 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
502 def DuplexIClass8: InstDuplex < 8 >;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
503 def DuplexIClass9: InstDuplex < 9 >;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
504 def DuplexIClassA: InstDuplex < 0xA >;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
505 def DuplexIClassB: InstDuplex < 0xB >;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
506 def DuplexIClassC: InstDuplex < 0xC >;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
507 def DuplexIClassD: InstDuplex < 0xD >;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
508 def DuplexIClassE: InstDuplex < 0xE >;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
509 def DuplexIClassF: InstDuplex < 0xF >;