comparison gcc/config/aarch64/cortex-a57-fma-steering.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 /* FMA steering optimization pass for Cortex-A57. 1 /* FMA steering optimization pass for Cortex-A57.
2 Copyright (C) 2015-2018 Free Software Foundation, Inc. 2 Copyright (C) 2015-2020 Free Software Foundation, Inc.
3 Contributed by ARM Ltd. 3 Contributed by ARM Ltd.
4 4
5 This file is part of GCC. 5 This file is part of GCC.
6 6
7 GCC is free software; you can redistribute it and/or modify it 7 GCC is free software; you can redistribute it and/or modify it
35 #include "recog.h" 35 #include "recog.h"
36 #include "cfganal.h" 36 #include "cfganal.h"
37 #include "insn-attr.h" 37 #include "insn-attr.h"
38 #include "context.h" 38 #include "context.h"
39 #include "tree-pass.h" 39 #include "tree-pass.h"
40 #include "function-abi.h"
40 #include "regrename.h" 41 #include "regrename.h"
41 #include "aarch64-protos.h" 42 #include "aarch64-protos.h"
42 43
43 /* For better performance, the destination of FMADD/FMSUB instructions should 44 /* For better performance, the destination of FMADD/FMSUB instructions should
44 have the same parity as their accumulator register if the accumulator 45 have the same parity as their accumulator register if the accumulator
112 void merge_forest (fma_forest *); 113 void merge_forest (fma_forest *);
113 void dump_info (); 114 void dump_info ();
114 void dispatch (); 115 void dispatch ();
115 116
116 private: 117 private:
118 /* Prohibit copy construction. */
119 fma_forest (const fma_forest &);
120
117 /* The list of roots that form this forest. */ 121 /* The list of roots that form this forest. */
118 std::list<fma_root_node *> *m_roots; 122 std::list<fma_root_node *> *m_roots;
119 123
120 /* Target parity the destination register of all FMUL and FMADD/FMSUB 124 /* Target parity the destination register of all FMUL and FMADD/FMSUB
121 instructions in this forest should have. */ 125 instructions in this forest should have. */
146 int get_parity (); 150 int get_parity ();
147 void set_head (du_head *); 151 void set_head (du_head *);
148 void rename (fma_forest *); 152 void rename (fma_forest *);
149 void dump_info (fma_forest *); 153 void dump_info (fma_forest *);
150 154
155 private:
156 /* Prohibit copy construction. */
157 fma_node (const fma_node &);
158
151 protected: 159 protected:
152 /* Root node that lead to this node. */ 160 /* Root node that lead to this node. */
153 fma_root_node *m_root; 161 fma_root_node *m_root;
154 162
155 /* The parent node of this node. If the node belong to a chain with several 163 /* The parent node of this node. If the node belong to a chain with several
201 fma_node *get_fma_node (rtx_insn *); 209 fma_node *get_fma_node (rtx_insn *);
202 void analyze_fma_fmul_insn (fma_forest *, du_chain *, du_head_p); 210 void analyze_fma_fmul_insn (fma_forest *, du_chain *, du_head_p);
203 void execute_fma_steering (); 211 void execute_fma_steering ();
204 212
205 private: 213 private:
214 /* Prohibit copy construction. */
215 func_fma_steering (const func_fma_steering &);
216
206 void dfs (void (*) (fma_forest *), void (*) (fma_forest *, fma_root_node *), 217 void dfs (void (*) (fma_forest *), void (*) (fma_forest *, fma_root_node *),
207 void (*) (fma_forest *, fma_node *), bool); 218 void (*) (fma_forest *, fma_node *), bool);
208 void analyze (); 219 void analyze ();
209 void rename_fma_trees (); 220 void rename_fma_trees ();
210 221
255 for (tmp = head->first; tmp; tmp = tmp->next_use) 266 for (tmp = head->first; tmp; tmp = tmp->next_use)
256 { 267 {
257 if (DEBUG_INSN_P (tmp->insn)) 268 if (DEBUG_INSN_P (tmp->insn))
258 continue; 269 continue;
259 n_uses++; 270 n_uses++;
260 IOR_COMPL_HARD_REG_SET (*unavailable, reg_class_contents[tmp->cl]); 271 *unavailable |= ~reg_class_contents[tmp->cl];
261 super_class = reg_class_superunion[(int) super_class][(int) tmp->cl]; 272 super_class = reg_class_superunion[(int) super_class][(int) tmp->cl];
262 } 273 }
263 274
264 if (n_uses < 1) 275 if (n_uses < 1)
265 return false; 276 return false;
269 280
270 if (dump_file) 281 if (dump_file)
271 { 282 {
272 fprintf (dump_file, "Register %s in insn %d", reg_names[reg], 283 fprintf (dump_file, "Register %s in insn %d", reg_names[reg],
273 INSN_UID (head->first->insn)); 284 INSN_UID (head->first->insn));
274 if (head->need_caller_save_reg) 285 if (head->call_abis)
275 fprintf (dump_file, " crosses a call"); 286 fprintf (dump_file, " crosses a call");
276 } 287 }
277 288
278 if (best_new_reg == reg) 289 if (best_new_reg == reg)
279 { 290 {