1;; Scheduler information for C-SKY CK803 processors.
2;; Copyright (C) 2018-2020 Free Software Foundation, Inc.
3;; Contributed by C-SKY Microsystems and Mentor Graphics.
4;;
5;; This file is part of GCC.
6;;
7;; GCC is free software; you can redistribute it and/or modify it
8;; under the terms of the GNU General Public License as published by
9;; the Free Software Foundation; either version 3, or (at your option)
10;; any later version.
11;;
12;; GCC is distributed in the hope that it will be useful, but
13;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15;; General Public License for more details.
16;;
17;; You should have received a copy of the GNU General Public License
18;; along with GCC; see the file COPYING3.  If not see
19;; <http://www.gnu.org/licenses/>.  */
20
21(define_automaton "ck803")
22
23(define_cpu_unit "ck803_ex1" "ck803")
24(define_cpu_unit "ck803_exit" "ck803")
25
26(define_insn_reservation "ck803_3cycle" 1
27  (and (match_test "CSKY_TARGET_ARCH (CK803)")
28       (eq_attr "type" "alu,cmp,branch,branch_jmp,call_jsr,call"))
29  "ck803_ex1+ck803_exit")
30
31(define_insn_reservation "ck803_alu1" 1
32  (and (match_test "CSKY_TARGET_ARCH (CK803)")
33       (eq_attr "type" "addsub,alu_ix"))
34  "ck803_ex1+ck803_exit")
35
36(define_insn_reservation "ck803_cbranch" 1
37  (and (match_test "CSKY_TARGET_ARCH (CK803)")
38       (eq_attr "type" "cbranch"))
39  "ck803_ex1+ck803_exit")
40
41(define_insn_reservation "ck803_load" 1
42  (and (match_test "CSKY_TARGET_ARCH (CK803)")
43       (and (eq_attr "type" "load")
44	    (match_test "!csky_minipool_load_p (insn)")))
45  "ck803_ex1+ck803_exit")
46
47(define_insn_reservation "ck803_pool" 1
48  (and (match_test "CSKY_TARGET_ARCH (CK803)")
49       (and (eq_attr "type" "load")
50	    (match_test "csky_minipool_load_p (insn)")))
51  "ck803_ex1+ck803_exit")
52
53(define_insn_reservation "ck803_store" 1
54  (and (match_test "CSKY_TARGET_ARCH (CK803)")
55       (eq_attr "type" "store"))
56  "ck803_ex1+ck803_exit")
57
58;; Switching between constant pool loads and loads/stores in the data section
59;; carries an extra penalty.
60(define_bypass 2 "ck803_load,ck803_store" "ck803_pool")
61(define_bypass 2 "ck803_pool" "ck803_load,ck803_store")
62
63(define_bypass 2 "ck803_3cycle,ck803_cbranch,ck803_load,ck803_store,ck803_pool"
64		 "ck803_cbranch")
65