blob: 6faa6251280fe95e3088598b5f4f5be2f074d307 [file] [log] [blame]
Brad Bishop286d45c2018-10-02 15:21:57 -04001From 17353cc4ba521f5ad928a1ede61cf03110e366ae Mon Sep 17 00:00:00 2001
2From: Mahesh Bodapati <mbodapat@xilinx.com>
3Date: Sat, 26 Aug 2017 19:21:43 -0700
4Subject: [PATCH] 8-stage pipeline for microblaze
5
6This patch adds the support for the 8-stage pipeline. The new 8-stage
7pipeline reduces the latencies of float & integer division drastically
8
9ChangeLog:
10
112016-01-18 Nagaraju Mekala <nagaraju.mekala@xilinx.com>
12
13 * microblaze.md (define_automaton mbpipe_8): New
14 * microblaze.c (microblaze_option_override): Update
15 Updated the logic to generate only when MB version is 10.0
16 * microblaze.h (pipeline_type): Update
17 Update the enum with MICROBLAZE_PIPE_8
18 * microblaze.opt (mxl-frequency): New
19 New flag added for 8-stage pipeline
20
21Signed-off-by: Nagaraju Mekala <nagaraju.mekala@xilinx.com>
22Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com>
23Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com>
24Upstream-Status: Pending
25---
26 gcc/config/microblaze/microblaze.c | 13 ++++++
27 gcc/config/microblaze/microblaze.h | 3 +-
28 gcc/config/microblaze/microblaze.md | 79 +++++++++++++++++++++++++++++++++++-
29 gcc/config/microblaze/microblaze.opt | 4 ++
30 4 files changed, 96 insertions(+), 3 deletions(-)
31
32diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
33index 663b20a022..e7697bf30d 100644
34--- a/gcc/config/microblaze/microblaze.c
35+++ b/gcc/config/microblaze/microblaze.c
36@@ -1773,6 +1773,19 @@ microblaze_option_override (void)
37 warning (0, "-mxl-reorder requires -mxl-pattern-compare for -mcpu=v8.30.a");
38 TARGET_REORDER = 0;
39 }
40+ ver = ver_int - microblaze_version_to_int("v10.0");
41+ if (ver < 0)
42+ {
43+ if (TARGET_AREA_OPTIMIZED_2)
44+ warning (0, "-mxl-frequency can be used only with -mcpu=v10.0 or greater");
45+ }
46+ else
47+ {
48+ if (TARGET_AREA_OPTIMIZED_2)
49+ microblaze_pipe = MICROBLAZE_PIPE_8;
50+ if (TARGET_BARREL_SHIFT)
51+ microblaze_has_bitfield = 1;
52+ }
53
54 if (TARGET_MULTIPLY_HIGH && TARGET_SOFT_MUL)
55 error ("-mxl-multiply-high requires -mno-xl-soft-mul");
56diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
57index 82e7e890be..3f48e48f10 100644
58--- a/gcc/config/microblaze/microblaze.h
59+++ b/gcc/config/microblaze/microblaze.h
60@@ -27,7 +27,8 @@
61 enum pipeline_type
62 {
63 MICROBLAZE_PIPE_3 = 0,
64- MICROBLAZE_PIPE_5 = 1
65+ MICROBLAZE_PIPE_5 = 1,
66+ MICROBLAZE_PIPE_8 = 2
67 };
68
69 #define MICROBLAZE_MASK_NO_UNSAFE_DELAY 0x00000001
70diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
71index b9c62b6d0f..61d6412dac 100644
72--- a/gcc/config/microblaze/microblaze.md
73+++ b/gcc/config/microblaze/microblaze.md
74@@ -35,6 +35,7 @@
75 (R_GOT 20) ;; GOT ptr reg
76 (MB_PIPE_3 0) ;; Microblaze 3-stage pipeline
77 (MB_PIPE_5 1) ;; Microblaze 5-stage pipeline
78+ (MB_PIPE_8 2) ;; Microblaze 8-stage pipeline
79 (UNSPEC_SET_GOT 101) ;;
80 (UNSPEC_GOTOFF 102) ;; GOT offset
81 (UNSPEC_PLT 103) ;; jump table
82@@ -80,7 +81,7 @@
83 ;; bshift Shift operations
84
85 (define_attr "type"
86- "unknown,branch,jump,call,load,store,move,arith,darith,imul,idiv,icmp,multi,nop,no_delay_arith,no_delay_load,no_delay_store,no_delay_imul,no_delay_move,bshift,fadd,frsub,fmul,fdiv,fcmp,fsl,fsqrt,fcvt,trap"
87+ "unknown,branch,jump,call,load,store,move,arith,darith,imul,idiv,icmp,multi,nop,no_delay_arith,no_delay_load,no_delay_store,no_delay_imul,no_delay_move,bshift,fadd,frsub,fmul,fdiv,fcmp,fsl,fsqrt,fcvt,fint,trap"
88 (const_string "unknown"))
89
90 ;; Main data type used by the insn
91@@ -222,6 +223,80 @@
92 ;;-----------------------------------------------------------------
93
94
95+
96+;;----------------------------------------------------------------
97+;; Microblaze 8-stage pipeline description (v10.0 and later)
98+;;----------------------------------------------------------------
99+
100+(define_automaton "mbpipe_8")
101+(define_cpu_unit "mb8_issue,mb8_iu,mb8_wb,mb8_fpu,mb8_fpu_2,mb8_mul,mb8_mul_2,mb8_div,mb8_div_2,mb8_bs,mb8_bs_2" "mbpipe_8")
102+
103+(define_insn_reservation "mb8-integer" 1
104+ (and (eq_attr "type" "branch,jump,call,arith,darith,icmp,nop,no_delay_arith")
105+ (eq (symbol_ref "microblaze_pipe") (const_int MB_PIPE_8)))
106+ "mb8_issue,mb8_iu,mb8_wb")
107+
108+(define_insn_reservation "mb8-special-move" 2
109+ (and (eq_attr "type" "move")
110+ (eq (symbol_ref "microblaze_pipe") (const_int MB_PIPE_8)))
111+ "mb8_issue,mb8_iu*2,mb8_wb")
112+
113+(define_insn_reservation "mb8-mem-load" 3
114+ (and (eq_attr "type" "load,no_delay_load")
115+ (eq (symbol_ref "microblaze_pipe") (const_int MB_PIPE_8)))
116+ "mb8_issue,mb8_iu,mb8_wb")
117+
118+(define_insn_reservation "mb8-mem-store" 1
119+ (and (eq_attr "type" "store,no_delay_store")
120+ (eq (symbol_ref "microblaze_pipe") (const_int MB_PIPE_8)))
121+ "mb8_issue,mb8_iu,mb8_wb")
122+
123+(define_insn_reservation "mb8-mul" 3
124+ (and (eq_attr "type" "imul,no_delay_imul")
125+ (eq (symbol_ref "microblaze_pipe") (const_int MB_PIPE_8)))
126+ "mb8_issue,mb8_mul,mb8_mul_2*2,mb8_wb")
127+
128+(define_insn_reservation "mb8-div" 30
129+ (and (eq_attr "type" "idiv")
130+ (eq (symbol_ref "microblaze_pipe") (const_int MB_PIPE_8)))
131+ "mb8_issue,mb8_div,mb8_div_2*29,mb8_wb")
132+
133+(define_insn_reservation "mb8-bs" 2
134+ (and (eq_attr "type" "bshift")
135+ (eq (symbol_ref "microblaze_pipe") (const_int MB_PIPE_8)))
136+ "mb8_issue,mb8_bs,mb8_bs_2,mb8_wb")
137+
138+(define_insn_reservation "mb8-fpu-add-sub-mul" 1
139+ (and (eq_attr "type" "fadd,frsub,fmul")
140+ (eq (symbol_ref "microblaze_pipe") (const_int MB_PIPE_8)))
141+ "mb8_issue,mb8_fpu,mb8_wb")
142+
143+(define_insn_reservation "mb8-fpu-fcmp" 3
144+ (and (eq_attr "type" "fcmp")
145+ (eq (symbol_ref "microblaze_pipe") (const_int MB_PIPE_8)))
146+ "mb8_issue,mb8_fpu,mb8_fpu*2,mb8_wb")
147+
148+(define_insn_reservation "mb8-fpu-div" 24
149+ (and (eq_attr "type" "fdiv")
150+ (eq (symbol_ref "microblaze_pipe") (const_int MB_PIPE_8)))
151+ "mb8_issue,mb8_fpu,mb8_fpu_2*23,mb8_wb")
152+
153+(define_insn_reservation "mb8-fpu-sqrt" 23
154+ (and (eq_attr "type" "fsqrt")
155+ (eq (symbol_ref "microblaze_pipe") (const_int MB_PIPE_8)))
156+ "mb8_issue,mb8_fpu,mb8_fpu_2*22,mb8_wb")
157+
158+(define_insn_reservation "mb8-fpu-fcvt" 1
159+ (and (eq_attr "type" "fcvt")
160+ (eq (symbol_ref "microblaze_pipe") (const_int MB_PIPE_8)))
161+ "mb8_issue,mb8_fpu,mb8_wb")
162+
163+(define_insn_reservation "mb8-fpu-fint" 2
164+ (and (eq_attr "type" "fint")
165+ (eq (symbol_ref "microblaze_pipe") (const_int MB_PIPE_8)))
166+ "mb8_issue,mb8_fpu,mb8_wb")
167+
168+
169 ;;----------------------------------------------------------------
170 ;; Microblaze 5-stage pipeline description (v5.00.a and later)
171 ;;----------------------------------------------------------------
172@@ -468,7 +543,7 @@
173 (fix:SI (match_operand:SF 1 "register_operand" "d")))]
174 "TARGET_HARD_FLOAT && TARGET_FLOAT_CONVERT"
175 "fint\t%0,%1"
176- [(set_attr "type" "fcvt")
177+ [(set_attr "type" "fint")
178 (set_attr "mode" "SF")
179 (set_attr "length" "4")])
180
181diff --git a/gcc/config/microblaze/microblaze.opt b/gcc/config/microblaze/microblaze.opt
182index 8847c3daf8..85a9929d74 100644
183--- a/gcc/config/microblaze/microblaze.opt
184+++ b/gcc/config/microblaze/microblaze.opt
185@@ -129,3 +129,7 @@ Use hardware prefetch instruction
186
187 mxl-mode-xilkernel
188 Target
189+
190+mxl-frequency
191+Target Mask(AREA_OPTIMIZED_2)
192+Use 8 stage pipeline (frequency optimization)
193--
1942.14.2
195