blob: b51adac56a54f687223b02459cd57cfae393e884 [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 LeMahieu1de7e0d2015-01-28 19:39:09 +000045def : T_RP_pat <A4_boundscheck, int_hexagon_A4_boundscheck>;
46
47def : T_PR_pat<A4_tlbmatch, int_hexagon_A4_tlbmatch>;
48
Colin LeMahieu94c33212015-01-28 19:16:17 +000049def : Pat <(int_hexagon_M4_mpyrr_addr IntRegs:$src1, IntRegs:$src2,
50 IntRegs:$src3),
51 (M4_mpyrr_addr IntRegs:$src1, IntRegs:$src2, IntRegs:$src3)>;
52
53def : T_IRR_pat <M4_mpyrr_addi, int_hexagon_M4_mpyrr_addi>;
54def : T_IRI_pat <M4_mpyri_addi, int_hexagon_M4_mpyri_addi>;
55def : T_RIR_pat <M4_mpyri_addr_u2, int_hexagon_M4_mpyri_addr_u2>;
56def : T_RRI_pat <M4_mpyri_addr, int_hexagon_M4_mpyri_addr>;
57// Multiply 32x32 and use upper result
58def : T_RRR_pat <M4_mac_up_s1_sat, int_hexagon_M4_mac_up_s1_sat>;
59def : T_RRR_pat <M4_nac_up_s1_sat, int_hexagon_M4_nac_up_s1_sat>;
60
Colin LeMahieu1de7e0d2015-01-28 19:39:09 +000061def : T_PP_pat<A4_andnp, int_hexagon_A4_andnp>;
62def : T_PP_pat<A4_ornp, int_hexagon_A4_ornp>;
63
Colin LeMahieu39b846c2015-01-28 18:06:23 +000064// Extract bitfield
65def : T_PP_pat <S4_extractp_rp, int_hexagon_S4_extractp_rp>;
66def : T_RP_pat <S4_extract_rp, int_hexagon_S4_extract_rp>;
67def : T_PII_pat <S4_extractp, int_hexagon_S4_extractp>;
68def : T_RII_pat <S4_extract, int_hexagon_S4_extract>;
69
Colin LeMahieufe03c9a2015-01-28 17:37:59 +000070// Shift an immediate left by register amount
71def : T_IR_pat<S4_lsli, int_hexagon_S4_lsli>;
72
Colin LeMahieu1de7e0d2015-01-28 19:39:09 +000073// Logical xor with xor accumulation
74def : T_PPP_pat<M4_xor_xacc, int_hexagon_M4_xor_xacc>;
75
Colin LeMahieufe03c9a2015-01-28 17:37:59 +000076// Shift and add/sub/and/or
77def : T_IRI_pat <S4_andi_asl_ri, int_hexagon_S4_andi_asl_ri>;
78def : T_IRI_pat <S4_ori_asl_ri, int_hexagon_S4_ori_asl_ri>;
79def : T_IRI_pat <S4_addi_asl_ri, int_hexagon_S4_addi_asl_ri>;
80def : T_IRI_pat <S4_subi_asl_ri, int_hexagon_S4_subi_asl_ri>;
81def : T_IRI_pat <S4_andi_lsr_ri, int_hexagon_S4_andi_lsr_ri>;
82def : T_IRI_pat <S4_ori_lsr_ri, int_hexagon_S4_ori_lsr_ri>;
83def : T_IRI_pat <S4_addi_lsr_ri, int_hexagon_S4_addi_lsr_ri>;
84def : T_IRI_pat <S4_subi_lsr_ri, int_hexagon_S4_subi_lsr_ri>;
Tony Linthicum1213a7a2011-12-12 21:14:40 +000085
Colin LeMahieu39b846c2015-01-28 18:06:23 +000086// Split bitfield
87def : T_RI_pat <A4_bitspliti, int_hexagon_A4_bitspliti>;
88def : T_RR_pat <A4_bitsplit, int_hexagon_A4_bitsplit>;
89
90def: T_RR_pat<S4_parity, int_hexagon_S4_parity>;
91
92def: T_RI_pat<S4_ntstbit_i, int_hexagon_S4_ntstbit_i>;
93def: T_RR_pat<S4_ntstbit_r, int_hexagon_S4_ntstbit_r>;
94
95def: T_RI_pat<S4_clbaddi, int_hexagon_S4_clbaddi>;
96def: T_PI_pat<S4_clbpaddi, int_hexagon_S4_clbpaddi>;
97def: T_P_pat <S4_clbpnorm, int_hexagon_S4_clbpnorm>;
98
Colin LeMahieu1de7e0d2015-01-28 19:39:09 +000099/********************************************************************
100* ALU32/ALU *
101*********************************************************************/
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000102
Colin LeMahieu1de7e0d2015-01-28 19:39:09 +0000103// ALU32 / ALU / Logical Operations.
104def: T_RR_pat<A4_andn, int_hexagon_A4_andn>;
105def: T_RR_pat<A4_orn, int_hexagon_A4_orn>;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000106
Colin LeMahieu1de7e0d2015-01-28 19:39:09 +0000107/********************************************************************
108* ALU32/PERM *
109*********************************************************************/
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000110
Colin LeMahieu1de7e0d2015-01-28 19:39:09 +0000111// Combine Words Into Doublewords.
112def: T_RI_pat<A4_combineri, int_hexagon_A4_combineri, s8ExtPred>;
113def: T_IR_pat<A4_combineir, int_hexagon_A4_combineir, s8ExtPred>;
114
115/********************************************************************
116* ALU32/PRED *
117*********************************************************************/
118
119def: T_RR_pat<A4_rcmpeq, int_hexagon_A4_rcmpeq>;
120def: T_RR_pat<A4_rcmpneq, int_hexagon_A4_rcmpneq>;
121
122def: T_RI_pat<A4_rcmpeqi, int_hexagon_A4_rcmpeqi>;
123def: T_RI_pat<A4_rcmpneqi, int_hexagon_A4_rcmpneqi>;
124
125/********************************************************************
126* XTYPE/ALU *
127*********************************************************************/
128
129// Add And Accumulate.
130
131def : T_RRI_pat <S4_addaddi, int_hexagon_S4_addaddi>;
132def : T_RIR_pat <S4_subaddi, int_hexagon_S4_subaddi>;
133
134
135// XTYPE / ALU / Logical-logical Words.
136def : T_RRR_pat <M4_or_xor, int_hexagon_M4_or_xor>;
137def : T_RRR_pat <M4_and_xor, int_hexagon_M4_and_xor>;
138def : T_RRR_pat <M4_or_and, int_hexagon_M4_or_and>;
139def : T_RRR_pat <M4_and_and, int_hexagon_M4_and_and>;
140def : T_RRR_pat <M4_xor_and, int_hexagon_M4_xor_and>;
141def : T_RRR_pat <M4_or_or, int_hexagon_M4_or_or>;
142def : T_RRR_pat <M4_and_or, int_hexagon_M4_and_or>;
143def : T_RRR_pat <M4_xor_or, int_hexagon_M4_xor_or>;
144def : T_RRR_pat <M4_or_andn, int_hexagon_M4_or_andn>;
145def : T_RRR_pat <M4_and_andn, int_hexagon_M4_and_andn>;
146def : T_RRR_pat <M4_xor_andn, int_hexagon_M4_xor_andn>;
147
148def : T_RRI_pat <S4_or_andi, int_hexagon_S4_or_andi>;
149def : T_RRI_pat <S4_or_andix, int_hexagon_S4_or_andix>;
150def : T_RRI_pat <S4_or_ori, int_hexagon_S4_or_ori>;
151
152// Modulo wrap.
153def : T_RR_pat <A4_modwrapu, int_hexagon_A4_modwrapu>;
154
155// Arithmetic/Convergent round
156// Rd=[cround|round](Rs,Rt)[:sat]
157// Rd=[cround|round](Rs,#u5)[:sat]
158def : T_RI_pat <A4_cround_ri, int_hexagon_A4_cround_ri>;
159def : T_RR_pat <A4_cround_rr, int_hexagon_A4_cround_rr>;
160
161def : T_RI_pat <A4_round_ri, int_hexagon_A4_round_ri>;
162def : T_RR_pat <A4_round_rr, int_hexagon_A4_round_rr>;
163
164def : T_RI_pat <A4_round_ri_sat, int_hexagon_A4_round_ri_sat>;
165def : T_RR_pat <A4_round_rr_sat, int_hexagon_A4_round_rr_sat>;
166
167def : T_P_pat <A2_roundsat, int_hexagon_A2_roundsat>;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000168
169class qi_neg_ALU32_sisi<string opc, Intrinsic IntID>
170 : ALU32_rr<(outs PredRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2),
171 !strconcat("$dst = !", !strconcat(opc , "($src1, $src2)")),
172 [(set PredRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2))]>;
173
174class qi_neg_ALU32_sis10<string opc, Intrinsic IntID>
175 : ALU32_rr<(outs PredRegs:$dst), (ins IntRegs:$src1, s10Imm:$src2),
176 !strconcat("$dst = !", !strconcat(opc , "($src1, #$src2)")),
177 [(set PredRegs:$dst, (IntID IntRegs:$src1, imm:$src2))]>;
178
179class qi_neg_ALU32_siu9<string opc, Intrinsic IntID>
180 : ALU32_rr<(outs PredRegs:$dst), (ins IntRegs:$src1, u9Imm:$src2),
181 !strconcat("$dst = !", !strconcat(opc , "($src1, #$src2)")),
182 [(set PredRegs:$dst, (IntID IntRegs:$src1, imm:$src2))]>;
183
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000184//
185// SInst Classes.
186//
187class qi_neg_SInst_qiqi<string opc, Intrinsic IntID>
188 : SInst<(outs PredRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2),
189 !strconcat("$dst = !", !strconcat(opc , "($src1, $src2)")),
190 [(set PredRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2))]>;
191
192class qi_SInst_qi_andqiqi_neg<string opc, Intrinsic IntID>
193 : SInst<(outs PredRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2,
194 IntRegs:$src3),
195 !strconcat("$dst = ", !strconcat(opc ,
196 "($src1, and($src2, !$src3)")),
197 [(set PredRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2,
198 IntRegs:$src3))]>;
199
200class qi_SInst_qi_andqiqi<string opc, Intrinsic IntID>
201 : SInst<(outs PredRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2,
202 IntRegs:$src3),
203 !strconcat("$dst = ", !strconcat(opc ,
204 "($src1, and($src2, $src3)")),
205 [(set PredRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2,
206 IntRegs:$src3))]>;
207
208class qi_SInst_qi_orqiqi_neg<string opc, Intrinsic IntID>
209 : SInst<(outs PredRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2,
210 IntRegs:$src3),
211 !strconcat("$dst = ", !strconcat(opc ,
212 "($src1, or($src2, !$src3)")),
213 [(set PredRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2,
214 IntRegs:$src3))]>;
215
216class qi_SInst_qi_orqiqi<string opc, Intrinsic IntID>
217 : SInst<(outs PredRegs:$dst), (ins IntRegs:$src1, IntRegs:$src2,
218 IntRegs:$src3),
219 !strconcat("$dst = ", !strconcat(opc ,
220 "($src1, or($src2, $src3)")),
221 [(set PredRegs:$dst, (IntID IntRegs:$src1, IntRegs:$src2,
222 IntRegs:$src3))]>;
223
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000224/********************************************************************
225* ALU32/PRED *
226*********************************************************************/
227
228// ALU32 / PRED / Conditional Shift Halfword.
229// ALU32 / PRED / Conditional Sign Extend.
230// ALU32 / PRED / Conditional Zero Extend.
231// ALU32 / PRED / Compare.
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000232def Hexagon_C4_cmpltei : qi_neg_ALU32_sis10 <"cmp.gt", int_hexagon_C4_cmpltei>;
Sid Manning31f71252014-09-25 13:09:54 +0000233def Hexagon_C4_cmplte : qi_neg_ALU32_sisi <"cmp.gt", int_hexagon_C4_cmplte>;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000234def Hexagon_C4_cmplteu : qi_neg_ALU32_sisi <"cmp.gtu",int_hexagon_C4_cmplteu>;
Sid Manning31f71252014-09-25 13:09:54 +0000235
236def: T_RI_pat<C4_cmpneqi, int_hexagon_C4_cmpneqi>;
237def: T_RI_pat<C4_cmpltei, int_hexagon_C4_cmpltei>;
238def: T_RI_pat<C4_cmplteui, int_hexagon_C4_cmplteui>;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000239
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000240
241/********************************************************************
242* CR *
243*********************************************************************/
244
245// CR / Corner Detection Acceleration.
246def Hexagon_C4_fastcorner9:
247 qi_SInst_qiqi<"fastcorner9", int_hexagon_C4_fastcorner9>;
248def Hexagon_C4_fastcorner9_not:
249 qi_neg_SInst_qiqi<"fastcorner9",int_hexagon_C4_fastcorner9_not>;
250
251// CR / Logical Operations On Predicates.
252def Hexagon_C4_and_andn:
253 qi_SInst_qi_andqiqi_neg <"and", int_hexagon_C4_and_andn>;
254def Hexagon_C4_and_and:
255 qi_SInst_qi_andqiqi <"and", int_hexagon_C4_and_and>;
256def Hexagon_C4_and_orn:
257 qi_SInst_qi_orqiqi_neg <"and", int_hexagon_C4_and_orn>;
258def Hexagon_C4_and_or:
259 qi_SInst_qi_orqiqi <"and", int_hexagon_C4_and_or>;
260def Hexagon_C4_or_andn:
261 qi_SInst_qi_andqiqi_neg <"or", int_hexagon_C4_or_andn>;
262def Hexagon_C4_or_and:
263 qi_SInst_qi_andqiqi <"or", int_hexagon_C4_or_and>;
264def Hexagon_C4_or_orn:
265 qi_SInst_qi_orqiqi_neg <"or", int_hexagon_C4_or_orn>;
266def Hexagon_C4_or_or:
267 qi_SInst_qi_orqiqi <"or", int_hexagon_C4_or_or>;