1 ;; ARM Cortex-A53 pipeline description
2 ;; Copyright (C) 2013-2016 Free Software Foundation, Inc.
4 ;; Contributed by ARM Ltd.
6 ;; This file is part of GCC.
8 ;; GCC is free software; you can redistribute it and/or modify it
9 ;; under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 3, or (at your option)
13 ;; GCC is distributed in the hope that it will be useful, but
14 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 ;; General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING3. If not see
20 ;; <http://www.gnu.org/licenses/>.
22 (define_automaton "cortex_a53")
24 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
25 ;; General-purpose functional units.
26 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
28 ;; We use slot0 and slot1 to model constraints on which instructions may
31 (define_cpu_unit "cortex_a53_slot0" "cortex_a53")
32 (define_cpu_unit "cortex_a53_slot1" "cortex_a53")
33 (final_presence_set "cortex_a53_slot1" "cortex_a53_slot0")
35 (define_reservation "cortex_a53_slot_any"
39 (define_reservation "cortex_a53_single_issue"
43 ;; Used to model load and store pipelines. Load/store instructions
44 ;; can dual-issue with other instructions, but two load/stores cannot
45 ;; simultaneously issue.
47 (define_cpu_unit "cortex_a53_store" "cortex_a53")
48 (define_cpu_unit "cortex_a53_load" "cortex_a53")
49 (define_cpu_unit "cortex_a53_ls_agen" "cortex_a53")
51 ;; Used to model a branch pipeline. Branches can dual-issue with other
52 ;; instructions (except when those instructions take multiple cycles
55 (define_cpu_unit "cortex_a53_branch" "cortex_a53")
57 ;; Used to model an integer divide pipeline.
59 (define_cpu_unit "cortex_a53_idiv" "cortex_a53")
61 ;; Used to model an integer multiply/multiply-accumulate pipeline.
63 (define_cpu_unit "cortex_a53_imul" "cortex_a53")
65 ;; Model general structural hazards, for wherever we need them.
67 (define_cpu_unit "cortex_a53_hazard" "cortex_a53")
69 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
71 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
73 (define_insn_reservation "cortex_a53_shift" 2
74 (and (eq_attr "tune" "cortexa53")
75 (eq_attr "type" "adr,shift_imm,mov_imm,mvn_imm,mov_shift"))
76 "cortex_a53_slot_any")
78 (define_insn_reservation "cortex_a53_shift_reg" 2
79 (and (eq_attr "tune" "cortexa53")
80 (eq_attr "type" "shift_reg,mov_shift_reg"))
81 "cortex_a53_slot_any+cortex_a53_hazard")
83 (define_insn_reservation "cortex_a53_alu" 3
84 (and (eq_attr "tune" "cortexa53")
85 (eq_attr "type" "alu_imm,alus_imm,logic_imm,logics_imm,
86 alu_sreg,alus_sreg,logic_reg,logics_reg,
87 adc_imm,adcs_imm,adc_reg,adcs_reg,
88 csel,clz,rbit,rev,alu_dsp_reg,
89 mov_reg,mvn_reg,mrs,multiple,no_insn"))
90 "cortex_a53_slot_any")
92 (define_insn_reservation "cortex_a53_alu_shift" 3
93 (and (eq_attr "tune" "cortexa53")
94 (eq_attr "type" "alu_shift_imm,alus_shift_imm,
95 crc,logic_shift_imm,logics_shift_imm,
96 alu_ext,alus_ext,bfm,extend,mvn_shift"))
97 "cortex_a53_slot_any")
99 (define_insn_reservation "cortex_a53_alu_shift_reg" 3
100 (and (eq_attr "tune" "cortexa53")
101 (eq_attr "type" "alu_shift_reg,alus_shift_reg,
102 logic_shift_reg,logics_shift_reg,
104 "cortex_a53_slot_any+cortex_a53_hazard")
106 (define_insn_reservation "cortex_a53_alu_extr" 3
107 (and (eq_attr "tune" "cortexa53")
108 (eq_attr "type" "rotate_imm"))
109 "cortex_a53_slot1|cortex_a53_single_issue")
111 (define_insn_reservation "cortex_a53_mul" 4
112 (and (eq_attr "tune" "cortexa53")
113 (ior (eq_attr "mul32" "yes")
114 (eq_attr "mul64" "yes")))
115 "cortex_a53_slot_any+cortex_a53_imul")
117 ;; From the perspective of the GCC scheduling state machine, if we wish to
118 ;; model an instruction as serialising other instructions, we are best to do
119 ;; so by modelling it as taking very few cycles. Scheduling many other
120 ;; instructions underneath it at the cost of freedom to pick from the
121 ;; ready list is likely to hurt us more than it helps. However, we do
122 ;; want to model some resource and latency cost for divide instructions in
123 ;; order to avoid divides ending up too lumpy.
125 (define_insn_reservation "cortex_a53_div" 4
126 (and (eq_attr "tune" "cortexa53")
127 (eq_attr "type" "udiv,sdiv"))
128 "cortex_a53_slot0,cortex_a53_idiv*2")
130 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
131 ;; Load/store instructions.
132 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
134 ;; TODO: load<n> is not prescriptive about how much data is to be loaded.
135 ;; This is most obvious for LDRD from AArch32 and LDP (X register) from
136 ;; AArch64, both are tagged load2 but LDP will load 128-bits compared to
137 ;; LDRD which is 64-bits.
139 ;; For the below, we assume AArch64 X-registers for load2, and AArch32
140 ;; registers for load3/load4.
142 (define_insn_reservation "cortex_a53_load1" 4
143 (and (eq_attr "tune" "cortexa53")
144 (eq_attr "type" "load_byte,load1,load_acq"))
145 "cortex_a53_slot_any+cortex_a53_ls_agen,
148 (define_insn_reservation "cortex_a53_store1" 2
149 (and (eq_attr "tune" "cortexa53")
150 (eq_attr "type" "store1,store_rel"))
151 "cortex_a53_slot_any+cortex_a53_ls_agen,
154 ;; Model AArch64-sized LDP Xm, Xn, [Xa]
156 (define_insn_reservation "cortex_a53_load2" 4
157 (and (eq_attr "tune" "cortexa53")
158 (eq_attr "type" "load2"))
159 "cortex_a53_single_issue+cortex_a53_ls_agen,
160 cortex_a53_load+cortex_a53_slot0,
163 (define_insn_reservation "cortex_a53_store2" 2
164 (and (eq_attr "tune" "cortexa53")
165 (eq_attr "type" "store2"))
166 "cortex_a53_slot_any+cortex_a53_ls_agen,
169 ;; Model AArch32-sized LDM Ra, {Rm, Rn, Ro}
171 (define_insn_reservation "cortex_a53_load3plus" 6
172 (and (eq_attr "tune" "cortexa53")
173 (eq_attr "type" "load3,load4"))
174 "cortex_a53_single_issue+cortex_a53_ls_agen,
175 cortex_a53_load+cortex_a53_slot0,
178 (define_insn_reservation "cortex_a53_store3plus" 2
179 (and (eq_attr "tune" "cortexa53")
180 (eq_attr "type" "store3,store4"))
181 "cortex_a53_slot_any+cortex_a53_ls_agen,
182 cortex_a53_store+cortex_a53_slot0,
185 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
187 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
189 ;; Model all branches as dual-issuable from either execution, which
190 ;; is not strictly true for all cases (indirect branches).
192 (define_insn_reservation "cortex_a53_branch" 0
193 (and (eq_attr "tune" "cortexa53")
194 (eq_attr "type" "branch,call"))
195 "cortex_a53_slot_any+cortex_a53_branch")
197 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
198 ;; General-purpose register bypasses
199 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
201 ;; Model bypasses for ALU to ALU instructions.
203 (define_bypass 0 "cortex_a53_shift*"
206 (define_bypass 1 "cortex_a53_shift*"
207 "cortex_a53_shift*,cortex_a53_alu_*")
209 (define_bypass 1 "cortex_a53_alu*"
212 (define_bypass 1 "cortex_a53_alu*"
213 "cortex_a53_alu_shift*"
214 "aarch_forward_to_shift_is_not_shifted_reg")
216 (define_bypass 2 "cortex_a53_alu*"
217 "cortex_a53_alu_*,cortex_a53_shift*")
219 ;; Model a bypass from MUL/MLA to MLA instructions.
221 (define_bypass 1 "cortex_a53_mul"
223 "aarch_accumulator_forwarding")
225 ;; Model a bypass from MUL/MLA to ALU instructions.
227 (define_bypass 2 "cortex_a53_mul"
230 (define_bypass 3 "cortex_a53_mul"
231 "cortex_a53_alu_*,cortex_a53_shift*")
233 ;; Model bypasses for loads which are to be consumed by the ALU.
235 (define_bypass 2 "cortex_a53_load1"
238 (define_bypass 3 "cortex_a53_load1"
239 "cortex_a53_alu_*,cortex_a53_shift*")
241 (define_bypass 3 "cortex_a53_load2"
244 ;; Model a bypass for ALU instructions feeding stores.
246 (define_bypass 0 "cortex_a53_alu*,cortex_a53_shift*"
248 "arm_no_early_store_addr_dep")
250 ;; Model a bypass for load and multiply instructions feeding stores.
252 (define_bypass 1 "cortex_a53_mul,
255 "arm_no_early_store_addr_dep")
257 ;; Model a GP->FP register move as similar to stores.
259 (define_bypass 0 "cortex_a53_alu*,cortex_a53_shift*"
262 (define_bypass 1 "cortex_a53_mul,
266 ;; Model flag forwarding to branches.
268 (define_bypass 0 "cortex_a53_alu*,cortex_a53_shift*"
271 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
272 ;; Floating-point/Advanced SIMD.
273 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
275 (define_automaton "cortex_a53_advsimd")
277 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
278 ;; Broad Advanced SIMD type categorisation
279 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
281 (define_attr "cortex_a53_advsimd_type"
282 "advsimd_alu, advsimd_alu_q,
283 advsimd_mul, advsimd_mul_q,
284 advsimd_div_s, advsimd_div_s_q,
285 advsimd_div_d, advsimd_div_d_q,
286 advsimd_load_64, advsimd_store_64,
287 advsimd_load_128, advsimd_store_128,
288 advsimd_load_lots, advsimd_store_lots,
291 (eq_attr "type" "neon_add, neon_qadd, neon_add_halve, neon_sub, neon_qsub,\
292 neon_sub_halve, neon_abs, neon_neg, neon_qneg,\
293 neon_qabs, neon_abd, neon_minmax, neon_compare,\
294 neon_compare_zero, neon_arith_acc, neon_reduc_add,\
295 neon_reduc_add_acc, neon_reduc_minmax,\
296 neon_logic, neon_tst, neon_shift_imm,\
297 neon_shift_reg, neon_shift_acc, neon_sat_shift_imm,\
298 neon_sat_shift_reg, neon_ins, neon_move,\
299 neon_permute, neon_zip, neon_tbl1,\
300 neon_tbl2, neon_tbl3, neon_tbl4, neon_bsl,\
301 neon_cls, neon_cnt, neon_dup,\
302 neon_ext, neon_rbit, neon_rev,\
303 neon_fp_abd_s, neon_fp_abd_d,\
304 neon_fp_abs_s, neon_fp_abs_d,\
305 neon_fp_addsub_s, neon_fp_addsub_d, neon_fp_compare_s,\
306 neon_fp_compare_d, neon_fp_minmax_s,\
307 neon_fp_minmax_d, neon_fp_neg_s, neon_fp_neg_d,\
308 neon_fp_reduc_add_s, neon_fp_reduc_add_d,\
309 neon_fp_reduc_minmax_s, neon_fp_reduc_minmax_d,\
310 neon_fp_cvt_widen_h, neon_fp_to_int_s,neon_fp_to_int_d,\
311 neon_int_to_fp_s, neon_int_to_fp_d, neon_fp_round_s,\
312 neon_fp_recpe_s, neon_fp_recpe_d, neon_fp_recps_s,\
313 neon_fp_recps_d, neon_fp_recpx_s, neon_fp_recpx_d,\
314 neon_fp_rsqrte_s, neon_fp_rsqrte_d, neon_fp_rsqrts_s,\
316 (const_string "advsimd_alu")
317 (eq_attr "type" "neon_add_q, neon_add_widen, neon_add_long,\
318 neon_qadd_q, neon_add_halve_q, neon_add_halve_narrow_q,\
319 neon_sub_q, neon_sub_widen, neon_sub_long,\
320 neon_qsub_q, neon_sub_halve_q, neon_sub_halve_narrow_q,\
321 neon_abs_q, neon_neg_q, neon_qneg_q, neon_qabs_q,\
322 neon_abd_q, neon_abd_long, neon_minmax_q,\
323 neon_compare_q, neon_compare_zero_q,\
324 neon_arith_acc_q, neon_reduc_add_q,\
325 neon_reduc_add_long, neon_reduc_add_acc_q,\
326 neon_reduc_minmax_q, neon_logic_q, neon_tst_q,\
327 neon_shift_imm_q, neon_shift_imm_narrow_q,\
328 neon_shift_imm_long, neon_shift_reg_q,\
329 neon_shift_acc_q, neon_sat_shift_imm_q,\
330 neon_sat_shift_imm_narrow_q, neon_sat_shift_reg_q,\
331 neon_ins_q, neon_move_q, neon_move_narrow_q,\
332 neon_permute_q, neon_zip_q,\
333 neon_tbl1_q, neon_tbl2_q, neon_tbl3_q,\
334 neon_tbl4_q, neon_bsl_q, neon_cls_q, neon_cnt_q,\
335 neon_dup_q, neon_ext_q, neon_rbit_q,\
336 neon_rev_q, neon_fp_abd_s_q, neon_fp_abd_d_q,\
337 neon_fp_abs_s_q, neon_fp_abs_d_q,\
338 neon_fp_addsub_s_q, neon_fp_addsub_d_q,\
339 neon_fp_compare_s_q, neon_fp_compare_d_q,\
340 neon_fp_minmax_s_q, neon_fp_minmax_d_q,\
341 neon_fp_cvt_widen_s, neon_fp_neg_s_q, neon_fp_neg_d_q,\
342 neon_fp_reduc_add_s_q, neon_fp_reduc_add_d_q,\
343 neon_fp_reduc_minmax_s_q, neon_fp_reduc_minmax_d_q,\
344 neon_fp_cvt_narrow_s_q, neon_fp_cvt_narrow_d_q,\
345 neon_fp_to_int_s_q, neon_fp_to_int_d_q,\
346 neon_int_to_fp_s_q, neon_int_to_fp_d_q,\
348 neon_fp_recpe_s_q, neon_fp_recpe_d_q,\
349 neon_fp_recps_s_q, neon_fp_recps_d_q,\
350 neon_fp_recpx_s_q, neon_fp_recpx_d_q,\
351 neon_fp_rsqrte_s_q, neon_fp_rsqrte_d_q,\
352 neon_fp_rsqrts_s_q, neon_fp_rsqrts_d_q")
353 (const_string "advsimd_alu_q")
354 (eq_attr "type" "neon_mul_b, neon_mul_h, neon_mul_s,\
355 neon_mul_h_scalar, neon_mul_s_scalar,\
356 neon_sat_mul_b, neon_sat_mul_h, neon_sat_mul_s,\
357 neon_sat_mul_h_scalar, neon_sat_mul_s_scalar,\
358 neon_mla_b, neon_mla_h, neon_mla_s,\
359 neon_mla_h_scalar, neon_mla_s_scalar,\
360 neon_fp_mul_s, neon_fp_mul_s_scalar,\
361 neon_fp_mul_d, neon_fp_mla_s,\
362 neon_fp_mla_s_scalar, neon_fp_mla_d")
363 (const_string "advsimd_mul")
364 (eq_attr "type" "neon_mul_b_q, neon_mul_h_q, neon_mul_s_q,\
365 neon_mul_b_long, neon_mul_h_long, neon_mul_s_long,\
366 neon_mul_d_long, neon_mul_h_scalar_q,\
367 neon_mul_s_scalar_q, neon_mul_h_scalar_long,\
368 neon_mul_s_scalar_long, neon_sat_mul_b_q,\
369 neon_sat_mul_h_q, neon_sat_mul_s_q,\
370 neon_sat_mul_b_long, neon_sat_mul_h_long,\
371 neon_sat_mul_s_long, neon_sat_mul_h_scalar_q,\
372 neon_sat_mul_s_scalar_q, neon_sat_mul_h_scalar_long,\
373 neon_sat_mul_s_scalar_long, neon_mla_b_q,\
374 neon_mla_h_q, neon_mla_s_q, neon_mla_b_long,\
375 neon_mla_h_long, neon_mla_s_long,\
376 neon_mla_h_scalar_q, neon_mla_s_scalar_q,\
377 neon_mla_h_scalar_long, neon_mla_s_scalar_long,\
378 neon_sat_mla_b_long, neon_sat_mla_h_long,\
379 neon_sat_mla_s_long, neon_sat_mla_h_scalar_long,\
380 neon_sat_mla_s_scalar_long,\
381 neon_fp_mul_s_q, neon_fp_mul_s_scalar_q,\
382 neon_fp_mul_d_q, neon_fp_mul_d_scalar_q,\
383 neon_fp_mla_s_q, neon_fp_mla_s_scalar_q,\
384 neon_fp_mla_d_q, neon_fp_mla_d_scalar_q")
385 (const_string "advsimd_mul_q")
386 (eq_attr "type" "neon_fp_sqrt_s, neon_fp_div_s")
387 (const_string "advsimd_div_s")
388 (eq_attr "type" "neon_fp_sqrt_s_q, neon_fp_div_s_q")
389 (const_string "advsimd_div_s_q")
390 (eq_attr "type" "neon_fp_sqrt_d, neon_fp_div_d")
391 (const_string "advsimd_div_d")
392 (eq_attr "type" "neon_fp_sqrt_d_q, neon_fp_div_d_q")
393 (const_string "advsimd_div_d_q")
394 (eq_attr "type" "neon_ldr, neon_load1_1reg,\
395 neon_load1_all_lanes, neon_load1_all_lanes_q,\
396 neon_load1_one_lane, neon_load1_one_lane_q")
397 (const_string "advsimd_load_64")
398 (eq_attr "type" "neon_str, neon_store1_1reg,\
399 neon_store1_one_lane,neon_store1_one_lane_q")
400 (const_string "advsimd_store_64")
401 (eq_attr "type" "neon_load1_1reg_q, neon_load1_2reg,\
403 neon_load2_all_lanes, neon_load2_all_lanes_q,\
404 neon_load2_one_lane, neon_load2_one_lane_q")
405 (const_string "advsimd_load_128")
406 (eq_attr "type" "neon_store1_1reg_q, neon_store1_2reg,\
408 neon_store2_one_lane, neon_store2_one_lane_q")
409 (const_string "advsimd_store_128")
410 (eq_attr "type" "neon_load1_2reg_q, neon_load1_3reg, neon_load1_3reg_q,\
411 neon_load1_4reg, neon_load1_4reg_q, \
412 neon_load2_2reg_q, neon_load2_4reg,\
413 neon_load2_4reg_q, neon_load3_3reg,\
414 neon_load3_3reg_q, neon_load3_all_lanes,\
415 neon_load3_all_lanes_q, neon_load3_one_lane,\
416 neon_load3_one_lane_q, neon_load4_4reg,\
417 neon_load4_4reg_q, neon_load4_all_lanes,\
418 neon_load4_all_lanes_q, neon_load4_one_lane,\
419 neon_load4_one_lane_q, neon_ldp, neon_ldp_q")
420 (const_string "advsimd_load_lots")
421 (eq_attr "type" "neon_store1_2reg_q, neon_store1_3reg,\
422 neon_store1_3reg_q, neon_store1_4reg,\
423 neon_store1_4reg_q, neon_store2_2reg_q,\
424 neon_store2_4reg, neon_store2_4reg_q,\
425 neon_store3_3reg, neon_store3_3reg_q,\
426 neon_store3_one_lane, neon_store3_one_lane_q,\
427 neon_store4_4reg, neon_store4_4reg_q,\
428 neon_store4_one_lane, neon_store4_one_lane_q,\
429 neon_stp, neon_stp_q")
430 (const_string "advsimd_store_lots")]
431 (const_string "unknown")))
433 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
434 ;; Floating-point/Advanced SIMD functional units.
435 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
437 ;; We model the Advanced SIMD unit as two 64-bit units, each with three
438 ;; pipes, FP_ALU, FP_MUL, FP_DIV. We also give convenient reservations
439 ;; for 128-bit Advanced SIMD instructions, which use both units.
441 ;; The floating-point/Advanced SIMD ALU pipelines.
443 (define_cpu_unit "cortex_a53_fp_alu_lo,\
444 cortex_a53_fp_alu_hi"
445 "cortex_a53_advsimd")
447 (define_reservation "cortex_a53_fp_alu"
448 "cortex_a53_fp_alu_lo\
449 |cortex_a53_fp_alu_hi")
451 (define_reservation "cortex_a53_fp_alu_q"
452 "cortex_a53_fp_alu_lo\
453 +cortex_a53_fp_alu_hi")
455 ;; The floating-point/Advanced SIMD multiply/multiply-accumulate
458 (define_cpu_unit "cortex_a53_fp_mul_lo,\
459 cortex_a53_fp_mul_hi"
460 "cortex_a53_advsimd")
462 (define_reservation "cortex_a53_fp_mul"
463 "cortex_a53_fp_mul_lo\
464 |cortex_a53_fp_mul_hi")
466 (define_reservation "cortex_a53_fp_mul_q"
467 "cortex_a53_fp_mul_lo\
468 +cortex_a53_fp_mul_hi")
470 ;; Floating-point/Advanced SIMD divide/square root.
472 (define_cpu_unit "cortex_a53_fp_div_lo,\
473 cortex_a53_fp_div_hi"
474 "cortex_a53_advsimd")
476 ;; Once we choose a pipe, stick with it for three simulated cycles.
478 (define_reservation "cortex_a53_fp_div"
479 "(cortex_a53_fp_div_lo*3)\
480 |(cortex_a53_fp_div_hi*3)")
482 (define_reservation "cortex_a53_fp_div_q"
483 "(cortex_a53_fp_div_lo*3)\
484 +(cortex_a53_fp_div_hi*3)")
486 ;; Cryptographic extensions
488 (define_cpu_unit "cortex_a53_crypto"
489 "cortex_a53_advsimd")
491 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
492 ;; Floating-point arithmetic.
493 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
495 (define_insn_reservation "cortex_a53_fpalu" 5
496 (and (eq_attr "tune" "cortexa53")
497 (eq_attr "type" "ffariths, fadds, ffarithd, faddd, fmov,
498 f_cvt, fcmps, fcmpd, fccmps, fccmpd, fcsel,
499 f_rints, f_rintd, f_minmaxs, f_minmaxd"))
500 "cortex_a53_slot_any,cortex_a53_fp_alu")
502 (define_insn_reservation "cortex_a53_fconst" 3
503 (and (eq_attr "tune" "cortexa53")
504 (eq_attr "type" "fconsts,fconstd"))
505 "cortex_a53_slot_any,cortex_a53_fp_alu")
507 (define_insn_reservation "cortex_a53_fpmul" 5
508 (and (eq_attr "tune" "cortexa53")
509 (eq_attr "type" "fmuls,fmuld"))
510 "cortex_a53_slot_any,cortex_a53_fp_mul")
512 ;; For multiply-accumulate, model the add (accumulate) as being issued
513 ;; after the multiply completes.
515 (define_insn_reservation "cortex_a53_fpmac" 8
516 (and (eq_attr "tune" "cortexa53")
517 (eq_attr "type" "fmacs,fmacd,ffmas,ffmad"))
518 "cortex_a53_slot_any,cortex_a53_fp_mul,
519 nothing*3, cortex_a53_fp_alu")
521 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
522 ;; Floating-point to/from core transfers.
523 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
525 (define_insn_reservation "cortex_a53_r2f" 6
526 (and (eq_attr "tune" "cortexa53")
527 (eq_attr "type" "f_mcr,f_mcrr,f_cvti2f,
528 neon_from_gp, neon_from_gp_q"))
529 "cortex_a53_slot_any,cortex_a53_store,
530 nothing,cortex_a53_fp_alu")
532 (define_insn_reservation "cortex_a53_f2r" 6
533 (and (eq_attr "tune" "cortexa53")
534 (eq_attr "type" "f_mrc,f_mrrc,f_cvtf2i,
535 neon_to_gp, neon_to_gp_q"))
536 "cortex_a53_slot_any,cortex_a53_fp_alu,
537 nothing,cortex_a53_store")
539 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
540 ;; Floating-point flag transfer.
541 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
543 (define_insn_reservation "cortex_a53_f_flags" 5
544 (and (eq_attr "tune" "cortexa53")
545 (eq_attr "type" "f_flag"))
546 "cortex_a53_slot_any")
548 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
549 ;; Floating-point load/store.
550 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
552 (define_insn_reservation "cortex_a53_f_load_64" 4
553 (and (eq_attr "tune" "cortexa53")
554 (ior (eq_attr "type" "f_loads,f_loadd")
555 (eq_attr "cortex_a53_advsimd_type"
557 "cortex_a53_slot_any+cortex_a53_ls_agen,
560 (define_insn_reservation "cortex_a53_f_load_many" 5
561 (and (eq_attr "tune" "cortexa53")
562 (eq_attr "cortex_a53_advsimd_type"
563 "advsimd_load_128,advsimd_load_lots"))
564 "cortex_a53_single_issue+cortex_a53_ls_agen,
565 cortex_a53_load+cortex_a53_slot0,
568 (define_insn_reservation "cortex_a53_f_store_64" 0
569 (and (eq_attr "tune" "cortexa53")
570 (ior (eq_attr "type" "f_stores,f_stored")
571 (eq_attr "cortex_a53_advsimd_type"
572 "advsimd_store_64")))
573 "cortex_a53_slot_any+cortex_a53_ls_agen,
576 (define_insn_reservation "cortex_a53_f_store_many" 0
577 (and (eq_attr "tune" "cortexa53")
578 (eq_attr "cortex_a53_advsimd_type"
579 "advsimd_store_128,advsimd_store_lots"))
580 "cortex_a53_slot_any+cortex_a53_ls_agen,
581 cortex_a53_store+cortex_a53_slot0,
584 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
586 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
588 ;; Either we want to model use of the ALU pipe, the multiply pipe or the
589 ;; divide/sqrt pipe. In all cases we need to check if we are a 64-bit
590 ;; operation (in which case we model dual-issue without penalty)
591 ;; or a 128-bit operation in which case we require in our model that we
592 ;; issue from slot 0.
594 (define_insn_reservation "cortex_a53_advsimd_alu" 5
595 (and (eq_attr "tune" "cortexa53")
596 (eq_attr "cortex_a53_advsimd_type" "advsimd_alu"))
597 "cortex_a53_slot_any,cortex_a53_fp_alu")
599 (define_insn_reservation "cortex_a53_advsimd_alu_q" 5
600 (and (eq_attr "tune" "cortexa53")
601 (eq_attr "cortex_a53_advsimd_type" "advsimd_alu_q"))
602 "cortex_a53_slot0,cortex_a53_fp_alu_q")
604 (define_insn_reservation "cortex_a53_advsimd_mul" 5
605 (and (eq_attr "tune" "cortexa53")
606 (eq_attr "cortex_a53_advsimd_type" "advsimd_mul"))
607 "cortex_a53_slot_any,cortex_a53_fp_mul")
609 (define_insn_reservation "cortex_a53_advsimd_mul_q" 5
610 (and (eq_attr "tune" "cortexa53")
611 (eq_attr "cortex_a53_advsimd_type" "advsimd_mul_q"))
612 "cortex_a53_slot0,cortex_a53_fp_mul_q")
616 (define_insn_reservation "cortex_a53_advsimd_div_s" 14
617 (and (eq_attr "tune" "cortexa53")
618 (ior (eq_attr "type" "fdivs,fsqrts")
619 (eq_attr "cortex_a53_advsimd_type" "advsimd_div_s")))
620 "cortex_a53_slot0,cortex_a53_fp_mul,
623 (define_insn_reservation "cortex_a53_advsimd_div_d" 29
624 (and (eq_attr "tune" "cortexa53")
625 (ior (eq_attr "type" "fdivd,fsqrtd")
626 (eq_attr "cortex_a53_advsimd_type" "advsimd_div_d")))
627 "cortex_a53_slot0,cortex_a53_fp_mul,
630 (define_insn_reservation "cortex_a53_advsimd_div_s_q" 14
631 (and (eq_attr "tune" "cortexa53")
632 (eq_attr "cortex_a53_advsimd_type" "advsimd_div_s_q"))
633 "cortex_a53_single_issue,cortex_a53_fp_mul_q,
634 cortex_a53_fp_div_q")
636 (define_insn_reservation "cortex_a53_advsimd_divd_q" 29
637 (and (eq_attr "tune" "cortexa53")
638 (eq_attr "cortex_a53_advsimd_type" "advsimd_div_d_q"))
639 "cortex_a53_single_issue,cortex_a53_fp_mul_q,
640 cortex_a53_fp_div_q")
642 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
643 ;; ARMv8-A Cryptographic extensions.
644 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
646 ;; We want AESE and AESMC to end up consecutive to one another.
648 (define_insn_reservation "cortex_a53_crypto_aese" 3
649 (and (eq_attr "tune" "cortexa53")
650 (eq_attr "type" "crypto_aese"))
653 (define_insn_reservation "cortex_a53_crypto_aesmc" 3
654 (and (eq_attr "tune" "cortexa53")
655 (eq_attr "type" "crypto_aesmc"))
656 "cortex_a53_slot_any")
660 (define_insn_reservation "cortex_a53_crypto_sha1_fast" 3
661 (and (eq_attr "tune" "cortexa53")
662 (eq_attr "type" "crypto_sha1_fast"))
663 "cortex_a53_slot_any,cortex_a53_crypto")
665 (define_insn_reservation "cortex_a53_crypto_sha256_fast" 3
666 (and (eq_attr "tune" "cortexa53")
667 (eq_attr "type" "crypto_sha256_fast"))
668 "cortex_a53_slot0,cortex_a53_crypto")
670 (define_insn_reservation "cortex_a53_crypto_sha1_xor" 4
671 (and (eq_attr "tune" "cortexa53")
672 (eq_attr "type" "crypto_sha1_xor"))
673 "cortex_a53_slot0,cortex_a53_crypto")
675 (define_insn_reservation "cortex_a53_crypto_sha_slow" 5
676 (and (eq_attr "tune" "cortexa53")
677 (eq_attr "type" "crypto_sha1_slow, crypto_sha256_slow"))
678 "cortex_a53_slot0,cortex_a53_crypto")
680 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
681 ;; Floating-point/Advanced SIMD register bypasses.
682 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
684 ;; Model the late use of the accumulator operand for floating-point
685 ;; multiply-accumulate operations as a bypass reducing the latency
686 ;; of producing instructions to near zero.
688 (define_bypass 1 "cortex_a53_fp*,
692 "aarch_accumulator_forwarding")
694 ;; Model a bypass from the result of an FP operation to a use.
696 (define_bypass 4 "cortex_a53_fpalu,
701 cortex_a53_advsimd_div*")
703 ;; We want AESE and AESMC to end up consecutive to one another.
705 (define_bypass 0 "cortex_a53_crypto_aese"
706 "cortex_a53_crypto_aesmc"
707 "aarch_crypto_can_dual_issue")