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