xref: /dflybsd-src/contrib/gcc-8.0/gcc/config/i386/core2.md (revision 38fd149817dfbff97799f62fcb70be98c4e32523)
1*38fd1498Szrj;; Scheduling for Core 2 and derived processors.
2*38fd1498Szrj;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
3*38fd1498Szrj;;
4*38fd1498Szrj;; This file is part of GCC.
5*38fd1498Szrj;;
6*38fd1498Szrj;; GCC is free software; you can redistribute it and/or modify
7*38fd1498Szrj;; it under the terms of the GNU General Public License as published by
8*38fd1498Szrj;; the Free Software Foundation; either version 3, or (at your option)
9*38fd1498Szrj;; any later version.
10*38fd1498Szrj;;
11*38fd1498Szrj;; GCC is distributed in the hope that it will be useful,
12*38fd1498Szrj;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13*38fd1498Szrj;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*38fd1498Szrj;; GNU General Public License for more details.
15*38fd1498Szrj;;
16*38fd1498Szrj;; You should have received a copy of the GNU General Public License
17*38fd1498Szrj;; along with GCC; see the file COPYING3.  If not see
18*38fd1498Szrj;; <http://www.gnu.org/licenses/>.  */
19*38fd1498Szrj
20*38fd1498Szrj;; The scheduling description in this file is based on the one in ppro.md,
21*38fd1498Szrj;; with additional information obtained from
22*38fd1498Szrj;;
23*38fd1498Szrj;;    "How to optimize for the Pentium family of microprocessors",
24*38fd1498Szrj;;    by Agner Fog, PhD.
25*38fd1498Szrj;;
26*38fd1498Szrj;; The major difference from the P6 pipeline is one extra decoder, and
27*38fd1498Szrj;; one extra execute unit.  Due to micro-op fusion, many insns no longer
28*38fd1498Szrj;; need to be decoded in decoder 0, but can be handled by all of them.
29*38fd1498Szrj
30*38fd1498Szrj;; The core2_idiv, core2_fdiv and core2_ssediv automata are used to
31*38fd1498Szrj;; model issue latencies of idiv, fdiv and ssediv type insns.
32*38fd1498Szrj(define_automaton "core2_decoder,core2_core,core2_idiv,core2_fdiv,core2_ssediv,core2_load,core2_store")
33*38fd1498Szrj
34*38fd1498Szrj;; The CPU domain, used for Core i7 bypass latencies
35*38fd1498Szrj(define_attr "i7_domain" "int,float,simd"
36*38fd1498Szrj  (cond [(eq_attr "type" "fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp,fisttp,frndint")
37*38fd1498Szrj	   (const_string "float")
38*38fd1498Szrj	 (eq_attr "type" "sselog,sselog1,sseiadd,sseiadd1,sseishft,sseishft1,sseimul,
39*38fd1498Szrj			  sse,ssemov,sseadd,sseadd1,ssemul,ssecmp,ssecomi,ssecvt,
40*38fd1498Szrj			  ssecvt1,sseicvt,ssediv,sseins,ssemuladd,sse4arg")
41*38fd1498Szrj	   (cond [(eq_attr "mode" "V4DF,V8SF,V2DF,V4SF,SF,DF")
42*38fd1498Szrj		    (const_string "float")
43*38fd1498Szrj		  (eq_attr "mode" "SI")
44*38fd1498Szrj		    (const_string "int")]
45*38fd1498Szrj		  (const_string "simd"))
46*38fd1498Szrj	 (eq_attr "type" "mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft")
47*38fd1498Szrj	   (const_string "simd")]
48*38fd1498Szrj	(const_string "int")))
49*38fd1498Szrj
50*38fd1498Szrj;; As for the Pentium Pro,
51*38fd1498Szrj;;  - an instruction with 1 uop can be decoded by any of the three
52*38fd1498Szrj;;    decoders in one cycle.
53*38fd1498Szrj;;  - an instruction with 1 to 4 uops can be decoded only by decoder 0
54*38fd1498Szrj;;    but still in only one cycle.
55*38fd1498Szrj;;  - a complex (microcode) instruction can also only be decoded by
56*38fd1498Szrj;;    decoder 0, and this takes an unspecified number of cycles.
57*38fd1498Szrj;;
58*38fd1498Szrj;; The goal is to schedule such that we have a few-one-one uops sequence
59*38fd1498Szrj;; in each cycle, to decode as many instructions per cycle as possible.
60*38fd1498Szrj(define_cpu_unit "c2_decoder0" "core2_decoder")
61*38fd1498Szrj(define_cpu_unit "c2_decoder1" "core2_decoder")
62*38fd1498Szrj(define_cpu_unit "c2_decoder2" "core2_decoder")
63*38fd1498Szrj(define_cpu_unit "c2_decoder3" "core2_decoder")
64*38fd1498Szrj
65*38fd1498Szrj;; We first wish to find an instruction for c2_decoder0, so exclude
66*38fd1498Szrj;; c2_decoder1 and c2_decoder2 from being reserved until c2_decoder 0 is
67*38fd1498Szrj;; reserved.
68*38fd1498Szrj(presence_set "c2_decoder1" "c2_decoder0")
69*38fd1498Szrj(presence_set "c2_decoder2" "c2_decoder0")
70*38fd1498Szrj(presence_set "c2_decoder3" "c2_decoder0")
71*38fd1498Szrj
72*38fd1498Szrj;; Most instructions can be decoded on any of the three decoders.
73*38fd1498Szrj(define_reservation "c2_decodern" "(c2_decoder0|c2_decoder1|c2_decoder2|c2_decoder3)")
74*38fd1498Szrj
75*38fd1498Szrj;; The out-of-order core has six pipelines.  These are similar to the
76*38fd1498Szrj;; Pentium Pro's five pipelines.  Port 2 is responsible for memory loads,
77*38fd1498Szrj;; port 3 for store address calculations, port 4 for memory stores, and
78*38fd1498Szrj;; ports 0, 1 and 5 for everything else.
79*38fd1498Szrj
80*38fd1498Szrj(define_cpu_unit "c2_p0,c2_p1,c2_p5" "core2_core")
81*38fd1498Szrj(define_cpu_unit "c2_p2" "core2_load")
82*38fd1498Szrj(define_cpu_unit "c2_p3,c2_p4" "core2_store")
83*38fd1498Szrj(define_cpu_unit "c2_idiv" "core2_idiv")
84*38fd1498Szrj(define_cpu_unit "c2_fdiv" "core2_fdiv")
85*38fd1498Szrj(define_cpu_unit "c2_ssediv" "core2_ssediv")
86*38fd1498Szrj
87*38fd1498Szrj;; Only the irregular instructions have to be modeled here.  A load
88*38fd1498Szrj;; increases the latency by 2 or 3, or by nothing if the manual gives
89*38fd1498Szrj;; a latency already.  Store latencies are not accounted for.
90*38fd1498Szrj;;
91*38fd1498Szrj;; The simple instructions follow a very regular pattern of 1 uop per
92*38fd1498Szrj;; reg-reg operation, 1 uop per load on port 2. and 2 uops per store
93*38fd1498Szrj;; on port 4 and port 3.  These instructions are modelled at the bottom
94*38fd1498Szrj;; of this file.
95*38fd1498Szrj;;
96*38fd1498Szrj;; For microcoded instructions we don't know how many uops are produced.
97*38fd1498Szrj;; These instructions are the "complex" ones in the Intel manuals.  All
98*38fd1498Szrj;; we _do_ know is that they typically produce four or more uops, so
99*38fd1498Szrj;; they can only be decoded on c2_decoder0.  Modelling their latencies
100*38fd1498Szrj;; doesn't make sense because we don't know how these instructions are
101*38fd1498Szrj;; executed in the core.  So we just model that they can only be decoded
102*38fd1498Szrj;; on decoder 0, and say that it takes a little while before the result
103*38fd1498Szrj;; is available.
104*38fd1498Szrj(define_insn_reservation "c2_complex_insn" 6
105*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
106*38fd1498Szrj			      (eq_attr "type" "other,multi,str"))
107*38fd1498Szrj			 "c2_decoder0")
108*38fd1498Szrj
109*38fd1498Szrj(define_insn_reservation "c2_call" 1
110*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
111*38fd1498Szrj			      (eq_attr "type" "call,callv"))
112*38fd1498Szrj			 "c2_decoder0")
113*38fd1498Szrj
114*38fd1498Szrj;; imov with memory operands does not use the integer units.
115*38fd1498Szrj;; imovx always decodes to one uop, and also doesn't use the integer
116*38fd1498Szrj;; units if it has memory operands.
117*38fd1498Szrj(define_insn_reservation "c2_imov" 1
118*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
119*38fd1498Szrj			      (and (eq_attr "memory" "none")
120*38fd1498Szrj				   (eq_attr "type" "imov,imovx")))
121*38fd1498Szrj			 "c2_decodern,(c2_p0|c2_p1|c2_p5)")
122*38fd1498Szrj
123*38fd1498Szrj(define_insn_reservation "c2_imov_load" 4
124*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
125*38fd1498Szrj			      (and (eq_attr "memory" "load")
126*38fd1498Szrj				   (eq_attr "type" "imov,imovx")))
127*38fd1498Szrj			 "c2_decodern,c2_p2")
128*38fd1498Szrj
129*38fd1498Szrj(define_insn_reservation "c2_imov_store" 1
130*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
131*38fd1498Szrj			      (and (eq_attr "memory" "store")
132*38fd1498Szrj				   (eq_attr "type" "imov")))
133*38fd1498Szrj			 "c2_decodern,c2_p4+c2_p3")
134*38fd1498Szrj
135*38fd1498Szrj(define_insn_reservation "c2_icmov" 2
136*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
137*38fd1498Szrj			      (and (eq_attr "memory" "none")
138*38fd1498Szrj				   (eq_attr "type" "icmov")))
139*38fd1498Szrj			 "c2_decoder0,(c2_p0|c2_p1|c2_p5)*2")
140*38fd1498Szrj
141*38fd1498Szrj(define_insn_reservation "c2_icmov_load" 2
142*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
143*38fd1498Szrj			      (and (eq_attr "memory" "load")
144*38fd1498Szrj				   (eq_attr "type" "icmov")))
145*38fd1498Szrj			 "c2_decoder0,c2_p2,(c2_p0|c2_p1|c2_p5)*2")
146*38fd1498Szrj
147*38fd1498Szrj(define_insn_reservation "c2_push_reg" 1
148*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
149*38fd1498Szrj			      (and (eq_attr "memory" "store")
150*38fd1498Szrj				   (eq_attr "type" "push")))
151*38fd1498Szrj			 "c2_decodern,c2_p4+c2_p3")
152*38fd1498Szrj
153*38fd1498Szrj(define_insn_reservation "c2_push_mem" 1
154*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
155*38fd1498Szrj			      (and (eq_attr "memory" "both")
156*38fd1498Szrj				   (eq_attr "type" "push")))
157*38fd1498Szrj			 "c2_decoder0,c2_p2,c2_p4+c2_p3")
158*38fd1498Szrj
159*38fd1498Szrj;; lea executes on port 0 with latency one and throughput 1.
160*38fd1498Szrj(define_insn_reservation "c2_lea" 1
161*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
162*38fd1498Szrj			      (and (eq_attr "memory" "none")
163*38fd1498Szrj				   (eq_attr "type" "lea")))
164*38fd1498Szrj			 "c2_decodern,c2_p0")
165*38fd1498Szrj
166*38fd1498Szrj;; Shift and rotate decode as two uops which can go to port 0 or 5.
167*38fd1498Szrj;; The load and store units need to be reserved when memory operands
168*38fd1498Szrj;; are involved.
169*38fd1498Szrj(define_insn_reservation "c2_shift_rotate" 1
170*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
171*38fd1498Szrj			      (and (eq_attr "memory" "none")
172*38fd1498Szrj				   (eq_attr "type" "ishift,ishift1,rotate,rotate1")))
173*38fd1498Szrj			 "c2_decodern,(c2_p0|c2_p5)")
174*38fd1498Szrj
175*38fd1498Szrj(define_insn_reservation "c2_shift_rotate_mem" 4
176*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
177*38fd1498Szrj			      (and (eq_attr "memory" "!none")
178*38fd1498Szrj				   (eq_attr "type" "ishift,ishift1,rotate,rotate1")))
179*38fd1498Szrj			 "c2_decoder0,c2_p2,(c2_p0|c2_p5),c2_p4+c2_p3")
180*38fd1498Szrj
181*38fd1498Szrj;; See comments in ppro.md for the corresponding reservation.
182*38fd1498Szrj(define_insn_reservation "c2_branch" 1
183*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
184*38fd1498Szrj			      (and (eq_attr "memory" "none")
185*38fd1498Szrj				   (eq_attr "type" "ibr")))
186*38fd1498Szrj			 "c2_decodern,c2_p5")
187*38fd1498Szrj
188*38fd1498Szrj;; ??? Indirect branches probably have worse latency than this.
189*38fd1498Szrj(define_insn_reservation "c2_indirect_branch" 6
190*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
191*38fd1498Szrj			      (and (eq_attr "memory" "!none")
192*38fd1498Szrj				   (eq_attr "type" "ibr")))
193*38fd1498Szrj			 "c2_decoder0,c2_p2+c2_p5")
194*38fd1498Szrj
195*38fd1498Szrj(define_insn_reservation "c2_leave" 4
196*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
197*38fd1498Szrj			      (eq_attr "type" "leave"))
198*38fd1498Szrj			 "c2_decoder0,c2_p2+(c2_p0|c2_p1),(c2_p0|c2_p1)")
199*38fd1498Szrj
200*38fd1498Szrj;; mul and imul with two/three operands only execute on port 1 for HImode
201*38fd1498Szrj;; and SImode, port 0 for DImode.
202*38fd1498Szrj(define_insn_reservation "c2_imul_hisi" 3
203*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
204*38fd1498Szrj			      (and (eq_attr "memory" "none")
205*38fd1498Szrj				   (and (eq_attr "mode" "HI,SI")
206*38fd1498Szrj					(eq_attr "type" "imul"))))
207*38fd1498Szrj			 "c2_decodern,c2_p1")
208*38fd1498Szrj
209*38fd1498Szrj(define_insn_reservation "c2_imul_hisi_mem" 3
210*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
211*38fd1498Szrj			      (and (eq_attr "memory" "!none")
212*38fd1498Szrj				   (and (eq_attr "mode" "HI,SI")
213*38fd1498Szrj					(eq_attr "type" "imul"))))
214*38fd1498Szrj			 "c2_decoder0,c2_p2+c2_p1")
215*38fd1498Szrj
216*38fd1498Szrj(define_insn_reservation "c2_imul_di" 5
217*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
218*38fd1498Szrj			      (and (eq_attr "memory" "none")
219*38fd1498Szrj				   (and (eq_attr "mode" "DI")
220*38fd1498Szrj					(eq_attr "type" "imul"))))
221*38fd1498Szrj			 "c2_decodern,c2_p0")
222*38fd1498Szrj
223*38fd1498Szrj(define_insn_reservation "c2_imul_di_mem" 5
224*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
225*38fd1498Szrj			      (and (eq_attr "memory" "!none")
226*38fd1498Szrj				   (and (eq_attr "mode" "DI")
227*38fd1498Szrj					(eq_attr "type" "imul"))))
228*38fd1498Szrj			 "c2_decoder0,c2_p2+c2_p0")
229*38fd1498Szrj
230*38fd1498Szrj;; div and idiv are very similar, so we model them the same.
231*38fd1498Szrj;; QI, HI, and SI have issue latency 12, 21, and 37, respectively.
232*38fd1498Szrj;; These issue latencies are modelled via the c2_div automaton.
233*38fd1498Szrj(define_insn_reservation "c2_idiv_QI" 19
234*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
235*38fd1498Szrj			      (and (eq_attr "memory" "none")
236*38fd1498Szrj				   (and (eq_attr "mode" "QI")
237*38fd1498Szrj					(eq_attr "type" "idiv"))))
238*38fd1498Szrj			 "c2_decoder0,(c2_p0+c2_idiv)*2,(c2_p0|c2_p1)+c2_idiv,c2_idiv*9")
239*38fd1498Szrj
240*38fd1498Szrj(define_insn_reservation "c2_idiv_QI_load" 19
241*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
242*38fd1498Szrj			      (and (eq_attr "memory" "load")
243*38fd1498Szrj				   (and (eq_attr "mode" "QI")
244*38fd1498Szrj					(eq_attr "type" "idiv"))))
245*38fd1498Szrj			 "c2_decoder0,c2_p2+c2_p0+c2_idiv,c2_p0+c2_idiv,(c2_p0|c2_p1)+c2_idiv,c2_idiv*9")
246*38fd1498Szrj
247*38fd1498Szrj(define_insn_reservation "c2_idiv_HI" 23
248*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
249*38fd1498Szrj			      (and (eq_attr "memory" "none")
250*38fd1498Szrj				   (and (eq_attr "mode" "HI")
251*38fd1498Szrj					(eq_attr "type" "idiv"))))
252*38fd1498Szrj			 "c2_decoder0,(c2_p0+c2_idiv)*3,(c2_p0|c2_p1)+c2_idiv,c2_idiv*17")
253*38fd1498Szrj
254*38fd1498Szrj(define_insn_reservation "c2_idiv_HI_load" 23
255*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
256*38fd1498Szrj			      (and (eq_attr "memory" "load")
257*38fd1498Szrj				   (and (eq_attr "mode" "HI")
258*38fd1498Szrj					(eq_attr "type" "idiv"))))
259*38fd1498Szrj			 "c2_decoder0,c2_p2+c2_p0+c2_idiv,c2_p0+c2_idiv,(c2_p0|c2_p1)+c2_idiv,c2_idiv*18")
260*38fd1498Szrj
261*38fd1498Szrj(define_insn_reservation "c2_idiv_SI" 39
262*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
263*38fd1498Szrj			      (and (eq_attr "memory" "none")
264*38fd1498Szrj				   (and (eq_attr "mode" "SI")
265*38fd1498Szrj					(eq_attr "type" "idiv"))))
266*38fd1498Szrj			 "c2_decoder0,(c2_p0+c2_idiv)*3,(c2_p0|c2_p1)+c2_idiv,c2_idiv*33")
267*38fd1498Szrj
268*38fd1498Szrj(define_insn_reservation "c2_idiv_SI_load" 39
269*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
270*38fd1498Szrj			      (and (eq_attr "memory" "load")
271*38fd1498Szrj				   (and (eq_attr "mode" "SI")
272*38fd1498Szrj					(eq_attr "type" "idiv"))))
273*38fd1498Szrj			 "c2_decoder0,c2_p2+c2_p0+c2_idiv,c2_p0+c2_idiv,(c2_p0|c2_p1)+c2_idiv,c2_idiv*34")
274*38fd1498Szrj
275*38fd1498Szrj;; x87 floating point operations.
276*38fd1498Szrj
277*38fd1498Szrj(define_insn_reservation "c2_fxch" 0
278*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
279*38fd1498Szrj			      (eq_attr "type" "fxch"))
280*38fd1498Szrj			 "c2_decodern")
281*38fd1498Szrj
282*38fd1498Szrj(define_insn_reservation "c2_fop" 3
283*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
284*38fd1498Szrj			      (and (eq_attr "memory" "none,unknown")
285*38fd1498Szrj				   (eq_attr "type" "fop")))
286*38fd1498Szrj			 "c2_decodern,c2_p1")
287*38fd1498Szrj
288*38fd1498Szrj(define_insn_reservation "c2_fop_load" 5
289*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
290*38fd1498Szrj			      (and (eq_attr "memory" "load")
291*38fd1498Szrj				   (eq_attr "type" "fop")))
292*38fd1498Szrj			 "c2_decoder0,c2_p2+c2_p1,c2_p1")
293*38fd1498Szrj
294*38fd1498Szrj(define_insn_reservation "c2_fop_store" 3
295*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
296*38fd1498Szrj			      (and (eq_attr "memory" "store")
297*38fd1498Szrj				   (eq_attr "type" "fop")))
298*38fd1498Szrj			 "c2_decoder0,c2_p0,c2_p0,c2_p0+c2_p4+c2_p3")
299*38fd1498Szrj
300*38fd1498Szrj(define_insn_reservation "c2_fop_both" 5
301*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
302*38fd1498Szrj			      (and (eq_attr "memory" "both")
303*38fd1498Szrj				   (eq_attr "type" "fop")))
304*38fd1498Szrj			 "c2_decoder0,c2_p2+c2_p0,c2_p0+c2_p4+c2_p3")
305*38fd1498Szrj
306*38fd1498Szrj(define_insn_reservation "c2_fsgn" 1
307*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
308*38fd1498Szrj			      (eq_attr "type" "fsgn"))
309*38fd1498Szrj			 "c2_decodern,c2_p0")
310*38fd1498Szrj
311*38fd1498Szrj(define_insn_reservation "c2_fistp" 5
312*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
313*38fd1498Szrj			      (eq_attr "type" "fistp"))
314*38fd1498Szrj			 "c2_decoder0,c2_p0*2,c2_p4+c2_p3")
315*38fd1498Szrj
316*38fd1498Szrj(define_insn_reservation "c2_fcmov" 2
317*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
318*38fd1498Szrj			      (eq_attr "type" "fcmov"))
319*38fd1498Szrj			 "c2_decoder0,c2_p0*2")
320*38fd1498Szrj
321*38fd1498Szrj(define_insn_reservation "c2_fcmp" 1
322*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
323*38fd1498Szrj			      (and (eq_attr "memory" "none")
324*38fd1498Szrj				   (eq_attr "type" "fcmp")))
325*38fd1498Szrj			 "c2_decodern,c2_p1")
326*38fd1498Szrj
327*38fd1498Szrj(define_insn_reservation "c2_fcmp_load" 4
328*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
329*38fd1498Szrj			      (and (eq_attr "memory" "load")
330*38fd1498Szrj				   (eq_attr "type" "fcmp")))
331*38fd1498Szrj			 "c2_decoder0,c2_p2+c2_p1")
332*38fd1498Szrj
333*38fd1498Szrj(define_insn_reservation "c2_fmov" 1
334*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
335*38fd1498Szrj			      (and (eq_attr "memory" "none")
336*38fd1498Szrj				   (eq_attr "type" "fmov")))
337*38fd1498Szrj			 "c2_decodern,c2_p0")
338*38fd1498Szrj
339*38fd1498Szrj(define_insn_reservation "c2_fmov_load" 1
340*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
341*38fd1498Szrj			      (and (eq_attr "memory" "load")
342*38fd1498Szrj				   (and (eq_attr "mode" "!XF")
343*38fd1498Szrj					(eq_attr "type" "fmov"))))
344*38fd1498Szrj			 "c2_decodern,c2_p2")
345*38fd1498Szrj
346*38fd1498Szrj(define_insn_reservation "c2_fmov_XF_load" 3
347*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
348*38fd1498Szrj			      (and (eq_attr "memory" "load")
349*38fd1498Szrj				   (and (eq_attr "mode" "XF")
350*38fd1498Szrj					(eq_attr "type" "fmov"))))
351*38fd1498Szrj			 "c2_decoder0,(c2_p2+c2_p0)*2")
352*38fd1498Szrj
353*38fd1498Szrj(define_insn_reservation "c2_fmov_store" 1
354*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
355*38fd1498Szrj			      (and (eq_attr "memory" "store")
356*38fd1498Szrj				   (and (eq_attr "mode" "!XF")
357*38fd1498Szrj					(eq_attr "type" "fmov"))))
358*38fd1498Szrj			 "c2_decodern,c2_p3+c2_p4")
359*38fd1498Szrj
360*38fd1498Szrj(define_insn_reservation "c2_fmov_XF_store" 3
361*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
362*38fd1498Szrj			      (and (eq_attr "memory" "store")
363*38fd1498Szrj				   (and (eq_attr "mode" "XF")
364*38fd1498Szrj					(eq_attr "type" "fmov"))))
365*38fd1498Szrj			 "c2_decoder0,(c2_p3+c2_p4),(c2_p3+c2_p4)")
366*38fd1498Szrj
367*38fd1498Szrj;; fmul executes on port 0 with latency 5.  It has issue latency 2,
368*38fd1498Szrj;; but we don't model this.
369*38fd1498Szrj(define_insn_reservation "c2_fmul" 5
370*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
371*38fd1498Szrj			      (and (eq_attr "memory" "none")
372*38fd1498Szrj				   (eq_attr "type" "fmul")))
373*38fd1498Szrj			 "c2_decoder0,c2_p0*2")
374*38fd1498Szrj
375*38fd1498Szrj(define_insn_reservation "c2_fmul_load" 6
376*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
377*38fd1498Szrj			      (and (eq_attr "memory" "load")
378*38fd1498Szrj				   (eq_attr "type" "fmul")))
379*38fd1498Szrj			 "c2_decoder0,c2_p2+c2_p0,c2_p0")
380*38fd1498Szrj
381*38fd1498Szrj;; fdiv latencies depend on the mode of the operands.  XFmode gives
382*38fd1498Szrj;; a latency of 38 cycles, DFmode gives 32, and SFmode gives latency 18.
383*38fd1498Szrj;; Division by a power of 2 takes only 9 cycles, but we cannot model
384*38fd1498Szrj;; that.  Throughput is equal to latency - 1, which we model using the
385*38fd1498Szrj;; c2_div automaton.
386*38fd1498Szrj(define_insn_reservation "c2_fdiv_SF" 18
387*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
388*38fd1498Szrj			      (and (eq_attr "memory" "none")
389*38fd1498Szrj				   (and (eq_attr "mode" "SF")
390*38fd1498Szrj					(eq_attr "type" "fdiv,fpspc"))))
391*38fd1498Szrj			 "c2_decodern,c2_p0+c2_fdiv,c2_fdiv*16")
392*38fd1498Szrj
393*38fd1498Szrj(define_insn_reservation "c2_fdiv_SF_load" 19
394*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
395*38fd1498Szrj			      (and (eq_attr "memory" "load")
396*38fd1498Szrj				   (and (eq_attr "mode" "SF")
397*38fd1498Szrj					(eq_attr "type" "fdiv,fpspc"))))
398*38fd1498Szrj			 "c2_decoder0,c2_p2+c2_p0+c2_fdiv,c2_fdiv*16")
399*38fd1498Szrj
400*38fd1498Szrj(define_insn_reservation "c2_fdiv_DF" 32
401*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
402*38fd1498Szrj			      (and (eq_attr "memory" "none")
403*38fd1498Szrj				   (and (eq_attr "mode" "DF")
404*38fd1498Szrj					(eq_attr "type" "fdiv,fpspc"))))
405*38fd1498Szrj			 "c2_decodern,c2_p0+c2_fdiv,c2_fdiv*30")
406*38fd1498Szrj
407*38fd1498Szrj(define_insn_reservation "c2_fdiv_DF_load" 33
408*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
409*38fd1498Szrj			      (and (eq_attr "memory" "load")
410*38fd1498Szrj				   (and (eq_attr "mode" "DF")
411*38fd1498Szrj					(eq_attr "type" "fdiv,fpspc"))))
412*38fd1498Szrj			 "c2_decoder0,c2_p2+c2_p0+c2_fdiv,c2_fdiv*30")
413*38fd1498Szrj
414*38fd1498Szrj(define_insn_reservation "c2_fdiv_XF" 38
415*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
416*38fd1498Szrj			      (and (eq_attr "memory" "none")
417*38fd1498Szrj				   (and (eq_attr "mode" "XF")
418*38fd1498Szrj					(eq_attr "type" "fdiv,fpspc"))))
419*38fd1498Szrj			 "c2_decodern,c2_p0+c2_fdiv,c2_fdiv*36")
420*38fd1498Szrj
421*38fd1498Szrj(define_insn_reservation "c2_fdiv_XF_load" 39
422*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
423*38fd1498Szrj			      (and (eq_attr "memory" "load")
424*38fd1498Szrj				   (and (eq_attr "mode" "XF")
425*38fd1498Szrj					(eq_attr "type" "fdiv,fpspc"))))
426*38fd1498Szrj			 "c2_decoder0,c2_p2+c2_p0+c2_fdiv,c2_fdiv*36")
427*38fd1498Szrj
428*38fd1498Szrj;; MMX instructions.
429*38fd1498Szrj
430*38fd1498Szrj(define_insn_reservation "c2_mmx_add" 1
431*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
432*38fd1498Szrj			      (and (eq_attr "memory" "none")
433*38fd1498Szrj				   (eq_attr "type" "mmxadd,sseiadd")))
434*38fd1498Szrj			 "c2_decodern,c2_p0|c2_p5")
435*38fd1498Szrj
436*38fd1498Szrj(define_insn_reservation "c2_mmx_add_load" 2
437*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
438*38fd1498Szrj			      (and (eq_attr "memory" "load")
439*38fd1498Szrj				   (eq_attr "type" "mmxadd,sseiadd")))
440*38fd1498Szrj			 "c2_decodern,c2_p2+c2_p0|c2_p5")
441*38fd1498Szrj
442*38fd1498Szrj(define_insn_reservation "c2_mmx_shft" 1
443*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
444*38fd1498Szrj			      (and (eq_attr "memory" "none")
445*38fd1498Szrj				   (eq_attr "type" "mmxshft")))
446*38fd1498Szrj			 "c2_decodern,c2_p0|c2_p5")
447*38fd1498Szrj
448*38fd1498Szrj(define_insn_reservation "c2_mmx_shft_load" 2
449*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
450*38fd1498Szrj			      (and (eq_attr "memory" "load")
451*38fd1498Szrj				   (eq_attr "type" "mmxshft")))
452*38fd1498Szrj			 "c2_decoder0,c2_p2+c2_p1")
453*38fd1498Szrj
454*38fd1498Szrj(define_insn_reservation "c2_mmx_sse_shft" 1
455*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
456*38fd1498Szrj			      (and (eq_attr "memory" "none")
457*38fd1498Szrj				   (and (eq_attr "type" "sseishft")
458*38fd1498Szrj					(eq_attr "length_immediate" "!0"))))
459*38fd1498Szrj			 "c2_decodern,c2_p1")
460*38fd1498Szrj
461*38fd1498Szrj(define_insn_reservation "c2_mmx_sse_shft_load" 2
462*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
463*38fd1498Szrj			      (and (eq_attr "memory" "load")
464*38fd1498Szrj				   (and (eq_attr "type" "sseishft")
465*38fd1498Szrj					(eq_attr "length_immediate" "!0"))))
466*38fd1498Szrj			 "c2_decodern,c2_p1")
467*38fd1498Szrj
468*38fd1498Szrj(define_insn_reservation "c2_mmx_sse_shft1" 2
469*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
470*38fd1498Szrj			      (and (eq_attr "memory" "none")
471*38fd1498Szrj				   (and (eq_attr "type" "sseishft")
472*38fd1498Szrj					(eq_attr "length_immediate" "0"))))
473*38fd1498Szrj			 "c2_decodern,c2_p1")
474*38fd1498Szrj
475*38fd1498Szrj(define_insn_reservation "c2_mmx_sse_shft1_load" 3
476*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
477*38fd1498Szrj			      (and (eq_attr "memory" "load")
478*38fd1498Szrj				   (and (eq_attr "type" "sseishft")
479*38fd1498Szrj					(eq_attr "length_immediate" "0"))))
480*38fd1498Szrj			 "c2_decodern,c2_p1")
481*38fd1498Szrj
482*38fd1498Szrj(define_insn_reservation "c2_mmx_mul" 3
483*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
484*38fd1498Szrj			      (and (eq_attr "memory" "none")
485*38fd1498Szrj				   (eq_attr "type" "mmxmul,sseimul")))
486*38fd1498Szrj			 "c2_decodern,c2_p1")
487*38fd1498Szrj
488*38fd1498Szrj(define_insn_reservation "c2_mmx_mul_load" 3
489*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
490*38fd1498Szrj			      (and (eq_attr "memory" "none")
491*38fd1498Szrj				   (eq_attr "type" "mmxmul,sseimul")))
492*38fd1498Szrj			 "c2_decoder0,c2_p2+c2_p1")
493*38fd1498Szrj
494*38fd1498Szrj(define_insn_reservation "c2_sse_mmxcvt" 4
495*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
496*38fd1498Szrj			      (and (eq_attr "mode" "DI")
497*38fd1498Szrj				   (eq_attr "type" "mmxcvt")))
498*38fd1498Szrj			 "c2_decodern,c2_p1")
499*38fd1498Szrj
500*38fd1498Szrj;; FIXME: These are Pentium III only, but we cannot tell here if
501*38fd1498Szrj;; we're generating code for PentiumPro/Pentium II or Pentium III
502*38fd1498Szrj;; (define_insn_reservation "c2_sse_mmxshft" 2
503*38fd1498Szrj;;			 (and (eq_attr "cpu" "core2,nehalem")
504*38fd1498Szrj;;			      (and (eq_attr "mode" "TI")
505*38fd1498Szrj;;				   (eq_attr "type" "mmxshft")))
506*38fd1498Szrj;;			 "c2_decodern,c2_p0")
507*38fd1498Szrj
508*38fd1498Szrj;; The sfence instruction.
509*38fd1498Szrj(define_insn_reservation "c2_sse_sfence" 3
510*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
511*38fd1498Szrj			      (and (eq_attr "memory" "unknown")
512*38fd1498Szrj				   (eq_attr "type" "sse")))
513*38fd1498Szrj			 "c2_decoder0,c2_p4+c2_p3")
514*38fd1498Szrj
515*38fd1498Szrj;; FIXME: This reservation is all wrong when we're scheduling sqrtss.
516*38fd1498Szrj(define_insn_reservation "c2_sse_SFDF" 3
517*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
518*38fd1498Szrj			      (and (eq_attr "mode" "SF,DF")
519*38fd1498Szrj				   (eq_attr "type" "sse")))
520*38fd1498Szrj			 "c2_decodern,c2_p0")
521*38fd1498Szrj
522*38fd1498Szrj(define_insn_reservation "c2_sse_V4SF" 4
523*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
524*38fd1498Szrj			      (and (eq_attr "mode" "V4SF")
525*38fd1498Szrj				   (eq_attr "type" "sse")))
526*38fd1498Szrj			 "c2_decoder0,c2_p1*2")
527*38fd1498Szrj
528*38fd1498Szrj(define_insn_reservation "c2_sse_addcmp" 3
529*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
530*38fd1498Szrj			      (and (eq_attr "memory" "none")
531*38fd1498Szrj				   (eq_attr "type" "sseadd,sseadd1,ssecmp,ssecomi")))
532*38fd1498Szrj			 "c2_decodern,c2_p1")
533*38fd1498Szrj
534*38fd1498Szrj(define_insn_reservation "c2_sse_addcmp_load" 3
535*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
536*38fd1498Szrj			      (and (eq_attr "memory" "load")
537*38fd1498Szrj				   (eq_attr "type" "sseadd,sseadd1,ssecmp,ssecomi")))
538*38fd1498Szrj			 "c2_decodern,c2_p2+c2_p1")
539*38fd1498Szrj
540*38fd1498Szrj(define_insn_reservation "c2_sse_mul_SF" 4
541*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
542*38fd1498Szrj			      (and (eq_attr "memory" "none")
543*38fd1498Szrj				   (and (eq_attr "mode" "SF,V4SF")
544*38fd1498Szrj					(eq_attr "type" "ssemul"))))
545*38fd1498Szrj			"c2_decodern,c2_p0")
546*38fd1498Szrj
547*38fd1498Szrj(define_insn_reservation "c2_sse_mul_SF_load" 4
548*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
549*38fd1498Szrj			      (and (eq_attr "memory" "load")
550*38fd1498Szrj				   (and (eq_attr "mode" "SF,V4SF")
551*38fd1498Szrj					(eq_attr "type" "ssemul"))))
552*38fd1498Szrj			"c2_decodern,c2_p2+c2_p0")
553*38fd1498Szrj
554*38fd1498Szrj(define_insn_reservation "c2_sse_mul_DF" 5
555*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
556*38fd1498Szrj			      (and (eq_attr "memory" "none")
557*38fd1498Szrj				   (and (eq_attr "mode" "DF,V2DF")
558*38fd1498Szrj					(eq_attr "type" "ssemul"))))
559*38fd1498Szrj			"c2_decodern,c2_p0")
560*38fd1498Szrj
561*38fd1498Szrj(define_insn_reservation "c2_sse_mul_DF_load" 5
562*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
563*38fd1498Szrj			      (and (eq_attr "memory" "load")
564*38fd1498Szrj				   (and (eq_attr "mode" "DF,V2DF")
565*38fd1498Szrj					(eq_attr "type" "ssemul"))))
566*38fd1498Szrj			"c2_decodern,c2_p2+c2_p0")
567*38fd1498Szrj
568*38fd1498Szrj(define_insn_reservation "c2_sse_div_SF" 18
569*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
570*38fd1498Szrj			      (and (eq_attr "memory" "none")
571*38fd1498Szrj				   (and (eq_attr "mode" "SF,V4SF")
572*38fd1498Szrj					(eq_attr "type" "ssediv"))))
573*38fd1498Szrj			 "c2_decodern,c2_p0,c2_ssediv*17")
574*38fd1498Szrj
575*38fd1498Szrj(define_insn_reservation "c2_sse_div_SF_load" 18
576*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
577*38fd1498Szrj			      (and (eq_attr "memory" "none")
578*38fd1498Szrj				   (and (eq_attr "mode" "SF,V4SF")
579*38fd1498Szrj					(eq_attr "type" "ssediv"))))
580*38fd1498Szrj			 "c2_decodern,(c2_p2+c2_p0),c2_ssediv*17")
581*38fd1498Szrj
582*38fd1498Szrj(define_insn_reservation "c2_sse_div_DF" 32
583*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
584*38fd1498Szrj			      (and (eq_attr "memory" "none")
585*38fd1498Szrj				   (and (eq_attr "mode" "DF,V2DF")
586*38fd1498Szrj					(eq_attr "type" "ssediv"))))
587*38fd1498Szrj			 "c2_decodern,c2_p0,c2_ssediv*31")
588*38fd1498Szrj
589*38fd1498Szrj(define_insn_reservation "c2_sse_div_DF_load" 32
590*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
591*38fd1498Szrj			      (and (eq_attr "memory" "none")
592*38fd1498Szrj				   (and (eq_attr "mode" "DF,V2DF")
593*38fd1498Szrj					(eq_attr "type" "ssediv"))))
594*38fd1498Szrj			 "c2_decodern,(c2_p2+c2_p0),c2_ssediv*31")
595*38fd1498Szrj
596*38fd1498Szrj;; FIXME: these have limited throughput
597*38fd1498Szrj(define_insn_reservation "c2_sse_icvt_SF" 4
598*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
599*38fd1498Szrj			      (and (eq_attr "memory" "none")
600*38fd1498Szrj				   (and (eq_attr "mode" "SF")
601*38fd1498Szrj					(eq_attr "type" "sseicvt"))))
602*38fd1498Szrj			 "c2_decodern,c2_p1")
603*38fd1498Szrj
604*38fd1498Szrj(define_insn_reservation "c2_sse_icvt_SF_load" 4
605*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
606*38fd1498Szrj			      (and (eq_attr "memory" "!none")
607*38fd1498Szrj				   (and (eq_attr "mode" "SF")
608*38fd1498Szrj					(eq_attr "type" "sseicvt"))))
609*38fd1498Szrj			 "c2_decodern,c2_p2+c2_p1")
610*38fd1498Szrj
611*38fd1498Szrj(define_insn_reservation "c2_sse_icvt_DF" 4
612*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
613*38fd1498Szrj			      (and (eq_attr "memory" "none")
614*38fd1498Szrj				   (and (eq_attr "mode" "DF")
615*38fd1498Szrj					(eq_attr "type" "sseicvt"))))
616*38fd1498Szrj			 "c2_decoder0,c2_p0+c2_p1")
617*38fd1498Szrj
618*38fd1498Szrj(define_insn_reservation "c2_sse_icvt_DF_load" 4
619*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
620*38fd1498Szrj			      (and (eq_attr "memory" "!none")
621*38fd1498Szrj				   (and (eq_attr "mode" "DF")
622*38fd1498Szrj					(eq_attr "type" "sseicvt"))))
623*38fd1498Szrj			 "c2_decoder0,(c2_p2+c2_p1)")
624*38fd1498Szrj
625*38fd1498Szrj(define_insn_reservation "c2_sse_icvt_SI" 3
626*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
627*38fd1498Szrj			      (and (eq_attr "memory" "none")
628*38fd1498Szrj				   (and (eq_attr "mode" "SI")
629*38fd1498Szrj					(eq_attr "type" "sseicvt"))))
630*38fd1498Szrj			 "c2_decodern,c2_p1")
631*38fd1498Szrj
632*38fd1498Szrj(define_insn_reservation "c2_sse_icvt_SI_load" 3
633*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
634*38fd1498Szrj			      (and (eq_attr "memory" "!none")
635*38fd1498Szrj				   (and (eq_attr "mode" "SI")
636*38fd1498Szrj					(eq_attr "type" "sseicvt"))))
637*38fd1498Szrj			 "c2_decodern,(c2_p2+c2_p1)")
638*38fd1498Szrj
639*38fd1498Szrj(define_insn_reservation "c2_sse_mov" 1
640*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
641*38fd1498Szrj			      (and (eq_attr "memory" "none")
642*38fd1498Szrj				   (eq_attr "type" "ssemov")))
643*38fd1498Szrj			 "c2_decodern,(c2_p0|c2_p1|c2_p5)")
644*38fd1498Szrj
645*38fd1498Szrj(define_insn_reservation "c2_sse_mov_load" 2
646*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
647*38fd1498Szrj			      (and (eq_attr "memory" "load")
648*38fd1498Szrj				   (eq_attr "type" "ssemov")))
649*38fd1498Szrj			 "c2_decodern,c2_p2")
650*38fd1498Szrj
651*38fd1498Szrj(define_insn_reservation "c2_sse_mov_store" 1
652*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
653*38fd1498Szrj			      (and (eq_attr "memory" "store")
654*38fd1498Szrj				   (eq_attr "type" "ssemov")))
655*38fd1498Szrj			 "c2_decodern,c2_p4+c2_p3")
656*38fd1498Szrj
657*38fd1498Szrj;; All other instructions are modelled as simple instructions.
658*38fd1498Szrj;; We have already modelled all i387 floating point instructions, so all
659*38fd1498Szrj;; other instructions execute on either port 0, 1 or 5.  This includes
660*38fd1498Szrj;; the ALU units, and the MMX units.
661*38fd1498Szrj;;
662*38fd1498Szrj;; reg-reg instructions produce 1 uop so they can be decoded on any of
663*38fd1498Szrj;; the three decoders.  Loads benefit from micro-op fusion and can be
664*38fd1498Szrj;; treated in the same way.
665*38fd1498Szrj(define_insn_reservation "c2_insn" 1
666*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
667*38fd1498Szrj			      (and (eq_attr "memory" "none,unknown")
668*38fd1498Szrj				   (eq_attr "type" "alu,alu1,negnot,incdec,icmp,test,setcc,sseishft1,mmx,mmxcmp")))
669*38fd1498Szrj			 "c2_decodern,(c2_p0|c2_p1|c2_p5)")
670*38fd1498Szrj
671*38fd1498Szrj(define_insn_reservation "c2_insn_load" 4
672*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
673*38fd1498Szrj			      (and (eq_attr "memory" "load")
674*38fd1498Szrj				   (eq_attr "type" "alu,alu1,negnot,incdec,icmp,test,setcc,pop,sseishft1,mmx,mmxcmp")))
675*38fd1498Szrj			 "c2_decodern,c2_p2,(c2_p0|c2_p1|c2_p5)")
676*38fd1498Szrj
677*38fd1498Szrj;; register-memory instructions have three uops,  so they have to be
678*38fd1498Szrj;; decoded on c2_decoder0.
679*38fd1498Szrj(define_insn_reservation "c2_insn_store" 1
680*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
681*38fd1498Szrj			      (and (eq_attr "memory" "store")
682*38fd1498Szrj				   (eq_attr "type" "alu,alu1,negnot,incdec,icmp,test,setcc,sseishft1,mmx,mmxcmp")))
683*38fd1498Szrj			 "c2_decoder0,(c2_p0|c2_p1|c2_p5),c2_p4+c2_p3")
684*38fd1498Szrj
685*38fd1498Szrj;; read-modify-store instructions produce 4 uops so they have to be
686*38fd1498Szrj;; decoded on c2_decoder0 as well.
687*38fd1498Szrj(define_insn_reservation "c2_insn_both" 4
688*38fd1498Szrj			 (and (eq_attr "cpu" "core2,nehalem")
689*38fd1498Szrj			      (and (eq_attr "memory" "both")
690*38fd1498Szrj				   (eq_attr "type" "alu,alu1,negnot,incdec,icmp,test,setcc,pop,sseishft1,mmx,mmxcmp")))
691*38fd1498Szrj			 "c2_decoder0,c2_p2,(c2_p0|c2_p1|c2_p5),c2_p4+c2_p3")
692