1;; Instruction scheduling information for C-SKY CK802 processors.
2;; Copyright (C) 2018-2021 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 "csky_ck802")
22
23(define_cpu_unit "csky_ck802_ex" "csky_ck802")
24(define_cpu_unit "csky_ck802_wb" "csky_ck802")
25
26(define_insn_reservation "ck802_alu" 2
27  (and (match_test "CSKY_TARGET_ARCH (CK802)")
28       (eq_attr "type" "alu"))
29  "csky_ck802_ex, csky_ck802_wb")
30
31(define_insn_reservation "ck802_branch" 2
32  (and (match_test "CSKY_TARGET_ARCH (CK802)")
33       (eq_attr "type" "branch, branch_jmp"))
34  "csky_ck802_ex, csky_ck802_wb")
35
36(define_insn_reservation "ck802_cmp" 2
37  (and (match_test "CSKY_TARGET_ARCH (CK802)")
38       (eq_attr "type" "cmp"))
39  "csky_ck802_ex, csky_ck802_wb")
40
41(define_insn_reservation "ck802_cbranch" 2
42  (and (match_test "CSKY_TARGET_ARCH (CK802)")
43       (eq_attr "type" "cbranch"))
44  "csky_ck802_ex, csky_ck802_wb")
45
46(define_insn_reservation "ck802_call" 2
47  (and (match_test "CSKY_TARGET_ARCH (CK802)")
48       (eq_attr "type" "call, call_jsr"))
49  "csky_ck802_ex, csky_ck802_wb")
50
51(define_insn_reservation "ck802_load" 2
52  (and (match_test "CSKY_TARGET_ARCH (CK802)")
53	(and (eq_attr "type" "load")
54	     (match_test "!csky_minipool_load_p (insn)")))
55  "csky_ck802_ex, csky_ck802_wb")
56
57(define_insn_reservation "ck802_pool" 2
58  (and (match_test "CSKY_TARGET_ARCH (CK802)")
59       (and (eq_attr "type" "load")
60	    (match_test "csky_minipool_load_p (insn)")))
61  "csky_ck802_ex, csky_ck802_wb")
62
63(define_insn_reservation "ck802_store" 2
64  (and (match_test "CSKY_TARGET_ARCH (CK802)")
65       (eq_attr "type" "store"))
66  "csky_ck802_ex, csky_ck802_wb")
67
68;; Switching between constant pool loads and loads/stores in the data section
69;; carries an extra penalty.
70(define_bypass 3 "ck802_load,ck802_store" "ck802_pool")
71(define_bypass 3 "ck802_pool" "ck802_load,ck802_store")
72
73(define_bypass 1 "ck802_alu,ck802_branch,ck802_cmp,ck802_cbranch,ck802_call,\
74		  ck802_load,ck802_pool,ck802_store"
75		 "ck802_alu")
76
77(define_bypass 1 "ck802_alu,ck802_branch,ck802_cmp,ck802_cbranch,ck802_call,\
78		  ck802_load,ck802_pool,ck802_store"
79		 "ck802_branch")
80
81(define_bypass 2 "ck802_cmp" "ck802_cbranch")
82