| 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 |
/* The first argument to these macros is the return type of the builtin, |
| 18 |
the rest are arguments of the builtin. */ |
| 19 |
#define _A1(a) {a, GCN_BTI_END_OF_PARAMS} |
| 20 |
#define _A2(a,b) {a, b, GCN_BTI_END_OF_PARAMS} |
| 21 |
#define _A3(a,b,c) {a, b, c, GCN_BTI_END_OF_PARAMS} |
| 22 |
#define _A4(a,b,c,d) {a, b, c, d, GCN_BTI_END_OF_PARAMS} |
| 23 |
#define _A5(a,b,c,d,e) {a, b, c, d, e, GCN_BTI_END_OF_PARAMS} |
| 24 |
|
| 25 |
DEF_BUILTIN (FLAT_LOAD_INT32, 1 /*CODE_FOR_flat_load_v64si*/, |
| 26 |
"flat_load_int32", B_INSN, |
| 27 |
_A3 (GCN_BTI_V64SI, GCN_BTI_EXEC, GCN_BTI_V64SI), |
| 28 |
gcn_expand_builtin_1) |
| 29 |
|
| 30 |
DEF_BUILTIN (FLAT_LOAD_PTR_INT32, 2 /*CODE_FOR_flat_load_ptr_v64si */, |
| 31 |
"flat_load_ptr_int32", B_INSN, |
| 32 |
_A4 (GCN_BTI_V64SI, GCN_BTI_EXEC, GCN_BTI_SIPTR, GCN_BTI_V64SI), |
| 33 |
gcn_expand_builtin_1) |
| 34 |
|
| 35 |
DEF_BUILTIN (FLAT_STORE_PTR_INT32, 3 /*CODE_FOR_flat_store_ptr_v64si */, |
| 36 |
"flat_store_ptr_int32", B_INSN, |
| 37 |
_A5 (GCN_BTI_VOID, GCN_BTI_EXEC, GCN_BTI_SIPTR, GCN_BTI_V64SI, |
| 38 |
GCN_BTI_V64SI), |
| 39 |
gcn_expand_builtin_1) |
| 40 |
|
| 41 |
DEF_BUILTIN (FLAT_LOAD_PTR_FLOAT, 2 /*CODE_FOR_flat_load_ptr_v64sf */, |
| 42 |
"flat_load_ptr_float", B_INSN, |
| 43 |
_A4 (GCN_BTI_V64SF, GCN_BTI_EXEC, GCN_BTI_SFPTR, GCN_BTI_V64SI), |
| 44 |
gcn_expand_builtin_1) |
| 45 |
|
| 46 |
DEF_BUILTIN (FLAT_STORE_PTR_FLOAT, 3 /*CODE_FOR_flat_store_ptr_v64sf */, |
| 47 |
"flat_store_ptr_float", B_INSN, |
| 48 |
_A5 (GCN_BTI_VOID, GCN_BTI_EXEC, GCN_BTI_SFPTR, GCN_BTI_V64SI, |
| 49 |
GCN_BTI_V64SF), |
| 50 |
gcn_expand_builtin_1) |
| 51 |
|
| 52 |
DEF_BUILTIN (SQRTVF, 3 /*CODE_FOR_sqrtvf */, |
| 53 |
"sqrtvf", B_INSN, |
| 54 |
_A2 (GCN_BTI_V64SF, GCN_BTI_V64SF), |
| 55 |
gcn_expand_builtin_1) |
| 56 |
|
| 57 |
DEF_BUILTIN (SQRTF, 3 /*CODE_FOR_sqrtf */, |
| 58 |
"sqrtf", B_INSN, |
| 59 |
_A2 (GCN_BTI_SF, GCN_BTI_SF), |
| 60 |
gcn_expand_builtin_1) |
| 61 |
|
| 62 |
DEF_BUILTIN (FABSVF, 3 /*CODE_FOR_fabsvf */, |
| 63 |
"fabsvf", B_INSN, |
| 64 |
_A2 (GCN_BTI_V64SF, GCN_BTI_V64SF), |
| 65 |
gcn_expand_builtin_1) |
| 66 |
|
| 67 |
DEF_BUILTIN (FABSV, 3 /*CODE_FOR_fabsv */, |
| 68 |
"fabsv", B_INSN, |
| 69 |
_A2 (GCN_BTI_V64DF, GCN_BTI_V64DF), |
| 70 |
gcn_expand_builtin_1) |
| 71 |
|
| 72 |
DEF_BUILTIN (FLOORVF, 3 /*CODE_FOR_floorvf */, |
| 73 |
"floorvf", B_INSN, |
| 74 |
_A2 (GCN_BTI_V64SF, GCN_BTI_V64SF), |
| 75 |
gcn_expand_builtin_1) |
| 76 |
|
| 77 |
DEF_BUILTIN (FLOORV, 3 /*CODE_FOR_floorv */, |
| 78 |
"floorv", B_INSN, |
| 79 |
_A2 (GCN_BTI_V64DF, GCN_BTI_V64DF), |
| 80 |
gcn_expand_builtin_1) |
| 81 |
|
| 82 |
DEF_BUILTIN (LDEXPVF, 3 /*CODE_FOR_ldexpvf */, |
| 83 |
"ldexpvf", B_INSN, |
| 84 |
_A3 (GCN_BTI_V64SF, GCN_BTI_V64SF, GCN_BTI_V64SI), |
| 85 |
gcn_expand_builtin_1) |
| 86 |
|
| 87 |
DEF_BUILTIN (LDEXPV, 3 /*CODE_FOR_ldexpv */, |
| 88 |
"ldexpv", B_INSN, |
| 89 |
_A3 (GCN_BTI_V64DF, GCN_BTI_V64DF, GCN_BTI_V64SI), |
| 90 |
gcn_expand_builtin_1) |
| 91 |
|
| 92 |
DEF_BUILTIN (FREXPVF_EXP, 3 /*CODE_FOR_frexpvf_exp */, |
| 93 |
"frexpvf_exp", B_INSN, |
| 94 |
_A2 (GCN_BTI_V64SI, GCN_BTI_V64SF), |
| 95 |
gcn_expand_builtin_1) |
| 96 |
|
| 97 |
DEF_BUILTIN (FREXPVF_MANT, 3 /*CODE_FOR_frexpvf_mant */, |
| 98 |
"frexpvf_mant", B_INSN, |
| 99 |
_A2 (GCN_BTI_V64SF, GCN_BTI_V64SF), |
| 100 |
gcn_expand_builtin_1) |
| 101 |
|
| 102 |
DEF_BUILTIN (FREXPV_EXP, 3 /*CODE_FOR_frexpv_exp */, |
| 103 |
"frexpv_exp", B_INSN, |
| 104 |
_A2 (GCN_BTI_V64SI, GCN_BTI_V64DF), |
| 105 |
gcn_expand_builtin_1) |
| 106 |
|
| 107 |
DEF_BUILTIN (FREXPV_MANT, 3 /*CODE_FOR_frexpv_mant */, |
| 108 |
"frexpv_mant", B_INSN, |
| 109 |
_A2 (GCN_BTI_V64DF, GCN_BTI_V64DF), |
| 110 |
gcn_expand_builtin_1) |
| 111 |
|
| 112 |
DEF_BUILTIN (CMP_SWAP, -1, |
| 113 |
"cmp_swap", B_INSN, |
| 114 |
_A4 (GCN_BTI_UINT, GCN_BTI_VOIDPTR, GCN_BTI_UINT, GCN_BTI_UINT), |
| 115 |
gcn_expand_builtin_1) |
| 116 |
|
| 117 |
DEF_BUILTIN (CMP_SWAPLL, -1, |
| 118 |
"cmp_swapll", B_INSN, |
| 119 |
_A4 (GCN_BTI_LLUINT, |
| 120 |
GCN_BTI_VOIDPTR, GCN_BTI_LLUINT, GCN_BTI_LLUINT), |
| 121 |
gcn_expand_builtin_1) |
| 122 |
|
| 123 |
/* DEF_BUILTIN_BINOP_INT_FP creates many variants of a builtin function for a |
| 124 |
given operation. The first argument will give base to the identifier of a |
| 125 |
particular builtin, the second will be used to form the name of the patter |
| 126 |
used to expand it to and the third will be used to create the user-visible |
| 127 |
builtin identifier. */ |
| 128 |
|
| 129 |
DEF_BUILTIN_BINOP_INT_FP (ADD, add, "add") |
| 130 |
DEF_BUILTIN_BINOP_INT_FP (SUB, sub, "sub") |
| 131 |
|
| 132 |
DEF_BUILTIN_BINOP_INT_FP (AND, and, "and") |
| 133 |
DEF_BUILTIN_BINOP_INT_FP (IOR, ior, "or") |
| 134 |
DEF_BUILTIN_BINOP_INT_FP (XOR, xor, "xor") |
| 135 |
|
| 136 |
/* OpenMP. */ |
| 137 |
|
| 138 |
DEF_BUILTIN (OMP_DIM_SIZE, CODE_FOR_oacc_dim_size, |
| 139 |
"dim_size", B_INSN, |
| 140 |
_A2 (GCN_BTI_INT, GCN_BTI_INT), |
| 141 |
gcn_expand_builtin_1) |
| 142 |
DEF_BUILTIN (OMP_DIM_POS, CODE_FOR_oacc_dim_pos, |
| 143 |
"dim_pos", B_INSN, |
| 144 |
_A2 (GCN_BTI_INT, GCN_BTI_INT), |
| 145 |
gcn_expand_builtin_1) |
| 146 |
|
| 147 |
/* OpenACC. */ |
| 148 |
|
| 149 |
DEF_BUILTIN (ACC_SINGLE_START, -1, "single_start", B_INSN, _A1 (GCN_BTI_BOOL), |
| 150 |
gcn_expand_builtin_1) |
| 151 |
|
| 152 |
DEF_BUILTIN (ACC_SINGLE_COPY_START, -1, "single_copy_start", B_INSN, |
| 153 |
_A1 (GCN_BTI_LDS_VOIDPTR), gcn_expand_builtin_1) |
| 154 |
|
| 155 |
DEF_BUILTIN (ACC_SINGLE_COPY_END, -1, "single_copy_end", B_INSN, |
| 156 |
_A2 (GCN_BTI_VOID, GCN_BTI_LDS_VOIDPTR), gcn_expand_builtin_1) |
| 157 |
|
| 158 |
DEF_BUILTIN (ACC_BARRIER, -1, "acc_barrier", B_INSN, _A1 (GCN_BTI_VOID), |
| 159 |
gcn_expand_builtin_1) |
| 160 |
|
| 161 |
/* Kernel inputs. */ |
| 162 |
|
| 163 |
DEF_BUILTIN (FIRST_CALL_THIS_THREAD_P, -1, "first_call_this_thread_p", B_INSN, |
| 164 |
_A1 (GCN_BTI_BOOL), gcn_expand_builtin_1) |
| 165 |
DEF_BUILTIN (KERNARG_PTR, -1, "kernarg_ptr", B_INSN, _A1 (GCN_BTI_VOIDPTR), |
| 166 |
gcn_expand_builtin_1) |
| 167 |
DEF_BUILTIN (DISPATCH_PTR, -1, "dispatch_ptr", B_INSN, _A1 (GCN_BTI_VOIDPTR), |
| 168 |
gcn_expand_builtin_1) |
| 169 |
DEF_BUILTIN (GET_STACK_LIMIT, -1, "get_stack_limit", B_INSN, |
| 170 |
_A1 (GCN_BTI_VOIDPTR), gcn_expand_builtin_1) |
| 171 |
|
| 172 |
#undef _A1 |
| 173 |
#undef _A2 |
| 174 |
#undef _A3 |
| 175 |
#undef _A4 |
| 176 |
#undef _A5 |