1 //===- HexagonIntrinsicsV4.td - V4 Instruction intrinsics --*- 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 //===----------------------------------------------------------------------===//
9 // This is populated based on the following specs:
10 // Hexagon V4 Architecture Extensions
11 // Application-Level Specification
20 class si_ALU32_sisi_not<string opc, Intrinsic IntID>
21 : ALU32_rr<(outs IntRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2),
22 !strconcat("$dst = ", !strconcat(opc , "($src1, ~$src2)")),
23 [(set IntRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2))]>;
25 class di_ALU32_s8si<string opc, Intrinsic IntID>
26 : ALU32_rr<(outs DoubleRegs:$dst), (ins s8Imm:$src1, IntRegs:$src2),
27 !strconcat("$dst = ", !strconcat(opc , "(#$src1, $src2)")),
28 [(set DoubleRegs:$dst, (IntID imm:$src1, IntRegs:$src2))]>;
30 class di_ALU32_sis8<string opc, Intrinsic IntID>
31 : ALU32_rr<(outs DoubleRegs:$dst), (ins IntRegs:$src1, s8Imm:$src2),
32 !strconcat("$dst = ", !strconcat(opc , "($src1, #$src2)")),
33 [(set DoubleRegs:$dst, (IntID IntRegs:$src1, imm:$src2))]>;
35 class qi_neg_ALU32_sisi<string opc, Intrinsic IntID>
36 : ALU32_rr<(outs PredRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2),
37 !strconcat("$dst = !", !strconcat(opc , "($src1, $src2)")),
38 [(set PredRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2))]>;
40 class qi_neg_ALU32_sis10<string opc, Intrinsic IntID>
41 : ALU32_rr<(outs PredRegs:$dst), (ins IntRegs:$src1, s10Imm:$src2),
42 !strconcat("$dst = !", !strconcat(opc , "($src1, #$src2)")),
43 [(set PredRegs:$dst, (IntID IntRegs:$src1, imm:$src2))]>;
45 class qi_neg_ALU32_siu9<string opc, Intrinsic IntID>
46 : ALU32_rr<(outs PredRegs:$dst), (ins IntRegs:$src1, u9Imm:$src2),
47 !strconcat("$dst = !", !strconcat(opc , "($src1, #$src2)")),
48 [(set PredRegs:$dst, (IntID IntRegs:$src1, imm:$src2))]>;
50 class si_neg_ALU32_sisi<string opc, Intrinsic IntID>
51 : ALU32_rr<(outs IntRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2),
52 !strconcat("$dst = !", !strconcat(opc , "($src1, $src2)")),
53 [(set IntRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2))]>;
55 class si_neg_ALU32_sis8<string opc, Intrinsic IntID>
56 : ALU32_rr<(outs IntRegs:$dst), (ins IntRegs:$src1, s8Imm:$src2),
57 !strconcat("$dst = !", !strconcat(opc , "($src1, #$src2)")),
58 [(set IntRegs:$dst, (IntID IntRegs:$src1, imm:$src2))]>;
60 class si_ALU32_sis8<string opc, Intrinsic IntID>
61 : ALU32_rr<(outs IntRegs:$dst), (ins IntRegs:$src1, s8Imm:$src2),
62 !strconcat("$dst = ", !strconcat(opc , "($src1, #$src2)")),
63 [(set IntRegs:$dst, (IntID IntRegs:$src1, imm:$src2))]>;
69 class qi_neg_SInst_qiqi<string opc, Intrinsic IntID>
70 : SInst<(outs PredRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2),
71 !strconcat("$dst = !", !strconcat(opc , "($src1, $src2)")),
72 [(set PredRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2))]>;
74 class qi_SInst_qi_andqiqi_neg<string opc, Intrinsic IntID>
75 : SInst<(outs PredRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2,
77 !strconcat("$dst = ", !strconcat(opc ,
78 "($src1, and($src2, !$src3)")),
79 [(set PredRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2,
82 class qi_SInst_qi_andqiqi<string opc, Intrinsic IntID>
83 : SInst<(outs PredRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2,
85 !strconcat("$dst = ", !strconcat(opc ,
86 "($src1, and($src2, $src3)")),
87 [(set PredRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2,
90 class qi_SInst_qi_orqiqi_neg<string opc, Intrinsic IntID>
91 : SInst<(outs PredRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2,
93 !strconcat("$dst = ", !strconcat(opc ,
94 "($src1, or($src2, !$src3)")),
95 [(set PredRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2,
98 class qi_SInst_qi_orqiqi<string opc, Intrinsic IntID>
99 : SInst<(outs PredRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2,
101 !strconcat("$dst = ", !strconcat(opc ,
102 "($src1, or($src2, $src3)")),
103 [(set PredRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2,
106 class si_SInst_si_addsis6<string opc, Intrinsic IntID>
107 : SInst<(outs IntRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2, s6Imm:$src3),
108 !strconcat("$dst = ", !strconcat(opc ,
109 "($src1, add($src2, #$src3)")),
110 [(set IntRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2,
113 class si_SInst_si_subs6si<string opc, Intrinsic IntID>
114 : SInst<(outs IntRegs:$dst), (ins IntRegs:$src1, s6Imm:$src2, IntRegs:$src3),
115 !strconcat("$dst = ", !strconcat(opc ,
116 "($src1, sub(#$src2, $src3)")),
117 [(set IntRegs:$dst, (IntID IntRegs:$src1, imm:$src2,
120 class di_ALU64_didi_neg<string opc, Intrinsic IntID>
121 : ALU64_rr<(outs DoubleRegs:$dst), (ins DoubleRegs:$src1, DoubleRegs:$src2),
122 !strconcat("$dst = ", !strconcat(opc , "($src1, ~$src2)")),
123 [(set DoubleRegs:$dst, (IntID DoubleRegs:$src1, DoubleRegs:$src2))]>;
125 class di_MInst_dididi_xacc<string opc, Intrinsic IntID>
126 : MInst_acc<(outs DoubleRegs:$dst), (ins DoubleRegs:$dst2, DoubleRegs:$src1,
128 !strconcat("$dst ^= ", !strconcat(opc , "($src1, $src2)")),
129 [(set DoubleRegs:$dst, (IntID DoubleRegs:$dst2, DoubleRegs:$src1,
133 class si_MInst_sisisi_and<string opc, Intrinsic IntID>
134 : MInst<(outs IntRegs:$dst), (ins IntRegs:$dst1, IntRegs:$src2,
136 !strconcat("$dst &= ", !strconcat(opc , "($src2, $src3)")),
137 [(set IntRegs:$dst, (IntID IntRegs:$dst1, IntRegs:$src2,
140 class si_MInst_sisisi_andn<string opc, Intrinsic IntID>
141 : MInst<(outs IntRegs:$dst), (ins IntRegs:$dst1, IntRegs:$src2,
143 !strconcat("$dst &= ", !strconcat(opc , "($src2, ~$src3)")),
144 [(set IntRegs:$dst, (IntID IntRegs:$dst1, IntRegs:$src2,
147 class si_SInst_sisis10_andi<string opc, Intrinsic IntID>
148 : SInst<(outs IntRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2, s10Imm:$src3),
149 !strconcat("$dst = ", !strconcat(opc ,
150 "($src1, and($src2, #$src3))")),
151 [(set IntRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2,
154 class si_MInst_sisisi_xor<string opc, Intrinsic IntID>
155 : MInst<(outs IntRegs:$dst), (ins IntRegs:$dst1, IntRegs:$src2,
157 !strconcat("$dst ^= ", !strconcat(opc , "($src2, $src3)")),
158 [(set IntRegs:$dst, (IntID IntRegs:$dst1, IntRegs:$src2,
161 class si_MInst_sisisi_xorn<string opc, Intrinsic IntID>
162 : MInst<(outs IntRegs:$dst), (ins IntRegs:$dst1, IntRegs:$src2,
164 !strconcat("$dst ^= ", !strconcat(opc , "($src2, ~$src3)")),
165 [(set IntRegs:$dst, (IntID IntRegs:$dst1, IntRegs:$src2,
168 class si_SInst_sisis10_or<string opc, Intrinsic IntID>
169 : SInst<(outs IntRegs:$dst), (ins IntRegs:$dst1, IntRegs:$src2, s10Imm:$src3),
170 !strconcat("$dst |= ", !strconcat(opc , "($src2, #$src3)")),
171 [(set IntRegs:$dst, (IntID IntRegs:$dst1, IntRegs:$src2,
174 class si_MInst_sisisi_or<string opc, Intrinsic IntID>
175 : MInst<(outs IntRegs:$dst), (ins IntRegs:$dst1, IntRegs:$src2,
177 !strconcat("$dst |= ", !strconcat(opc , "($src2, $src3)")),
178 [(set IntRegs:$dst, (IntID IntRegs:$dst1, IntRegs:$src2,
181 class si_MInst_sisisi_orn<string opc, Intrinsic IntID>
182 : MInst<(outs IntRegs:$dst), (ins IntRegs:$dst1, IntRegs:$src2,
184 !strconcat("$dst |= ", !strconcat(opc , "($src2, ~$src3)")),
185 [(set IntRegs:$dst, (IntID IntRegs:$dst1, IntRegs:$src2,
188 class si_SInst_siu5_sat<string opc, Intrinsic IntID>
189 : SInst<(outs IntRegs:$dst), (ins IntRegs:$src1, u5Imm:$src2),
190 !strconcat("$dst = ", !strconcat(opc , "($src1, #$src2):sat")),
191 [(set IntRegs:$dst, (IntID IntRegs:$src1, imm:$src2))]>;
194 /********************************************************************
196 *********************************************************************/
198 // ALU32 / ALU / Logical Operations.
199 def Hexagon_A4_orn : si_ALU32_sisi_not <"or", int_hexagon_A4_orn>;
200 def Hexagon_A4_andn : si_ALU32_sisi_not <"and", int_hexagon_A4_andn>;
203 /********************************************************************
205 *********************************************************************/
207 // ALU32 / PERM / Combine Words Into Doublewords.
208 def Hexagon_A4_combineir : di_ALU32_s8si <"combine", int_hexagon_A4_combineir>;
209 def Hexagon_A4_combineri : di_ALU32_sis8 <"combine", int_hexagon_A4_combineri>;
212 /********************************************************************
214 *********************************************************************/
216 // ALU32 / PRED / Conditional Shift Halfword.
217 // ALU32 / PRED / Conditional Sign Extend.
218 // ALU32 / PRED / Conditional Zero Extend.
219 // ALU32 / PRED / Compare.
220 def Hexagon_C4_cmpltei : qi_neg_ALU32_sis10 <"cmp.gt", int_hexagon_C4_cmpltei>;
221 def Hexagon_C4_cmplte : qi_neg_ALU32_sisi <"cmp.gt", int_hexagon_C4_cmplte>;
222 def Hexagon_C4_cmplteu : qi_neg_ALU32_sisi <"cmp.gtu",int_hexagon_C4_cmplteu>;
224 def: T_RI_pat<C4_cmpneqi, int_hexagon_C4_cmpneqi>;
225 def: T_RI_pat<C4_cmpltei, int_hexagon_C4_cmpltei>;
226 def: T_RI_pat<C4_cmplteui, int_hexagon_C4_cmplteui>;
228 // ALU32 / PRED / cmpare To General Register.
229 def Hexagon_A4_rcmpneq : si_neg_ALU32_sisi <"cmp.eq", int_hexagon_A4_rcmpneq>;
230 def Hexagon_A4_rcmpneqi: si_neg_ALU32_sis8 <"cmp.eq", int_hexagon_A4_rcmpneqi>;
231 def Hexagon_A4_rcmpeq : si_ALU32_sisi <"cmp.eq", int_hexagon_A4_rcmpeq>;
232 def Hexagon_A4_rcmpeqi : si_ALU32_sis8 <"cmp.eq", int_hexagon_A4_rcmpeqi>;
235 /********************************************************************
237 *********************************************************************/
239 // CR / Corner Detection Acceleration.
240 def Hexagon_C4_fastcorner9:
241 qi_SInst_qiqi<"fastcorner9", int_hexagon_C4_fastcorner9>;
242 def Hexagon_C4_fastcorner9_not:
243 qi_neg_SInst_qiqi<"fastcorner9",int_hexagon_C4_fastcorner9_not>;
245 // CR / Logical Operations On Predicates.
246 def Hexagon_C4_and_andn:
247 qi_SInst_qi_andqiqi_neg <"and", int_hexagon_C4_and_andn>;
248 def Hexagon_C4_and_and:
249 qi_SInst_qi_andqiqi <"and", int_hexagon_C4_and_and>;
250 def Hexagon_C4_and_orn:
251 qi_SInst_qi_orqiqi_neg <"and", int_hexagon_C4_and_orn>;
252 def Hexagon_C4_and_or:
253 qi_SInst_qi_orqiqi <"and", int_hexagon_C4_and_or>;
254 def Hexagon_C4_or_andn:
255 qi_SInst_qi_andqiqi_neg <"or", int_hexagon_C4_or_andn>;
256 def Hexagon_C4_or_and:
257 qi_SInst_qi_andqiqi <"or", int_hexagon_C4_or_and>;
258 def Hexagon_C4_or_orn:
259 qi_SInst_qi_orqiqi_neg <"or", int_hexagon_C4_or_orn>;
260 def Hexagon_C4_or_or:
261 qi_SInst_qi_orqiqi <"or", int_hexagon_C4_or_or>;
264 /********************************************************************
266 *********************************************************************/
268 // XTYPE / ALU / Add And Accumulate.
269 def Hexagon_S4_addaddi:
270 si_SInst_si_addsis6 <"add", int_hexagon_S4_addaddi>;
271 def Hexagon_S4_subaddi:
272 si_SInst_si_subs6si <"add", int_hexagon_S4_subaddi>;
274 // XTYPE / ALU / Logical Doublewords.
275 def Hexagon_S4_andnp:
276 di_ALU64_didi_neg <"and", int_hexagon_A4_andnp>;
278 di_ALU64_didi_neg <"or", int_hexagon_A4_ornp>;
280 // XTYPE / ALU / Logical-logical Doublewords.
281 def Hexagon_M4_xor_xacc:
282 di_MInst_dididi_xacc <"xor", int_hexagon_M4_xor_xacc>;
284 // XTYPE / ALU / Logical-logical Words.
285 def HEXAGON_M4_and_and:
286 si_MInst_sisisi_and <"and", int_hexagon_M4_and_and>;
287 def HEXAGON_M4_and_or:
288 si_MInst_sisisi_and <"or", int_hexagon_M4_and_or>;
289 def HEXAGON_M4_and_xor:
290 si_MInst_sisisi_and <"xor", int_hexagon_M4_and_xor>;
291 def HEXAGON_M4_and_andn:
292 si_MInst_sisisi_andn <"and", int_hexagon_M4_and_andn>;
293 def HEXAGON_M4_xor_and:
294 si_MInst_sisisi_xor <"and", int_hexagon_M4_xor_and>;
295 def HEXAGON_M4_xor_or:
296 si_MInst_sisisi_xor <"or", int_hexagon_M4_xor_or>;
297 def HEXAGON_M4_xor_andn:
298 si_MInst_sisisi_xorn <"and", int_hexagon_M4_xor_andn>;
299 def HEXAGON_M4_or_and:
300 si_MInst_sisisi_or <"and", int_hexagon_M4_or_and>;
301 def HEXAGON_M4_or_or:
302 si_MInst_sisisi_or <"or", int_hexagon_M4_or_or>;
303 def HEXAGON_M4_or_xor:
304 si_MInst_sisisi_or <"xor", int_hexagon_M4_or_xor>;
305 def HEXAGON_M4_or_andn:
306 si_MInst_sisisi_orn <"and", int_hexagon_M4_or_andn>;
307 def HEXAGON_S4_or_andix:
308 si_SInst_sisis10_andi <"or", int_hexagon_S4_or_andix>;
309 def HEXAGON_S4_or_andi:
310 si_SInst_sisis10_or <"and", int_hexagon_S4_or_andi>;
311 def HEXAGON_S4_or_ori:
312 si_SInst_sisis10_or <"or", int_hexagon_S4_or_ori>;
314 // XTYPE / ALU / Modulo wrap.
315 def HEXAGON_A4_modwrapu:
316 si_ALU64_sisi <"modwrap", int_hexagon_A4_modwrapu>;
318 // XTYPE / ALU / Round.
319 def HEXAGON_A4_cround_ri:
320 si_SInst_siu5 <"cround", int_hexagon_A4_cround_ri>;
321 def HEXAGON_A4_cround_rr:
322 si_SInst_sisi <"cround", int_hexagon_A4_cround_rr>;
323 def HEXAGON_A4_round_ri:
324 si_SInst_siu5 <"round", int_hexagon_A4_round_ri>;
325 def HEXAGON_A4_round_rr:
326 si_SInst_sisi <"round", int_hexagon_A4_round_rr>;
327 def HEXAGON_A4_round_ri_sat:
328 si_SInst_siu5_sat <"round", int_hexagon_A4_round_ri_sat>;
329 def HEXAGON_A4_round_rr_sat:
330 si_SInst_sisi_sat <"round", int_hexagon_A4_round_rr_sat>;
332 // XTYPE / ALU / Vector reduce add unsigned halfwords.
333 // XTYPE / ALU / Vector add bytes.
334 // XTYPE / ALU / Vector conditional negate.
335 // XTYPE / ALU / Vector maximum bytes.
336 // XTYPE / ALU / Vector reduce maximum halfwords.
337 // XTYPE / ALU / Vector reduce maximum words.
338 // XTYPE / ALU / Vector minimum bytes.
339 // XTYPE / ALU / Vector reduce minimum halfwords.
340 // XTYPE / ALU / Vector reduce minimum words.
341 // XTYPE / ALU / Vector subtract bytes.
344 /********************************************************************
346 *********************************************************************/
348 // XTYPE / BIT / Count leading.
349 // XTYPE / BIT / Count trailing.
350 // XTYPE / BIT / Extract bitfield.
351 // XTYPE / BIT / Masked parity.
352 // XTYPE / BIT / Bit reverse.
353 // XTYPE / BIT / Split bitfield.
356 /********************************************************************
358 *********************************************************************/
360 // XTYPE / COMPLEX / Complex add/sub halfwords.
361 // XTYPE / COMPLEX / Complex add/sub words.
362 // XTYPE / COMPLEX / Complex multiply 32x16.
363 // XTYPE / COMPLEX / Vector reduce complex rotate.
366 /********************************************************************
368 *********************************************************************/
370 // XTYPE / COMPLEX / Complex add/sub halfwords.