| 1 |
/* Copyright (C) 2016-2025 Free Software Foundation, Inc. |
| 2 |
|
| 3 |
This file is free software; you can redistribute it and/or modify it under |
| 4 |
the terms of the GNU General Public License as published by the Free |
| 5 |
Software Foundation; either version 3 of the License, or (at your option) |
| 6 |
any later version. |
| 7 |
|
| 8 |
This file is distributed in the hope that it will be useful, but WITHOUT |
| 9 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 10 |
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 11 |
for more details. |
| 12 |
|
| 13 |
You should have received a copy of the GNU General Public License |
| 14 |
along with GCC; see the file COPYING3. If not see |
| 15 |
<http://www.gnu.org/licenses/>. */ |
| 16 |
|
| 17 |
#ifndef _GCN_PROTOS_ |
| 18 |
#define _GCN_PROTOS_ |
| 19 |
|
| 20 |
extern void gcn_asm_output_symbol_ref (FILE *file, rtx x); |
| 21 |
extern void gcn_asm_weaken_decl (FILE *stream, tree decl, const char *name, |
| 22 |
const char *value); |
| 23 |
extern tree gcn_builtin_decl (unsigned code, bool initialize_p); |
| 24 |
extern bool gcn_can_split_p (machine_mode, rtx); |
| 25 |
extern bool gcn_constant64_p (rtx); |
| 26 |
extern bool gcn_constant_p (rtx); |
| 27 |
extern rtx gcn_convert_mask_mode (rtx reg); |
| 28 |
extern unsigned int gcn_dwarf_register_number (unsigned int regno); |
| 29 |
extern rtx get_exec (int64_t); |
| 30 |
extern rtx get_exec (machine_mode mode); |
| 31 |
extern char * gcn_expand_dpp_shr_insn (machine_mode, const char *, int, int); |
| 32 |
extern char * gcn_expand_dpp_swap_pairs_insn (machine_mode, const char *, int); |
| 33 |
extern char * gcn_expand_dpp_distribute_even_insn (machine_mode, const char *, |
| 34 |
int unspec); |
| 35 |
extern char * gcn_expand_dpp_distribute_odd_insn (machine_mode, const char *, |
| 36 |
int unspec); |
| 37 |
extern void gcn_expand_epilogue (); |
| 38 |
extern rtx gcn_expand_scaled_offsets (addr_space_t as, rtx base, rtx offsets, |
| 39 |
rtx scale, bool unsigned_p, rtx exec); |
| 40 |
extern void gcn_expand_prologue (); |
| 41 |
extern rtx gcn_expand_reduc_scalar (machine_mode, rtx, int); |
| 42 |
extern rtx gcn_expand_scalar_to_vector_address (machine_mode, rtx, rtx, rtx); |
| 43 |
extern void gcn_expand_vector_init (rtx, rtx); |
| 44 |
extern bool gcn_flat_address_p (rtx, machine_mode); |
| 45 |
extern bool gcn_fp_constant_p (rtx, bool); |
| 46 |
extern rtx gcn_gen_undef (machine_mode); |
| 47 |
extern bool gcn_global_address_p (rtx); |
| 48 |
extern tree gcn_goacc_adjust_private_decl (location_t, tree var, int level); |
| 49 |
extern tree gcn_goacc_create_worker_broadcast_record (tree record_type, |
| 50 |
bool sender, |
| 51 |
const char *name, |
| 52 |
unsigned HOST_WIDE_INT offset); |
| 53 |
extern void gcn_goacc_reduction (gcall *call); |
| 54 |
extern bool gcn_hard_regno_rename_ok (unsigned int from_reg, |
| 55 |
unsigned int to_reg); |
| 56 |
extern machine_mode gcn_hard_regno_caller_save_mode (unsigned int regno, |
| 57 |
unsigned int nregs, |
| 58 |
machine_mode regmode); |
| 59 |
extern bool gcn_hard_regno_mode_ok (int regno, machine_mode mode); |
| 60 |
extern int gcn_hard_regno_nregs (int regno, machine_mode mode); |
| 61 |
extern void gcn_hsa_declare_function_name (FILE *file, const char *name, |
| 62 |
tree decl); |
| 63 |
extern HOST_WIDE_INT gcn_initial_elimination_offset (int, int); |
| 64 |
extern REAL_VALUE_TYPE gcn_dconst1over2pi (void); |
| 65 |
extern bool gcn_inline_constant64_p (rtx, bool); |
| 66 |
extern bool gcn_inline_constant_p (rtx); |
| 67 |
extern int gcn_inline_fp_constant_p (rtx, bool); |
| 68 |
extern reg_class gcn_mode_code_base_reg_class (machine_mode, addr_space_t, |
| 69 |
int, int); |
| 70 |
extern rtx gcn_oacc_dim_pos (int dim); |
| 71 |
extern rtx gcn_oacc_dim_size (int dim); |
| 72 |
extern rtx gcn_operand_doublepart (machine_mode, rtx, int); |
| 73 |
extern rtx gcn_operand_part (machine_mode, rtx, int); |
| 74 |
extern bool gcn_regno_mode_code_ok_for_base_p (int, machine_mode, |
| 75 |
addr_space_t, int, int); |
| 76 |
extern reg_class gcn_regno_reg_class (int regno); |
| 77 |
extern bool gcn_scalar_flat_address_p (rtx); |
| 78 |
extern bool gcn_scalar_flat_mem_p (rtx); |
| 79 |
extern bool gcn_sgpr_move_p (rtx, rtx); |
| 80 |
extern bool gcn_stepped_zero_int_parallel_p (rtx op, int step); |
| 81 |
extern bool gcn_valid_move_p (machine_mode, rtx, rtx); |
| 82 |
extern rtx gcn_vec_constant (machine_mode, int); |
| 83 |
extern rtx gcn_vec_constant (machine_mode, rtx); |
| 84 |
extern bool gcn_vgpr_move_p (rtx, rtx); |
| 85 |
extern void print_operand_address (FILE *file, rtx addr); |
| 86 |
extern void print_operand (FILE *file, rtx x, int code); |
| 87 |
extern bool regno_ok_for_index_p (int); |
| 88 |
|
| 89 |
enum gcn_cvt_t |
| 90 |
{ |
| 91 |
fix_trunc_cvt, |
| 92 |
fixuns_trunc_cvt, |
| 93 |
float_cvt, |
| 94 |
floatuns_cvt, |
| 95 |
extend_cvt, |
| 96 |
trunc_cvt |
| 97 |
}; |
| 98 |
|
| 99 |
extern bool gcn_valid_cvt_p (machine_mode from, machine_mode to, |
| 100 |
enum gcn_cvt_t op); |
| 101 |
|
| 102 |
#ifdef TREE_CODE |
| 103 |
extern void gcn_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree, |
| 104 |
int); |
| 105 |
class gimple_opt_pass; |
| 106 |
extern gimple_opt_pass *make_pass_omp_gcn (gcc::context *ctxt); |
| 107 |
#endif |
| 108 |
|
| 109 |
/* Return true if MODE is valid for 1 VGPR register. */ |
| 110 |
|
| 111 |
inline bool |
| 112 |
vgpr_1reg_mode_p (machine_mode mode) |
| 113 |
{ |
| 114 |
if (VECTOR_MODE_P (mode)) |
| 115 |
mode = GET_MODE_INNER (mode); |
| 116 |
|
| 117 |
return (mode == SImode || mode == SFmode || mode == HImode || mode == HFmode |
| 118 |
|| mode == QImode || mode == BImode); |
| 119 |
} |
| 120 |
|
| 121 |
/* Return true if MODE is valid for 1 SGPR register. */ |
| 122 |
|
| 123 |
inline bool |
| 124 |
sgpr_1reg_mode_p (machine_mode mode) |
| 125 |
{ |
| 126 |
return (mode == SImode || mode == SFmode || mode == HImode |
| 127 |
|| mode == QImode || mode == BImode); |
| 128 |
} |
| 129 |
|
| 130 |
/* Return true if MODE is valid for pair of VGPR registers. */ |
| 131 |
|
| 132 |
inline bool |
| 133 |
vgpr_2reg_mode_p (machine_mode mode) |
| 134 |
{ |
| 135 |
if (VECTOR_MODE_P (mode)) |
| 136 |
mode = GET_MODE_INNER (mode); |
| 137 |
|
| 138 |
return (mode == DImode || mode == DFmode); |
| 139 |
} |
| 140 |
|
| 141 |
/* Return true if MODE is valid for four VGPR registers. */ |
| 142 |
|
| 143 |
inline bool |
| 144 |
vgpr_4reg_mode_p (machine_mode mode) |
| 145 |
{ |
| 146 |
if (VECTOR_MODE_P (mode)) |
| 147 |
mode = GET_MODE_INNER (mode); |
| 148 |
|
| 149 |
return (mode == TImode); |
| 150 |
} |
| 151 |
|
| 152 |
/* Return true if MODE can be handled directly by VGPR operations. */ |
| 153 |
|
| 154 |
inline bool |
| 155 |
vgpr_vector_mode_p (machine_mode mode) |
| 156 |
{ |
| 157 |
return VECTOR_MODE_P (mode); |
| 158 |
} |
| 159 |
|
| 160 |
|
| 161 |
/* Return true if MODE is valid for pair of SGPR registers. */ |
| 162 |
|
| 163 |
inline bool |
| 164 |
sgpr_2reg_mode_p (machine_mode mode) |
| 165 |
{ |
| 166 |
return mode == DImode || mode == DFmode; |
| 167 |
} |
| 168 |
|
| 169 |
#endif |