comparison gcc/config/arm/cortex-a9.md @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents f6334be47118
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 ;; ARM Cortex-A9 pipeline description 1 ;; ARM Cortex-A9 pipeline description
2 ;; Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. 2 ;; Copyright (C) 2008-2017 Free Software Foundation, Inc.
3 ;; Originally written by CodeSourcery for VFP. 3 ;; Originally written by CodeSourcery for VFP.
4 ;; 4 ;;
5 ;; Rewritten by Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> 5 ;; Rewritten by Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
6 ;; Integer Pipeline description contributed by ARM Ltd. 6 ;; Integer Pipeline description contributed by ARM Ltd.
7 ;; VFP Pipeline description rewritten and contributed by ARM Ltd. 7 ;; VFP Pipeline description rewritten and contributed by ARM Ltd.
66 "cortex_a9_multcycle1, cortex_a9_mac_m2, cortex_a9_p0_wb") 66 "cortex_a9_multcycle1, cortex_a9_mac_m2, cortex_a9_p0_wb")
67 (define_reservation "cortex_a9_mult" 67 (define_reservation "cortex_a9_mult"
68 "cortex_a9_mac_m1*2, cortex_a9_mac_m2, cortex_a9_p0_wb") 68 "cortex_a9_mac_m1*2, cortex_a9_mac_m2, cortex_a9_p0_wb")
69 (define_reservation "cortex_a9_mac" 69 (define_reservation "cortex_a9_mac"
70 "cortex_a9_multcycle1*2 ,cortex_a9_mac_m2, cortex_a9_p0_wb") 70 "cortex_a9_multcycle1*2 ,cortex_a9_mac_m2, cortex_a9_p0_wb")
71 71 (define_reservation "cortex_a9_mult_long"
72 "cortex_a9_mac_m1*3, cortex_a9_mac_m2, cortex_a9_p0_wb")
72 73
73 ;; Issue at the same time along the load store pipeline and 74 ;; Issue at the same time along the load store pipeline and
74 ;; the VFP / Neon pipeline is not possible. 75 ;; the VFP / Neon pipeline is not possible.
75 (exclusion_set "cortex_a9_ls" "ca9_issue_vfp_neon") 76 (exclusion_set "cortex_a9_ls" "ca9_issue_vfp_neon")
76 77
77 ;; Default data processing instruction without any shift 78 ;; Default data processing instruction without any shift
78 ;; The only exception to this is the mov instruction 79 ;; The only exception to this is the mov instruction
79 ;; which can go down E2 without any problem. 80 ;; which can go down E2 without any problem.
80 (define_insn_reservation "cortex_a9_dp" 2 81 (define_insn_reservation "cortex_a9_dp" 2
81 (and (eq_attr "tune" "cortexa9") 82 (and (eq_attr "tune" "cortexa9")
82 (ior (and (eq_attr "type" "alu") 83 (eq_attr "type" "alu_imm,alus_imm,logic_imm,logics_imm,\
83 (eq_attr "neon_type" "none")) 84 alu_sreg,alus_sreg,logic_reg,logics_reg,\
84 (and (and (eq_attr "type" "alu_shift_reg, alu_shift") 85 adc_imm,adcs_imm,adc_reg,adcs_reg,\
85 (eq_attr "insn" "mov")) 86 adr,bfm,clz,rbit,rev,alu_dsp_reg,\
86 (eq_attr "neon_type" "none")))) 87 shift_imm,shift_reg,\
88 mov_imm,mov_reg,mvn_imm,mvn_reg,\
89 mov_shift_reg,mov_shift,\
90 mrs,multiple,no_insn"))
87 "cortex_a9_p0_default|cortex_a9_p1_default") 91 "cortex_a9_p0_default|cortex_a9_p1_default")
88 92
89 ;; An instruction using the shifter will go down E1. 93 ;; An instruction using the shifter will go down E1.
90 (define_insn_reservation "cortex_a9_dp_shift" 3 94 (define_insn_reservation "cortex_a9_dp_shift" 3
91 (and (eq_attr "tune" "cortexa9") 95 (and (eq_attr "tune" "cortexa9")
92 (and (eq_attr "type" "alu_shift_reg, alu_shift") 96 (eq_attr "type" "alu_shift_imm,alus_shift_imm,\
93 (not (eq_attr "insn" "mov")))) 97 logic_shift_imm,logics_shift_imm,\
98 alu_shift_reg,alus_shift_reg,\
99 logic_shift_reg,logics_shift_reg,\
100 extend,mvn_shift,mvn_shift_reg"))
94 "cortex_a9_p0_shift | cortex_a9_p1_shift") 101 "cortex_a9_p0_shift | cortex_a9_p1_shift")
95 102
96 ;; Loads have a latency of 4 cycles. 103 ;; Loads have a latency of 4 cycles.
97 ;; We don't model autoincrement instructions. These 104 ;; We don't model autoincrement instructions. These
98 ;; instructions use the load store pipeline and 1 of 105 ;; instructions use the load store pipeline and 1 of
99 ;; the E2 units to write back the result of the increment. 106 ;; the E2 units to write back the result of the increment.
100 107
101 (define_insn_reservation "cortex_a9_load1_2" 4 108 (define_insn_reservation "cortex_a9_load1_2" 4
102 (and (eq_attr "tune" "cortexa9") 109 (and (eq_attr "tune" "cortexa9")
103 (eq_attr "type" "load1, load2, load_byte, f_loads, f_loadd")) 110 (eq_attr "type" "load_4, load_8, load_byte, f_loads, f_loadd"))
104 "cortex_a9_ls") 111 "cortex_a9_ls")
105 112
106 ;; Loads multiples and store multiples can't be issued for 2 cycles in a 113 ;; Loads multiples and store multiples can't be issued for 2 cycles in a
107 ;; row. The description below assumes that addresses are 64 bit aligned. 114 ;; row. The description below assumes that addresses are 64 bit aligned.
108 ;; If not, there is an extra cycle latency which is not modelled. 115 ;; If not, there is an extra cycle latency which is not modelled.
109 116
110 (define_insn_reservation "cortex_a9_load3_4" 5 117 (define_insn_reservation "cortex_a9_load3_4" 5
111 (and (eq_attr "tune" "cortexa9") 118 (and (eq_attr "tune" "cortexa9")
112 (eq_attr "type" "load3, load4")) 119 (eq_attr "type" "load_12, load_16"))
113 "cortex_a9_ls, cortex_a9_ls") 120 "cortex_a9_ls, cortex_a9_ls")
114 121
115 (define_insn_reservation "cortex_a9_store1_2" 0 122 (define_insn_reservation "cortex_a9_store1_2" 0
116 (and (eq_attr "tune" "cortexa9") 123 (and (eq_attr "tune" "cortexa9")
117 (eq_attr "type" "store1, store2, f_stores, f_stored")) 124 (eq_attr "type" "store_4, store_8, f_stores, f_stored"))
118 "cortex_a9_ls") 125 "cortex_a9_ls")
119 126
120 ;; Almost all our store multiples use an auto-increment 127 ;; Almost all our store multiples use an auto-increment
121 ;; form. Don't issue back to back load and store multiples 128 ;; form. Don't issue back to back load and store multiples
122 ;; because the load store unit will stall. 129 ;; because the load store unit will stall.
123 130
124 (define_insn_reservation "cortex_a9_store3_4" 0 131 (define_insn_reservation "cortex_a9_store3_4" 0
125 (and (eq_attr "tune" "cortexa9") 132 (and (eq_attr "tune" "cortexa9")
126 (eq_attr "type" "store3, store4")) 133 (eq_attr "type" "store_12, store_16"))
127 "cortex_a9_ls+(cortex_a9_p0_default | cortex_a9_p1_default), cortex_a9_ls") 134 "cortex_a9_ls+(cortex_a9_p0_default | cortex_a9_p1_default), cortex_a9_ls")
128 135
129 ;; We get 16*16 multiply / mac results in 3 cycles. 136 ;; We get 16*16 multiply / mac results in 3 cycles.
130 (define_insn_reservation "cortex_a9_mult16" 3 137 (define_insn_reservation "cortex_a9_mult16" 3
131 (and (eq_attr "tune" "cortexa9") 138 (and (eq_attr "tune" "cortexa9")
132 (eq_attr "insn" "smulxy")) 139 (eq_attr "type" "smulxy"))
133 "cortex_a9_mult16") 140 "cortex_a9_mult16")
134 141
135 ;; The 16*16 mac is slightly different that it 142 ;; The 16*16 mac is slightly different that it
136 ;; reserves M1 and M2 in the same cycle. 143 ;; reserves M1 and M2 in the same cycle.
137 (define_insn_reservation "cortex_a9_mac16" 3 144 (define_insn_reservation "cortex_a9_mac16" 3
138 (and (eq_attr "tune" "cortexa9") 145 (and (eq_attr "tune" "cortexa9")
139 (eq_attr "insn" "smlaxy")) 146 (eq_attr "type" "smlaxy"))
140 "cortex_a9_mac16") 147 "cortex_a9_mac16")
141 148
142
143 (define_insn_reservation "cortex_a9_multiply" 4 149 (define_insn_reservation "cortex_a9_multiply" 4
144 (and (eq_attr "tune" "cortexa9") 150 (and (eq_attr "tune" "cortexa9")
145 (eq_attr "insn" "mul")) 151 (eq_attr "type" "mul,smmul,smmulr"))
146 "cortex_a9_mult") 152 "cortex_a9_mult")
147 153
148 (define_insn_reservation "cortex_a9_mac" 4 154 (define_insn_reservation "cortex_a9_mac" 4
149 (and (eq_attr "tune" "cortexa9") 155 (and (eq_attr "tune" "cortexa9")
150 (eq_attr "insn" "mla")) 156 (eq_attr "type" "mla,smmla"))
151 "cortex_a9_mac") 157 "cortex_a9_mac")
158
159 (define_insn_reservation "cortex_a9_multiply_long" 5
160 (and (eq_attr "tune" "cortexa9")
161 (eq_attr "type" "smull,umull,smulls,umulls,smlal,smlals,umlal,umlals"))
162 "cortex_a9_mult_long")
152 163
153 ;; An instruction with a result in E2 can be forwarded 164 ;; An instruction with a result in E2 can be forwarded
154 ;; to E2 or E1 or M1 or the load store unit in the next cycle. 165 ;; to E2 or E1 or M1 or the load store unit in the next cycle.
155 166
156 (define_bypass 1 "cortex_a9_dp" 167 (define_bypass 1 "cortex_a9_dp"
157 "cortex_a9_dp_shift, cortex_a9_multiply, 168 "cortex_a9_dp_shift, cortex_a9_multiply,
158 cortex_a9_load1_2, cortex_a9_dp, cortex_a9_store1_2, 169 cortex_a9_load1_2, cortex_a9_dp, cortex_a9_store1_2,
159 cortex_a9_mult16, cortex_a9_mac16, cortex_a9_mac, cortex_a9_store3_4, cortex_a9_load3_4") 170 cortex_a9_mult16, cortex_a9_mac16, cortex_a9_mac, cortex_a9_store3_4, cortex_a9_load3_4,
171 cortex_a9_multiply_long")
160 172
161 (define_bypass 2 "cortex_a9_dp_shift" 173 (define_bypass 2 "cortex_a9_dp_shift"
162 "cortex_a9_dp_shift, cortex_a9_multiply, 174 "cortex_a9_dp_shift, cortex_a9_multiply,
163 cortex_a9_load1_2, cortex_a9_dp, cortex_a9_store1_2, 175 cortex_a9_load1_2, cortex_a9_dp, cortex_a9_store1_2,
164 cortex_a9_mult16, cortex_a9_mac16, cortex_a9_mac, cortex_a9_store3_4, cortex_a9_load3_4") 176 cortex_a9_mult16, cortex_a9_mac16, cortex_a9_mac, cortex_a9_store3_4, cortex_a9_load3_4,
177 cortex_a9_multiply_long")
165 178
166 ;; An instruction in the load store pipeline can provide 179 ;; An instruction in the load store pipeline can provide
167 ;; read access to a DP instruction in the P0 default pipeline 180 ;; read access to a DP instruction in the P0 default pipeline
168 ;; before the writeback stage. 181 ;; before the writeback stage.
169 182
192 205
193 206
194 ;; Pipelining for VFP instructions. 207 ;; Pipelining for VFP instructions.
195 ;; Issue happens either along load store unit or the VFP / Neon unit. 208 ;; Issue happens either along load store unit or the VFP / Neon unit.
196 ;; Pipeline Instruction Classification. 209 ;; Pipeline Instruction Classification.
197 ;; FPS - fcpys, ffariths, ffarithd,r_2_f,f_2_r 210 ;; FPS - fmov, ffariths, ffarithd,f_mcr,f_mcrr,f_mrc,f_mrrc
198 ;; FP_ADD - fadds, faddd, fcmps (1) 211 ;; FP_ADD - fadds, faddd, fcmps (1)
199 ;; FPMUL - fmul{s,d}, fmac{s,d} 212 ;; FPMUL - fmul{s,d}, fmac{s,d}, ffma{s,d}
200 ;; FPDIV - fdiv{s,d} 213 ;; FPDIV - fdiv{s,d}
201 (define_cpu_unit "ca9fps" "cortex_a9") 214 (define_cpu_unit "ca9fps" "cortex_a9")
202 (define_cpu_unit "ca9fp_add1, ca9fp_add2, ca9fp_add3, ca9fp_add4" "cortex_a9") 215 (define_cpu_unit "ca9fp_add1, ca9fp_add2, ca9fp_add3, ca9fp_add4" "cortex_a9")
203 (define_cpu_unit "ca9fp_mul1, ca9fp_mul2 , ca9fp_mul3, ca9fp_mul4" "cortex_a9") 216 (define_cpu_unit "ca9fp_mul1, ca9fp_mul2 , ca9fp_mul3, ca9fp_mul4" "cortex_a9")
204 (define_cpu_unit "ca9fp_ds1" "cortex_a9") 217 (define_cpu_unit "ca9fp_ds1" "cortex_a9")
205 218
206 219
207 ;; fmrs, fmrrd, fmstat and fmrx - The data is available after 1 cycle. 220 ;; fmrs, fmrrd, fmstat and fmrx - The data is available after 1 cycle.
208 (define_insn_reservation "cortex_a9_fps" 2 221 (define_insn_reservation "cortex_a9_fps" 2
209 (and (eq_attr "tune" "cortexa9") 222 (and (eq_attr "tune" "cortexa9")
210 (eq_attr "type" "fcpys, fconsts, fconstd, ffariths, ffarithd, r_2_f, f_2_r, f_flag")) 223 (eq_attr "type" "fmov, fconsts, fconstd, ffariths, ffarithd,\
224 f_mcr, f_mcrr, f_mrc, f_mrrc, f_flag"))
211 "ca9_issue_vfp_neon + ca9fps") 225 "ca9_issue_vfp_neon + ca9fps")
212 226
213 (define_bypass 1 227 (define_bypass 1
214 "cortex_a9_fps" 228 "cortex_a9_fps"
215 "cortex_a9_fadd, cortex_a9_fps, cortex_a9_fcmp, cortex_a9_dp, cortex_a9_dp_shift, cortex_a9_multiply") 229 "cortex_a9_fadd, cortex_a9_fps, cortex_a9_fcmp, cortex_a9_dp, cortex_a9_dp_shift, cortex_a9_multiply, cortex_a9_multiply_long")
216 230
217 ;; Scheduling on the FP_ADD pipeline. 231 ;; Scheduling on the FP_ADD pipeline.
218 (define_reservation "ca9fp_add" "ca9_issue_vfp_neon + ca9fp_add1, ca9fp_add2, ca9fp_add3, ca9fp_add4") 232 (define_reservation "ca9fp_add" "ca9_issue_vfp_neon + ca9fp_add1, ca9fp_add2, ca9fp_add3, ca9fp_add4")
219 233
220 (define_insn_reservation "cortex_a9_fadd" 4 234 (define_insn_reservation "cortex_a9_fadd" 4
221 (and (eq_attr "tune" "cortexa9") 235 (and (eq_attr "tune" "cortexa9")
222 (eq_attr "type" "fadds, faddd, f_cvt")) 236 (eq_attr "type" "fadds, faddd, f_cvt, f_cvtf2i, f_cvti2f"))
223 "ca9fp_add") 237 "ca9fp_add")
224 238
225 (define_insn_reservation "cortex_a9_fcmp" 1 239 (define_insn_reservation "cortex_a9_fcmp" 1
226 (and (eq_attr "tune" "cortexa9") 240 (and (eq_attr "tune" "cortexa9")
227 (eq_attr "type" "fcmps, fcmpd")) 241 (eq_attr "type" "fcmps, fcmpd"))
244 (eq_attr "type" "fmuld")) 258 (eq_attr "type" "fmuld"))
245 "ca9fmuld") 259 "ca9fmuld")
246 260
247 (define_insn_reservation "cortex_a9_fmacs" 8 261 (define_insn_reservation "cortex_a9_fmacs" 8
248 (and (eq_attr "tune" "cortexa9") 262 (and (eq_attr "tune" "cortexa9")
249 (eq_attr "type" "fmacs")) 263 (eq_attr "type" "fmacs,ffmas"))
250 "ca9fmuls, ca9fp_add") 264 "ca9fmuls, ca9fp_add")
251 265
252 (define_insn_reservation "cortex_a9_fmacd" 9 266 (define_insn_reservation "cortex_a9_fmacd" 9
253 (and (eq_attr "tune" "cortexa9") 267 (and (eq_attr "tune" "cortexa9")
254 (eq_attr "type" "fmacd")) 268 (eq_attr "type" "fmacd,ffmad"))
255 "ca9fmuld, ca9fp_add") 269 "ca9fmuld, ca9fp_add")
256 270
257 ;; Division pipeline description. 271 ;; Division pipeline description.
258 (define_insn_reservation "cortex_a9_fdivs" 15 272 (define_insn_reservation "cortex_a9_fdivs" 15
259 (and (eq_attr "tune" "cortexa9") 273 (and (eq_attr "tune" "cortexa9")
260 (eq_attr "type" "fdivs")) 274 (eq_attr "type" "fdivs, fsqrts"))
261 "ca9fp_ds1 + ca9_issue_vfp_neon, nothing*14") 275 "ca9fp_ds1 + ca9_issue_vfp_neon, nothing*14")
262 276
263 (define_insn_reservation "cortex_a9_fdivd" 25 277 (define_insn_reservation "cortex_a9_fdivd" 25
264 (and (eq_attr "tune" "cortexa9") 278 (and (eq_attr "tune" "cortexa9")
265 (eq_attr "type" "fdivd")) 279 (eq_attr "type" "fdivd, fsqrtd"))
266 "ca9fp_ds1 + ca9_issue_vfp_neon, nothing*24") 280 "ca9fp_ds1 + ca9_issue_vfp_neon, nothing*24")
267 281
268 ;; Include Neon pipeline description 282 ;; Include Neon pipeline description
269 (include "cortex-a9-neon.md") 283 (include "cortex-a9-neon.md")