1 ;; Machine description for AppliedMicro xgene1 core.
2 ;; Copyright (C) 2012-2025 Free Software Foundation, Inc.
3 ;; Contributed by Theobroma Systems Design und Consulting GmbH.
5 ;; This file is part of GCC.
7 ;; GCC is free software; you can redistribute it and/or modify it
8 ;; under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 3, or (at your option)
12 ;; GCC is distributed in the hope that it will be useful, but
13 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 ;; General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GCC; see the file COPYING3. If not see
19 ;; <http://www.gnu.org/licenses/>.
21 ;; Pipeline description for the xgene1 micro-architecture
23 (define_automaton "xgene1_main, xgene1_decoder, xgene1_div, xgene1_simd")
25 (define_cpu_unit "xgene1_decode_out0" "xgene1_decoder")
26 (define_cpu_unit "xgene1_decode_out1" "xgene1_decoder")
27 (define_cpu_unit "xgene1_decode_out2" "xgene1_decoder")
28 (define_cpu_unit "xgene1_decode_out3" "xgene1_decoder")
30 (define_cpu_unit "xgene1_IXA" "xgene1_main")
31 (define_cpu_unit "xgene1_IXB" "xgene1_main")
32 (define_cpu_unit "xgene1_IXB_compl" "xgene1_main")
34 (define_reservation "xgene1_IXn" "(xgene1_IXA | xgene1_IXB)")
36 (define_cpu_unit "xgene1_multiply" "xgene1_main")
37 (define_cpu_unit "xgene1_divide" "xgene1_div")
38 (define_cpu_unit "xgene1_fp_divide" "xgene1_div")
39 (define_cpu_unit "xgene1_fsu" "xgene1_simd")
40 (define_cpu_unit "xgene1_fcmp" "xgene1_simd")
41 (define_cpu_unit "xgene1_ld" "xgene1_main")
42 (define_cpu_unit "xgene1_st" "xgene1_main")
44 (define_reservation "xgene1_decode1op"
45 "( xgene1_decode_out0 )
46 |( xgene1_decode_out1 )
47 |( xgene1_decode_out2 )
48 |( xgene1_decode_out3 )"
50 (define_reservation "xgene1_decode2op"
51 "( xgene1_decode_out0 + xgene1_decode_out1 )
52 |( xgene1_decode_out0 + xgene1_decode_out2 )
53 |( xgene1_decode_out0 + xgene1_decode_out3 )
54 |( xgene1_decode_out1 + xgene1_decode_out2 )
55 |( xgene1_decode_out1 + xgene1_decode_out3 )
56 |( xgene1_decode_out2 + xgene1_decode_out3 )"
58 (define_reservation "xgene1_decodeIsolated"
59 "( xgene1_decode_out0 + xgene1_decode_out1 + xgene1_decode_out2 + xgene1_decode_out3 )"
62 (define_insn_reservation "xgene1_branch" 1
63 (and (eq_attr "tune" "xgene1")
64 (eq_attr "type" "branch"))
67 (define_insn_reservation "xgene1_call" 1
68 (and (eq_attr "tune" "xgene1")
69 (eq_attr "type" "call"))
72 (define_insn_reservation "xgene1_f_load" 10
73 (and (eq_attr "tune" "xgene1")
74 (eq_attr "type" "f_loadd,f_loads"))
75 "xgene1_decode2op, xgene1_ld")
77 (define_insn_reservation "xgene1_f_store" 4
78 (and (eq_attr "tune" "xgene1")
79 (eq_attr "type" "f_stored,f_stores"))
80 "xgene1_decode2op, xgene1_st")
82 (define_insn_reservation "xgene1_fmov" 2
83 (and (eq_attr "tune" "xgene1")
84 (eq_attr "type" "fmov,fconsts,fconstd"))
87 (define_insn_reservation "xgene1_f_mcr" 10
88 (and (eq_attr "tune" "xgene1")
89 (eq_attr "type" "f_mcr"))
90 "xgene1_decodeIsolated")
92 (define_insn_reservation "xgene1_f_mrc" 4
93 (and (eq_attr "tune" "xgene1")
94 (eq_attr "type" "f_mrc"))
97 (define_insn_reservation "xgene1_load_pair" 6
98 (and (eq_attr "tune" "xgene1")
99 (eq_attr "type" "load_16"))
100 "xgene1_decodeIsolated, xgene1_ld*2")
102 (define_insn_reservation "xgene1_store_pair" 2
103 (and (eq_attr "tune" "xgene1")
104 (eq_attr "type" "store_16"))
105 "xgene1_decodeIsolated, xgene1_st*2")
107 (define_insn_reservation "xgene1_fp_load1" 10
108 (and (eq_attr "tune" "xgene1")
109 (eq_attr "type" "load_4, load_8")
110 (eq_attr "fp" "yes"))
111 "xgene1_decode1op, xgene1_ld")
113 (define_insn_reservation "xgene1_load1" 5
114 (and (eq_attr "tune" "xgene1")
115 (eq_attr "type" "load_4, load_8"))
116 "xgene1_decode1op, xgene1_ld")
118 (define_insn_reservation "xgene1_store1" 1
119 (and (eq_attr "tune" "xgene1")
120 (eq_attr "type" "store_4, store_8"))
121 "xgene1_decode1op, xgene1_st")
123 (define_insn_reservation "xgene1_move" 1
124 (and (eq_attr "tune" "xgene1")
125 (eq_attr "type" "mov_reg,mov_imm,mrs"))
126 "xgene1_decode1op, xgene1_IXn")
128 (define_insn_reservation "xgene1_alu_cond" 1
129 (and (eq_attr "tune" "xgene1")
130 (eq_attr "type" "csel"))
131 "xgene1_decode1op, xgene1_IXn")
133 (define_insn_reservation "xgene1_alu" 1
134 (and (eq_attr "tune" "xgene1")
135 (eq_attr "type" "alu_imm,alu_sreg,alu_shift_imm_lsl_1to4,alu_shift_imm_other,\
136 alu_ext,adc_reg,logic_imm,\
137 logic_reg,logic_shift_imm,clz,\
138 rbit,adr,mov_reg,shift_imm,\
139 mov_imm,extend,multiple"))
140 "xgene1_decode1op, xgene1_IXn")
142 (define_insn_reservation "xgene1_shift_rotate" 2
143 (and (eq_attr "tune" "xgene1")
144 (eq_attr "type" "shift_reg"))
145 "xgene1_decode1op, xgene1_IXB, xgene1_IXB_compl")
147 (define_insn_reservation "xgene1_simd" 2
148 (and (eq_attr "tune" "xgene1")
149 (eq_attr "type" "rev"))
150 "xgene1_decode1op, xgene1_IXB, xgene1_IXB_compl")
152 (define_insn_reservation "xgene1_alus" 1
153 (and (eq_attr "tune" "xgene1")
154 (eq_attr "type" "alus_imm,alus_sreg,alus_shift_imm,\
155 alus_ext,logics_imm,logics_reg,\
157 "xgene1_decode1op, xgene1_IXB, xgene1_IXB_compl")
159 (define_bypass 2 "xgene1_alus"
160 "xgene1_alu_cond, xgene1_branch")
162 (define_insn_reservation "xgene1_mul32" 4
163 (and (eq_attr "tune" "xgene1")
164 (eq_attr "mul32" "yes"))
165 "xgene1_decode2op, xgene1_IXB + xgene1_multiply, xgene1_multiply, nothing, xgene1_IXB_compl")
167 (define_insn_reservation "xgene1_widen_mul64" 5
168 (and (eq_attr "tune" "xgene1")
169 (eq_attr "widen_mul64" "yes"))
170 "xgene1_decode2op, xgene1_IXB + xgene1_multiply, xgene1_multiply, nothing*2, xgene1_IXB_compl")
172 (define_insn_reservation "xgene1_div" 34
173 (and (eq_attr "tune" "xgene1")
174 (eq_attr "type" "sdiv,udiv"))
175 "xgene1_decode1op, xgene1_IXB + xgene1_divide*7")
177 (define_insn_reservation "xgene1_fcmp" 10
178 (and (eq_attr "tune" "xgene1")
179 (eq_attr "type" "fcmpd,fcmps,fccmpd,fccmps"))
180 "xgene1_decode1op, xgene1_fsu + xgene1_fcmp*3")
182 (define_insn_reservation "xgene1_fcsel" 3
183 (and (eq_attr "tune" "xgene1")
184 (eq_attr "type" "fcsel"))
185 "xgene1_decode1op, xgene1_fsu")
187 (define_insn_reservation "xgene1_bfx" 1
188 (and (eq_attr "tune" "xgene1")
189 (eq_attr "type" "bfx"))
190 "xgene1_decode1op, xgene1_IXn")
192 (define_insn_reservation "xgene1_bfm" 2
193 (and (eq_attr "tune" "xgene1")
194 (eq_attr "type" "bfm"))
195 "xgene1_decode1op, xgene1_IXB, xgene1_IXB_compl")
197 (define_insn_reservation "xgene1_f_rint" 5
198 (and (eq_attr "tune" "xgene1")
199 (eq_attr "type" "f_rintd,f_rints"))
200 "xgene1_decode1op, xgene1_fsu")
202 (define_insn_reservation "xgene1_f_cvt" 3
203 (and (eq_attr "tune" "xgene1")
204 (eq_attr "type" "f_cvt"))
205 "xgene1_decode1op,xgene1_fsu")
207 (define_insn_reservation "xgene1_f_cvtf2i" 11
208 (and (eq_attr "tune" "xgene1")
209 (eq_attr "type" "f_cvtf2i"))
210 "xgene1_decodeIsolated,xgene1_fsu")
212 (define_insn_reservation "xgene1_f_cvti2f" 14
213 (and (eq_attr "tune" "xgene1")
214 (eq_attr "type" "f_cvti2f"))
215 "xgene1_decodeIsolated,xgene1_fsu")
217 (define_insn_reservation "xgene1_f_add" 5
218 (and (eq_attr "tune" "xgene1")
219 (eq_attr "type" "faddd,fadds,fmuld,fmuls"))
220 "xgene1_decode1op,xgene1_fsu")
222 (define_insn_reservation "xgene1_f_divs" 22
223 (and (eq_attr "tune" "xgene1")
224 (eq_attr "type" "fdivs,fsqrts"))
225 "xgene1_decode1op,(xgene1_fp_divide+xgene1_fsu)*8,xgene1_fp_divide*14")
227 (define_insn_reservation "xgene1_f_divd" 28
228 (and (eq_attr "tune" "xgene1")
229 (eq_attr "type" "fdivd"))
230 "xgene1_decode1op,(xgene1_fp_divide+xgene1_fsu)*11,xgene1_fp_divide*17")
232 (define_insn_reservation "xgene1_f_sqrtd" 28
233 (and (eq_attr "tune" "xgene1")
234 (eq_attr "type" "fsqrtd"))
235 "xgene1_decode1op,(xgene1_fp_divide+xgene1_fsu)*17,xgene1_fp_divide*11")
237 (define_insn_reservation "xgene1_f_arith" 2
238 (and (eq_attr "tune" "xgene1")
239 (eq_attr "type" "ffarithd,ffariths"))
240 "xgene1_decode1op,xgene1_fsu")
242 (define_insn_reservation "xgene1_f_select" 3
243 (and (eq_attr "tune" "xgene1")
244 (eq_attr "type" "f_minmaxd,f_minmaxs"))
245 "xgene1_decode1op,xgene1_fsu")
247 (define_insn_reservation "xgene1_neon_dup" 3
248 (and (eq_attr "tune" "xgene1")
249 (eq_attr "type" "neon_dup,neon_dup_q"))
250 "xgene1_decode1op,xgene1_fsu")
252 (define_insn_reservation "xgene1_neon_load1" 11
253 (and (eq_attr "tune" "xgene1")
254 (eq_attr "type" "neon_load1_1reg, neon_load1_1reg_q"))
255 "xgene1_decode2op, xgene1_ld")
257 (define_insn_reservation "xgene1_neon_store1" 5
258 (and (eq_attr "tune" "xgene1")
259 (eq_attr "type" "neon_store1_1reg, neon_store1_1reg_q"))
260 "xgene1_decode2op, xgene1_st")
262 (define_insn_reservation "xgene1_neon_logic" 2
263 (and (eq_attr "tune" "xgene1")
264 (eq_attr "type" "neon_logic,\
271 "xgene1_decode1op,xgene1_fsu")
273 (define_insn_reservation "xgene1_neon_umov" 7
274 (and (eq_attr "tune" "xgene1")
275 (eq_attr "type" "neon_to_gp, neon_to_gp_q"))
276 "xgene1_decodeIsolated")
278 (define_insn_reservation "xgene1_neon_ins" 14
279 (and (eq_attr "tune" "xgene1")
280 (eq_attr "type" "neon_from_gp,\
285 "xgene1_decodeIsolated,xgene1_fsu")
287 (define_insn_reservation "xgene1_neon_shift" 3
288 (and (eq_attr "tune" "xgene1")
289 (eq_attr "type" "neon_shift_imm,\
293 neon_shift_imm_long,\
295 neon_sat_shift_imm_q,\
296 neon_sat_shift_imm_narrow_q,\
298 neon_sat_shift_reg_q,\
299 neon_shift_imm_narrow_q,\
301 "xgene1_decode1op,xgene1_fsu")
303 (define_insn_reservation "xgene1_neon_arith" 3
304 (and (eq_attr "tune" "xgene1")
305 (eq_attr "type" "neon_add,\
327 neon_compare_zero_q,\
333 "xgene1_decode1op,xgene1_fsu")
335 (define_insn_reservation "xgene1_neon_abs_diff" 6
336 (and (eq_attr "tune" "xgene1")
337 (eq_attr "type" "neon_arith_acc,neon_arith_acc_q"))
338 "xgene1_decode2op,xgene1_fsu*2")
340 (define_insn_reservation "xgene1_neon_mul" 5
341 (and (eq_attr "tune" "xgene1")
342 (eq_attr "type" "neon_mul_b,\
348 neon_fp_mul_s_scalar,\
349 neon_fp_mul_s_scalar_q,\
350 neon_fp_mul_d_scalar_q,\
351 neon_mla_b,neon_mla_b_q,\
352 neon_mla_h,neon_mla_h_q,\
353 neon_mla_s,neon_mla_s_q,\
355 neon_mla_h_scalar_q,\
357 neon_mla_s_scalar_q,\
369 neon_fp_mla_s_scalar,\
370 neon_fp_mla_s_scalar_q,\
371 neon_fp_mla_d_scalar_q,\
378 neon_sat_mul_h_scalar,\
379 neon_sat_mul_h_scalar_q,\
380 neon_sat_mul_s_scalar,\
381 neon_sat_mul_s_scalar_q,\
382 neon_sat_mul_h_scalar_long,\
383 neon_sat_mul_s_scalar_long,\
384 neon_sat_mla_b_long,\
385 neon_sat_mla_h_long,\
386 neon_sat_mla_s_long,\
387 neon_sat_mla_h_scalar_long,\
388 neon_sat_mla_s_scalar_long,\
390 "xgene1_decode2op,xgene1_fsu*2")
392 (define_insn_reservation "xgene1_fp_abd_diff" 5
393 (and (eq_attr "tune" "xgene1")
394 (eq_attr "type" "neon_fp_abd_s,\
399 "xgene1_decode1op,xgene1_fsu")
401 (define_insn_reservation "xgene1_neon_f_add" 5
402 (and (eq_attr "tune" "xgene1")
403 (eq_attr "type" "neon_fp_addsub_s,\
410 (define_insn_reservation "xgene1_neon_f_div" 2
411 (and (eq_attr "tune" "xgene1")
412 (eq_attr "type" "neon_fp_div_s,\
417 "xgene1_decode1op,(xgene1_fsu+xgene1_fp_divide)")
419 (define_insn_reservation "xgene1_neon_f_neg" 2
420 (and (eq_attr "tune" "xgene1")
421 (eq_attr "type" "neon_fp_neg_s,\
432 (define_insn_reservation "xgene1_neon_f_round" 5
433 (and (eq_attr "tune" "xgene1")
434 (eq_attr "type" "neon_fp_round_s,\
441 (define_insn_reservation "xgene1_neon_f_cvt" 5
442 (and (eq_attr "tune" "xgene1")
443 (eq_attr "type" "neon_int_to_fp_s,\
447 neon_fp_cvt_widen_s,\
448 neon_fp_cvt_narrow_s_q,\
449 neon_fp_cvt_narrow_d_q,\
453 (define_insn_reservation "xgene1_neon_f_reduc" 5
454 (and (eq_attr "tune" "xgene1")
455 (eq_attr "type" "neon_fp_reduc_add_s,\
456 neon_fp_reduc_add_s_q,\
457 neon_fp_reduc_add_d,\
458 neon_fp_reduc_add_d_q,\
462 (define_insn_reservation "xgene1_neon_cls" 2
463 (and (eq_attr "tune" "xgene1")
464 (eq_attr "type" "neon_cls,neon_cls_q"))
467 (define_insn_reservation "xgene1_neon_st1" 4
468 (and (eq_attr "tune" "xgene1")
469 (eq_attr "type" "neon_store1_one_lane,\
470 neon_store1_one_lane_q,\
474 "xgene1_decodeIsolated, xgene1_st")
476 (define_insn_reservation "xgene1_neon_halve_narrow" 6
477 (and (eq_attr "tune" "xgene1")
478 (eq_attr "type" "neon_sub_halve_narrow_q,\
479 neon_add_halve_narrow_q,\
481 "xgene1_decodeIsolated")
483 (define_insn_reservation "xgene1_neon_shift_acc" 6
484 (and (eq_attr "tune" "xgene1")
485 (eq_attr "type" "neon_shift_acc,\
490 (define_insn_reservation "xgene1_neon_fp_compare" 3
491 (and (eq_attr "tune" "xgene1")
492 (eq_attr "type" "neon_fp_compare_s,\
493 neon_fp_compare_s_q,\
495 neon_fp_compare_d_q,\
499 (define_insn_reservation "xgene1_neon_fp_sqrt" 2
500 (and (eq_attr "tune" "xgene1")
501 (eq_attr "type" "neon_fp_sqrt_s,\
506 "xgene1_decode1op,(xgene1_fsu+xgene1_fp_divide)")
508 (define_insn_reservation "xgene1_neon_tbl1" 4
509 (and (eq_attr "tune" "xgene1")
510 (eq_attr "type" "neon_tbl1,\
515 (define_insn_reservation "xgene1_neon_tbl2" 8
516 (and (eq_attr "tune" "xgene1")
517 (eq_attr "type" "neon_tbl2,\
520 "xgene1_decodeIsolated")
522 (define_insn_reservation "xgene1_neon_permute" 3
523 (and (eq_attr "tune" "xgene1")
524 (eq_attr "type" "neon_permute,\
529 (define_insn_reservation "xgene1_neon_ld1r" 10
530 (and (eq_attr "tune" "xgene1")
531 (eq_attr "type" "neon_load1_all_lanes,\
533 "xgene1_decode1op, xgene1_ld")
535 (define_insn_reservation "xgene1_neon_fp_recp" 3
536 (and (eq_attr "tune" "xgene1")
537 (eq_attr "type" "neon_fp_recpe_s,\
549 (define_insn_reservation "xgene1_neon_fp_recp_s" 5
550 (and (eq_attr "tune" "xgene1")
551 (eq_attr "type" "neon_fp_recps_s,\
558 (define_insn_reservation "xgene1_neon_pmull" 5
559 (and (eq_attr "tune" "xgene1")
560 (eq_attr "type" "neon_mul_d_long,\