1 (define_automaton "sifive_7")
3 ;; Sifive 7 Series Base Core
4 ;; This has two pipelines, A (Address) and B (Branch).
5 ;; Loads, stores, and FP <-> integer moves use the A-pipe.
6 ;; Branches, MUL/DIV, and FP ops use the B-pipe.
7 ;; Integer ALU ops can use either pipe.
9 (define_cpu_unit "sifive_7_A" "sifive_7")
10 (define_cpu_unit "sifive_7_B" "sifive_7")
12 (define_cpu_unit "sifive_7_idiv" "sifive_7")
13 (define_cpu_unit "sifive_7_fpu" "sifive_7")
15 (define_insn_reservation "sifive_7_load" 3
16 (and (eq_attr "tune" "sifive_7")
17 (eq_attr "type" "load"))
20 (define_insn_reservation "sifive_7_fpload" 2
21 (and (eq_attr "tune" "sifive_7")
22 (eq_attr "type" "fpload"))
25 (define_insn_reservation "sifive_7_store" 1
26 (and (eq_attr "tune" "sifive_7")
27 (eq_attr "type" "store"))
30 (define_insn_reservation "sifive_7_fpstore" 1
31 (and (eq_attr "tune" "sifive_7")
32 (eq_attr "type" "fpstore"))
35 (define_insn_reservation "sifive_7_branch" 1
36 (and (eq_attr "tune" "sifive_7")
37 (eq_attr "type" "branch,ret,trap"))
40 (define_insn_reservation "sifive_7_sfb_alu" 2
41 (and (eq_attr "tune" "sifive_7")
42 (eq_attr "type" "sfb_alu"))
43 "sifive_7_A+sifive_7_B")
45 (define_insn_reservation "sifive_7_jump" 1
46 (and (eq_attr "tune" "sifive_7")
47 (eq_attr "type" "jump,call,jalr"))
50 (define_insn_reservation "sifive_7_mul" 3
51 (and (eq_attr "tune" "sifive_7")
52 (eq_attr "type" "imul"))
55 (define_insn_reservation "sifive_7_div" 16
56 (and (eq_attr "tune" "sifive_7")
57 (eq_attr "type" "idiv"))
58 "sifive_7_B,sifive_7_idiv*15")
60 (define_insn_reservation "sifive_7_alu" 2
61 (and (eq_attr "tune" "sifive_7")
62 (eq_attr "type" "unknown,arith,shift,slt,multi,logical,move,bitmanip,\
63 rotate,min,max,minu,maxu,clz,ctz,atomic,condmove,mvpair,zicond"))
64 "sifive_7_A|sifive_7_B")
66 (define_insn_reservation "sifive_7_load_immediate" 1
67 (and (eq_attr "tune" "sifive_7")
68 (eq_attr "type" "nop,const,auipc"))
69 "sifive_7_A|sifive_7_B")
71 (define_insn_reservation "sifive_7_hfma" 5
72 (and (eq_attr "tune" "sifive_7")
73 (and (eq_attr "type" "fadd,fmul,fmadd")
74 (eq_attr "mode" "HF")))
77 (define_insn_reservation "sifive_7_sfma" 5
78 (and (eq_attr "tune" "sifive_7")
79 (and (eq_attr "type" "fadd,fmul,fmadd")
80 (eq_attr "mode" "SF")))
83 (define_insn_reservation "sifive_7_dfma" 7
84 (and (eq_attr "tune" "sifive_7")
85 (and (eq_attr "type" "fadd,fmul,fmadd")
86 (eq_attr "mode" "DF")))
89 (define_insn_reservation "sifive_7_fp_other" 3
90 (and (eq_attr "tune" "sifive_7")
91 (eq_attr "type" "fcvt,fcvt_i2f,fcvt_f2i,fcmp,fmove"))
94 (define_insn_reservation "sifive_7_fdiv_s" 27
95 (and (eq_attr "tune" "sifive_7")
96 (eq_attr "type" "fdiv,fsqrt")
97 (eq_attr "mode" "SF"))
98 "sifive_7_B,sifive_7_fpu*26")
100 (define_insn_reservation "sifive_7_fdiv_d" 56
101 (and (eq_attr "tune" "sifive_7")
102 (eq_attr "type" "fdiv,fsqrt")
103 (eq_attr "mode" "DF"))
104 "sifive_7_B,sifive_7_fpu*55")
106 (define_insn_reservation "sifive_7_i2f" 3
107 (and (eq_attr "tune" "sifive_7")
108 (eq_attr "type" "mtc"))
111 (define_insn_reservation "sifive_7_f2i" 3
112 (and (eq_attr "tune" "sifive_7")
113 (eq_attr "type" "mfc"))
116 ;; Popcount and clmul.
117 (define_insn_reservation "sifive_7_popcount" 2
118 (and (eq_attr "tune" "sifive_7")
119 (eq_attr "type" "cpop,clmul"))
122 (define_bypass 1 "sifive_7_load,sifive_7_alu,sifive_7_mul,sifive_7_f2i,sifive_7_sfb_alu"
123 "sifive_7_alu,sifive_7_branch")
125 (define_bypass 1 "sifive_7_alu,sifive_7_sfb_alu"
128 (define_bypass 1 "sifive_7_load,sifive_7_alu,sifive_7_mul,sifive_7_f2i,sifive_7_sfb_alu"
129 "sifive_7_store" "riscv_store_data_bypass_p")
131 (define_bypass 2 "sifive_7_i2f"
132 "sifive_7_sfma,sifive_7_dfma,sifive_7_fp_other,sifive_7_fdiv_s,sifive_7_fdiv_d")
134 (define_bypass 2 "sifive_7_fp_other"
135 "sifive_7_sfma,sifive_7_dfma,sifive_7_fp_other,sifive_7_fdiv_s,sifive_7_fdiv_d")
137 (define_bypass 2 "sifive_7_fp_other"
138 "sifive_7_alu,sifive_7_branch")
140 (define_bypass 2 "sifive_7_fp_other"
141 "sifive_7_store" "riscv_store_data_bypass_p")