blob: 4b1cf3f4c026f57205e7f93e4f0e6a8da5b73ef1 [file] [log] [blame]
Tony Linthicum1213a7a2011-12-12 21:14:40 +00001//===- HexagonIntrinsicsV4.td - V4 Instruction intrinsics --*- tablegen -*-===//
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// This is populated based on the following specs:
10// Hexagon V4 Architecture Extensions
11// Application-Level Specification
12// 80-V9418-12 Rev. A
13// June 15, 2010
14
Colin LeMahieu94c33212015-01-28 19:16:17 +000015// Polynomial multiply words
16// Rdd=pmpyw(Rs,Rt)
17def : T_RR_pat <M4_pmpyw, int_hexagon_M4_pmpyw>;
18// Rxx^=pmpyw(Rs,Rt)
19def : T_PRR_pat <M4_pmpyw_acc, int_hexagon_M4_pmpyw_acc>;
20
21//Rxx^=asr(Rss,Rt)
22def : T_PPR_pat <S2_asr_r_p_xor, int_hexagon_S2_asr_r_p_xor>;
23//Rxx^=asl(Rss,Rt)
24def : T_PPR_pat <S2_asl_r_p_xor, int_hexagon_S2_asl_r_p_xor>;
25//Rxx^=lsr(Rss,Rt)
26def : T_PPR_pat <S2_lsr_r_p_xor, int_hexagon_S2_lsr_r_p_xor>;
27//Rxx^=lsl(Rss,Rt)
28def : T_PPR_pat <S2_lsl_r_p_xor, int_hexagon_S2_lsl_r_p_xor>;
29
30// Multiply and use upper result
31def : MType_R32_pat <int_hexagon_M2_mpysu_up, M2_mpysu_up>;
32def : MType_R32_pat <int_hexagon_M2_mpy_up_s1, M2_mpy_up_s1>;
33def : MType_R32_pat <int_hexagon_M2_hmmpyh_s1, M2_hmmpyh_s1>;
34def : MType_R32_pat <int_hexagon_M2_hmmpyl_s1, M2_hmmpyl_s1>;
35def : MType_R32_pat <int_hexagon_M2_mpy_up_s1_sat, M2_mpy_up_s1_sat>;
36
Colin LeMahieu39b846c2015-01-28 18:06:23 +000037def : T_P_pat <S2_brevp, int_hexagon_S2_brevp>;
38
39def: T_P_pat <S2_ct0p, int_hexagon_S2_ct0p>;
40def: T_P_pat <S2_ct1p, int_hexagon_S2_ct1p>;
41def: T_RR_pat<C4_nbitsset, int_hexagon_C4_nbitsset>;
42def: T_RR_pat<C4_nbitsclr, int_hexagon_C4_nbitsclr>;
43def: T_RI_pat<C4_nbitsclri, int_hexagon_C4_nbitsclri>;
44
Colin LeMahieua749b3e2015-01-29 16:08:43 +000045def : T_RR_pat<A4_cmpbeq, int_hexagon_A4_cmpbeq>;
46def : T_RR_pat<A4_cmpbgt, int_hexagon_A4_cmpbgt>;
47def : T_RR_pat<A4_cmpbgtu, int_hexagon_A4_cmpbgtu>;
48def : T_RR_pat<A4_cmpheq, int_hexagon_A4_cmpheq>;
49def : T_RR_pat<A4_cmphgt, int_hexagon_A4_cmphgt>;
50def : T_RR_pat<A4_cmphgtu, int_hexagon_A4_cmphgtu>;
51
52def : T_RI_pat<A4_cmpbeqi, int_hexagon_A4_cmpbeqi>;
53def : T_RI_pat<A4_cmpbgti, int_hexagon_A4_cmpbgti>;
54def : T_RI_pat<A4_cmpbgtui, int_hexagon_A4_cmpbgtui>;
55
56def : T_RI_pat<A4_cmpheqi, int_hexagon_A4_cmpheqi>;
57def : T_RI_pat<A4_cmphgti, int_hexagon_A4_cmphgti>;
58def : T_RI_pat<A4_cmphgtui, int_hexagon_A4_cmphgtui>;
59
Colin LeMahieu1de7e0d2015-01-28 19:39:09 +000060def : T_RP_pat <A4_boundscheck, int_hexagon_A4_boundscheck>;
61
62def : T_PR_pat<A4_tlbmatch, int_hexagon_A4_tlbmatch>;
63
Colin LeMahieu94c33212015-01-28 19:16:17 +000064def : Pat <(int_hexagon_M4_mpyrr_addr IntRegs:$src1, IntRegs:$src2,
65 IntRegs:$src3),
66 (M4_mpyrr_addr IntRegs:$src1, IntRegs:$src2, IntRegs:$src3)>;
67
68def : T_IRR_pat <M4_mpyrr_addi, int_hexagon_M4_mpyrr_addi>;
69def : T_IRI_pat <M4_mpyri_addi, int_hexagon_M4_mpyri_addi>;
70def : T_RIR_pat <M4_mpyri_addr_u2, int_hexagon_M4_mpyri_addr_u2>;
71def : T_RRI_pat <M4_mpyri_addr, int_hexagon_M4_mpyri_addr>;
72// Multiply 32x32 and use upper result
73def : T_RRR_pat <M4_mac_up_s1_sat, int_hexagon_M4_mac_up_s1_sat>;
74def : T_RRR_pat <M4_nac_up_s1_sat, int_hexagon_M4_nac_up_s1_sat>;
75
Colin LeMahieu1de7e0d2015-01-28 19:39:09 +000076def : T_PP_pat<A4_andnp, int_hexagon_A4_andnp>;
77def : T_PP_pat<A4_ornp, int_hexagon_A4_ornp>;
78
Colin LeMahieu39b846c2015-01-28 18:06:23 +000079// Extract bitfield
80def : T_PP_pat <S4_extractp_rp, int_hexagon_S4_extractp_rp>;
81def : T_RP_pat <S4_extract_rp, int_hexagon_S4_extract_rp>;
82def : T_PII_pat <S4_extractp, int_hexagon_S4_extractp>;
83def : T_RII_pat <S4_extract, int_hexagon_S4_extract>;
84
Colin LeMahieufe03c9a2015-01-28 17:37:59 +000085// Shift an immediate left by register amount
86def : T_IR_pat<S4_lsli, int_hexagon_S4_lsli>;
87
Colin LeMahieu1de7e0d2015-01-28 19:39:09 +000088// Logical xor with xor accumulation
89def : T_PPP_pat<M4_xor_xacc, int_hexagon_M4_xor_xacc>;
90
Colin LeMahieufe03c9a2015-01-28 17:37:59 +000091// Shift and add/sub/and/or
92def : T_IRI_pat <S4_andi_asl_ri, int_hexagon_S4_andi_asl_ri>;
93def : T_IRI_pat <S4_ori_asl_ri, int_hexagon_S4_ori_asl_ri>;
94def : T_IRI_pat <S4_addi_asl_ri, int_hexagon_S4_addi_asl_ri>;
95def : T_IRI_pat <S4_subi_asl_ri, int_hexagon_S4_subi_asl_ri>;
96def : T_IRI_pat <S4_andi_lsr_ri, int_hexagon_S4_andi_lsr_ri>;
97def : T_IRI_pat <S4_ori_lsr_ri, int_hexagon_S4_ori_lsr_ri>;
98def : T_IRI_pat <S4_addi_lsr_ri, int_hexagon_S4_addi_lsr_ri>;
99def : T_IRI_pat <S4_subi_lsr_ri, int_hexagon_S4_subi_lsr_ri>;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000100
Colin LeMahieu39b846c2015-01-28 18:06:23 +0000101// Split bitfield
102def : T_RI_pat <A4_bitspliti, int_hexagon_A4_bitspliti>;
103def : T_RR_pat <A4_bitsplit, int_hexagon_A4_bitsplit>;
104
105def: T_RR_pat<S4_parity, int_hexagon_S4_parity>;
106
107def: T_RI_pat<S4_ntstbit_i, int_hexagon_S4_ntstbit_i>;
108def: T_RR_pat<S4_ntstbit_r, int_hexagon_S4_ntstbit_r>;
109
110def: T_RI_pat<S4_clbaddi, int_hexagon_S4_clbaddi>;
111def: T_PI_pat<S4_clbpaddi, int_hexagon_S4_clbpaddi>;
112def: T_P_pat <S4_clbpnorm, int_hexagon_S4_clbpnorm>;
113
Colin LeMahieu1de7e0d2015-01-28 19:39:09 +0000114/********************************************************************
115* ALU32/ALU *
116*********************************************************************/
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000117
Colin LeMahieu1de7e0d2015-01-28 19:39:09 +0000118// ALU32 / ALU / Logical Operations.
119def: T_RR_pat<A4_andn, int_hexagon_A4_andn>;
120def: T_RR_pat<A4_orn, int_hexagon_A4_orn>;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000121
Colin LeMahieu1de7e0d2015-01-28 19:39:09 +0000122/********************************************************************
123* ALU32/PERM *
124*********************************************************************/
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000125
Colin LeMahieu1de7e0d2015-01-28 19:39:09 +0000126// Combine Words Into Doublewords.
127def: T_RI_pat<A4_combineri, int_hexagon_A4_combineri, s8ExtPred>;
128def: T_IR_pat<A4_combineir, int_hexagon_A4_combineir, s8ExtPred>;
129
130/********************************************************************
131* ALU32/PRED *
132*********************************************************************/
133
134def: T_RR_pat<A4_rcmpeq, int_hexagon_A4_rcmpeq>;
135def: T_RR_pat<A4_rcmpneq, int_hexagon_A4_rcmpneq>;
136
137def: T_RI_pat<A4_rcmpeqi, int_hexagon_A4_rcmpeqi>;
138def: T_RI_pat<A4_rcmpneqi, int_hexagon_A4_rcmpneqi>;
139
140/********************************************************************
141* XTYPE/ALU *
142*********************************************************************/
143
144// Add And Accumulate.
145
146def : T_RRI_pat <S4_addaddi, int_hexagon_S4_addaddi>;
147def : T_RIR_pat <S4_subaddi, int_hexagon_S4_subaddi>;
148
149
150// XTYPE / ALU / Logical-logical Words.
151def : T_RRR_pat <M4_or_xor, int_hexagon_M4_or_xor>;
152def : T_RRR_pat <M4_and_xor, int_hexagon_M4_and_xor>;
153def : T_RRR_pat <M4_or_and, int_hexagon_M4_or_and>;
154def : T_RRR_pat <M4_and_and, int_hexagon_M4_and_and>;
155def : T_RRR_pat <M4_xor_and, int_hexagon_M4_xor_and>;
156def : T_RRR_pat <M4_or_or, int_hexagon_M4_or_or>;
157def : T_RRR_pat <M4_and_or, int_hexagon_M4_and_or>;
158def : T_RRR_pat <M4_xor_or, int_hexagon_M4_xor_or>;
159def : T_RRR_pat <M4_or_andn, int_hexagon_M4_or_andn>;
160def : T_RRR_pat <M4_and_andn, int_hexagon_M4_and_andn>;
161def : T_RRR_pat <M4_xor_andn, int_hexagon_M4_xor_andn>;
162
163def : T_RRI_pat <S4_or_andi, int_hexagon_S4_or_andi>;
164def : T_RRI_pat <S4_or_andix, int_hexagon_S4_or_andix>;
165def : T_RRI_pat <S4_or_ori, int_hexagon_S4_or_ori>;
166
167// Modulo wrap.
168def : T_RR_pat <A4_modwrapu, int_hexagon_A4_modwrapu>;
169
170// Arithmetic/Convergent round
171// Rd=[cround|round](Rs,Rt)[:sat]
172// Rd=[cround|round](Rs,#u5)[:sat]
173def : T_RI_pat <A4_cround_ri, int_hexagon_A4_cround_ri>;
174def : T_RR_pat <A4_cround_rr, int_hexagon_A4_cround_rr>;
175
176def : T_RI_pat <A4_round_ri, int_hexagon_A4_round_ri>;
177def : T_RR_pat <A4_round_rr, int_hexagon_A4_round_rr>;
178
179def : T_RI_pat <A4_round_ri_sat, int_hexagon_A4_round_ri_sat>;
180def : T_RR_pat <A4_round_rr_sat, int_hexagon_A4_round_rr_sat>;
181
182def : T_P_pat <A2_roundsat, int_hexagon_A2_roundsat>;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000183
184class qi_neg_ALU32_sisi<string opc, Intrinsic IntID>
185 : ALU32_rr<(outs PredRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2),
186 !strconcat("$dst = !", !strconcat(opc , "($src1, $src2)")),
187 [(set PredRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2))]>;
188
189class qi_neg_ALU32_sis10<string opc, Intrinsic IntID>
190 : ALU32_rr<(outs PredRegs:$dst), (ins IntRegs:$src1, s10Imm:$src2),
191 !strconcat("$dst = !", !strconcat(opc , "($src1, #$src2)")),
192 [(set PredRegs:$dst, (IntID IntRegs:$src1, imm:$src2))]>;
193
194class qi_neg_ALU32_siu9<string opc, Intrinsic IntID>
195 : ALU32_rr<(outs PredRegs:$dst), (ins IntRegs:$src1, u9Imm:$src2),
196 !strconcat("$dst = !", !strconcat(opc , "($src1, #$src2)")),
197 [(set PredRegs:$dst, (IntID IntRegs:$src1, imm:$src2))]>;
198
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000199//
200// SInst Classes.
201//
202class qi_neg_SInst_qiqi<string opc, Intrinsic IntID>
203 : SInst<(outs PredRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2),
204 !strconcat("$dst = !", !strconcat(opc , "($src1, $src2)")),
205 [(set PredRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2))]>;
206
207class qi_SInst_qi_andqiqi_neg<string opc, Intrinsic IntID>
208 : SInst<(outs PredRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2,
209 IntRegs:$src3),
210 !strconcat("$dst = ", !strconcat(opc ,
211 "($src1, and($src2, !$src3)")),
212 [(set PredRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2,
213 IntRegs:$src3))]>;
214
215class qi_SInst_qi_andqiqi<string opc, Intrinsic IntID>
216 : SInst<(outs PredRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2,
217 IntRegs:$src3),
218 !strconcat("$dst = ", !strconcat(opc ,
219 "($src1, and($src2, $src3)")),
220 [(set PredRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2,
221 IntRegs:$src3))]>;
222
223class qi_SInst_qi_orqiqi_neg<string opc, Intrinsic IntID>
224 : SInst<(outs PredRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2,
225 IntRegs:$src3),
226 !strconcat("$dst = ", !strconcat(opc ,
227 "($src1, or($src2, !$src3)")),
228 [(set PredRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2,
229 IntRegs:$src3))]>;
230
231class qi_SInst_qi_orqiqi<string opc, Intrinsic IntID>
232 : SInst<(outs PredRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2,
233 IntRegs:$src3),
234 !strconcat("$dst = ", !strconcat(opc ,
235 "($src1, or($src2, $src3)")),
236 [(set PredRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2,
237 IntRegs:$src3))]>;
238
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000239/********************************************************************
240* ALU32/PRED *
241*********************************************************************/
242
243// ALU32 / PRED / Conditional Shift Halfword.
244// ALU32 / PRED / Conditional Sign Extend.
245// ALU32 / PRED / Conditional Zero Extend.
246// ALU32 / PRED / Compare.
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000247def Hexagon_C4_cmpltei : qi_neg_ALU32_sis10 <"cmp.gt", int_hexagon_C4_cmpltei>;
Sid Manning31f71252014-09-25 13:09:54 +0000248def Hexagon_C4_cmplte : qi_neg_ALU32_sisi <"cmp.gt", int_hexagon_C4_cmplte>;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000249def Hexagon_C4_cmplteu : qi_neg_ALU32_sisi <"cmp.gtu",int_hexagon_C4_cmplteu>;
Sid Manning31f71252014-09-25 13:09:54 +0000250
251def: T_RI_pat<C4_cmpneqi, int_hexagon_C4_cmpneqi>;
252def: T_RI_pat<C4_cmpltei, int_hexagon_C4_cmpltei>;
253def: T_RI_pat<C4_cmplteui, int_hexagon_C4_cmplteui>;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000254
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000255
256/********************************************************************
257* CR *
258*********************************************************************/
259
260// CR / Corner Detection Acceleration.
261def Hexagon_C4_fastcorner9:
262 qi_SInst_qiqi<"fastcorner9", int_hexagon_C4_fastcorner9>;
263def Hexagon_C4_fastcorner9_not:
264 qi_neg_SInst_qiqi<"fastcorner9",int_hexagon_C4_fastcorner9_not>;
265
266// CR / Logical Operations On Predicates.
267def Hexagon_C4_and_andn:
268 qi_SInst_qi_andqiqi_neg <"and", int_hexagon_C4_and_andn>;
269def Hexagon_C4_and_and:
270 qi_SInst_qi_andqiqi <"and", int_hexagon_C4_and_and>;
271def Hexagon_C4_and_orn:
272 qi_SInst_qi_orqiqi_neg <"and", int_hexagon_C4_and_orn>;
273def Hexagon_C4_and_or:
274 qi_SInst_qi_orqiqi <"and", int_hexagon_C4_and_or>;
275def Hexagon_C4_or_andn:
276 qi_SInst_qi_andqiqi_neg <"or", int_hexagon_C4_or_andn>;
277def Hexagon_C4_or_and:
278 qi_SInst_qi_andqiqi <"or", int_hexagon_C4_or_and>;
279def Hexagon_C4_or_orn:
280 qi_SInst_qi_orqiqi_neg <"or", int_hexagon_C4_or_orn>;
281def Hexagon_C4_or_or:
282 qi_SInst_qi_orqiqi <"or", int_hexagon_C4_or_or>;