Turn SLOW_UNALIGNED_ACCESS into a target hook
[official-gcc.git] / gcc / config / arm / xgene1.md
blob34a13f4eae089e5dbc8dbaac4c979ffde225485a
1 ;; Machine description for AppliedMicro xgene1 core.
2 ;; Copyright (C) 2012-2017 Free Software Foundation, Inc.
3 ;; Contributed by Theobroma Systems Design und Consulting GmbH.
4 ;;
5 ;; This file is part of GCC.
6 ;;
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)
10 ;; any later version.
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")
25 (define_cpu_unit "xgene1_decode_out0" "xgene1")
26 (define_cpu_unit "xgene1_decode_out1" "xgene1")
27 (define_cpu_unit "xgene1_decode_out2" "xgene1")
28 (define_cpu_unit "xgene1_decode_out3" "xgene1")
30 (define_cpu_unit "xgene1_divide" "xgene1")
31 (define_cpu_unit "xgene1_fp_divide" "xgene1")
32 (define_cpu_unit "xgene1_fsu" "xgene1")
33 (define_cpu_unit "xgene1_fcmp" "xgene1")
35 (define_reservation "xgene1_decode1op"
36         "( xgene1_decode_out0 )
37         |( xgene1_decode_out1 )
38         |( xgene1_decode_out2 )
39         |( xgene1_decode_out3 )"
41 (define_reservation "xgene1_decode2op"
42         "( xgene1_decode_out0 + xgene1_decode_out1 )
43         |( xgene1_decode_out0 + xgene1_decode_out2 )
44         |( xgene1_decode_out0 + xgene1_decode_out3 )
45         |( xgene1_decode_out1 + xgene1_decode_out2 )
46         |( xgene1_decode_out1 + xgene1_decode_out3 )
47         |( xgene1_decode_out2 + xgene1_decode_out3 )"
49 (define_reservation "xgene1_decodeIsolated"
50         "( xgene1_decode_out0 + xgene1_decode_out1 + xgene1_decode_out2 + xgene1_decode_out3 )"
53 (define_insn_reservation "xgene1_branch" 1
54   (and (eq_attr "tune" "xgene1")
55        (eq_attr "type" "branch"))
56   "xgene1_decode1op")
58 (define_insn_reservation "xgene1_nop" 1
59   (and (eq_attr "tune" "xgene1")
60        (eq_attr "type" "no_insn"))
61   "xgene1_decode1op")
63 (define_insn_reservation "xgene1_call" 1
64   (and (eq_attr "tune" "xgene1")
65        (eq_attr "type" "call"))
66   "xgene1_decode2op")
68 (define_insn_reservation "xgene1_f_load" 10
69   (and (eq_attr "tune" "xgene1")
70        (eq_attr "type" "f_loadd,f_loads"))
71   "xgene1_decode2op")
73 (define_insn_reservation "xgene1_f_store" 4
74   (and (eq_attr "tune" "xgene1")
75        (eq_attr "type" "f_stored,f_stores"))
76   "xgene1_decode2op")
78 (define_insn_reservation "xgene1_fmov" 2
79   (and (eq_attr "tune" "xgene1")
80        (eq_attr "type" "fmov,fconsts,fconstd"))
81   "xgene1_decode1op")
83 (define_insn_reservation "xgene1_f_mcr" 10
84   (and (eq_attr "tune" "xgene1")
85        (eq_attr "type" "f_mcr"))
86   "xgene1_decodeIsolated")
88 (define_insn_reservation "xgene1_f_mrc" 4
89   (and (eq_attr "tune" "xgene1")
90        (eq_attr "type" "f_mrc"))
91   "xgene1_decode2op")
93 (define_insn_reservation "xgene1_load_pair" 6
94   (and (eq_attr "tune" "xgene1")
95        (eq_attr "type" "load2"))
96   "xgene1_decodeIsolated")
98 (define_insn_reservation "xgene1_store_pair" 2
99   (and (eq_attr "tune" "xgene1")
100        (eq_attr "type" "store2"))
101   "xgene1_decodeIsolated")
103 (define_insn_reservation "xgene1_fp_load1" 10
104   (and (eq_attr "tune" "xgene1")
105        (eq_attr "type" "load1")
106        (eq_attr "fp" "yes"))
107   "xgene1_decode1op")
109 (define_insn_reservation "xgene1_load1" 5
110   (and (eq_attr "tune" "xgene1")
111        (eq_attr "type" "load1"))
112   "xgene1_decode1op")
114 (define_insn_reservation "xgene1_store1" 2
115   (and (eq_attr "tune" "xgene1")
116        (eq_attr "type" "store1"))
117   "xgene1_decode2op")
119 (define_insn_reservation "xgene1_move" 1
120   (and (eq_attr "tune" "xgene1")
121        (eq_attr "type" "mov_reg,mov_imm,mrs"))
122   "xgene1_decode1op")
124 (define_insn_reservation "xgene1_alu" 1
125   (and (eq_attr "tune" "xgene1")
126        (eq_attr "type" "alu_imm,alu_sreg,alu_shift_imm,\
127                         alu_ext,adc_reg,csel,logic_imm,\
128                         logic_reg,logic_shift_imm,clz,\
129                         rbit,shift_reg,adr,mov_reg,\
130                         mov_imm,extend"))
131   "xgene1_decode1op")
133 (define_insn_reservation "xgene1_simd" 1
134   (and (eq_attr "tune" "xgene1")
135        (eq_attr "type" "rev"))
136   "xgene1_decode1op")
138 (define_insn_reservation "xgene1_alus" 1
139   (and (eq_attr "tune" "xgene1")
140        (eq_attr "type" "alus_imm,alu_sreg,alus_shift_imm,\
141                         alus_ext,logics_imm,logics_reg,\
142                         logics_shift_imm"))
143   "xgene1_decode1op")
145 (define_insn_reservation "xgene1_mul" 6
146   (and (eq_attr "tune" "xgene1")
147        (eq_attr "type" "mul,mla,smull,umull,smlal,umlal"))
148   "xgene1_decode2op")
150 (define_insn_reservation "xgene1_div" 34
151   (and (eq_attr "tune" "xgene1")
152        (eq_attr "type" "sdiv,udiv"))
153   "xgene1_decode1op,xgene1_divide*7")
155 (define_insn_reservation "xgene1_fcmp" 10
156   (and (eq_attr "tune" "xgene1")
157        (eq_attr "type" "fcmpd,fcmps,fccmpd,fccmps"))
158   "xgene1_decode1op,xgene1_fsu+xgene1_fcmp*3")
160 (define_insn_reservation "xgene1_fcsel" 3
161   (and (eq_attr "tune" "xgene1")
162        (eq_attr "type" "fcsel"))
163   "xgene1_decode1op,xgene1_fsu")
165 (define_insn_reservation "xgene1_bfm" 2
166   (and (eq_attr "tune" "xgene1")
167        (eq_attr "type" "bfm,bfx"))
168   "xgene1_decode1op,xgene1_fsu")
170 (define_insn_reservation "xgene1_f_rint" 5
171   (and (eq_attr "tune" "xgene1")
172        (eq_attr "type" "f_rintd,f_rints"))
173   "xgene1_decode1op,xgene1_fsu")
175 (define_insn_reservation "xgene1_f_cvt" 3
176   (and (eq_attr "tune" "xgene1")
177        (eq_attr "type" "f_cvt"))
178   "xgene1_decode1op,xgene1_fsu")
180 (define_insn_reservation "xgene1_f_cvtf2i" 11
181   (and (eq_attr "tune" "xgene1")
182        (eq_attr "type" "f_cvtf2i"))
183   "xgene1_decodeIsolated,xgene1_fsu")
185 (define_insn_reservation "xgene1_f_cvti2f" 14
186   (and (eq_attr "tune" "xgene1")
187        (eq_attr "type" "f_cvti2f"))
188   "xgene1_decodeIsolated,xgene1_fsu")
190 (define_insn_reservation "xgene1_f_add" 5
191   (and (eq_attr "tune" "xgene1")
192        (eq_attr "type" "faddd,fadds,fmuld,fmuls"))
193   "xgene1_decode1op,xgene1_fsu")
195 (define_insn_reservation "xgene1_f_divs" 22
196   (and (eq_attr "tune" "xgene1")
197        (eq_attr "type" "fdivs,fsqrts"))
198   "xgene1_decode1op,(xgene1_fp_divide+xgene1_fsu)*8,xgene1_fp_divide*14")
200 (define_insn_reservation "xgene1_f_divd" 28
201   (and (eq_attr "tune" "xgene1")
202        (eq_attr "type" "fdivd"))
203   "xgene1_decode1op,(xgene1_fp_divide+xgene1_fsu)*11,xgene1_fp_divide*17")
205 (define_insn_reservation "xgene1_f_sqrtd" 28
206   (and (eq_attr "tune" "xgene1")
207        (eq_attr "type" "fsqrtd"))
208   "xgene1_decode1op,(xgene1_fp_divide+xgene1_fsu)*17,xgene1_fp_divide*11")
210 (define_insn_reservation "xgene1_f_arith" 2
211   (and (eq_attr "tune" "xgene1")
212        (eq_attr "type" "ffarithd,ffariths"))
213   "xgene1_decode1op,xgene1_fsu")
215 (define_insn_reservation "xgene1_f_select" 3
216   (and (eq_attr "tune" "xgene1")
217        (eq_attr "type" "f_minmaxd,f_minmaxs"))
218   "xgene1_decode1op,xgene1_fsu")
220 (define_insn_reservation "xgene1_neon_dup" 3
221   (and (eq_attr "tune" "xgene1")
222        (eq_attr "type" "neon_dup,neon_dup_q"))
223   "xgene1_decode1op,xgene1_fsu")
225 (define_insn_reservation "xgene1_neon_load1" 11
226   (and (eq_attr "tune" "xgene1")
227        (eq_attr "type" "neon_load1_1reg, neon_load1_1reg_q"))
228   "xgene1_decode2op,xgene1_fsu")
230 (define_insn_reservation "xgene1_neon_store1" 5
231   (and (eq_attr "tune" "xgene1")
232        (eq_attr "type" "neon_store1_1reg, neon_store1_1reg_q"))
233   "xgene1_decode2op,xgene1_fsu")
235 (define_insn_reservation "xgene1_neon_logic" 2
236   (and (eq_attr "tune" "xgene1")
237        (eq_attr "type" "neon_logic,\
238                         neon_logic_q,\
239                         neon_bsl,\
240                         neon_bsl_q,\
241                         neon_move,\
242                         neon_move_q,\
243                        "))
244   "xgene1_decode1op,xgene1_fsu")
246 (define_insn_reservation "xgene1_neon_umov" 7
247   (and (eq_attr "tune" "xgene1")
248        (eq_attr "type" "neon_to_gp, neon_to_gp_q"))
249   "xgene1_decodeIsolated")
251 (define_insn_reservation "xgene1_neon_ins" 14
252   (and (eq_attr "tune" "xgene1")
253        (eq_attr "type" "neon_from_gp,\
254                         neon_from_gp_q,\
255                         neon_ins,\
256                         neon_ins_q,\
257                        "))
258   "xgene1_decodeIsolated,xgene1_fsu")
260 (define_insn_reservation "xgene1_neon_shift" 3
261   (and (eq_attr "tune" "xgene1")
262        (eq_attr "type" "neon_shift_imm,\
263                         neon_shift_imm_q,\
264                         neon_shift_reg,\
265                         neon_shift_reg_q,\
266                         neon_shift_imm_long,\
267                         neon_sat_shift_imm,\
268                         neon_sat_shift_imm_q,\
269                         neon_sat_shift_imm_narrow_q,\
270                         neon_sat_shift_reg,\
271                         neon_sat_shift_reg_q,\
272                         neon_shift_imm_narrow_q,\
273                        "))
274   "xgene1_decode1op,xgene1_fsu")
276 (define_insn_reservation "xgene1_neon_arith" 3
277   (and (eq_attr "tune" "xgene1")
278        (eq_attr "type" "neon_add,\
279                         neon_add_q,\
280                         neon_sub,\
281                         neon_sub_q,\
282                         neon_neg,\
283                         neon_neg_q,\
284                         neon_abs,\
285                         neon_abs_q,\
286                         neon_abd_q,\
287                         neon_arith_acc,\
288                         neon_arith_acc_q,\
289                         neon_reduc_add,\
290                         neon_reduc_add_q,\
291                         neon_add_halve,\
292                         neon_add_halve_q,\
293                         neon_sub_halve,\
294                         neon_sub_halve_q,\
295                         neon_qadd,\
296                         neon_qadd_q,\
297                         neon_compare,\
298                         neon_compare_q,\
299                         neon_compare_zero,\
300                         neon_compare_zero_q,\
301                         neon_tst,\
302                         neon_tst_q,\
303                        "))
304   "xgene1_decode1op,xgene1_fsu")
306 (define_insn_reservation "xgene1_neon_abs_diff" 6
307   (and (eq_attr "tune" "xgene1")
308        (eq_attr "type" "neon_arith_acc,neon_arith_acc_q"))
309   "xgene1_decode2op,xgene1_fsu*2")
311 (define_insn_reservation "xgene1_neon_mul" 5
312   (and (eq_attr "tune" "xgene1")
313        (eq_attr "type" "neon_mul_b,\
314                         neon_mul_b_q,\
315                         neon_mul_h,\
316                         neon_mul_h_q,\
317                         neon_mul_s,\
318                         neon_mul_s_q,\
319                         neon_fp_mul_s_scalar,\
320                         neon_fp_mul_s_scalar_q,\
321                         neon_fp_mul_d_scalar_q,\
322                         neon_mla_b,neon_mla_b_q,\
323                         neon_mla_h,neon_mla_h_q,\
324                         neon_mla_s,neon_mla_s_q,\
325                         neon_mla_h_scalar,\
326                         neon_mla_h_scalar_q,\
327                         neon_mla_s_scalar,\
328                         neon_mla_s_scalar_q,\
329                         neon_mla_b_long,\
330                         neon_mla_h_long,\
331                         neon_mla_s_long,\
332                         neon_fp_mul_s,\
333                         neon_fp_mul_s_q,\
334                         neon_fp_mul_d,\
335                         neon_fp_mul_d_q,\
336                         neon_fp_mla_s,\
337                         neon_fp_mla_s_q,\
338                         neon_fp_mla_d,\
339                         neon_fp_mla_d_q,\
340                         neon_fp_mla_s_scalar,\
341                         neon_fp_mla_s_scalar_q,\
342                         neon_fp_mla_d_scalar_q,\
343                         neon_sat_mul_b,\
344                         neon_sat_mul_b_q,\
345                         neon_sat_mul_h,\
346                         neon_sat_mul_h_q,\
347                         neon_sat_mul_s,\
348                         neon_sat_mul_s_q,\
349                         neon_sat_mul_h_scalar,\
350                         neon_sat_mul_h_scalar_q,\
351                         neon_sat_mul_s_scalar,\
352                         neon_sat_mul_s_scalar_q,\
353                         neon_sat_mul_h_scalar_long,\
354                         neon_sat_mul_s_scalar_long,\
355                         neon_sat_mla_b_long,\
356                         neon_sat_mla_h_long,\
357                         neon_sat_mla_s_long,\
358                         neon_sat_mla_h_scalar_long,\
359                         neon_sat_mla_s_scalar_long,\
360                        "))
361   "xgene1_decode2op,xgene1_fsu*2")
363 (define_insn_reservation "xgene1_fp_abd_diff" 5
364   (and (eq_attr "tune" "xgene1")
365        (eq_attr "type" "neon_fp_abd_s,\
366                         neon_fp_abd_s_q,\
367                         neon_fp_abd_d,\
368                         neon_fp_abd_d_q,\
369                        "))
370   "xgene1_decode1op,xgene1_fsu")
372 (define_insn_reservation "xgene1_neon_f_add" 5
373   (and (eq_attr "tune" "xgene1")
374        (eq_attr "type" "neon_fp_addsub_s,\
375                         neon_fp_addsub_s_q,\
376                         neon_fp_addsub_d,\
377                         neon_fp_addsub_d_q,\
378                        "))
379   "xgene1_decode1op")
381 (define_insn_reservation "xgene1_neon_f_div" 2
382   (and (eq_attr "tune" "xgene1")
383        (eq_attr "type" "neon_fp_div_s,\
384                         neon_fp_div_s_q,\
385                         neon_fp_div_d,\
386                         neon_fp_div_d_q,\
387                        "))
388   "xgene1_decode1op,(xgene1_fsu+xgene1_fp_divide)")
390 (define_insn_reservation "xgene1_neon_f_neg" 2
391   (and (eq_attr "tune" "xgene1")
392        (eq_attr "type" "neon_fp_neg_s,\
393                         neon_fp_neg_s_q,\
394                         neon_fp_neg_d,\
395                         neon_fp_neg_d_q,\
396                         neon_fp_abs_s,\
397                         neon_fp_abs_s_q,\
398                         neon_fp_abs_d,\
399                         neon_fp_abs_d_q,\
400                        "))
401   "xgene1_decode1op")
403 (define_insn_reservation "xgene1_neon_f_round" 5
404   (and (eq_attr "tune" "xgene1")
405        (eq_attr "type" "neon_fp_round_s,\
406                         neon_fp_round_s_q,\
407                         neon_fp_round_d,\
408                         neon_fp_round_d_q,\
409                        "))
410   "xgene1_decode1op")
412 (define_insn_reservation "xgene1_neon_f_cvt" 5
413   (and (eq_attr "tune" "xgene1")
414        (eq_attr "type"  "neon_int_to_fp_s,\
415                          neon_int_to_fp_s_q,\
416                          neon_int_to_fp_d,\
417                          neon_int_to_fp_d_q,\
418                          neon_fp_cvt_widen_s,\
419                          neon_fp_cvt_narrow_s_q,\
420                          neon_fp_cvt_narrow_d_q,\
421                         "))
422   "xgene1_decode1op")
424 (define_insn_reservation "xgene1_neon_f_reduc" 5
425   (and (eq_attr "tune" "xgene1")
426        (eq_attr "type" "neon_fp_reduc_add_s,\
427                         neon_fp_reduc_add_s_q,\
428                         neon_fp_reduc_add_d,\
429                         neon_fp_reduc_add_d_q,\
430                        "))
431   "xgene1_decode1op")
433 (define_insn_reservation "xgene1_neon_cls" 2
434   (and (eq_attr "tune" "xgene1")
435        (eq_attr "type" "neon_cls,neon_cls_q"))
436   "xgene1_decode1op")
438 (define_insn_reservation "xgene1_neon_st1" 4
439   (and (eq_attr "tune" "xgene1")
440        (eq_attr "type" "neon_store1_one_lane,\
441                         neon_store1_one_lane_q,\
442                        "))
443   "xgene1_decode1op")
445 (define_insn_reservation "xgene1_neon_halve_narrow" 6
446   (and (eq_attr "tune" "xgene1")
447        (eq_attr "type" "neon_sub_halve_narrow_q,\
448                         neon_add_halve_narrow_q,\
449                        "))
450   "xgene1_decodeIsolated")
452 (define_insn_reservation "xgene1_neon_shift_acc" 6
453   (and (eq_attr "tune" "xgene1")
454        (eq_attr "type" "neon_shift_acc,\
455                         neon_shift_acc_q,\
456                        "))
457   "xgene1_decode2op")
459 (define_insn_reservation "xgene1_neon_fp_compare" 3
460   (and (eq_attr "tune" "xgene1")
461        (eq_attr "type" "neon_fp_compare_s,\
462                         neon_fp_compare_s_q,\
463                         neon_fp_compare_d,\
464                         neon_fp_compare_d_q,\
465                        "))
466   "xgene1_decode1op")
468 (define_insn_reservation "xgene1_neon_fp_sqrt" 2
469   (and (eq_attr "tune" "xgene1")
470        (eq_attr "type" "neon_fp_sqrt_s,\
471                         neon_fp_sqrt_s_q,\
472                         neon_fp_sqrt_d,\
473                         neon_fp_sqrt_d_q,\
474                        "))
475   "xgene1_decode1op,(xgene1_fsu+xgene1_fp_divide)")
477 (define_insn_reservation "xgene1_neon_tbl1" 4
478   (and (eq_attr "tune" "xgene1")
479        (eq_attr "type" "neon_tbl1,\
480                         neon_tbl1_q,\
481                        "))
482   "xgene1_decode2op")
484 (define_insn_reservation "xgene1_neon_tbl2" 8
485   (and (eq_attr "tune" "xgene1")
486        (eq_attr "type" "neon_tbl2,\
487                         neon_tbl2_q,\
488                        "))
489   "xgene1_decodeIsolated")
491 (define_insn_reservation "xgene1_neon_permute" 3
492   (and (eq_attr "tune" "xgene1")
493        (eq_attr "type" "neon_permute,\
494                         neon_permute_q,\
495                        "))
496   "xgene1_decode2op")
498 (define_insn_reservation "xgene1_neon_ld1r" 10
499   (and (eq_attr "tune" "xgene1")
500        (eq_attr "type" "neon_load1_all_lanes,\
501                        "))
502   "xgene1_decode1op")
504 (define_insn_reservation "xgene1_neon_fp_recp" 3
505   (and (eq_attr "tune" "xgene1")
506        (eq_attr "type" "neon_fp_recpe_s,\
507                         neon_fp_recpe_s_q,\
508                         neon_fp_recpe_d,\
509                         neon_fp_recpe_d_q,\
510                         neon_fp_recpx_s,\
511                         neon_fp_recpx_s_q,\
512                         neon_fp_recpx_d,\
513                         neon_fp_recpx_d_q,\
514                        "))
515   "xgene1_decode1op")
518 (define_insn_reservation "xgene1_neon_fp_recp_s" 5
519   (and (eq_attr "tune" "xgene1")
520        (eq_attr "type" "neon_fp_recps_s,\
521                         neon_fp_recps_s_q,\
522                         neon_fp_recps_d,\
523                         neon_fp_recps_d_q,\
524                        "))
525   "xgene1_decode1op")
527 (define_insn_reservation "xgene1_neon_pmull" 5
528   (and (eq_attr "tune" "xgene1")
529        (eq_attr "type" "neon_mul_d_long,\
530                         crypto_pmull,\
531                        "))
532   "xgene1_decode2op")