PR target/16201
[official-gcc.git] / gcc / config / sh / shmedia.md
blob4efed77b7ed4904952f299c2ef608011c7b5955b
1 ;; DFA scheduling description for SH-5 SHmedia instructions.
2 ;; Copyright (C) 2004 Free Software Foundation, Inc.
4 ;; This file is part of GCC.
6 ;; GCC is free software; you can redistribute it and/or modify
7 ;; it under the terms of the GNU General Public License as published by
8 ;; the Free Software Foundation; either version 2, or (at your option)
9 ;; any later version.
11 ;; GCC is distributed in the hope that it will be useful,
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 ;; GNU General Public License for more details.
16 ;; You should have received a copy of the GNU General Public License
17 ;; along with GCC; see the file COPYING.  If not, write to
18 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
19 ;; Boston, MA 02111-1307, USA.
21 ;; This is just a conversion of the old model using define_function_unit.
23 ;; When executing SHmedia code, the SH-5 is a fairly straightforward
24 ;; single-issue machine.  It has four pipelines, the branch unit (br),
25 ;; the integer and multimedia unit (imu), the load/store unit (lsu), and
26 ;; the floating point unit (fpu).
28 (define_automaton "shmedia")
30 (define_cpu_unit "sh5issue,sh5fds" "shmedia")
32 ;; Every instruction on SH-5 occupies the issue resource for at least one
33 ;; cycle.
34 (define_insn_reservation "shmedia1" 1
35   (and (eq_attr "pipe_model" "sh5media")
36        (eq_attr "type" "!pt_media,ptabs_media,invalidate_line_media,dmpy_media,load_media,fload_media,fcmp_media,fmove_media,fparith_media,dfparith_media,fpconv_media,dfpconv_media,dfmul_media,store_media,fstore_media,mcmp_media,mac_media,d2mpy_media,atrans_media,ustore_media"))
37   "sh5issue")
39 ;; Specify the various types of instruction which have latency > 1
40 (define_insn_reservation "shmedia2" 2
41   (and (eq_attr "pipe_model" "sh5media")
42        (eq_attr "type" "mcmp_media"))
43   "sh5issue")
45 (define_insn_reservation "shmedia3" 3
46   (and (eq_attr "pipe_model" "sh5media")
47        (eq_attr "type" "dmpy_media,load_media,fcmp_media,mac_media"))
48   "sh5issue")
49 ;; but see sh_adjust_cost for mac_media exception.
51 (define_insn_reservation "shmedia4" 4
52   (and (eq_attr "pipe_model" "sh5media")
53        (eq_attr "type" "fload_media,fmove_media"))
54   "sh5issue")
56 (define_insn_reservation "shmedia_d2mpy" 4
57   (and (eq_attr "pipe_model" "sh5media")
58        (eq_attr "type" "d2mpy_media"))
59   "sh5issue*2")
61 (define_insn_reservation "shmedia5" 5
62   (and (eq_attr "pipe_model" "sh5media")
63        (eq_attr "type" "pt_media,ptabs_media"))
64   "sh5issue")
66 (define_insn_reservation "shmedia6" 6
67   (and (eq_attr "pipe_model" "sh5media")
68        (eq_attr "type" "fparith_media,dfparith_media,fpconv_media,dfpconv_media"))
69   "sh5issue")
71 (define_insn_reservation "shmedia_invalidate" 7
72   (and (eq_attr "pipe_model" "sh5media")
73        (eq_attr "type" "invalidate_line_media"))
74   "sh5issue*7")
76 (define_insn_reservation "shmedia_dfmul" 9
77   (and (eq_attr "pipe_model" "sh5media") (eq_attr "type" "dfmul_media"))
78   "sh5issue*4")
80 (define_insn_reservation "shmedia_atrans" 10
81   (and (eq_attr "pipe_model" "sh5media") (eq_attr "type" "atrans_media"))
82   "sh5issue*5")
84 ;; Floating-point divide and square-root occupy an additional resource,
85 ;; which is not internally pipelined.  However, other instructions
86 ;; can continue to issue.
87 (define_insn_reservation "shmedia_fdiv" 19
88   (and (eq_attr "pipe_model" "sh5media") (eq_attr "type" "fdiv_media"))
89   "sh5fds*19")
91 (define_insn_reservation "shmedia_dfdiv" 35
92   (and (eq_attr "pipe_model" "sh5media") (eq_attr "type" "dfdiv_media"))
93   "sh5fds*35")