summaryrefslogtreecommitdiff
path: root/gcc/config/arm/cortex-m7.md
blob: e4695ad666f14929388ce06b011bde95245b9c01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
;; ARM Cortex-M7 pipeline description
;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
;;
;; This file is part of GCC.
;;
;; GCC is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;;
;; GCC is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GCC; see the file COPYING3.  If not see
;; <http://www.gnu.org/licenses/>.

(define_automaton "cortex_m7")

;; We model the dual-issue constraints of this core with
;; following units.

(define_cpu_unit "cm7_i0, cm7_i1" "cortex_m7")
(define_cpu_unit "cm7_a0, cm7_a1" "cortex_m7")
(define_cpu_unit "cm7_branch,cm7_wb,cm7_ext,cm7_shf" "cortex_m7")
(define_cpu_unit "cm7_lsu" "cortex_m7")
(define_cpu_unit "cm7_mac" "cortex_m7")
(define_cpu_unit "cm7_fpu" "cortex_m7")

(define_reservation "cm7_all_units"
                    "cm7_i0+cm7_i1+cm7_a0+cm7_a1+cm7_branch\
                     +cm7_wb+cm7_ext+cm7_shf+cm7_lsu+cm7_mac\
                     +cm7_fpu")

;; Simple alu instruction without inline shift operation.
(define_insn_reservation "cortex_m7_alu_simple" 2
  (and (eq_attr "tune" "cortexm7")
       (eq_attr "type" "alu_imm,alus_imm,logic_imm,logics_imm,\
                        alu_sreg,alus_sreg,logic_reg,logics_reg,\
                        adc_imm,adcs_imm,adc_reg,adcs_reg,\
                        adr,bfm,rev,\
                        shift_imm,shift_reg,\
                        mov_imm,mov_reg,mvn_imm,mvn_reg,\
                        mov_shift_reg,mov_shift,\
                        mvn_shift,mvn_shift_reg,\
                        logic_shift_imm,logics_shift_imm,\
                        alu_shift_reg,alus_shift_reg,\
                        logic_shift_reg,logics_shift_reg,\
                        mrs,clz,f_mcr,f_mrc,multiple,no_insn"))
  "cm7_i0|cm7_i1,cm7_a0|cm7_a1")

;; Simple alu with inline shift operation.
(define_insn_reservation "cortex_m7_alu_shift" 2
   (and (eq_attr "tune" "cortexm7")
	(eq_attr "type" "alu_shift_imm,alus_shift_imm"))
   "cm7_i0|cm7_i1,(cm7_a0|cm7_a1)+cm7_shf+cm7_branch")

;; Only one ALU can be used for DSP instructions.
(define_insn_reservation "cortex_m7_dsp" 2
  (and (eq_attr "tune" "cortexm7")
       (eq_attr "type" "alu_dsp_reg,smlaxy,smlalxy,smulxy"))
  "cm7_i0|cm7_i1,cm7_a0")

;; The multiply instructions.
(define_insn_reservation "cortex_m7_multiply" 2
   (and (eq_attr "tune" "cortexm7")
        (eq_attr "type" "mul,muls,umull,smull"))
   "cm7_i0|cm7_i1,(cm7_a0|cm7_a1)+cm7_wb")

(define_insn_reservation "cortex_m7_idiv" 4
   (and (eq_attr "tune" "cortexm7")
        (eq_attr "type" "sdiv,udiv"))
   "cm7_all_units*4")

(define_insn_reservation "cortex_m7_alu_extend" 2
   (and (eq_attr "tune" "cortexm7")
        (eq_attr "type" "extend"))
   "cm7_i0|cm7_i1,(cm7_a0|cm7_a1)+cm7_ext+cm7_branch")

(define_insn_reservation "cortex_m7_mac" 2
   (and (eq_attr "tune" "cortexm7")
        (eq_attr "type" "mla,mlas"))
   "cm7_i0|cm7_i1,cm7_mac+cm7_wb")

;; The branch instructions.
(define_insn_reservation "cortex_m7_branch" 0
   (and (eq_attr "tune" "cortexm7")
        (eq_attr "type" "branch,call"))
   "cm7_i0|cm7_i1,cm7_branch")

;; The load instructions.
(define_insn_reservation "cortex_m7_load1" 2
   (and (eq_attr "tune" "cortexm7")
        (eq_attr "type" "load_byte, load_4"))
   "cm7_i0|cm7_i1,cm7_lsu")

(define_insn_reservation "cortex_m7_load2" 2
   (and (eq_attr "tune" "cortexm7")
        (eq_attr "type" "load_8"))
   "cm7_all_units")

(define_insn_reservation "cortex_m7_loadm" 2
   (and (eq_attr "tune" "cortexm7")
        (eq_attr "type" "load_12,load_16"))
   "cm7_all_units*2")

;; The store instructions.
(define_insn_reservation "cortex_m7_store1" 0
   (and (eq_attr "tune" "cortexm7")
        (eq_attr "type" "store_4"))
   "cm7_i0|cm7_i1,cm7_lsu+cm7_wb")

(define_insn_reservation "cortex_m7_store2" 0
   (and (eq_attr "tune" "cortexm7")
        (eq_attr "type" "store_8"))
   "cm7_all_units")

(define_insn_reservation "cortex_m7_storem" 0
   (and (eq_attr "tune" "cortexm7")
        (eq_attr "type" "store_12,store_16"))
   "cm7_all_units*2")

;; The FPU instructions.
(define_insn_reservation "cortex_m7_fpalu" 3
  (and (eq_attr "tune" "cortexm7")
       (eq_attr "type" "ffariths,ffarithd,fadds,faddd,fmov,fconsts,\
                        fconstd,fcmpd,f_cvt,f_cvtf2i,f_cvti2f, fcmps,\
                        fmuls,f_flag"))
  "cm7_i0|cm7_i1,cm7_fpu")

(define_insn_reservation "cortex_m7_fmacs" 6
  (and (eq_attr "tune" "cortexm7")
       (eq_attr "type" "fmacs,ffmas"))
  "cm7_i0|cm7_i1,cm7_fpu")

(define_insn_reservation "cortex_m7_fdivs" 16
  (and (eq_attr "tune" "cortexm7")
       (eq_attr "type" "fdivs, fsqrts"))
  "cm7_i0|cm7_i1, cm7_fpu*5")

(define_insn_reservation "cortex_m7_f_loads" 2
  (and (eq_attr "tune" "cortexm7")
       (eq_attr "type" "f_loads"))
  "cm7_i0|cm7_i1, cm7_lsu")

(define_insn_reservation "cortex_m7_f_stores" 0
  (and (eq_attr "tune" "cortexm7")
       (eq_attr "type" "f_stores"))
  "cm7_i0|cm7_i1, cm7_lsu+cm7_wb")

(define_insn_reservation "cortex_m7_fmuld" 6
  (and (eq_attr "tune" "cortexm7")
       (eq_attr "type" "fmuld"))
  "cm7_i0|cm7_i1,cm7_fpu*3")

(define_insn_reservation "cortex_m7_fmacd" 10
  (and (eq_attr "tune" "cortexm7")
       (eq_attr "type" "fmacd,ffmad"))
  "cm7_i0|cm7_i1,cm7_fpu*4")

(define_insn_reservation "cortex_m7_fdivd" 31
  (and (eq_attr "tune" "cortexm7")
       (eq_attr "type" "fdivd,fsqrtd"))
  "cm7_i0|cm7_i1,cm7_fpu*4")

(define_insn_reservation "cortex_m7_f_loadd" 3
  (and (eq_attr "tune" "cortexm7")
       (eq_attr "type" "f_loadd"))
  "cm7_all_units")

(define_insn_reservation "cortex_m7_f_stored" 0
  (and (eq_attr "tune" "cortexm7")
       (eq_attr "type" "f_stored"))
  "cm7_all_units")

(define_insn_reservation "cortex_m7_f_mcr" 1
  (and (eq_attr "tune" "cortexm7")
       (eq_attr "type" "f_mcrr,f_mrrc"))
  "cm7_all_units")