OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [config/] [mips/] [24k.md] - Blame information for rev 645

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
;; DFA-based pipeline descriptions for MIPS Technologies 24K core.
2
;; Contributed by Chao-ying Fu (fu@mips.com), Nigel Stephens (nigel@mips.com)
3
;;   and David Ung (davidu@mips.com)
4
;;
5
;; The 24K is a single-issue processor with a half-clocked fpu.
6
;; The 24Kx is 24k with 1:1 clocked fpu.
7
;;
8
;; References:
9
;;   "MIPS32 24K Processor Core Family Software User's Manual, Rev 3.04."
10
;;
11
;; Copyright (C) 2005, 2007 Free Software Foundation, Inc.
12
;;
13
;; This file is part of GCC.
14
;;
15
;; GCC is free software; you can redistribute it and/or modify it
16
;; under the terms of the GNU General Public License as published
17
;; by the Free Software Foundation; either version 3, or (at your
18
;; option) any later version.
19
 
20
;; GCC is distributed in the hope that it will be useful, but WITHOUT
21
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
22
;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
23
;; License for more details.
24
 
25
;; You should have received a copy of the GNU General Public License
26
;; along with GCC; see the file COPYING3.  If not see
27
;; .
28
 
29
(define_automaton "r24k_cpu, r24k_mdu, r24k_fpu")
30
 
31
;; Integer execution unit.
32
(define_cpu_unit "r24k_iss"             "r24k_cpu")
33
(define_cpu_unit "r24k_ixu_arith"       "r24k_cpu")
34
(define_cpu_unit "r24k_mul3a"           "r24k_mdu")
35
(define_cpu_unit "r24k_mul3b"           "r24k_mdu")
36
(define_cpu_unit "r24k_mul3c"           "r24k_mdu")
37
 
38
;; --------------------------------------------------------------
39
;; Producers
40
;; --------------------------------------------------------------
41
 
42
;; 1. Loads: lb, lbu, lh, lhu, ll, lw, lwl, lwr, lwpc, lwxs
43
(define_insn_reservation "r24k_int_load" 2
44
  (and (eq_attr "cpu" "24k,24kx")
45
       (eq_attr "type" "load"))
46
  "r24k_iss+r24k_ixu_arith")
47
 
48
 
49
;; 2. Arithmetic: add, addi, addiu, addiupc, addu, and, andi, clo, clz,
50
;;    ext, ins, lui, movn, movz, nor, or, ori, rotr, rotrv, seb, seh, sll,
51
;;    sllv, slt, slti, sltiu, sltu, sra, srav, srl, srlv, sub, subu, wsbh,
52
;;    xor, xori
53
;; (movn/movz is not matched, we'll need to split condmov to
54
;;  differentiate between integer/float moves)
55
(define_insn_reservation "r24k_int_arith" 1
56
  (and (eq_attr "cpu" "24k,24kx")
57
       (eq_attr "type" "arith,const,nop,shift,slt"))
58
  "r24k_iss+r24k_ixu_arith")
59
 
60
 
61
;; 3. Links: bgezal, bgezall, bltzal, bltzall, jal, jalr, jalx
62
;; 3a. jr/jalr consumer
63
(define_insn_reservation "r24k_int_jump" 1
64
  (and (eq_attr "cpu" "24k,24kx")
65
       (eq_attr "type" "call,jump"))
66
  "r24k_iss+r24k_ixu_arith")
67
 
68
;; 3b. branch consumer
69
(define_insn_reservation "r24k_int_branch" 1
70
  (and (eq_attr "cpu" "24k,24kx")
71
       (eq_attr "type" "branch"))
72
  "r24k_iss+r24k_ixu_arith")
73
 
74
 
75
;; 4. MDU: fully pipelined multiplier
76
;; mult - delivers result to hi/lo in 1 cycle (pipelined)
77
(define_insn_reservation "r24k_int_mult" 1
78
  (and (eq_attr "cpu" "24k,24kx")
79
       (eq_attr "type" "imul"))
80
  "r24k_iss+(r24k_mul3a|r24k_mul3b|r24k_mul3c)")
81
 
82
;; madd, msub - delivers result to hi/lo in 1 cycle (pipelined)
83
(define_insn_reservation "r24k_int_madd" 1
84
  (and (eq_attr "cpu" "24k,24kx")
85
       (eq_attr "type" "imadd"))
86
  "r24k_iss+(r24k_mul3a|r24k_mul3b|r24k_mul3c)")
87
 
88
;; mul - delivers result to gpr in 5 cycles
89
(define_insn_reservation "r24k_int_mul3" 5
90
  (and (eq_attr "cpu" "24k,24kx")
91
       (eq_attr "type" "imul3"))
92
  "r24k_iss+(r24k_mul3a|r24k_mul3b|r24k_mul3c)*5")
93
 
94
;; mfhi, mflo, mflhxu - deliver result to gpr in 5 cycles
95
(define_insn_reservation "r24k_int_mfhilo" 5
96
  (and (eq_attr "cpu" "24k,24kx")
97
       (eq_attr "type" "mfhilo"))
98
  "r24k_iss+(r24k_mul3a|r24k_mul3b|r24k_mul3c)")
99
 
100
;; mthi, mtlo, mtlhx - deliver result to hi/lo, thence madd, handled as bypass
101
(define_insn_reservation "r24k_int_mthilo" 1
102
  (and (eq_attr "cpu" "24k,24kx")
103
       (eq_attr "type" "mthilo"))
104
  "r24k_iss+(r24k_mul3a|r24k_mul3b|r24k_mul3c)")
105
 
106
;; div - default to 36 cycles for 32bit operands.  Faster for 24bit, 16bit and
107
;; 8bit, but is tricky to identify.
108
(define_insn_reservation "r24k_int_div" 36
109
  (and (eq_attr "cpu" "24k,24kx")
110
       (eq_attr "type" "idiv"))
111
  "r24k_iss+(r24k_mul3a+r24k_mul3b+r24k_mul3c)*36")
112
 
113
 
114
;; 5. Cop: cfc1, di, ei, mfc0, mtc0
115
;; (Disabled until we add proper cop0 support)
116
;;(define_insn_reservation "r24k_int_cop" 3
117
;;  (and (eq_attr "cpu" "24k,24kx")
118
;;       (eq_attr "type" "cop0"))
119
;;  "r24k_iss+r24k_ixu_arith")
120
 
121
 
122
;; 6. Store
123
(define_insn_reservation "r24k_int_store" 1
124
  (and (eq_attr "cpu" "24k,24kx")
125
       (and (eq_attr "type" "store")
126
            (eq_attr "mode" "!unknown")))
127
  "r24k_iss+r24k_ixu_arith")
128
 
129
;; 6.1 Special case - matches the cprestore pattern which don't set the mode
130
;;     attrib. This avoids being set as r24k_int_store and have it checked
131
;;     against store_data_bypass_p, which would then fail because cprestore
132
;;     does not have a normal SET pattern.
133
(define_insn_reservation "r24k_unknown_store" 1
134
  (and (eq_attr "cpu" "24k,24kx")
135
       (and (eq_attr "type" "store")
136
            (eq_attr "mode" "unknown")))
137
  "r24k_iss+r24k_ixu_arith")
138
 
139
 
140
;; 7. Multiple instructions
141
(define_insn_reservation "r24k_int_multi" 1
142
  (and (eq_attr "cpu" "24k,24kx")
143
       (eq_attr "type" "multi"))
144
  "r24k_iss+r24k_ixu_arith+r24k_fpu_arith+(r24k_mul3a+r24k_mul3b+r24k_mul3c)")
145
 
146
 
147
;; 8. Unknowns - Currently these include blockage, consttable and alignment
148
;;    rtls. They do not really affect scheduling latency, (blockage affects
149
;;    scheduling via log links, but not used here).
150
(define_insn_reservation "r24k_int_unknown" 0
151
  (and (eq_attr "cpu" "24k,24kx")
152
       (eq_attr "type" "unknown"))
153
  "r24k_iss")
154
 
155
 
156
;; 9. Prefetch
157
(define_insn_reservation "r24k_int_prefetch" 1
158
  (and (eq_attr "cpu" "24k,24kx")
159
       (eq_attr "type" "prefetch,prefetchx"))
160
  "r24k_iss+r24k_ixu_arith")
161
 
162
 
163
;; --------------------------------------------------------------
164
;; Bypass to Consumer
165
;; --------------------------------------------------------------
166
 
167
;; load->next use :  2 cycles (Default)
168
;; load->load base:  3 cycles
169
;; load->store base: 3 cycles
170
;; load->prefetch:   3 cycles
171
(define_bypass 3 "r24k_int_load" "r24k_int_load")
172
(define_bypass 3 "r24k_int_load" "r24k_int_store" "!store_data_bypass_p")
173
(define_bypass 3 "r24k_int_load" "r24k_int_prefetch")
174
 
175
;; arith->next use :  1 cycles (Default)
176
;; arith->load base:  2 cycles
177
;; arith->store base: 2 cycles
178
;; arith->prefetch:   2 cycles
179
(define_bypass 2 "r24k_int_arith" "r24k_int_load")
180
(define_bypass 2 "r24k_int_arith" "r24k_int_store" "!store_data_bypass_p")
181
(define_bypass 2 "r24k_int_arith" "r24k_int_prefetch")
182
 
183
;; mul3->next use : 5 cycles (default)
184
;; mul3->l/s base : 6 cycles
185
;; mul3->prefetch : 6 cycles
186
(define_bypass 6 "r24k_int_mul3" "r24k_int_load")
187
(define_bypass 6 "r24k_int_mul3" "r24k_int_store" "!store_data_bypass_p")
188
(define_bypass 6 "r24k_int_mul3" "r24k_int_prefetch")
189
 
190
;; mfhilo->next use  : 5 cycles (default)
191
;; mfhilo->l/s base  : 6 cycles
192
;; mfhilo->prefetch  : 6 cycles
193
;; mthilo->madd/msub : 2 cycle (only for mthi/lo not mfhi/lo)
194
(define_bypass 6 "r24k_int_mfhilo" "r24k_int_load")
195
(define_bypass 6 "r24k_int_mfhilo" "r24k_int_store" "!store_data_bypass_p")
196
(define_bypass 6 "r24k_int_mfhilo" "r24k_int_prefetch")
197
(define_bypass 2 "r24k_int_mthilo" "r24k_int_madd")
198
 
199
;; cop->next use : 3 cycles (Default)
200
;; cop->l/s base : 4 cycles
201
;; (define_bypass 4 "r24k_int_cop" "r24k_int_load")
202
;; (define_bypass 4 "r24k_int_cop" "r24k_int_store" "!store_data_bypass_p")
203
 
204
;; multi->next use : 1 cycles (Default)
205
;; multi->l/s base : 2 cycles
206
;; multi->prefetch : 2 cycles
207
(define_bypass 2 "r24k_int_multi" "r24k_int_load")
208
(define_bypass 2 "r24k_int_multi" "r24k_int_store" "!store_data_bypass_p")
209
(define_bypass 2 "r24k_int_multi" "r24k_int_prefetch")
210
 
211
 
212
;; --------------------------------------------------------------
213
;; Floating Point Instructions
214
;; --------------------------------------------------------------
215
 
216
(define_cpu_unit "r24k_fpu_arith" "r24k_fpu")
217
 
218
;; The 24k is a single issue cpu, and the fpu runs at half clock speed,
219
;; so each fpu instruction ties up the shared instruction scheduler for
220
;; 1 cycle, and the fpu scheduler for 2 cycles.
221
;;
222
;; These timings are therefore twice the values in the 24K manual,
223
;; which are quoted in fpu clocks.
224
;;
225
;; The 24kx is a 24k configured with 1:1 cpu and fpu, so use
226
;; the unscaled timings
227
 
228
(define_reservation "r24k_fpu_iss"      "r24k_iss+(r24k_fpu_arith*2)")
229
 
230
;; fadd, fabs, fneg
231
(define_insn_reservation "r24k_fadd" 8
232
  (and (eq_attr "cpu" "24k")
233
       (eq_attr "type" "fadd,fabs,fneg"))
234
  "r24k_fpu_iss")
235
 
236
;; fmove, fcmove
237
(define_insn_reservation "r24k_fmove" 8
238
  (and (eq_attr "cpu" "24k")
239
       (eq_attr "type" "fmove,condmove"))
240
  "r24k_fpu_iss")
241
 
242
;; fload
243
(define_insn_reservation "r24k_fload" 6
244
  (and (eq_attr "cpu" "24k")
245
       (eq_attr "type" "fpload,fpidxload"))
246
  "r24k_fpu_iss")
247
 
248
;; fstore
249
(define_insn_reservation "r24k_fstore" 2
250
  (and (eq_attr "cpu" "24k")
251
       (eq_attr "type" "fpstore"))
252
  "r24k_fpu_iss")
253
 
254
;; fmul, fmadd
255
(define_insn_reservation "r24k_fmul_sf" 8
256
  (and (eq_attr "cpu" "24k")
257
       (and (eq_attr "type" "fmul,fmadd")
258
            (eq_attr "mode" "SF")))
259
  "r24k_fpu_iss")
260
 
261
(define_insn_reservation "r24k_fmul_df" 10
262
  (and (eq_attr "cpu" "24k")
263
       (and (eq_attr "type" "fmul,fmadd")
264
            (eq_attr "mode" "DF")))
265
  "r24k_fpu_iss,(r24k_fpu_arith*2)")
266
 
267
 
268
;; fdiv, fsqrt, frsqrt
269
(define_insn_reservation "r24k_fdiv_sf" 34
270
  (and (eq_attr "cpu" "24k")
271
       (and (eq_attr "type" "fdiv,fsqrt,frsqrt")
272
            (eq_attr "mode" "SF")))
273
  "r24k_fpu_iss,(r24k_fpu_arith*26)")
274
 
275
(define_insn_reservation "r24k_fdiv_df" 64
276
  (and (eq_attr "cpu" "24k")
277
       (and (eq_attr "type" "fdiv,fsqrt")
278
            (eq_attr "mode" "DF")))
279
  "r24k_fpu_iss,(r24k_fpu_arith*56)")
280
 
281
;; frsqrt
282
(define_insn_reservation "r24k_frsqrt_df" 70
283
  (and (eq_attr "cpu" "24k")
284
       (and (eq_attr "type" "frsqrt")
285
            (eq_attr "mode" "DF")))
286
  "r24k_fpu_iss,(r24k_fpu_arith*60)")
287
 
288
;; fcmp
289
(define_insn_reservation "r24k_fcmp" 4
290
  (and (eq_attr "cpu" "24k")
291
       (eq_attr "type" "fcmp"))
292
  "r24k_fpu_iss")
293
 
294
;; fcmp -> movf.fmt & movt.fmt bypass (dependency must be on the condition)
295
(define_bypass 2 "r24k_fcmp" "r24k_fmove")
296
 
297
;; fcvt (cvt.d.s, cvt.[sd].[wl])
298
(define_insn_reservation "r24k_fcvt_i2f_s2d" 8
299
  (and (eq_attr "cpu" "24k")
300
       (and (eq_attr "type" "fcvt")
301
            (eq_attr "cnv_mode" "I2S,I2D,S2D")))
302
  "r24k_fpu_iss")
303
 
304
;; fcvt (cvt.s.d)
305
(define_insn_reservation "r24k_fcvt_s2d" 12
306
  (and (eq_attr "cpu" "24k")
307
       (and (eq_attr "type" "fcvt")
308
            (eq_attr "cnv_mode" "D2S")))
309
  "r24k_fpu_iss")
310
 
311
;; fcvt (cvt.[wl].[sd], etc)
312
(define_insn_reservation "r24k_fcvt_f2i" 10
313
  (and (eq_attr "cpu" "24k")
314
       (and (eq_attr "type" "fcvt")
315
            (eq_attr "cnv_mode" "S2I,D2I")))
316
  "r24k_fpu_iss")
317
 
318
;; fxfer (mfc1, mfhc1, mtc1, mthc1)
319
(define_insn_reservation "r24k_fxfer" 4
320
  (and (eq_attr "cpu" "24k")
321
       (eq_attr "type" "xfer"))
322
  "r24k_fpu_iss")
323
 
324
;; --------------------------------------------------------------
325
;; Bypass to Consumer
326
;; --------------------------------------------------------------
327
;; r24k_fcvt_f2i->l/s base : 11 cycles
328
;; r24k_fcvt_f2i->prefetch : 11 cycles
329
(define_bypass 11 "r24k_fcvt_f2i" "r24k_int_load")
330
(define_bypass 11 "r24k_fcvt_f2i" "r24k_int_store" "!store_data_bypass_p")
331
(define_bypass 11 "r24k_fcvt_f2i" "r24k_int_prefetch")
332
 
333
;; r24k_fxfer->l/s base : 5 cycles
334
;; r24k_fxfer->prefetch : 5 cycles
335
(define_bypass 5 "r24k_fxfer" "r24k_int_load")
336
(define_bypass 5 "r24k_fxfer" "r24k_int_store" "!store_data_bypass_p")
337
(define_bypass 5 "r24k_fxfer" "r24k_int_prefetch")
338
 
339
;; --------------------------------------------------------------
340
;; The 24kx is a 24k configured with 1:1 cpu and fpu, so use
341
;; the unscaled timings
342
;; --------------------------------------------------------------
343
 
344
(define_reservation "r24kx_fpu_iss"     "r24k_iss+r24k_fpu_arith")
345
 
346
;; fadd, fabs, fneg
347
(define_insn_reservation "r24kx_fadd" 4
348
  (and (eq_attr "cpu" "24kx")
349
       (eq_attr "type" "fadd,fabs,fneg"))
350
  "r24kx_fpu_iss")
351
 
352
;; fmove, fcmove
353
(define_insn_reservation "r24kx_fmove" 4
354
  (and (eq_attr "cpu" "24kx")
355
       (eq_attr "type" "fmove,condmove"))
356
  "r24kx_fpu_iss")
357
 
358
;; fload
359
(define_insn_reservation "r24kx_fload" 3
360
  (and (eq_attr "cpu" "24kx")
361
       (eq_attr "type" "fpload,fpidxload"))
362
  "r24kx_fpu_iss")
363
 
364
;; fstore
365
(define_insn_reservation "r24kx_fstore" 1
366
  (and (eq_attr "cpu" "24kx")
367
       (eq_attr "type" "fpstore"))
368
  "r24kx_fpu_iss")
369
 
370
;; fmul, fmadd
371
(define_insn_reservation "r24kx_fmul_sf" 4
372
  (and (eq_attr "cpu" "24kx")
373
       (and (eq_attr "type" "fmul,fmadd")
374
            (eq_attr "mode" "SF")))
375
  "r24kx_fpu_iss")
376
 
377
(define_insn_reservation "r24kx_fmul_df" 5
378
  (and (eq_attr "cpu" "24kx")
379
       (and (eq_attr "type" "fmul,fmadd")
380
            (eq_attr "mode" "DF")))
381
  "r24kx_fpu_iss,r24k_fpu_arith")
382
 
383
 
384
;; fdiv, fsqrt, frsqrt
385
(define_insn_reservation "r24kx_fdiv_sf" 17
386
  (and (eq_attr "cpu" "24kx")
387
       (and (eq_attr "type" "fdiv,fsqrt,frsqrt")
388
            (eq_attr "mode" "SF")))
389
  "r24kx_fpu_iss,(r24k_fpu_arith*13)")
390
 
391
(define_insn_reservation "r24kx_fdiv_df" 32
392
  (and (eq_attr "cpu" "24kx")
393
       (and (eq_attr "type" "fdiv,fsqrt")
394
            (eq_attr "mode" "DF")))
395
  "r24kx_fpu_iss,(r24k_fpu_arith*28)")
396
 
397
;; frsqrt
398
(define_insn_reservation "r24kx_frsqrt_df" 35
399
  (and (eq_attr "cpu" "24kx")
400
       (and (eq_attr "type" "frsqrt")
401
            (eq_attr "mode" "DF")))
402
  "r24kx_fpu_iss,(r24k_fpu_arith*30)")
403
 
404
;; fcmp
405
(define_insn_reservation "r24kx_fcmp" 2
406
  (and (eq_attr "cpu" "24kx")
407
       (eq_attr "type" "fcmp"))
408
  "r24kx_fpu_iss")
409
 
410
;; fcmp -> movf.fmt & movt.fmt bypass (dependency must be on the condition)
411
(define_bypass 1 "r24kx_fcmp" "r24kx_fmove")
412
 
413
;; fcvt (cvt.d.s, cvt.[sd].[wl])
414
(define_insn_reservation "r24kx_fcvt_i2f_s2d" 4
415
  (and (eq_attr "cpu" "24kx")
416
       (and (eq_attr "type" "fcvt")
417
            (eq_attr "cnv_mode" "I2S,I2D,S2D")))
418
  "r24kx_fpu_iss")
419
 
420
;; fcvt (cvt.s.d)
421
(define_insn_reservation "r24kx_fcvt_s2d" 6
422
  (and (eq_attr "cpu" "24kx")
423
       (and (eq_attr "type" "fcvt")
424
            (eq_attr "cnv_mode" "D2S")))
425
  "r24kx_fpu_iss")
426
 
427
;; fcvt (cvt.[wl].[sd], etc)
428
(define_insn_reservation "r24kx_fcvt_f2i" 5
429
  (and (eq_attr "cpu" "24kx")
430
       (and (eq_attr "type" "fcvt")
431
            (eq_attr "cnv_mode" "S2I,D2I")))
432
  "r24kx_fpu_iss")
433
 
434
;; fxfer (mfc1, mfhc1, mtc1, mthc1)
435
(define_insn_reservation "r24kx_fxfer" 2
436
  (and (eq_attr "cpu" "24kx")
437
       (eq_attr "type" "xfer"))
438
  "r24kx_fpu_iss")
439
 
440
;; --------------------------------------------------------------
441
;; Bypass to Consumer
442
;; --------------------------------------------------------------
443
;; r24kx_fcvt_f2i->l/s base : 6 cycles
444
;; r24kx_fcvt_f2i->prefetch : 6 cycles
445
(define_bypass 6 "r24kx_fcvt_f2i" "r24k_int_load")
446
(define_bypass 6 "r24kx_fcvt_f2i" "r24k_int_store" "!store_data_bypass_p")
447
(define_bypass 6 "r24kx_fcvt_f2i" "r24k_int_prefetch")
448
 
449
;; r24kx_fxfer->l/s base : 3 cycles
450
;; r24kx_fxfer->prefetch : 3 cycles
451
(define_bypass 3 "r24kx_fxfer" "r24k_int_load")
452
(define_bypass 3 "r24kx_fxfer" "r24k_int_store" "!store_data_bypass_p")
453
(define_bypass 3 "r24kx_fxfer" "r24k_int_prefetch")
454
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.