]>
Commit | Line | Data |
---|---|---|
09cae750 | 1 | /* Definition of RISC-V target for GNU compiler. |
83ffe9cd | 2 | Copyright (C) 2011-2023 Free Software Foundation, Inc. |
09cae750 PD |
3 | Contributed by Andrew Waterman (andrew@sifive.com). |
4 | Based on MIPS target for GNU compiler. | |
5 | ||
6 | This file is part of GCC. | |
7 | ||
8 | GCC is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation; either version 3, or (at your option) | |
11 | any later version. | |
12 | ||
13 | GCC is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with GCC; see the file COPYING3. If not see | |
20 | <http://www.gnu.org/licenses/>. */ | |
21 | ||
22 | #ifndef GCC_RISCV_PROTOS_H | |
23 | #define GCC_RISCV_PROTOS_H | |
24 | ||
942ab49b PN |
25 | #include "memmodel.h" |
26 | ||
09cae750 PD |
27 | /* Symbol types we understand. The order of this list must match that of |
28 | the unspec enum in riscv.md, subsequent to UNSPEC_ADDRESS_FIRST. */ | |
29 | enum riscv_symbol_type { | |
30 | SYMBOL_ABSOLUTE, | |
31 | SYMBOL_PCREL, | |
32 | SYMBOL_GOT_DISP, | |
33 | SYMBOL_TLS, | |
34 | SYMBOL_TLS_LE, | |
35 | SYMBOL_TLS_IE, | |
36 | SYMBOL_TLS_GD | |
37 | }; | |
38 | #define NUM_SYMBOL_TYPES (SYMBOL_TLS_GD + 1) | |
39 | ||
96ad6ab2 CM |
40 | /* Classifies an address. |
41 | ||
42 | ADDRESS_REG | |
43 | A natural register + offset address. The register satisfies | |
44 | riscv_valid_base_register_p and the offset is a const_arith_operand. | |
45 | ||
46 | ADDRESS_LO_SUM | |
47 | A LO_SUM rtx. The first operand is a valid base register and | |
48 | the second operand is a symbolic address. | |
49 | ||
50 | ADDRESS_CONST_INT | |
51 | A signed 16-bit constant address. | |
52 | ||
53 | ADDRESS_SYMBOLIC: | |
54 | A constant symbolic address. */ | |
55 | enum riscv_address_type { | |
56 | ADDRESS_REG, | |
57 | ADDRESS_LO_SUM, | |
58 | ADDRESS_CONST_INT, | |
59 | ADDRESS_SYMBOLIC | |
60 | }; | |
61 | ||
62 | /* Information about an address described by riscv_address_type. | |
63 | ||
64 | ADDRESS_CONST_INT | |
65 | No fields are used. | |
66 | ||
67 | ADDRESS_REG | |
68 | REG is the base register and OFFSET is the constant offset. | |
69 | ||
70 | ADDRESS_LO_SUM | |
71 | REG and OFFSET are the operands to the LO_SUM and SYMBOL_TYPE | |
72 | is the type of symbol it references. | |
73 | ||
74 | ADDRESS_SYMBOLIC | |
75 | SYMBOL_TYPE is the type of symbol that the address references. */ | |
76 | struct riscv_address_info { | |
77 | enum riscv_address_type type; | |
78 | rtx reg; | |
79 | rtx offset; | |
80 | enum riscv_symbol_type symbol_type; | |
81 | }; | |
82 | ||
e53b6e56 | 83 | /* Routines implemented in riscv.cc. */ |
09cae750 PD |
84 | extern enum riscv_symbol_type riscv_classify_symbolic_expression (rtx); |
85 | extern bool riscv_symbolic_constant_p (rtx, enum riscv_symbol_type *); | |
30699b99 | 86 | extern int riscv_float_const_rtx_index_for_fli (rtx); |
b8506a8a | 87 | extern int riscv_regno_mode_ok_for_base_p (int, machine_mode, bool); |
42360427 CM |
88 | extern enum reg_class riscv_index_reg_class (); |
89 | extern int riscv_regno_ok_for_index_p (int); | |
b8506a8a | 90 | extern int riscv_address_insns (rtx, machine_mode, bool); |
09cae750 PD |
91 | extern int riscv_const_insns (rtx); |
92 | extern int riscv_split_const_insns (rtx); | |
93 | extern int riscv_load_store_insns (rtx, rtx_insn *); | |
94 | extern rtx riscv_emit_move (rtx, rtx); | |
05302544 | 95 | extern bool riscv_split_symbol (rtx, rtx, machine_mode, rtx *); |
09cae750 PD |
96 | extern bool riscv_split_symbol_type (enum riscv_symbol_type); |
97 | extern rtx riscv_unspec_address (rtx, enum riscv_symbol_type); | |
05302544 | 98 | extern void riscv_move_integer (rtx, rtx, HOST_WIDE_INT, machine_mode); |
b8506a8a | 99 | extern bool riscv_legitimize_move (machine_mode, rtx, rtx); |
09cae750 PD |
100 | extern rtx riscv_subword (rtx, bool); |
101 | extern bool riscv_split_64bit_move_p (rtx, rtx); | |
102 | extern void riscv_split_doubleword_move (rtx, rtx); | |
103 | extern const char *riscv_output_move (rtx, rtx); | |
8cad5b14 | 104 | extern const char *riscv_output_return (); |
3d1d3132 FG |
105 | extern bool |
106 | riscv_zcmp_valid_stack_adj_bytes_p (HOST_WIDE_INT, int); | |
02fcaf41 | 107 | |
09cae750 | 108 | #ifdef RTX_CODE |
8ae83274 | 109 | extern void riscv_expand_int_scc (rtx, enum rtx_code, rtx, rtx, bool *invert_ptr = 0); |
09cae750 PD |
110 | extern void riscv_expand_float_scc (rtx, enum rtx_code, rtx, rtx); |
111 | extern void riscv_expand_conditional_branch (rtx, enum rtx_code, rtx, rtx); | |
99bfdb07 | 112 | extern rtx riscv_emit_binary (enum rtx_code code, rtx dest, rtx x, rtx y); |
09cae750 | 113 | #endif |
8e7ffe12 | 114 | extern bool riscv_expand_conditional_move (rtx, rtx, rtx, rtx); |
09cae750 PD |
115 | extern rtx riscv_legitimize_call_address (rtx); |
116 | extern void riscv_set_return_address (rtx, rtx); | |
117 | extern bool riscv_expand_block_move (rtx, rtx, rtx); | |
118 | extern rtx riscv_return_addr (int, rtx); | |
3496ca4e | 119 | extern poly_int64 riscv_initial_elimination_offset (int, int); |
09cae750 | 120 | extern void riscv_expand_prologue (void); |
fd1e52dc | 121 | extern void riscv_expand_epilogue (int); |
d0ebdd9f | 122 | extern bool riscv_epilogue_uses (unsigned int); |
09cae750 | 123 | extern bool riscv_can_use_return_insn (void); |
6ed01e6b | 124 | extern rtx riscv_function_value (const_tree, const_tree, enum machine_mode); |
6ed01e6b | 125 | extern bool riscv_expand_block_move (rtx, rtx, rtx); |
88108b27 | 126 | extern bool riscv_store_data_bypass_p (rtx_insn *, rtx_insn *); |
d0e0c130 KC |
127 | extern rtx riscv_gen_gpr_save_insn (struct riscv_frame_info *); |
128 | extern bool riscv_gpr_save_operation_p (rtx); | |
b4feb49c | 129 | extern void riscv_reinit (void); |
f556cd8b | 130 | extern poly_uint64 riscv_regmode_natural_size (machine_mode); |
7e924ba3 | 131 | extern bool riscv_v_ext_vector_mode_p (machine_mode); |
12847288 | 132 | extern bool riscv_v_ext_tuple_mode_p (machine_mode); |
33b153ff | 133 | extern bool riscv_v_ext_vls_mode_p (machine_mode); |
6ae5565e | 134 | extern int riscv_get_v_regno_alignment (machine_mode); |
787ac959 | 135 | extern bool riscv_shamt_matches_mask_p (int, HOST_WIDE_INT); |
f797260a PN |
136 | extern void riscv_subword_address (rtx, rtx *, rtx *, rtx *, rtx *); |
137 | extern void riscv_lshift_subword (machine_mode, rtx, rtx, rtx *); | |
942ab49b | 138 | extern enum memmodel riscv_union_memmodels (enum memmodel, enum memmodel); |
09cae750 | 139 | |
e53b6e56 | 140 | /* Routines implemented in riscv-c.cc. */ |
09cae750 | 141 | void riscv_cpu_cpp_builtins (cpp_reader *); |
7d935cdd | 142 | void riscv_register_pragmas (void); |
09cae750 | 143 | |
e53b6e56 | 144 | /* Routines implemented in riscv-builtins.cc. */ |
09cae750 | 145 | extern void riscv_atomic_assign_expand_fenv (tree *, tree *, tree *); |
60bd33bc | 146 | extern bool riscv_gimple_fold_builtin (gimple_stmt_iterator *); |
b8506a8a | 147 | extern rtx riscv_expand_builtin (tree, rtx, rtx, machine_mode, int); |
09cae750 PD |
148 | extern tree riscv_builtin_decl (unsigned int, bool); |
149 | extern void riscv_init_builtins (void); | |
150 | ||
e53b6e56 | 151 | /* Routines implemented in riscv-common.cc. */ |
f908b69c | 152 | extern std::string riscv_arch_str (bool version_p = true); |
b4feb49c | 153 | extern void riscv_parse_arch_string (const char *, struct gcc_options *, location_t); |
8e966210 | 154 | |
e0a5b313 KC |
155 | extern bool riscv_hard_regno_rename_ok (unsigned, unsigned); |
156 | ||
de6320a8 | 157 | rtl_opt_pass * make_pass_shorten_memrefs (gcc::context *ctxt); |
9243c3d1 | 158 | rtl_opt_pass * make_pass_vsetvl (gcc::context *ctxt); |
de6320a8 | 159 | |
72eb8335 KC |
160 | /* Information about one CPU we know about. */ |
161 | struct riscv_cpu_info { | |
162 | /* This CPU's canonical name. */ | |
163 | const char *name; | |
164 | ||
165 | /* Default arch for this CPU, could be NULL if no default arch. */ | |
166 | const char *arch; | |
167 | ||
168 | /* Which automaton to use for tuning. */ | |
169 | const char *tune; | |
170 | }; | |
171 | ||
172 | extern const riscv_cpu_info *riscv_find_cpu (const char *); | |
173 | ||
b4feb49c | 174 | /* Routines implemented in riscv-selftests.cc. */ |
175 | #if CHECKING_P | |
176 | namespace selftest { | |
3b6d44f4 | 177 | void riscv_run_selftests (void); |
b4feb49c | 178 | } // namespace selftest |
179 | #endif | |
180 | ||
7d935cdd | 181 | namespace riscv_vector { |
fa144175 | 182 | #define RVV_VLMAX gen_rtx_REG (Pmode, X0_REGNUM) |
272e119d | 183 | #define RVV_VUNDEF(MODE) \ |
7caa1ae5 JZZ |
184 | gen_rtx_UNSPEC (MODE, gen_rtvec (1, gen_rtx_REG (SImode, X0_REGNUM)), \ |
185 | UNSPEC_VUNDEF) | |
b3176bdc | 186 | |
79ab19bc LD |
187 | /* These flags describe how to pass the operands to a rvv insn pattern. |
188 | e.g.: | |
189 | If a insn has this flags: | |
190 | HAS_DEST_P | HAS_MASK_P | USE_VUNDEF_MERGE_P | |
191 | | TU_POLICY_P | BINARY_OP_P | FRM_DYN_P | |
192 | that means: | |
193 | operands[0] is the dest operand | |
194 | operands[1] is the mask operand | |
195 | operands[2] is the merge operand | |
196 | operands[3] and operands[4] is the two operand to do the operation. | |
197 | operands[5] is the vl operand | |
198 | operands[6] is the tail policy operand | |
199 | operands[7] is the mask policy operands | |
200 | operands[8] is the rounding mode operands | |
201 | ||
202 | Then you can call `emit_vlmax_insn (flags, icode, ops)` to emit a insn. | |
203 | and ops[0] is the dest operand (operands[0]), ops[1] is the mask | |
204 | operand (operands[1]), ops[2] and ops[3] is the two | |
205 | operands (operands[3], operands[4]) to do the operation. Other operands | |
206 | will be created by emit_vlmax_insn according to the flags information. | |
207 | */ | |
208 | enum insn_flags : unsigned int | |
51fd69ec | 209 | { |
79ab19bc LD |
210 | /* flags for dest, mask, merge operands. */ |
211 | /* Means INSN has dest operand. False for STORE insn. */ | |
212 | HAS_DEST_P = 1 << 0, | |
213 | /* Means INSN has mask operand. */ | |
214 | HAS_MASK_P = 1 << 1, | |
215 | /* Means using ALL_TRUES for mask operand. */ | |
216 | USE_ALL_TRUES_MASK_P = 1 << 2, | |
217 | /* Means using ONE_TRUE for mask operand. */ | |
218 | USE_ONE_TRUE_MASK_P = 1 << 3, | |
219 | /* Means INSN has merge operand. */ | |
220 | HAS_MERGE_P = 1 << 4, | |
221 | /* Means using VUNDEF for merge operand. */ | |
222 | USE_VUNDEF_MERGE_P = 1 << 5, | |
223 | ||
224 | /* flags for tail policy and mask plicy operands. */ | |
225 | /* Means the tail policy is TAIL_UNDISTURBED. */ | |
226 | TU_POLICY_P = 1 << 6, | |
227 | /* Means the tail policy is default (return by get_prefer_tail_policy). */ | |
228 | TDEFAULT_POLICY_P = 1 << 7, | |
229 | /* Means the mask policy is MASK_UNDISTURBED. */ | |
230 | MU_POLICY_P = 1 << 8, | |
231 | /* Means the mask policy is default (return by get_prefer_mask_policy). */ | |
232 | MDEFAULT_POLICY_P = 1 << 9, | |
233 | ||
234 | /* flags for the number operands to do the operation. */ | |
235 | /* Means INSN need zero operand to do the operation. e.g. vid.v */ | |
236 | NULLARY_OP_P = 1 << 10, | |
237 | /* Means INSN need one operand to do the operation. */ | |
238 | UNARY_OP_P = 1 << 11, | |
239 | /* Means INSN need two operands to do the operation. */ | |
240 | BINARY_OP_P = 1 << 12, | |
241 | /* Means INSN need two operands to do the operation. */ | |
242 | TERNARY_OP_P = 1 << 13, | |
243 | ||
244 | /* flags for get mask mode from the index number. default from dest operand. */ | |
245 | MASK_MODE_FROM_OP1_P = 1 << 14, | |
246 | ||
247 | /* flags for the floating-point rounding mode. */ | |
248 | /* Means INSN has FRM operand and the value is FRM_DYN. */ | |
249 | FRM_DYN_P = 1 << 15, | |
51fd69ec | 250 | }; |
79ab19bc LD |
251 | |
252 | enum insn_type : unsigned int | |
253 | { | |
254 | /* some flags macros. */ | |
255 | /* For non-mask insn with tama. */ | |
256 | __NORMAL_OP = HAS_DEST_P | HAS_MASK_P | USE_ALL_TRUES_MASK_P | HAS_MERGE_P | |
257 | | USE_VUNDEF_MERGE_P | TDEFAULT_POLICY_P | MDEFAULT_POLICY_P, | |
258 | /* For non-mask insn with ta, without mask policy operand. */ | |
259 | __NORMAL_OP_TA = HAS_DEST_P | HAS_MASK_P | USE_ALL_TRUES_MASK_P | HAS_MERGE_P | |
260 | | USE_VUNDEF_MERGE_P | TDEFAULT_POLICY_P, | |
261 | /* For non-mask insn with ta, without mask operand and mask policy operand. */ | |
262 | __NORMAL_OP_TA2 | |
263 | = HAS_DEST_P | HAS_MERGE_P | USE_VUNDEF_MERGE_P | TDEFAULT_POLICY_P, | |
264 | /* For non-mask insn with ma, without tail policy operand. */ | |
265 | __NORMAL_OP_MA = HAS_DEST_P | HAS_MASK_P | USE_ALL_TRUES_MASK_P | HAS_MERGE_P | |
266 | | USE_VUNDEF_MERGE_P | MDEFAULT_POLICY_P, | |
267 | /* For mask insn with tama. */ | |
268 | __MASK_OP_TAMA = HAS_DEST_P | HAS_MASK_P | HAS_MERGE_P | USE_VUNDEF_MERGE_P | |
269 | | TDEFAULT_POLICY_P | MDEFAULT_POLICY_P, | |
270 | /* For mask insn with tamu. */ | |
271 | __MASK_OP_TAMU | |
272 | = HAS_DEST_P | HAS_MASK_P | HAS_MERGE_P | TDEFAULT_POLICY_P | MU_POLICY_P, | |
273 | /* For mask insn with tuma. */ | |
274 | __MASK_OP_TUMA = HAS_DEST_P | HAS_MASK_P | USE_ALL_TRUES_MASK_P | HAS_MERGE_P | |
275 | | TU_POLICY_P | MDEFAULT_POLICY_P, | |
276 | /* For mask insn with mu. */ | |
277 | __MASK_OP_MU = HAS_DEST_P | HAS_MASK_P | HAS_MERGE_P | MU_POLICY_P, | |
278 | /* For mask insn with ta, without mask policy operand. */ | |
279 | __MASK_OP_TA = HAS_DEST_P | HAS_MASK_P | HAS_MERGE_P | USE_VUNDEF_MERGE_P | |
280 | | TDEFAULT_POLICY_P, | |
281 | ||
282 | /* Nullary operator. e.g. vid.v */ | |
283 | NULLARY_OP = __NORMAL_OP | NULLARY_OP_P, | |
284 | ||
285 | /* Unary operator. */ | |
286 | UNARY_OP = __NORMAL_OP | UNARY_OP_P, | |
287 | UNARY_OP_TAMA = __MASK_OP_TAMA | UNARY_OP_P, | |
288 | UNARY_OP_TAMU = __MASK_OP_TAMU | UNARY_OP_P, | |
289 | UNARY_OP_FRM_DYN = UNARY_OP | FRM_DYN_P, | |
290 | ||
291 | /* Binary operator. */ | |
292 | BINARY_OP = __NORMAL_OP | BINARY_OP_P, | |
293 | BINARY_OP_TAMA = __MASK_OP_TAMA | BINARY_OP_P, | |
294 | BINARY_OP_TAMU = __MASK_OP_TAMU | BINARY_OP_P, | |
295 | BINARY_OP_TUMA = __MASK_OP_TUMA | BINARY_OP_P, | |
296 | BINARY_OP_FRM_DYN = BINARY_OP | FRM_DYN_P, | |
297 | ||
298 | /* Ternary operator. Always have real merge operand. */ | |
299 | TERNARY_OP = HAS_DEST_P | HAS_MASK_P | USE_ALL_TRUES_MASK_P | HAS_MERGE_P | |
300 | | TDEFAULT_POLICY_P | MDEFAULT_POLICY_P | TERNARY_OP_P, | |
301 | TERNARY_OP_FRM_DYN = TERNARY_OP | FRM_DYN_P, | |
302 | ||
303 | /* For vwmacc, no merge operand. */ | |
304 | WIDEN_TERNARY_OP = HAS_DEST_P | HAS_MASK_P | USE_ALL_TRUES_MASK_P | |
305 | | TDEFAULT_POLICY_P | MDEFAULT_POLICY_P | TERNARY_OP_P, | |
306 | WIDEN_TERNARY_OP_FRM_DYN = WIDEN_TERNARY_OP | FRM_DYN_P, | |
307 | ||
308 | /* For vmerge, no mask operand, no mask policy operand. */ | |
309 | MERGE_OP = __NORMAL_OP_TA2 | TERNARY_OP_P, | |
310 | ||
311 | /* For vm<compare>, no tail policy operand. */ | |
312 | COMPARE_OP = __NORMAL_OP_MA | TERNARY_OP_P, | |
313 | COMPARE_OP_MU = __MASK_OP_MU | TERNARY_OP_P, | |
314 | ||
315 | /* For scatter insn: no dest operand, no merge operand, no tail and mask | |
316 | policy operands. */ | |
317 | SCATTER_OP_M = HAS_MASK_P | TERNARY_OP_P, | |
318 | ||
319 | /* For vcpop.m, no merge operand, no tail and mask policy operands. */ | |
320 | CPOP_OP = HAS_DEST_P | HAS_MASK_P | USE_ALL_TRUES_MASK_P | UNARY_OP_P | |
321 | | MASK_MODE_FROM_OP1_P, | |
322 | ||
323 | /* For mask instrunctions, no tail and mask policy operands. */ | |
324 | UNARY_MASK_OP = HAS_DEST_P | HAS_MASK_P | USE_ALL_TRUES_MASK_P | HAS_MERGE_P | |
325 | | USE_VUNDEF_MERGE_P | UNARY_OP_P, | |
326 | BINARY_MASK_OP = HAS_DEST_P | HAS_MASK_P | USE_ALL_TRUES_MASK_P | HAS_MERGE_P | |
327 | | USE_VUNDEF_MERGE_P | BINARY_OP_P, | |
328 | ||
329 | /* For vcompress.vm */ | |
330 | COMPRESS_OP = __NORMAL_OP_TA2 | BINARY_OP_P, | |
331 | /* has merge operand but use ta. */ | |
332 | COMPRESS_OP_MERGE | |
333 | = HAS_DEST_P | HAS_MERGE_P | TDEFAULT_POLICY_P | BINARY_OP_P, | |
334 | ||
335 | /* For vreduce, no mask policy operand. */ | |
336 | REDUCE_OP = __NORMAL_OP_TA | BINARY_OP_P | MASK_MODE_FROM_OP1_P, | |
337 | REDUCE_OP_FRM_DYN = REDUCE_OP | FRM_DYN_P | MASK_MODE_FROM_OP1_P, | |
338 | REDUCE_OP_M_FRM_DYN | |
339 | = __MASK_OP_TA | BINARY_OP_P | FRM_DYN_P | MASK_MODE_FROM_OP1_P, | |
340 | ||
341 | /* For vmv.s.x/vfmv.s.f. */ | |
342 | SCALAR_MOVE_OP = HAS_DEST_P | HAS_MASK_P | USE_ONE_TRUE_MASK_P | HAS_MERGE_P | |
343 | | USE_VUNDEF_MERGE_P | TDEFAULT_POLICY_P | MDEFAULT_POLICY_P | |
344 | | UNARY_OP_P, | |
345 | }; | |
346 | ||
3b16afeb JZZ |
347 | enum vlmul_type |
348 | { | |
349 | LMUL_1 = 0, | |
350 | LMUL_2 = 1, | |
351 | LMUL_4 = 2, | |
352 | LMUL_8 = 3, | |
353 | LMUL_RESERVED = 4, | |
354 | LMUL_F8 = 5, | |
355 | LMUL_F4 = 6, | |
356 | LMUL_F2 = 7, | |
ec99ffab | 357 | NUM_LMUL = 8 |
3b16afeb | 358 | }; |
9243c3d1 JZZ |
359 | |
360 | enum avl_type | |
361 | { | |
362 | NONVLMAX, | |
363 | VLMAX, | |
364 | }; | |
7d935cdd | 365 | /* Routines implemented in riscv-vector-builtins.cc. */ |
3b6d44f4 JZZ |
366 | void init_builtins (void); |
367 | const char *mangle_builtin_type (const_tree); | |
509c10a6 | 368 | tree lookup_vector_type_attribute (const_tree); |
94a4b932 | 369 | bool builtin_type_p (const_tree); |
7d935cdd | 370 | #ifdef GCC_TARGET_H |
3b6d44f4 | 371 | bool verify_type_context (location_t, type_context_kind, const_tree, bool); |
631e86b7 JZ |
372 | bool expand_vec_perm_const (machine_mode, machine_mode, rtx, rtx, rtx, |
373 | const vec_perm_indices &); | |
7d935cdd | 374 | #endif |
3b6d44f4 JZZ |
375 | void handle_pragma_vector (void); |
376 | tree builtin_decl (unsigned, bool); | |
60bd33bc | 377 | gimple *gimple_fold_builtin (unsigned int, gimple_stmt_iterator *, gcall *); |
3b6d44f4 | 378 | rtx expand_builtin (unsigned int, tree, rtx); |
7caa1ae5 JZZ |
379 | bool check_builtin_call (location_t, vec<location_t>, unsigned int, |
380 | tree, unsigned int, tree *); | |
3b6d44f4 | 381 | bool const_vec_all_same_in_range_p (rtx, HOST_WIDE_INT, HOST_WIDE_INT); |
51fd69ec | 382 | bool legitimize_move (rtx, rtx); |
cd0c433e | 383 | void emit_vlmax_vsetvl (machine_mode, rtx); |
40fc8e3d | 384 | void emit_hard_vlmax_vsetvl (machine_mode, rtx); |
79ab19bc LD |
385 | void emit_vlmax_insn (unsigned, unsigned, rtx *); |
386 | void emit_nonvlmax_insn (unsigned, unsigned, rtx *, rtx); | |
387 | void emit_vlmax_insn_lra (unsigned, unsigned, rtx *, rtx); | |
3b6d44f4 | 388 | enum vlmul_type get_vlmul (machine_mode); |
b3176bdc | 389 | rtx get_vlmax_rtx (machine_mode); |
3b6d44f4 | 390 | unsigned int get_ratio (machine_mode); |
12847288 JZZ |
391 | unsigned int get_nf (machine_mode); |
392 | machine_mode get_subpart_mode (machine_mode); | |
3b6d44f4 JZZ |
393 | int get_ta (rtx); |
394 | int get_ma (rtx); | |
395 | int get_avl_type (rtx); | |
396 | unsigned int calculate_ratio (unsigned int, enum vlmul_type); | |
f556cd8b JZZ |
397 | enum tail_policy |
398 | { | |
399 | TAIL_UNDISTURBED = 0, | |
400 | TAIL_AGNOSTIC = 1, | |
9243c3d1 | 401 | TAIL_ANY = 2, |
f556cd8b JZZ |
402 | }; |
403 | ||
404 | enum mask_policy | |
405 | { | |
406 | MASK_UNDISTURBED = 0, | |
407 | MASK_AGNOSTIC = 1, | |
9243c3d1 | 408 | MASK_ANY = 2, |
f556cd8b | 409 | }; |
8390a2af | 410 | |
e69d050f LD |
411 | /* Return true if VALUE is agnostic or any policy. */ |
412 | #define IS_AGNOSTIC(VALUE) (bool) (VALUE & 0x1 || (VALUE >> 1 & 0x1)) | |
413 | ||
8390a2af JZ |
414 | enum class reduction_type |
415 | { | |
416 | UNORDERED, | |
417 | FOLD_LEFT, | |
418 | MASK_LEN_FOLD_LEFT, | |
419 | }; | |
9243c3d1 JZZ |
420 | enum tail_policy get_prefer_tail_policy (); |
421 | enum mask_policy get_prefer_mask_policy (); | |
a143c3f7 | 422 | rtx get_avl_type_rtx (enum avl_type); |
6c9bcb6c | 423 | opt_machine_mode get_vector_mode (scalar_mode, poly_uint64); |
12847288 | 424 | opt_machine_mode get_tuple_mode (machine_mode, unsigned int); |
3b6d44f4 JZZ |
425 | bool simm5_p (rtx); |
426 | bool neg_simm5_p (rtx); | |
a035d133 | 427 | #ifdef RTX_CODE |
3b6d44f4 | 428 | bool has_vi_variant_p (rtx_code, rtx); |
e0600a02 JZ |
429 | void expand_vec_cmp (rtx, rtx_code, rtx, rtx); |
430 | bool expand_vec_cmp_float (rtx, rtx_code, rtx, rtx, bool); | |
4d1c8b04 LD |
431 | void expand_cond_len_unop (unsigned, rtx *); |
432 | void expand_cond_len_binop (unsigned, rtx *); | |
8390a2af JZ |
433 | void expand_reduction (rtx_code, rtx *, rtx, |
434 | reduction_type = reduction_type::UNORDERED); | |
a035d133 | 435 | #endif |
51fd69ec | 436 | bool sew64_scalar_helper (rtx *, rtx *, rtx, machine_mode, |
3cb0fa12 | 437 | bool, void (*)(rtx *, rtx)); |
ec99ffab | 438 | rtx gen_scalar_move_mask (machine_mode); |
1bff101b JZZ |
439 | |
440 | /* RVV vector register sizes. | |
441 | TODO: Currently, we only add RVV_32/RVV_64/RVV_128, we may need to | |
442 | support other values in the future. */ | |
443 | enum vlen_enum | |
444 | { | |
445 | RVV_32 = 32, | |
446 | RVV_64 = 64, | |
447 | RVV_65536 = 65536 | |
448 | }; | |
449 | bool slide1_sew64_helper (int, machine_mode, machine_mode, | |
450 | machine_mode, rtx *); | |
db4f7a9b | 451 | rtx gen_avl_for_scalar_move (rtx); |
51fd69ec | 452 | void expand_tuple_move (rtx *); |
2d76f2b4 | 453 | machine_mode preferred_simd_mode (scalar_mode); |
1349f530 | 454 | machine_mode get_mask_mode (machine_mode); |
003f388c | 455 | void expand_vec_series (rtx, rtx, rtx); |
1c1a9d8e | 456 | void expand_vec_init (rtx, rtx); |
2418cdfc | 457 | void expand_vec_perm (rtx, rtx, rtx, rtx); |
55dcf277 | 458 | void expand_select_vl (rtx *); |
d42d199e | 459 | void expand_load_store (rtx *, bool); |
f048af2a | 460 | void expand_gather_scatter (rtx *, bool); |
0d2673e9 | 461 | void expand_cond_len_ternop (unsigned, rtx *); |
6ae5565e | 462 | void prepare_ternary_operands (rtx *, bool = false); |
fe578886 | 463 | void expand_lanes_load_store (rtx *, bool); |
e7545cad | 464 | void expand_fold_extract_last (rtx *); |
47ffabaf | 465 | |
5ed88078 | 466 | /* Rounding mode bitfield for fixed point VXRM. */ |
47ffabaf | 467 | enum fixed_point_rounding_mode |
5ed88078 JZ |
468 | { |
469 | VXRM_RNU, | |
470 | VXRM_RNE, | |
471 | VXRM_RDN, | |
472 | VXRM_ROD | |
473 | }; | |
47ffabaf | 474 | |
7f4644f8 PL |
475 | /* Rounding mode bitfield for floating point FRM. The value of enum comes |
476 | from the below link. | |
477 | https://github.com/riscv/riscv-isa-manual/blob/main/src/f-st-ext.adoc#floating-point-control-and-status-register | |
478 | */ | |
47ffabaf | 479 | enum floating_point_rounding_mode |
8cd140d3 | 480 | { |
7f4644f8 PL |
481 | FRM_RNE = 0, /* Aka 0b000. */ |
482 | FRM_RTZ = 1, /* Aka 0b001. */ | |
483 | FRM_RDN = 2, /* Aka 0b010. */ | |
484 | FRM_RUP = 3, /* Aka 0b011. */ | |
485 | FRM_RMM = 4, /* Aka 0b100. */ | |
486 | FRM_DYN = 7, /* Aka 0b111. */ | |
4d1e97f5 PL |
487 | FRM_STATIC_MIN = FRM_RNE, |
488 | FRM_STATIC_MAX = FRM_RMM, | |
4cede0de PL |
489 | FRM_DYN_EXIT = 8, |
490 | FRM_DYN_CALL = 9, | |
491 | FRM_NONE = 10, | |
8cd140d3 | 492 | }; |
25907509 | 493 | |
4cede0de | 494 | enum floating_point_rounding_mode get_frm_mode (rtx); |
25907509 RD |
495 | opt_machine_mode vectorize_related_mode (machine_mode, scalar_mode, |
496 | poly_uint64); | |
497 | unsigned int autovectorize_vector_modes (vec<machine_mode> *, bool); | |
509c10a6 JZ |
498 | hash_set<basic_block> get_all_predecessors (basic_block); |
499 | hash_set<basic_block> get_all_successors (basic_block); | |
7d935cdd JZZ |
500 | } |
501 | ||
cbd50570 JZZ |
502 | /* We classify builtin types into two classes: |
503 | 1. General builtin class which is defined in riscv_builtins. | |
504 | 2. Vector builtin class which is a special builtin architecture | |
505 | that implement intrinsic short into "pragma". */ | |
506 | enum riscv_builtin_class | |
507 | { | |
508 | RISCV_BUILTIN_GENERAL, | |
509 | RISCV_BUILTIN_VECTOR | |
510 | }; | |
511 | ||
512 | const unsigned int RISCV_BUILTIN_SHIFT = 1; | |
513 | ||
514 | /* Mask that selects the riscv_builtin_class part of a function code. */ | |
515 | const unsigned int RISCV_BUILTIN_CLASS = (1 << RISCV_BUILTIN_SHIFT) - 1; | |
516 | ||
02fcaf41 CM |
517 | /* Routines implemented in thead.cc. */ |
518 | extern bool th_mempair_operands_p (rtx[4], bool, machine_mode); | |
519 | extern void th_mempair_order_operands (rtx[4], bool, machine_mode); | |
520 | extern void th_mempair_prepare_save_restore_operands (rtx[4], bool, | |
521 | machine_mode, | |
522 | int, HOST_WIDE_INT, | |
523 | int, HOST_WIDE_INT); | |
524 | extern void th_mempair_save_restore_regs (rtx[4], bool, machine_mode); | |
525 | #ifdef RTX_CODE | |
526 | extern const char* | |
527 | th_mempair_output_move (rtx[4], bool, machine_mode, RTX_CODE); | |
528 | #endif | |
529 | ||
065be0ff | 530 | extern bool riscv_use_divmod_expander (void); |
1d4d302a YW |
531 | void riscv_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree, int); |
532 | ||
09cae750 | 533 | #endif /* ! GCC_RISCV_PROTOS_H */ |