xref: /openbsd/gnu/gcc/gcc/config/sh/shmedia.md (revision fc61954a)
1;; DFA scheduling description for SH-5 SHmedia instructions.
2;; Copyright (C) 2004, 2005 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 2, 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 COPYING.  If not, write to
18;; the Free Software Foundation, 51 Franklin Street, Fifth Floor,
19;; Boston, MA 02110-1301, USA.
20
21;; This is just a conversion of the old model using define_function_unit.
22
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).
27
28(define_automaton "sh5inst_pipe, sh5fpu_pipe")
29
30(define_cpu_unit "sh5issue" "sh5inst_pipe")
31
32(define_cpu_unit "sh5fds" "sh5fpu_pipe")
33
34;; Every instruction on SH-5 occupies the issue resource for at least one
35;; cycle.
36(define_insn_reservation "shmedia1" 1
37  (and (eq_attr "pipe_model" "sh5media")
38       (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"))
39  "sh5issue")
40
41;; Specify the various types of instruction which have latency > 1
42(define_insn_reservation "shmedia2" 2
43  (and (eq_attr "pipe_model" "sh5media")
44       (eq_attr "type" "mcmp_media"))
45  "sh5issue")
46
47(define_insn_reservation "shmedia3" 3
48  (and (eq_attr "pipe_model" "sh5media")
49       (eq_attr "type" "dmpy_media,load_media,fcmp_media,mac_media"))
50  "sh5issue")
51;; but see sh_adjust_cost for mac_media exception.
52
53(define_insn_reservation "shmedia4" 4
54  (and (eq_attr "pipe_model" "sh5media")
55       (eq_attr "type" "fload_media,fmove_media"))
56  "sh5issue")
57
58(define_insn_reservation "shmedia_d2mpy" 4
59  (and (eq_attr "pipe_model" "sh5media")
60       (eq_attr "type" "d2mpy_media"))
61  "sh5issue*2")
62
63(define_insn_reservation "shmedia5" 5
64  (and (eq_attr "pipe_model" "sh5media")
65       (eq_attr "type" "pt_media,ptabs_media"))
66  "sh5issue")
67
68(define_insn_reservation "shmedia6" 6
69  (and (eq_attr "pipe_model" "sh5media")
70       (eq_attr "type" "fparith_media,dfparith_media,fpconv_media,dfpconv_media"))
71  "sh5issue")
72
73(define_insn_reservation "shmedia_invalidate" 7
74  (and (eq_attr "pipe_model" "sh5media")
75       (eq_attr "type" "invalidate_line_media"))
76  "sh5issue*7")
77
78(define_insn_reservation "shmedia_dfmul" 9
79  (and (eq_attr "pipe_model" "sh5media") (eq_attr "type" "dfmul_media"))
80  "sh5issue*4")
81
82(define_insn_reservation "shmedia_atrans" 10
83  (and (eq_attr "pipe_model" "sh5media") (eq_attr "type" "atrans_media"))
84  "sh5issue*5")
85
86;; Floating-point divide and square-root occupy an additional resource,
87;; which is not internally pipelined.  However, other instructions
88;; can continue to issue.
89(define_insn_reservation "shmedia_fdiv" 19
90  (and (eq_attr "pipe_model" "sh5media") (eq_attr "type" "fdiv_media"))
91  "sh5issue+sh5fds,sh5fds*18")
92
93(define_insn_reservation "shmedia_dfdiv" 35
94  (and (eq_attr "pipe_model" "sh5media") (eq_attr "type" "dfdiv_media"))
95  "sh5issue+sh5fds,sh5fds*34")
96