]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/arm/cortex-a15.md
A15 neon description.
[thirdparty/gcc.git] / gcc / config / arm / cortex-a15.md
1 ;; ARM Cortex-A15 pipeline description
2 ;; Copyright (C) 2011 Free Software Foundation, Inc.
3 ;;
4 ;; Written by Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
5
6 ;; This file is part of GCC.
7 ;;
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)
11 ;; any later version.
12 ;;
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.
17 ;;
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/>.
21
22 (define_automaton "cortex_a15")
23
24 ;; The Cortex-A15 core is modelled as a triple issue pipeline that has
25 ;; the following dispatch units.
26 ;; 1. Two pipelines for simple integer operations: SX1, SX2
27 ;; 2. Individual units for Neon and FP operations as in cortex-a15-neon.md
28 ;; 3. One pipeline for branch operations: BX
29 ;; 4. One pipeline for integer multiply and divide operations: MX
30 ;; 5. Two pipelines for load and store operations: LS1, LS2
31 ;;
32 ;; We can issue into three pipelines per-cycle.
33 ;;
34 ;; We assume that where we have unit pairs xx1 is always filled before xx2.
35
36 ;; The three issue units
37 (define_cpu_unit "ca15_i0, ca15_i1, ca15_i2" "cortex_a15")
38
39 (define_reservation "ca15_issue1" "(ca15_i0|ca15_i1|ca15_i2)")
40 (define_reservation "ca15_issue2" "((ca15_i0+ca15_i1)|(ca15_i1+ca15_i2))")
41 (define_reservation "ca15_issue3" "(ca15_i0+ca15_i1+ca15_i2)")
42 (final_presence_set "ca15_i1" "ca15_i0")
43 (final_presence_set "ca15_i2" "ca15_i1")
44
45 ;; The main dispatch units
46 (define_cpu_unit "ca15_sx1, ca15_sx2" "cortex_a15")
47 (define_cpu_unit "ca15_ls1, ca15_ls2" "cortex_a15")
48 (define_cpu_unit "ca15_bx, ca15_mx" "cortex_a15")
49
50 (define_reservation "ca15_ls" "(ca15_ls1|ca15_ls2)")
51
52 ;; The extended load-store pipeline
53 (define_cpu_unit "ca15_ldr, ca15_str" "cortex_a15")
54
55 ;; The extended ALU pipeline
56 (define_cpu_unit "ca15_sx1_alu, ca15_sx1_shf, ca15_sx1_sat" "cortex_a15")
57 (define_cpu_unit "ca15_sx2_alu, ca15_sx2_shf, ca15_sx2_sat" "cortex_a15")
58
59 ;; Simple Execution Unit:
60 ;;
61 ;; Simple ALU without shift
62 (define_insn_reservation "cortex_a15_alu" 2
63 (and (eq_attr "tune" "cortexa15")
64 (and (eq_attr "type" "alu")
65 (eq_attr "neon_type" "none")))
66 "ca15_issue1,(ca15_sx1,ca15_sx1_alu)|(ca15_sx2,ca15_sx2_alu)")
67
68 ;; ALU ops with immediate shift
69 (define_insn_reservation "cortex_a15_alu_shift" 3
70 (and (eq_attr "tune" "cortexa15")
71 (and (eq_attr "type" "alu_shift")
72 (eq_attr "neon_type" "none")))
73 "ca15_issue1,(ca15_sx1,ca15_sx1+ca15_sx1_shf,ca15_sx1_alu)\
74 |(ca15_sx2,ca15_sx2+ca15_sx2_shf,ca15_sx2_alu)")
75
76 ;; ALU ops with register controlled shift
77 (define_insn_reservation "cortex_a15_alu_shift_reg" 3
78 (and (eq_attr "tune" "cortexa15")
79 (and (eq_attr "type" "alu_shift_reg")
80 (eq_attr "neon_type" "none")))
81 "(ca15_issue2,ca15_sx1+ca15_sx2,ca15_sx1_shf,ca15_sx2_alu)\
82 |(ca15_issue1,(ca15_issue1+ca15_sx2,ca15_sx1+ca15_sx2_shf)\
83 |(ca15_issue1+ca15_sx1,ca15_sx1+ca15_sx1_shf),ca15_sx1_alu)")
84
85 ;; Multiply Execution Unit:
86 ;;
87 ;; 32-bit multiplies
88 (define_insn_reservation "cortex_a15_mult32" 3
89 (and (eq_attr "tune" "cortexa15")
90 (and (eq_attr "type" "mult")
91 (and (eq_attr "neon_type" "none")
92 (eq_attr "mul64" "no"))))
93 "ca15_issue1,ca15_mx")
94
95 ;; 64-bit multiplies
96 (define_insn_reservation "cortex_a15_mult64" 4
97 (and (eq_attr "tune" "cortexa15")
98 (and (eq_attr "type" "mult")
99 (and (eq_attr "neon_type" "none")
100 (eq_attr "mul64" "yes"))))
101 "ca15_issue1,ca15_mx*2")
102
103 ;; Integer divide
104 (define_insn_reservation "cortex_a15_udiv" 9
105 (and (eq_attr "tune" "cortexa15")
106 (eq_attr "insn" "udiv"))
107 "ca15_issue1,ca15_mx")
108
109 (define_insn_reservation "cortex_a15_sdiv" 10
110 (and (eq_attr "tune" "cortexa15")
111 (eq_attr "insn" "sdiv"))
112 "ca15_issue1,ca15_mx")
113
114 ;; Block all issue pipes for a cycle
115 (define_insn_reservation "cortex_a15_block" 1
116 (and (eq_attr "tune" "cortexa15")
117 (and (eq_attr "type" "block")
118 (eq_attr "neon_type" "none")))
119 "ca15_issue3")
120
121 ;; Branch execution Unit
122 ;;
123 ;; Branches take one issue slot.
124 ;; No latency as there is no result
125 (define_insn_reservation "cortex_a15_branch" 0
126 (and (eq_attr "tune" "cortexa15")
127 (and (eq_attr "type" "branch")
128 (eq_attr "neon_type" "none")))
129 "ca15_issue1,ca15_bx")
130
131 ;; Load-store execution Unit
132 ;;
133 ;; Loads of up to two words.
134 (define_insn_reservation "cortex_a15_load1" 4
135 (and (eq_attr "tune" "cortexa15")
136 (and (eq_attr "type" "load_byte,load1,load2")
137 (eq_attr "neon_type" "none")))
138 "ca15_issue1,ca15_ls,ca15_ldr,nothing")
139
140 ;; Loads of three or four words.
141 (define_insn_reservation "cortex_a15_load3" 5
142 (and (eq_attr "tune" "cortexa15")
143 (and (eq_attr "type" "load3,load4")
144 (eq_attr "neon_type" "none")))
145 "ca15_issue2,ca15_ls1+ca15_ls2,ca15_ldr,ca15_ldr,nothing")
146
147 ;; Stores of up to two words.
148 (define_insn_reservation "cortex_a15_store1" 0
149 (and (eq_attr "tune" "cortexa15")
150 (and (eq_attr "type" "store1,store2")
151 (eq_attr "neon_type" "none")))
152 "ca15_issue1,ca15_ls,ca15_str")
153
154 ;; Stores of three or four words.
155 (define_insn_reservation "cortex_a15_store3" 0
156 (and (eq_attr "tune" "cortexa15")
157 (and (eq_attr "type" "store3,store4")
158 (eq_attr "neon_type" "none")))
159 "ca15_issue2,ca15_ls1+ca15_ls2,ca15_str,ca15_str")
160
161 ;; We include Neon.md here to ensure that the branch can block the Neon units.
162 (include "cortex-a15-neon.md")
163
164 ;; We lie with calls. They take up all issue slots, and form a block in the
165 ;; pipeline. The result however is available the next cycle.
166 (define_insn_reservation "cortex_a15_call" 1
167 (and (eq_attr "tune" "cortexa15")
168 (and (eq_attr "type" "call")
169 (eq_attr "neon_type" "none")))
170 "ca15_issue3,\
171 ca15_sx1+ca15_sx2+ca15_bx+ca15_mx+ca15_cx_ij+ca15_cx_ik+ca15_ls1+ca15_ls2+\
172 ca15_cx_imac1+ca15_cx_ialu1+ca15_cx_ialu2+ca15_cx_ishf+\
173 ca15_cx_acc+ca15_cx_fmul1+ca15_cx_fmul2+ca15_cx_fmul3+ca15_cx_fmul4+\
174 ca15_cx_falu1+ca15_cx_falu2+ca15_cx_falu3+ca15_cx_falu4+ca15_cx_vfp_i,\
175 ca15_sx1_alu+ca15_sx1_shf+ca15_sx1_sat+ca15_sx2_alu+\
176 ca15_sx2_shf+ca15_sx2_sat+ca15_ldr+ca15_str")
177
178 ;; Simple execution unit bypasses
179 (define_bypass 1 "cortex_a15_alu"
180 "cortex_a15_alu,cortex_a15_alu_shift,cortex_a15_alu_shift_reg")
181 (define_bypass 2 "cortex_a15_alu_shift"
182 "cortex_a15_alu,cortex_a15_alu_shift,cortex_a15_alu_shift_reg")
183 (define_bypass 2 "cortex_a15_alu_shift_reg"
184 "cortex_a15_alu,cortex_a15_alu_shift,cortex_a15_alu_shift_reg")
185 (define_bypass 1 "cortex_a15_alu" "cortex_a15_load1,cortex_a15_load3")
186 (define_bypass 2 "cortex_a15_alu_shift" "cortex_a15_load1,cortex_a15_load3")
187 (define_bypass 2 "cortex_a15_alu_shift_reg"
188 "cortex_a15_load1,cortex_a15_load3")