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_cmpneq : qi_neg_ALU32_sisi <"cmp.eq", int_hexagon_C4_cmpneq>;
221 def Hexagon_C4_cmpneqi : qi_neg_ALU32_sis10 <"cmp.eq", int_hexagon_C4_cmpneqi>;
222 def Hexagon_C4_cmplte : qi_neg_ALU32_sisi <"cmp.gt", int_hexagon_C4_cmplte>;
223 def Hexagon_C4_cmpltei : qi_neg_ALU32_sis10 <"cmp.gt", int_hexagon_C4_cmpltei>;
224 def Hexagon_C4_cmplteu : qi_neg_ALU32_sisi <"cmp.gtu",int_hexagon_C4_cmplteu>;
225 def Hexagon_C4_cmplteui: qi_neg_ALU32_siu9 <"cmp.gtu",int_hexagon_C4_cmplteui>;
227 // ALU32 / PRED / cmpare To General Register.
228 def Hexagon_A4_rcmpneq : si_neg_ALU32_sisi <"cmp.eq", int_hexagon_A4_rcmpneq>;
229 def Hexagon_A4_rcmpneqi: si_neg_ALU32_sis8 <"cmp.eq", int_hexagon_A4_rcmpneqi>;
230 def Hexagon_A4_rcmpeq : si_ALU32_sisi <"cmp.eq", int_hexagon_A4_rcmpeq>;
231 def Hexagon_A4_rcmpeqi : si_ALU32_sis8 <"cmp.eq", int_hexagon_A4_rcmpeqi>;
234 /********************************************************************
236 *********************************************************************/
238 // CR / Corner Detection Acceleration.
239 def Hexagon_C4_fastcorner9:
240 qi_SInst_qiqi<"fastcorner9", int_hexagon_C4_fastcorner9>;
241 def Hexagon_C4_fastcorner9_not:
242 qi_neg_SInst_qiqi<"fastcorner9",int_hexagon_C4_fastcorner9_not>;
244 // CR / Logical Operations On Predicates.
245 def Hexagon_C4_and_andn:
246 qi_SInst_qi_andqiqi_neg <"and", int_hexagon_C4_and_andn>;
247 def Hexagon_C4_and_and:
248 qi_SInst_qi_andqiqi <"and", int_hexagon_C4_and_and>;
249 def Hexagon_C4_and_orn:
250 qi_SInst_qi_orqiqi_neg <"and", int_hexagon_C4_and_orn>;
251 def Hexagon_C4_and_or:
252 qi_SInst_qi_orqiqi <"and", int_hexagon_C4_and_or>;
253 def Hexagon_C4_or_andn:
254 qi_SInst_qi_andqiqi_neg <"or", int_hexagon_C4_or_andn>;
255 def Hexagon_C4_or_and:
256 qi_SInst_qi_andqiqi <"or", int_hexagon_C4_or_and>;
257 def Hexagon_C4_or_orn:
258 qi_SInst_qi_orqiqi_neg <"or", int_hexagon_C4_or_orn>;
259 def Hexagon_C4_or_or:
260 qi_SInst_qi_orqiqi <"or", int_hexagon_C4_or_or>;
263 /********************************************************************
265 *********************************************************************/
267 // XTYPE / ALU / Add And Accumulate.
268 def Hexagon_S4_addaddi:
269 si_SInst_si_addsis6 <"add", int_hexagon_S4_addaddi>;
270 def Hexagon_S4_subaddi:
271 si_SInst_si_subs6si <"add", int_hexagon_S4_subaddi>;
273 // XTYPE / ALU / Logical Doublewords.
274 def Hexagon_S4_andnp:
275 di_ALU64_didi_neg <"and", int_hexagon_A4_andnp>;
277 di_ALU64_didi_neg <"or", int_hexagon_A4_ornp>;
279 // XTYPE / ALU / Logical-logical Doublewords.
280 def Hexagon_M4_xor_xacc:
281 di_MInst_dididi_xacc <"xor", int_hexagon_M4_xor_xacc>;
283 // XTYPE / ALU / Logical-logical Words.
284 def HEXAGON_M4_and_and:
285 si_MInst_sisisi_and <"and", int_hexagon_M4_and_and>;
286 def HEXAGON_M4_and_or:
287 si_MInst_sisisi_and <"or", int_hexagon_M4_and_or>;
288 def HEXAGON_M4_and_xor:
289 si_MInst_sisisi_and <"xor", int_hexagon_M4_and_xor>;
290 def HEXAGON_M4_and_andn:
291 si_MInst_sisisi_andn <"and", int_hexagon_M4_and_andn>;
292 def HEXAGON_M4_xor_and:
293 si_MInst_sisisi_xor <"and", int_hexagon_M4_xor_and>;
294 def HEXAGON_M4_xor_or:
295 si_MInst_sisisi_xor <"or", int_hexagon_M4_xor_or>;
296 def HEXAGON_M4_xor_andn:
297 si_MInst_sisisi_xorn <"and", int_hexagon_M4_xor_andn>;
298 def HEXAGON_M4_or_and:
299 si_MInst_sisisi_or <"and", int_hexagon_M4_or_and>;
300 def HEXAGON_M4_or_or:
301 si_MInst_sisisi_or <"or", int_hexagon_M4_or_or>;
302 def HEXAGON_M4_or_xor:
303 si_MInst_sisisi_or <"xor", int_hexagon_M4_or_xor>;
304 def HEXAGON_M4_or_andn:
305 si_MInst_sisisi_orn <"and", int_hexagon_M4_or_andn>;
306 def HEXAGON_S4_or_andix:
307 si_SInst_sisis10_andi <"or", int_hexagon_S4_or_andix>;
308 def HEXAGON_S4_or_andi:
309 si_SInst_sisis10_or <"and", int_hexagon_S4_or_andi>;
310 def HEXAGON_S4_or_ori:
311 si_SInst_sisis10_or <"or", int_hexagon_S4_or_ori>;
313 // XTYPE / ALU / Modulo wrap.
314 def HEXAGON_A4_modwrapu:
315 si_ALU64_sisi <"modwrap", int_hexagon_A4_modwrapu>;
317 // XTYPE / ALU / Round.
318 def HEXAGON_A4_cround_ri:
319 si_SInst_siu5 <"cround", int_hexagon_A4_cround_ri>;
320 def HEXAGON_A4_cround_rr:
321 si_SInst_sisi <"cround", int_hexagon_A4_cround_rr>;
322 def HEXAGON_A4_round_ri:
323 si_SInst_siu5 <"round", int_hexagon_A4_round_ri>;
324 def HEXAGON_A4_round_rr:
325 si_SInst_sisi <"round", int_hexagon_A4_round_rr>;
326 def HEXAGON_A4_round_ri_sat:
327 si_SInst_siu5_sat <"round", int_hexagon_A4_round_ri_sat>;
328 def HEXAGON_A4_round_rr_sat:
329 si_SInst_sisi_sat <"round", int_hexagon_A4_round_rr_sat>;
331 // XTYPE / ALU / Vector reduce add unsigned halfwords.
332 // XTYPE / ALU / Vector add bytes.
333 // XTYPE / ALU / Vector conditional negate.
334 // XTYPE / ALU / Vector maximum bytes.
335 // XTYPE / ALU / Vector reduce maximum halfwords.
336 // XTYPE / ALU / Vector reduce maximum words.
337 // XTYPE / ALU / Vector minimum bytes.
338 // XTYPE / ALU / Vector reduce minimum halfwords.
339 // XTYPE / ALU / Vector reduce minimum words.
340 // XTYPE / ALU / Vector subtract bytes.
343 /********************************************************************
345 *********************************************************************/
347 // XTYPE / BIT / Count leading.
348 // XTYPE / BIT / Count trailing.
349 // XTYPE / BIT / Extract bitfield.
350 // XTYPE / BIT / Masked parity.
351 // XTYPE / BIT / Bit reverse.
352 // XTYPE / BIT / Split bitfield.
355 /********************************************************************
357 *********************************************************************/
359 // XTYPE / COMPLEX / Complex add/sub halfwords.
360 // XTYPE / COMPLEX / Complex add/sub words.
361 // XTYPE / COMPLEX / Complex multiply 32x16.
362 // XTYPE / COMPLEX / Vector reduce complex rotate.
365 /********************************************************************
367 *********************************************************************/
369 // XTYPE / COMPLEX / Complex add/sub halfwords.