PR c++/56838
[official-gcc.git] / gcc / config / mips / octeon.md
blobf5e779b02aea297a4b16919d7284aa48aba9d42a
1 ;;  Octeon pipeline description.
2 ;;  Copyright (C) 2008-2013 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 3, 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 COPYING3.  If not see
18 ;; <http://www.gnu.org/licenses/>.
19 ;;   Copyright (C) 2004, 2005, 2006 Cavium Networks.
22 ;; Octeon is a dual-issue processor that can issue all instructions on
23 ;; pipe0 and a subset on pipe1.
25 (define_automaton "octeon_main, octeon_mult")
27 (define_cpu_unit "octeon_pipe0" "octeon_main")
28 (define_cpu_unit "octeon_pipe1" "octeon_main")
29 (define_cpu_unit "octeon_mult" "octeon_mult")
31 (define_insn_reservation "octeon_arith" 1
32   (and (eq_attr "cpu" "octeon,octeon2")
33        (eq_attr "type" "arith,const,logical,move,shift,signext,slt,nop"))
34   "octeon_pipe0 | octeon_pipe1")
36 (define_insn_reservation "octeon_condmove" 2
37   (and (eq_attr "cpu" "octeon,octeon2")
38        (eq_attr "type" "condmove"))
39   "octeon_pipe0 | octeon_pipe1")
41 (define_insn_reservation "octeon_load_o1" 2
42   (and (eq_attr "cpu" "octeon")
43        (eq_attr "type" "load,prefetch,mtc,mfc"))
44   "octeon_pipe0")
46 (define_insn_reservation "octeon_load_o2" 3
47   (and (eq_attr "cpu" "octeon2")
48        (eq_attr "type" "load,prefetch"))
49   "octeon_pipe0")
51 ;; ??? memory-related cop0 reads are pipe0 with 3-cycle latency.
52 ;; Front-end-related ones are 1-cycle on pipe1.  Assume front-end for now.
53 (define_insn_reservation "octeon_cop_o2" 1
54   (and (eq_attr "cpu" "octeon2")
55        (eq_attr "type" "mtc,mfc"))
56   "octeon_pipe1")
58 (define_insn_reservation "octeon_store" 1
59   (and (eq_attr "cpu" "octeon,octeon2")
60        (eq_attr "type" "store"))
61   "octeon_pipe0")
63 (define_insn_reservation "octeon_brj_o1" 1
64   (and (eq_attr "cpu" "octeon")
65        (eq_attr "type" "branch,jump,call,trap"))
66   "octeon_pipe0")
68 (define_insn_reservation "octeon_brj_o2" 2
69   (and (eq_attr "cpu" "octeon2")
70        (eq_attr "type" "branch,jump,call,trap"))
71   "octeon_pipe1")
73 (define_insn_reservation "octeon_imul3_o1" 5
74   (and (eq_attr "cpu" "octeon")
75        (eq_attr "type" "imul3,pop,clz"))
76   "(octeon_pipe0 | octeon_pipe1) + octeon_mult")
78 (define_insn_reservation "octeon_imul3_o2" 6
79   (and (eq_attr "cpu" "octeon2")
80        (eq_attr "type" "imul3,pop,clz"))
81   "octeon_pipe1 + octeon_mult")
83 (define_insn_reservation "octeon_imul_o1" 2
84   (and (eq_attr "cpu" "octeon")
85        (eq_attr "type" "imul,mthi,mtlo"))
86   "(octeon_pipe0 | octeon_pipe1) + octeon_mult, octeon_mult")
88 (define_insn_reservation "octeon_imul_o2" 1
89   (and (eq_attr "cpu" "octeon2")
90        (eq_attr "type" "imul,mthi,mtlo"))
91   "octeon_pipe1 + octeon_mult")
93 (define_insn_reservation "octeon_mfhilo_o1" 5
94   (and (eq_attr "cpu" "octeon")
95        (eq_attr "type" "mfhi,mflo"))
96   "(octeon_pipe0 | octeon_pipe1) + octeon_mult")
98 (define_insn_reservation "octeon_mfhilo_o2" 6
99   (and (eq_attr "cpu" "octeon2")
100        (eq_attr "type" "mfhi,mflo"))
101   "octeon_pipe1 + octeon_mult")
103 (define_insn_reservation "octeon_imadd_o1" 4
104   (and (eq_attr "cpu" "octeon")
105        (eq_attr "type" "imadd"))
106   "(octeon_pipe0 | octeon_pipe1) + octeon_mult, octeon_mult*3")
108 (define_insn_reservation "octeon_imadd_o2" 1
109   (and (eq_attr "cpu" "octeon2")
110        (eq_attr "type" "imadd"))
111   "octeon_pipe1 + octeon_mult")
113 (define_insn_reservation "octeon_idiv_o1" 72
114   (and (eq_attr "cpu" "octeon")
115        (eq_attr "type" "idiv"))
116   "(octeon_pipe0 | octeon_pipe1) + octeon_mult, octeon_mult*71")
118 (define_insn_reservation "octeon_idiv_o2_si" 18
119   (and (eq_attr "cpu" "octeon2")
120        (eq_attr "mode" "SI")
121        (eq_attr "type" "idiv"))
122   "octeon_pipe1 + octeon_mult, octeon_mult*17")
124 (define_insn_reservation "octeon_idiv_o2_di" 35
125   (and (eq_attr "cpu" "octeon2")
126        (eq_attr "mode" "DI")
127        (eq_attr "type" "idiv"))
128   "octeon_pipe1 + octeon_mult, octeon_mult*34")
130 ;; Assume both pipes are needed for unknown and multiple-instruction
131 ;; patterns.
133 (define_insn_reservation "octeon_unknown" 1
134   (and (eq_attr "cpu" "octeon,octeon2")
135        (eq_attr "type" "unknown,multi,atomic,syncloop"))
136   "octeon_pipe0 + octeon_pipe1")