OSDN Git Service

2010-04-06 Kai Tietz <kai.tietz@onevision.com>
[pf3gnuchains/gcc-fork.git] / gcc / config / sh / shmedia.md
1 ;; DFA scheduling description for SH-5 SHmedia instructions.
2 ;; Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
3
4 ;; This file is part of GCC.
5
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 3, or (at your option)
9 ;; any later version.
10
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.
15
16 ;; You should have received a copy of the GNU General Public License
17 ;; along with GCC; see the file COPYING3.  If not see
18 ;; <http://www.gnu.org/licenses/>.
19
20 ;; This is just a conversion of the old model using define_function_unit.
21
22 ;; When executing SHmedia code, the SH-5 is a fairly straightforward
23 ;; single-issue machine.  It has four pipelines, the branch unit (br),
24 ;; the integer and multimedia unit (imu), the load/store unit (lsu), and
25 ;; the floating point unit (fpu).
26
27 (define_automaton "sh5inst_pipe, sh5fpu_pipe")
28
29 (define_cpu_unit "sh5issue" "sh5inst_pipe")
30
31 (define_cpu_unit "sh5fds" "sh5fpu_pipe")
32
33 ;; Every instruction on SH-5 occupies the issue resource for at least one
34 ;; cycle.
35 (define_insn_reservation "shmedia1" 1
36   (and (eq_attr "pipe_model" "sh5media")
37        (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"))
38   "sh5issue")
39
40 ;; Specify the various types of instruction which have latency > 1
41 (define_insn_reservation "shmedia2" 2
42   (and (eq_attr "pipe_model" "sh5media")
43        (eq_attr "type" "mcmp_media"))
44   "sh5issue")
45
46 (define_insn_reservation "shmedia3" 3
47   (and (eq_attr "pipe_model" "sh5media")
48        (eq_attr "type" "dmpy_media,load_media,fcmp_media,mac_media"))
49   "sh5issue")
50 ;; but see sh_adjust_cost for mac_media exception.
51
52 (define_insn_reservation "shmedia4" 4
53   (and (eq_attr "pipe_model" "sh5media")
54        (eq_attr "type" "fload_media,fmove_media"))
55   "sh5issue")
56
57 (define_insn_reservation "shmedia_d2mpy" 4
58   (and (eq_attr "pipe_model" "sh5media")
59        (eq_attr "type" "d2mpy_media"))
60   "sh5issue*2")
61
62 (define_insn_reservation "shmedia5" 5
63   (and (eq_attr "pipe_model" "sh5media")
64        (eq_attr "type" "pt_media,ptabs_media"))
65   "sh5issue")
66
67 (define_insn_reservation "shmedia6" 6
68   (and (eq_attr "pipe_model" "sh5media")
69        (eq_attr "type" "fparith_media,dfparith_media,fpconv_media,dfpconv_media"))
70   "sh5issue")
71
72 (define_insn_reservation "shmedia_invalidate" 7
73   (and (eq_attr "pipe_model" "sh5media")
74        (eq_attr "type" "invalidate_line_media"))
75   "sh5issue*7")
76
77 (define_insn_reservation "shmedia_dfmul" 9
78   (and (eq_attr "pipe_model" "sh5media") (eq_attr "type" "dfmul_media"))
79   "sh5issue*4")
80
81 (define_insn_reservation "shmedia_atrans" 10
82   (and (eq_attr "pipe_model" "sh5media") (eq_attr "type" "atrans_media"))
83   "sh5issue*5")
84
85 ;; Floating-point divide and square-root occupy an additional resource,
86 ;; which is not internally pipelined.  However, other instructions
87 ;; can continue to issue.
88 (define_insn_reservation "shmedia_fdiv" 19
89   (and (eq_attr "pipe_model" "sh5media") (eq_attr "type" "fdiv_media"))
90   "sh5issue+sh5fds,sh5fds*18")
91
92 (define_insn_reservation "shmedia_dfdiv" 35
93   (and (eq_attr "pipe_model" "sh5media") (eq_attr "type" "dfdiv_media"))
94   "sh5issue+sh5fds,sh5fds*34")