| 1 |
/* ACLE support for Arm MVE (function shapes) |
| 2 |
Copyright (C) 2023-2025 Free Software Foundation, Inc. |
| 3 |
|
| 4 |
This file is part of GCC. |
| 5 |
|
| 6 |
GCC is free software; you can redistribute it and/or modify it |
| 7 |
under the terms of the GNU General Public License as published by |
| 8 |
the Free Software Foundation; either version 3, or (at your option) |
| 9 |
any later version. |
| 10 |
|
| 11 |
GCC is distributed in the hope that it will be useful, but |
| 12 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
General Public License for more details. |
| 15 |
|
| 16 |
You should have received a copy of the GNU General Public License |
| 17 |
along with GCC; see the file COPYING3. If not see |
| 18 |
<http://www.gnu.org/licenses/>. */ |
| 19 |
|
| 20 |
#include "config.h" |
| 21 |
#include "system.h" |
| 22 |
#include "coretypes.h" |
| 23 |
#include "tm.h" |
| 24 |
#include "tree.h" |
| 25 |
#include "rtl.h" |
| 26 |
#include "memmodel.h" |
| 27 |
#include "insn-codes.h" |
| 28 |
#include "optabs.h" |
| 29 |
#include "arm-mve-builtins.h" |
| 30 |
#include "arm-mve-builtins-shapes.h" |
| 31 |
|
| 32 |
/* In the comments below, _t0 represents the first type suffix |
| 33 |
(e.g. "_s8") and _t1 represents the second. T0/T1 represent the |
| 34 |
type full names (e.g. int8x16_t). Square brackets enclose |
| 35 |
characters that are present in only the full name, not the |
| 36 |
overloaded name. Governing predicate arguments and predicate |
| 37 |
suffixes are not shown, since they depend on the predication type, |
| 38 |
which is a separate piece of information from the shape. */ |
| 39 |
|
| 40 |
namespace arm_mve { |
| 41 |
|
| 42 |
/* Return a representation of "const T *". */ |
| 43 |
static tree |
| 44 |
build_const_pointer (tree t) |
| 45 |
{ |
| 46 |
return build_pointer_type (build_qualified_type (t, TYPE_QUAL_CONST)); |
| 47 |
} |
| 48 |
|
| 49 |
/* If INSTANCE has a predicate, add it to the list of argument types |
| 50 |
in ARGUMENT_TYPES. RETURN_TYPE is the type returned by the |
| 51 |
function. */ |
| 52 |
static void |
| 53 |
apply_predication (const function_instance &instance, tree return_type, |
| 54 |
vec<tree> &argument_types) |
| 55 |
{ |
| 56 |
if (instance.pred != PRED_none) |
| 57 |
{ |
| 58 |
/* When predicate is PRED_m, insert a first argument |
| 59 |
("inactive") with the same type as return_type. */ |
| 60 |
if (instance.has_inactive_argument ()) |
| 61 |
argument_types.quick_insert (0, return_type); |
| 62 |
argument_types.quick_push (get_mve_pred16_t ()); |
| 63 |
} |
| 64 |
} |
| 65 |
|
| 66 |
/* Parse and move past an element type in FORMAT and return it as a type |
| 67 |
suffix. The format is: |
| 68 |
|
| 69 |
[01] - the element type in type suffix 0 or 1 of INSTANCE. |
| 70 |
h<elt> - a half-sized version of <elt> |
| 71 |
p<elt> - a poly type with the same width as <elt> |
| 72 |
s<bits> - a signed type with the given number of bits |
| 73 |
s[01] - a signed type with the same width as type suffix 0 or 1 |
| 74 |
u<bits> - an unsigned type with the given number of bits |
| 75 |
u[01] - an unsigned type with the same width as type suffix 0 or 1 |
| 76 |
U<elt> - an unsigned type with the double width as <elt> |
| 77 |
w<elt> - a double-sized version of <elt> |
| 78 |
x<bits> - a type with the given number of bits and same signedness |
| 79 |
as the next argument. |
| 80 |
|
| 81 |
Future intrinsics will extend this format. */ |
| 82 |
static type_suffix_index |
| 83 |
parse_element_type (const function_instance &instance, const char *&format) |
| 84 |
{ |
| 85 |
int ch = *format++; |
| 86 |
|
| 87 |
|
| 88 |
if (ch == 's' || ch == 'u') |
| 89 |
{ |
| 90 |
type_class_index tclass = (ch == 's' ? TYPE_signed |
| 91 |
: TYPE_unsigned); |
| 92 |
char *end; |
| 93 |
unsigned int bits = strtol (format, &end, 10); |
| 94 |
format = end; |
| 95 |
if (bits == 0 || bits == 1) |
| 96 |
bits = instance.type_suffix (bits).element_bits; |
| 97 |
return find_type_suffix (tclass, bits); |
| 98 |
} |
| 99 |
|
| 100 |
if (ch == 'h') |
| 101 |
{ |
| 102 |
type_suffix_index suffix = parse_element_type (instance, format); |
| 103 |
return find_type_suffix (type_suffixes[suffix].tclass, |
| 104 |
type_suffixes[suffix].element_bits / 2); |
| 105 |
} |
| 106 |
|
| 107 |
if (ch == 'w') |
| 108 |
{ |
| 109 |
type_suffix_index suffix = parse_element_type (instance, format); |
| 110 |
return find_type_suffix (type_suffixes[suffix].tclass, |
| 111 |
type_suffixes[suffix].element_bits * 2); |
| 112 |
} |
| 113 |
|
| 114 |
if (ch == 'U') |
| 115 |
{ |
| 116 |
type_suffix_index suffix = parse_element_type (instance, format); |
| 117 |
return find_type_suffix (TYPE_unsigned, |
| 118 |
type_suffixes[suffix].element_bits * 2); |
| 119 |
} |
| 120 |
|
| 121 |
if (ch == 'p') |
| 122 |
{ |
| 123 |
type_suffix_index suffix = parse_element_type (instance, format); |
| 124 |
return find_type_suffix (TYPE_poly, |
| 125 |
type_suffixes[suffix].element_bits); |
| 126 |
} |
| 127 |
|
| 128 |
if (ch == 'x') |
| 129 |
{ |
| 130 |
const char *next = format; |
| 131 |
next = strstr (format, ","); |
| 132 |
next+=2; |
| 133 |
type_suffix_index suffix = parse_element_type (instance, next); |
| 134 |
type_class_index tclass = type_suffixes[suffix].tclass; |
| 135 |
char *end; |
| 136 |
unsigned int bits = strtol (format, &end, 10); |
| 137 |
format = end; |
| 138 |
return find_type_suffix (tclass, bits); |
| 139 |
} |
| 140 |
|
| 141 |
if (ch == '0' || ch == '1') |
| 142 |
return instance.type_suffix_ids[ch - '0']; |
| 143 |
|
| 144 |
gcc_unreachable (); |
| 145 |
} |
| 146 |
|
| 147 |
/* Read and return a type from FORMAT for function INSTANCE. Advance |
| 148 |
FORMAT beyond the type string. The format is: |
| 149 |
|
| 150 |
_ - void |
| 151 |
al - array pointer for loads |
| 152 |
as - array pointer for stores |
| 153 |
b - pointer to vector of unsigned, width given by the first type suffix |
| 154 |
p - predicates with type mve_pred16_t |
| 155 |
s<elt> - a scalar type with the given element suffix |
| 156 |
t<elt> - a vector or tuple type with given element suffix [*1] |
| 157 |
v<elt> - a vector with the given element suffix |
| 158 |
|
| 159 |
where <elt> has the format described above parse_element_type. |
| 160 |
|
| 161 |
Future intrinsics will extend this format. |
| 162 |
|
| 163 |
[*1] the vectors_per_tuple function indicates whether the type should |
| 164 |
be a tuple, and if so, how many vectors it should contain. */ |
| 165 |
static tree |
| 166 |
parse_type (const function_instance &instance, const char *&format) |
| 167 |
{ |
| 168 |
int ch = *format++; |
| 169 |
|
| 170 |
|
| 171 |
if (ch == '_') |
| 172 |
return void_type_node; |
| 173 |
|
| 174 |
if (ch == 'a') |
| 175 |
{ |
| 176 |
ch = *format++; |
| 177 |
if (ch == 'l') |
| 178 |
return build_const_pointer (instance.memory_scalar_type ()); |
| 179 |
if (ch == 's') { |
| 180 |
return build_pointer_type (instance.memory_scalar_type ()); |
| 181 |
} |
| 182 |
gcc_unreachable (); |
| 183 |
} |
| 184 |
|
| 185 |
if (ch == 'b') |
| 186 |
{ |
| 187 |
type_class_index tclass = TYPE_unsigned; |
| 188 |
unsigned int bits = instance.type_suffix (0).element_bits; |
| 189 |
type_suffix_index suffix = find_type_suffix (tclass, bits); |
| 190 |
tree acle_type = acle_vector_types[0][type_suffixes[suffix].vector_type]; |
| 191 |
return build_pointer_type (acle_type); |
| 192 |
} |
| 193 |
|
| 194 |
if (ch == 'p') |
| 195 |
return get_mve_pred16_t (); |
| 196 |
|
| 197 |
if (ch == 's') |
| 198 |
{ |
| 199 |
type_suffix_index suffix = parse_element_type (instance, format); |
| 200 |
return scalar_types[type_suffixes[suffix].vector_type]; |
| 201 |
} |
| 202 |
|
| 203 |
if (ch == 't') |
| 204 |
{ |
| 205 |
type_suffix_index suffix = parse_element_type (instance, format); |
| 206 |
vector_type_index vector_type = type_suffixes[suffix].vector_type; |
| 207 |
unsigned int num_vectors = instance.vectors_per_tuple (); |
| 208 |
return acle_vector_types[num_vectors >> 1][vector_type]; |
| 209 |
} |
| 210 |
|
| 211 |
if (ch == 'v') |
| 212 |
{ |
| 213 |
type_suffix_index suffix = parse_element_type (instance, format); |
| 214 |
return acle_vector_types[0][type_suffixes[suffix].vector_type]; |
| 215 |
} |
| 216 |
|
| 217 |
gcc_unreachable (); |
| 218 |
} |
| 219 |
|
| 220 |
/* Read a type signature for INSTANCE from FORMAT. Add the argument |
| 221 |
types to ARGUMENT_TYPES and return the return type. Assert there |
| 222 |
are no more than MAX_ARGS arguments. |
| 223 |
|
| 224 |
The format is a comma-separated list of types (as for parse_type), |
| 225 |
with the first type being the return type and the rest being the |
| 226 |
argument types. */ |
| 227 |
static tree |
| 228 |
parse_signature (const function_instance &instance, const char *format, |
| 229 |
vec<tree> &argument_types, unsigned int max_args) |
| 230 |
{ |
| 231 |
tree return_type = parse_type (instance, format); |
| 232 |
unsigned int args = 0; |
| 233 |
while (format[0] == ',') |
| 234 |
{ |
| 235 |
gcc_assert (args < max_args); |
| 236 |
format += 1; |
| 237 |
tree argument_type = parse_type (instance, format); |
| 238 |
argument_types.quick_push (argument_type); |
| 239 |
args += 1; |
| 240 |
} |
| 241 |
gcc_assert (format[0] == 0); |
| 242 |
return return_type; |
| 243 |
} |
| 244 |
|
| 245 |
/* Add one function instance for GROUP, using mode suffix MODE_SUFFIX_ID, |
| 246 |
the type suffixes at index TI and the predication suffix at index PI. |
| 247 |
The other arguments are as for build_all. */ |
| 248 |
static void |
| 249 |
build_one (function_builder &b, const char *signature, |
| 250 |
const function_group_info &group, mode_suffix_index mode_suffix_id, |
| 251 |
unsigned int ti, unsigned int pi, bool preserve_user_namespace, |
| 252 |
bool force_direct_overloads) |
| 253 |
{ |
| 254 |
/* Current functions take at most five arguments. Match |
| 255 |
parse_signature parameter below. */ |
| 256 |
auto_vec<tree, 5> argument_types; |
| 257 |
function_instance instance (group.base_name, *group.base, *group.shape, |
| 258 |
mode_suffix_id, group.types[ti], |
| 259 |
group.preds[pi]); |
| 260 |
tree return_type = parse_signature (instance, signature, argument_types, 5); |
| 261 |
apply_predication (instance, return_type, argument_types); |
| 262 |
b.add_unique_function (instance, return_type, argument_types, |
| 263 |
preserve_user_namespace, group.requires_float, |
| 264 |
force_direct_overloads); |
| 265 |
} |
| 266 |
|
| 267 |
/* Add a function instance for every type and predicate combination in |
| 268 |
GROUP, except if requested to use only the predicates listed in |
| 269 |
RESTRICT_TO_PREDS. Take the function base name from GROUP and the |
| 270 |
mode suffix from MODE_SUFFIX_ID. Use SIGNATURE to construct the |
| 271 |
function signature, then use apply_predication to add in the |
| 272 |
predicate. */ |
| 273 |
static void |
| 274 |
build_all (function_builder &b, const char *signature, |
| 275 |
const function_group_info &group, mode_suffix_index mode_suffix_id, |
| 276 |
bool preserve_user_namespace, |
| 277 |
bool force_direct_overloads = false, |
| 278 |
const predication_index *restrict_to_preds = NULL) |
| 279 |
{ |
| 280 |
for (unsigned int pi = 0; group.preds[pi] != NUM_PREDS; ++pi) |
| 281 |
{ |
| 282 |
unsigned int pi2 = 0; |
| 283 |
|
| 284 |
if (restrict_to_preds) |
| 285 |
for (; restrict_to_preds[pi2] != NUM_PREDS; ++pi2) |
| 286 |
if (restrict_to_preds[pi2] == group.preds[pi]) |
| 287 |
break; |
| 288 |
|
| 289 |
if (restrict_to_preds == NULL || restrict_to_preds[pi2] != NUM_PREDS) |
| 290 |
for (unsigned int ti = 0; |
| 291 |
ti == 0 || group.types[ti][0] != NUM_TYPE_SUFFIXES; ++ti) |
| 292 |
build_one (b, signature, group, mode_suffix_id, ti, pi, |
| 293 |
preserve_user_namespace, force_direct_overloads); |
| 294 |
} |
| 295 |
} |
| 296 |
|
| 297 |
/* Add a function instance for every type and predicate combination in |
| 298 |
GROUP, except if requested to use only the predicates listed in |
| 299 |
RESTRICT_TO_PREDS, and only for 16-bit and 32-bit integers. Take |
| 300 |
the function base name from GROUP and the mode suffix from |
| 301 |
MODE_SUFFIX_ID. Use SIGNATURE to construct the function signature, |
| 302 |
then use apply_predication to add in the predicate. */ |
| 303 |
static void |
| 304 |
build_16_32 (function_builder &b, const char *signature, |
| 305 |
const function_group_info &group, mode_suffix_index mode_suffix_id, |
| 306 |
bool preserve_user_namespace, |
| 307 |
bool force_direct_overloads = false, |
| 308 |
const predication_index *restrict_to_preds = NULL) |
| 309 |
{ |
| 310 |
for (unsigned int pi = 0; group.preds[pi] != NUM_PREDS; ++pi) |
| 311 |
{ |
| 312 |
unsigned int pi2 = 0; |
| 313 |
|
| 314 |
if (restrict_to_preds) |
| 315 |
for (; restrict_to_preds[pi2] != NUM_PREDS; ++pi2) |
| 316 |
if (restrict_to_preds[pi2] == group.preds[pi]) |
| 317 |
break; |
| 318 |
|
| 319 |
if (restrict_to_preds == NULL || restrict_to_preds[pi2] != NUM_PREDS) |
| 320 |
for (unsigned int ti = 0; |
| 321 |
ti == 0 || group.types[ti][0] != NUM_TYPE_SUFFIXES; ++ti) |
| 322 |
{ |
| 323 |
unsigned int element_bits = type_suffixes[group.types[ti][0]].element_bits; |
| 324 |
type_class_index tclass = type_suffixes[group.types[ti][0]].tclass; |
| 325 |
if ((tclass == TYPE_signed || tclass == TYPE_unsigned) |
| 326 |
&& (element_bits == 16 || element_bits == 32)) |
| 327 |
build_one (b, signature, group, mode_suffix_id, ti, pi, |
| 328 |
preserve_user_namespace, force_direct_overloads); |
| 329 |
} |
| 330 |
} |
| 331 |
} |
| 332 |
|
| 333 |
/* TYPE is the largest type suffix associated with the arguments of R, but the |
| 334 |
result is twice as wide. Return the associated type suffix of |
| 335 |
EXPECTED_TCLASS if it exists, otherwise report an appropriate error and |
| 336 |
return NUM_TYPE_SUFFIXES. */ |
| 337 |
static type_suffix_index |
| 338 |
long_type_suffix (function_resolver &r, |
| 339 |
type_suffix_index type, |
| 340 |
type_class_index expected_tclass) |
| 341 |
{ |
| 342 |
unsigned int element_bits = type_suffixes[type].element_bits; |
| 343 |
if (expected_tclass == function_resolver::SAME_TYPE_CLASS) |
| 344 |
expected_tclass = type_suffixes[type].tclass; |
| 345 |
|
| 346 |
if (type_suffixes[type].integer_p && element_bits < 64) |
| 347 |
return find_type_suffix (expected_tclass, element_bits * 2); |
| 348 |
|
| 349 |
r.report_no_such_form (type); |
| 350 |
return NUM_TYPE_SUFFIXES; |
| 351 |
} |
| 352 |
|
| 353 |
/* Return the type suffix half as wide as TYPE with EXPECTED_TCLASS if it |
| 354 |
exists, otherwise report an appropriate error and return |
| 355 |
NUM_TYPE_SUFFIXES. */ |
| 356 |
static type_suffix_index |
| 357 |
half_type_suffix (function_resolver &r, |
| 358 |
type_suffix_index type, |
| 359 |
type_class_index expected_tclass) |
| 360 |
{ |
| 361 |
unsigned int element_bits = type_suffixes[type].element_bits; |
| 362 |
if (expected_tclass == function_resolver::SAME_TYPE_CLASS) |
| 363 |
expected_tclass = type_suffixes[type].tclass; |
| 364 |
|
| 365 |
if (type_suffixes[type].integer_p && element_bits > 8) |
| 366 |
return find_type_suffix (expected_tclass, element_bits / 2); |
| 367 |
|
| 368 |
r.report_no_such_form (type); |
| 369 |
return NUM_TYPE_SUFFIXES; |
| 370 |
} |
| 371 |
|
| 372 |
/* Declare the function shape NAME, pointing it to an instance |
| 373 |
of class <NAME>_def. */ |
| 374 |
#define SHAPE(NAME) \ |
| 375 |
static CONSTEXPR const NAME##_def NAME##_obj; \ |
| 376 |
namespace shapes { const function_shape *const NAME = &NAME##_obj; } |
| 377 |
|
| 378 |
/* Base class for functions that are not overloaded. */ |
| 379 |
struct nonoverloaded_base : public function_shape |
| 380 |
{ |
| 381 |
bool |
| 382 |
explicit_type_suffix_p (unsigned int, enum predication_index, |
| 383 |
enum mode_suffix_index, type_suffix_info) const override |
| 384 |
{ |
| 385 |
return true; |
| 386 |
} |
| 387 |
|
| 388 |
bool |
| 389 |
explicit_mode_suffix_p (enum predication_index, enum mode_suffix_index) const override |
| 390 |
{ |
| 391 |
return true; |
| 392 |
} |
| 393 |
|
| 394 |
bool |
| 395 |
skip_overload_p (enum predication_index, enum mode_suffix_index) const override |
| 396 |
{ |
| 397 |
return false; |
| 398 |
} |
| 399 |
|
| 400 |
bool |
| 401 |
mode_after_pred () const override |
| 402 |
{ |
| 403 |
return true; |
| 404 |
} |
| 405 |
|
| 406 |
tree |
| 407 |
resolve (function_resolver &) const override |
| 408 |
{ |
| 409 |
gcc_unreachable (); |
| 410 |
} |
| 411 |
}; |
| 412 |
|
| 413 |
/* Base class for overloaded functions. Bit N of EXPLICIT_MASK is true |
| 414 |
if type suffix N appears in the overloaded name. */ |
| 415 |
template<unsigned int EXPLICIT_MASK> |
| 416 |
struct overloaded_base : public function_shape |
| 417 |
{ |
| 418 |
bool |
| 419 |
explicit_type_suffix_p (unsigned int i, enum predication_index, |
| 420 |
enum mode_suffix_index, type_suffix_info) const override |
| 421 |
{ |
| 422 |
return (EXPLICIT_MASK >> i) & 1; |
| 423 |
} |
| 424 |
|
| 425 |
bool |
| 426 |
explicit_mode_suffix_p (enum predication_index, enum mode_suffix_index) const override |
| 427 |
{ |
| 428 |
return false; |
| 429 |
} |
| 430 |
|
| 431 |
bool |
| 432 |
skip_overload_p (enum predication_index, enum mode_suffix_index) const override |
| 433 |
{ |
| 434 |
return false; |
| 435 |
} |
| 436 |
|
| 437 |
bool |
| 438 |
mode_after_pred () const override |
| 439 |
{ |
| 440 |
return true; |
| 441 |
} |
| 442 |
}; |
| 443 |
|
| 444 |
/* <T0>_t vfoo[_t0](<T0>_t, <T0>_t) |
| 445 |
|
| 446 |
i.e. the standard shape for binary operations that operate on |
| 447 |
uniform types. |
| 448 |
|
| 449 |
Example: vandq. |
| 450 |
int8x16_t [__arm_]vandq[_s8](int8x16_t a, int8x16_t b) |
| 451 |
int8x16_t [__arm_]vandq_m[_s8](int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) |
| 452 |
int8x16_t [__arm_]vandq_x[_s8](int8x16_t a, int8x16_t b, mve_pred16_t p) */ |
| 453 |
struct binary_def : public overloaded_base<0> |
| 454 |
{ |
| 455 |
void |
| 456 |
build (function_builder &b, const function_group_info &group, |
| 457 |
bool preserve_user_namespace) const override |
| 458 |
{ |
| 459 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 460 |
build_all (b, "v0,v0,v0", group, MODE_none, preserve_user_namespace); |
| 461 |
} |
| 462 |
|
| 463 |
tree |
| 464 |
resolve (function_resolver &r) const override |
| 465 |
{ |
| 466 |
return r.resolve_uniform (2); |
| 467 |
} |
| 468 |
}; |
| 469 |
SHAPE (binary) |
| 470 |
|
| 471 |
/* <[u]int32>_t vfoo[_<t0>](<T0>_t, <T0>_t) |
| 472 |
|
| 473 |
i.e. the shape for binary operations that operate on a pair of |
| 474 |
vectors and produce an int32_t or an uint32_t depending on the |
| 475 |
signedness of the input elements. |
| 476 |
|
| 477 |
Example: vmladavq. |
| 478 |
int32_t [__arm_]vmladavq[_s16](int16x8_t m1, int16x8_t m2) |
| 479 |
int32_t [__arm_]vmladavq_p[_s16](int16x8_t m1, int16x8_t m2, mve_pred16_t p) */ |
| 480 |
struct binary_acc_int32_def : public overloaded_base<0> |
| 481 |
{ |
| 482 |
void |
| 483 |
build (function_builder &b, const function_group_info &group, |
| 484 |
bool preserve_user_namespace) const override |
| 485 |
{ |
| 486 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 487 |
build_all (b, "sx32,v0,v0", group, MODE_none, preserve_user_namespace); |
| 488 |
} |
| 489 |
|
| 490 |
tree |
| 491 |
resolve (function_resolver &r) const override |
| 492 |
{ |
| 493 |
return r.resolve_uniform (2); |
| 494 |
} |
| 495 |
}; |
| 496 |
SHAPE (binary_acc_int32) |
| 497 |
|
| 498 |
/* <[u]int64>_t vfoo[_<t0>](<T0>_t, <T0>_t) |
| 499 |
|
| 500 |
Example: vmlaldavq. |
| 501 |
int64_t [__arm_]vmlaldavq[_s16](int16x8_t m1, int16x8_t m2) |
| 502 |
int64_t [__arm_]vmlaldavq_p[_s16](int16x8_t m1, int16x8_t m2, mve_pred16_t p) */ |
| 503 |
struct binary_acc_int64_def : public overloaded_base<0> |
| 504 |
{ |
| 505 |
void |
| 506 |
build (function_builder &b, const function_group_info &group, |
| 507 |
bool preserve_user_namespace) const override |
| 508 |
{ |
| 509 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 510 |
build_all (b, "sx64,v0,v0", group, MODE_none, preserve_user_namespace); |
| 511 |
} |
| 512 |
|
| 513 |
tree |
| 514 |
resolve (function_resolver &r) const override |
| 515 |
{ |
| 516 |
return r.resolve_uniform (2); |
| 517 |
} |
| 518 |
}; |
| 519 |
SHAPE (binary_acc_int64) |
| 520 |
|
| 521 |
/* <[u]int32>_t vfoo[_<t0>]([u]int32_t, <T0>_t, <T0>_t) |
| 522 |
|
| 523 |
Example: vmladavaq. |
| 524 |
int32_t [__arm_]vmladavaq[_s16](int32_t add, int16x8_t m1, int16x8_t m2) |
| 525 |
int32_t [__arm_]vmladavaq_p[_s16](int32_t add, int16x8_t m1, int16x8_t m2, mve_pred16_t p) */ |
| 526 |
struct binary_acca_int32_def : public overloaded_base<0> |
| 527 |
{ |
| 528 |
void |
| 529 |
build (function_builder &b, const function_group_info &group, |
| 530 |
bool preserve_user_namespace) const override |
| 531 |
{ |
| 532 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 533 |
build_all (b, "sx32,sx32,v0,v0", group, MODE_none, preserve_user_namespace); |
| 534 |
} |
| 535 |
|
| 536 |
tree |
| 537 |
resolve (function_resolver &r) const override |
| 538 |
{ |
| 539 |
unsigned int i, nargs; |
| 540 |
type_suffix_index type; |
| 541 |
const char *first_type_name; |
| 542 |
|
| 543 |
if (!r.check_gp_argument (3, i, nargs) |
| 544 |
|| (type = r.infer_vector_type (1)) == NUM_TYPE_SUFFIXES) |
| 545 |
return error_mark_node; |
| 546 |
|
| 547 |
first_type_name = (type_suffixes[type].unsigned_p |
| 548 |
? "uint32_t" |
| 549 |
: "int32_t"); |
| 550 |
if (!r.require_scalar_type (0, first_type_name)) |
| 551 |
return error_mark_node; |
| 552 |
|
| 553 |
unsigned int last_arg = i + 1; |
| 554 |
for (i = 1; i < last_arg; i++) |
| 555 |
if (!r.require_matching_vector_type (i, type)) |
| 556 |
return error_mark_node; |
| 557 |
|
| 558 |
return r.resolve_to (r.mode_suffix_id, type); |
| 559 |
} |
| 560 |
}; |
| 561 |
SHAPE (binary_acca_int32) |
| 562 |
|
| 563 |
/* [u]int64_t vfoo[_<t0>]([u]int64_t, <T0>_t, <T0>_t) |
| 564 |
|
| 565 |
Example: vmlaldavaq. |
| 566 |
int64_t [__arm_]vmlaldavaq[_s16](int64_t add, int16x8_t m1, int16x8_t m2) |
| 567 |
int64_t [__arm_]vmlaldavaq_p[_s16](int64_t add, int16x8_t m1, int16x8_t m2, mve_pred16_t p) */ |
| 568 |
struct binary_acca_int64_def : public overloaded_base<0> |
| 569 |
{ |
| 570 |
void |
| 571 |
build (function_builder &b, const function_group_info &group, |
| 572 |
bool preserve_user_namespace) const override |
| 573 |
{ |
| 574 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 575 |
build_all (b, "sx64,sx64,v0,v0", group, MODE_none, preserve_user_namespace); |
| 576 |
} |
| 577 |
|
| 578 |
tree |
| 579 |
resolve (function_resolver &r) const override |
| 580 |
{ |
| 581 |
unsigned int i, nargs; |
| 582 |
type_suffix_index type; |
| 583 |
const char *first_type_name; |
| 584 |
|
| 585 |
if (!r.check_gp_argument (3, i, nargs) |
| 586 |
|| (type = r.infer_vector_type (1)) == NUM_TYPE_SUFFIXES) |
| 587 |
return error_mark_node; |
| 588 |
|
| 589 |
|
| 590 |
first_type_name = (type_suffixes[type].unsigned_p |
| 591 |
? "uint64_t" |
| 592 |
: "int64_t"); |
| 593 |
if (!r.require_scalar_type (0, first_type_name)) |
| 594 |
return error_mark_node; |
| 595 |
|
| 596 |
unsigned int last_arg = i + 1; |
| 597 |
for (i = 1; i < last_arg; i++) |
| 598 |
if (!r.require_matching_vector_type (i, type)) |
| 599 |
return error_mark_node; |
| 600 |
|
| 601 |
return r.resolve_to (r.mode_suffix_id, type); |
| 602 |
} |
| 603 |
}; |
| 604 |
SHAPE (binary_acca_int64) |
| 605 |
|
| 606 |
/* <T0>_t vfoo[_n_t0](<T0>_t, int32_t) |
| 607 |
|
| 608 |
i.e. the shape for binary operations that operate on |
| 609 |
a vector and an int32_t. |
| 610 |
|
| 611 |
Example: vbrsrq. |
| 612 |
int16x8_t [__arm_]vbrsrq[_n_s16](int16x8_t a, int32_t b) |
| 613 |
int16x8_t [__arm_]vbrsrq_m[_n_s16](int16x8_t inactive, int16x8_t a, int32_t b, mve_pred16_t p) |
| 614 |
int16x8_t [__arm_]vbrsrq_x[_n_s16](int16x8_t a, int32_t b, mve_pred16_t p) */ |
| 615 |
struct binary_imm32_def : public overloaded_base<0> |
| 616 |
{ |
| 617 |
void |
| 618 |
build (function_builder &b, const function_group_info &group, |
| 619 |
bool preserve_user_namespace) const override |
| 620 |
{ |
| 621 |
b.add_overloaded_functions (group, MODE_n, preserve_user_namespace); |
| 622 |
build_all (b, "v0,v0,ss32", group, MODE_n, preserve_user_namespace); |
| 623 |
} |
| 624 |
|
| 625 |
tree |
| 626 |
resolve (function_resolver &r) const override |
| 627 |
{ |
| 628 |
return r.resolve_uniform (1, 1); |
| 629 |
} |
| 630 |
}; |
| 631 |
SHAPE (binary_imm32) |
| 632 |
|
| 633 |
/* <T0>_t vfoo[_n_t0](<T0>_t, const int) |
| 634 |
|
| 635 |
Shape for vector shift right operations that take a vector first |
| 636 |
argument and an integer, and produce a vector. |
| 637 |
|
| 638 |
Check that 'imm' is in the [1..#bits] range. |
| 639 |
|
| 640 |
Example: vrshrq. |
| 641 |
int8x16_t [__arm_]vrshrq[_n_s8](int8x16_t a, const int imm) |
| 642 |
int8x16_t [__arm_]vrshrq_m[_n_s8](int8x16_t inactive, int8x16_t a, const int imm, mve_pred16_t p) |
| 643 |
int8x16_t [__arm_]vrshrq_x[_n_s8](int8x16_t a, const int imm, mve_pred16_t p) */ |
| 644 |
struct binary_rshift_def : public overloaded_base<0> |
| 645 |
{ |
| 646 |
void |
| 647 |
build (function_builder &b, const function_group_info &group, |
| 648 |
bool preserve_user_namespace) const override |
| 649 |
{ |
| 650 |
b.add_overloaded_functions (group, MODE_n, preserve_user_namespace); |
| 651 |
build_all (b, "v0,v0,ss32", group, MODE_n, preserve_user_namespace); |
| 652 |
} |
| 653 |
|
| 654 |
tree |
| 655 |
resolve (function_resolver &r) const override |
| 656 |
{ |
| 657 |
return r.resolve_uniform (1, 1); |
| 658 |
} |
| 659 |
|
| 660 |
bool |
| 661 |
check (function_checker &c) const override |
| 662 |
{ |
| 663 |
unsigned int bits = c.type_suffix (0).element_bits; |
| 664 |
return c.require_immediate_range (1, 1, bits); |
| 665 |
} |
| 666 |
}; |
| 667 |
SHAPE (binary_rshift) |
| 668 |
|
| 669 |
|
| 670 |
/* <uT0>_t vfoo[_n_t0](<T0>_t, int) |
| 671 |
|
| 672 |
Shape for vector saturating shift left operations that take a |
| 673 |
vector of signed elements as first argument and an integer, and |
| 674 |
produce a vector of unsigned elements. |
| 675 |
|
| 676 |
Check that 'imm' is in the [0..#bits-1] range. |
| 677 |
|
| 678 |
Example: vqshluq. |
| 679 |
uint16x8_t [__arm_]vqshluq[_n_s16](int16x8_t a, const int imm) |
| 680 |
uint16x8_t [__arm_]vqshluq_m[_n_s16](uint16x8_t inactive, int16x8_t a, const int imm, mve_pred16_t p) */ |
| 681 |
struct binary_lshift_unsigned_def : public overloaded_base<0> |
| 682 |
{ |
| 683 |
void |
| 684 |
build (function_builder &b, const function_group_info &group, |
| 685 |
bool preserve_user_namespace) const override |
| 686 |
{ |
| 687 |
b.add_overloaded_functions (group, MODE_n, preserve_user_namespace); |
| 688 |
build_all (b, "vu0,vs0,su64", group, MODE_n, preserve_user_namespace); |
| 689 |
} |
| 690 |
|
| 691 |
tree |
| 692 |
resolve (function_resolver &r) const override |
| 693 |
{ |
| 694 |
unsigned int i, nargs; |
| 695 |
type_suffix_index type; |
| 696 |
if (!r.check_gp_argument (2, i, nargs) |
| 697 |
|| !r.require_integer_immediate (i) |
| 698 |
|| (type = r.infer_vector_type (i-1)) == NUM_TYPE_SUFFIXES) |
| 699 |
return error_mark_node; |
| 700 |
|
| 701 |
if (r.pred == PRED_m) |
| 702 |
{ |
| 703 |
/* With PRED_m, check that the 'inactive' first argument has |
| 704 |
the expeected unsigned type. */ |
| 705 |
type_suffix_index return_type |
| 706 |
= find_type_suffix (TYPE_unsigned, type_suffixes[type].element_bits); |
| 707 |
|
| 708 |
if (!r.require_matching_vector_type (0, return_type)) |
| 709 |
return error_mark_node; |
| 710 |
} |
| 711 |
|
| 712 |
return r.resolve_to (r.mode_suffix_id, type); |
| 713 |
} |
| 714 |
|
| 715 |
bool |
| 716 |
check (function_checker &c) const override |
| 717 |
{ |
| 718 |
unsigned int bits = c.type_suffix (0).element_bits; |
| 719 |
return c.require_immediate_range (1, 0, bits - 1); |
| 720 |
} |
| 721 |
|
| 722 |
}; |
| 723 |
SHAPE (binary_lshift_unsigned) |
| 724 |
|
| 725 |
/* <uT0>_t vfoo[_t0](<uT0>_t, <T0>_t) |
| 726 |
|
| 727 |
i.e. binary operations that take a vector of unsigned elements as first argument and a |
| 728 |
vector of signed elements as second argument, and produce a vector of unsigned elements. |
| 729 |
|
| 730 |
Example: vminaq. |
| 731 |
uint8x16_t [__arm_]vminaq[_s8](uint8x16_t a, int8x16_t b) |
| 732 |
uint8x16_t [__arm_]vminaq_m[_s8](uint8x16_t a, int8x16_t b, mve_pred16_t p) */ |
| 733 |
struct binary_maxamina_def : public overloaded_base<0> |
| 734 |
{ |
| 735 |
void |
| 736 |
build (function_builder &b, const function_group_info &group, |
| 737 |
bool preserve_user_namespace) const override |
| 738 |
{ |
| 739 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 740 |
build_all (b, "vu0,vu0,vs0", group, MODE_none, preserve_user_namespace); |
| 741 |
} |
| 742 |
|
| 743 |
tree |
| 744 |
resolve (function_resolver &r) const override |
| 745 |
{ |
| 746 |
unsigned int i, nargs; |
| 747 |
type_suffix_index type; |
| 748 |
if (!r.check_gp_argument (2, i, nargs) |
| 749 |
|| (type = r.infer_vector_type (i)) == NUM_TYPE_SUFFIXES) |
| 750 |
return error_mark_node; |
| 751 |
|
| 752 |
/* Check that the first argument has the expeected unsigned |
| 753 |
type. */ |
| 754 |
type_suffix_index return_type |
| 755 |
= find_type_suffix (TYPE_unsigned, type_suffixes[type].element_bits); |
| 756 |
if (!r.require_matching_vector_type (0, return_type)) |
| 757 |
return error_mark_node; |
| 758 |
|
| 759 |
return r.resolve_to (r.mode_suffix_id, type); |
| 760 |
} |
| 761 |
}; |
| 762 |
SHAPE (binary_maxamina) |
| 763 |
|
| 764 |
/* <uS0>_t vfoo[_<t0>](<uS0>_t, <T0>_t) |
| 765 |
|
| 766 |
Example: vmaxavq. |
| 767 |
uint8_t [__arm_]vmaxavq[_s8](uint8_t a, int8x16_t b) |
| 768 |
uint8_t [__arm_]vmaxavq_p[_s8](uint8_t a, int8x16_t b, mve_pred16_t p) */ |
| 769 |
struct binary_maxavminav_def : public overloaded_base<0> |
| 770 |
{ |
| 771 |
void |
| 772 |
build (function_builder &b, const function_group_info &group, |
| 773 |
bool preserve_user_namespace) const override |
| 774 |
{ |
| 775 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 776 |
build_all (b, "su0,su0,v0", group, MODE_none, preserve_user_namespace); |
| 777 |
} |
| 778 |
|
| 779 |
tree |
| 780 |
resolve (function_resolver &r) const override |
| 781 |
{ |
| 782 |
unsigned int i, nargs; |
| 783 |
type_suffix_index type; |
| 784 |
if (!r.check_gp_argument (2, i, nargs) |
| 785 |
|| !r.require_derived_scalar_type (0, TYPE_unsigned) |
| 786 |
|| (type = r.infer_vector_type (1)) == NUM_TYPE_SUFFIXES) |
| 787 |
return error_mark_node; |
| 788 |
|
| 789 |
return r.resolve_to (r.mode_suffix_id, type); |
| 790 |
} |
| 791 |
}; |
| 792 |
SHAPE (binary_maxavminav) |
| 793 |
|
| 794 |
/* <S0>_t vfoo[_<t0>](<S0>_t, <T0>_t) |
| 795 |
|
| 796 |
Example: vmaxvq. |
| 797 |
int8_t [__arm_]vmaxvq[_s8](int8_t a, int8x16_t b) |
| 798 |
int8_t [__arm_]vmaxvq_p[_s8](int8_t a, int8x16_t b, mve_pred16_t p) */ |
| 799 |
struct binary_maxvminv_def : public overloaded_base<0> |
| 800 |
{ |
| 801 |
void |
| 802 |
build (function_builder &b, const function_group_info &group, |
| 803 |
bool preserve_user_namespace) const override |
| 804 |
{ |
| 805 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 806 |
build_all (b, "s0,s0,v0", group, MODE_none, preserve_user_namespace); |
| 807 |
} |
| 808 |
|
| 809 |
tree |
| 810 |
resolve (function_resolver &r) const override |
| 811 |
{ |
| 812 |
unsigned int i, nargs; |
| 813 |
type_suffix_index type; |
| 814 |
if (!r.check_gp_argument (2, i, nargs) |
| 815 |
|| !r.require_derived_scalar_type (0, r.SAME_TYPE_CLASS) |
| 816 |
|| (type = r.infer_vector_type (1)) == NUM_TYPE_SUFFIXES) |
| 817 |
return error_mark_node; |
| 818 |
|
| 819 |
return r.resolve_to (r.mode_suffix_id, type); |
| 820 |
} |
| 821 |
}; |
| 822 |
SHAPE (binary_maxvminv) |
| 823 |
|
| 824 |
/* <T0:half>_t vfoo[_t0](<T0:half>_t, <T0>_t) |
| 825 |
|
| 826 |
Example: vmovnbq. |
| 827 |
int8x16_t [__arm_]vmovnbq[_s16](int8x16_t a, int16x8_t b) |
| 828 |
int8x16_t [__arm_]vmovnbq_m[_s16](int8x16_t a, int16x8_t b, mve_pred16_t p) */ |
| 829 |
struct binary_move_narrow_def : public overloaded_base<0> |
| 830 |
{ |
| 831 |
void |
| 832 |
build (function_builder &b, const function_group_info &group, |
| 833 |
bool preserve_user_namespace) const override |
| 834 |
{ |
| 835 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 836 |
build_all (b, "vh0,vh0,v0", group, MODE_none, preserve_user_namespace); |
| 837 |
} |
| 838 |
|
| 839 |
tree |
| 840 |
resolve (function_resolver &r) const override |
| 841 |
{ |
| 842 |
unsigned int i, nargs; |
| 843 |
type_suffix_index type, narrow_suffix; |
| 844 |
if (!r.check_gp_argument (2, i, nargs) |
| 845 |
|| (type = r.infer_vector_type (1)) == NUM_TYPE_SUFFIXES |
| 846 |
|| ((narrow_suffix = half_type_suffix (r, type, r.SAME_TYPE_CLASS)) |
| 847 |
== NUM_TYPE_SUFFIXES)) |
| 848 |
return error_mark_node; |
| 849 |
|
| 850 |
if (!r.require_matching_vector_type (0, narrow_suffix)) |
| 851 |
return error_mark_node; |
| 852 |
|
| 853 |
return r.resolve_to (r.mode_suffix_id, type); |
| 854 |
} |
| 855 |
}; |
| 856 |
SHAPE (binary_move_narrow) |
| 857 |
|
| 858 |
/* <uT0:half>_t vfoo[_t0](<uT0:half>_t, <T0>_t) |
| 859 |
|
| 860 |
Example: vqmovunbq. |
| 861 |
uint8x16_t [__arm_]vqmovunbq[_s16](uint8x16_t a, int16x8_t b) |
| 862 |
uint8x16_t [__arm_]vqmovunbq_m[_s16](uint8x16_t a, int16x8_t b, mve_pred16_t p) */ |
| 863 |
struct binary_move_narrow_unsigned_def : public overloaded_base<0> |
| 864 |
{ |
| 865 |
void |
| 866 |
build (function_builder &b, const function_group_info &group, |
| 867 |
bool preserve_user_namespace) const override |
| 868 |
{ |
| 869 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 870 |
build_all (b, "vhu0,vhu0,v0", group, MODE_none, preserve_user_namespace); |
| 871 |
} |
| 872 |
|
| 873 |
tree |
| 874 |
resolve (function_resolver &r) const override |
| 875 |
{ |
| 876 |
unsigned int i, nargs; |
| 877 |
type_suffix_index type, narrow_suffix; |
| 878 |
if (!r.check_gp_argument (2, i, nargs) |
| 879 |
|| (type = r.infer_vector_type (1)) == NUM_TYPE_SUFFIXES |
| 880 |
|| ((narrow_suffix = half_type_suffix (r, type, TYPE_unsigned)) |
| 881 |
== NUM_TYPE_SUFFIXES)) |
| 882 |
return error_mark_node; |
| 883 |
|
| 884 |
if (!r.require_matching_vector_type (0, narrow_suffix)) |
| 885 |
return error_mark_node; |
| 886 |
|
| 887 |
return r.resolve_to (r.mode_suffix_id, type); |
| 888 |
} |
| 889 |
}; |
| 890 |
SHAPE (binary_move_narrow_unsigned) |
| 891 |
|
| 892 |
/* <T0>_t vfoo[_t0](<T0>_t, <T0>_t) |
| 893 |
<T0>_t vfoo[_n_t0](<T0>_t, <S0>_t) |
| 894 |
|
| 895 |
i.e. the standard shape for binary operations that operate on |
| 896 |
uniform types. |
| 897 |
|
| 898 |
Example: vaddq. |
| 899 |
int8x16_t [__arm_]vaddq[_s8](int8x16_t a, int8x16_t b) |
| 900 |
int8x16_t [__arm_]vaddq[_n_s8](int8x16_t a, int8_t b) |
| 901 |
int8x16_t [__arm_]vaddq_m[_s8](int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) |
| 902 |
int8x16_t [__arm_]vaddq_m[_n_s8](int8x16_t inactive, int8x16_t a, int8_t b, mve_pred16_t p) |
| 903 |
int8x16_t [__arm_]vaddq_x[_s8](int8x16_t a, int8x16_t b, mve_pred16_t p) |
| 904 |
int8x16_t [__arm_]vaddq_x[_n_s8](int8x16_t a, int8_t b, mve_pred16_t p) */ |
| 905 |
struct binary_opt_n_def : public overloaded_base<0> |
| 906 |
{ |
| 907 |
void |
| 908 |
build (function_builder &b, const function_group_info &group, |
| 909 |
bool preserve_user_namespace) const override |
| 910 |
{ |
| 911 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 912 |
build_all (b, "v0,v0,v0", group, MODE_none, preserve_user_namespace); |
| 913 |
build_all (b, "v0,v0,s0", group, MODE_n, preserve_user_namespace); |
| 914 |
} |
| 915 |
|
| 916 |
tree |
| 917 |
resolve (function_resolver &r) const override |
| 918 |
{ |
| 919 |
return r.resolve_uniform_opt_n (2); |
| 920 |
} |
| 921 |
}; |
| 922 |
SHAPE (binary_opt_n) |
| 923 |
|
| 924 |
/* <T0>_t vfoo[t0](<T0>_t, <T0>_t) |
| 925 |
<T0>_t vfoo[_n_t0](<T0>_t, <S0>_t) |
| 926 |
|
| 927 |
Where the _n form only supports s16/s32/u16/u32 types as for vorrq. |
| 928 |
|
| 929 |
Example: vorrq. |
| 930 |
int16x8_t [__arm_]vorrq[_s16](int16x8_t a, int16x8_t b) |
| 931 |
int16x8_t [__arm_]vorrq_m[_s16](int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) |
| 932 |
int16x8_t [__arm_]vorrq_x[_s16](int16x8_t a, int16x8_t b, mve_pred16_t p) |
| 933 |
int16x8_t [__arm_]vorrq[_n_s16](int16x8_t a, const int16_t imm) |
| 934 |
int16x8_t [__arm_]vorrq_m_n[_s16](int16x8_t a, const int16_t imm, mve_pred16_t p) |
| 935 |
|
| 936 |
No "_n" forms for floating-point, nor 8-bit integers: |
| 937 |
float16x8_t [__arm_]vorrq[_f16](float16x8_t a, float16x8_t b) |
| 938 |
float16x8_t [__arm_]vorrq_m[_f16](float16x8_t inactive, float16x8_t a, float16x8_t b, mve_pred16_t p) |
| 939 |
float16x8_t [__arm_]vorrq_x[_f16](float16x8_t a, float16x8_t b, mve_pred16_t p) */ |
| 940 |
struct binary_orrq_def : public overloaded_base<0> |
| 941 |
{ |
| 942 |
bool |
| 943 |
explicit_mode_suffix_p (enum predication_index pred, enum mode_suffix_index mode) const override |
| 944 |
{ |
| 945 |
return (mode == MODE_n |
| 946 |
&& pred == PRED_m); |
| 947 |
} |
| 948 |
|
| 949 |
bool |
| 950 |
skip_overload_p (enum predication_index pred, enum mode_suffix_index mode) const override |
| 951 |
{ |
| 952 |
switch (mode) |
| 953 |
{ |
| 954 |
case MODE_none: |
| 955 |
return false; |
| 956 |
|
| 957 |
/* For MODE_n, share the overloaded instance with MODE_none, except for PRED_m. */ |
| 958 |
case MODE_n: |
| 959 |
return pred != PRED_m; |
| 960 |
|
| 961 |
default: |
| 962 |
gcc_unreachable (); |
| 963 |
} |
| 964 |
} |
| 965 |
|
| 966 |
void |
| 967 |
build (function_builder &b, const function_group_info &group, |
| 968 |
bool preserve_user_namespace) const override |
| 969 |
{ |
| 970 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 971 |
b.add_overloaded_functions (group, MODE_n, preserve_user_namespace); |
| 972 |
build_all (b, "v0,v0,v0", group, MODE_none, preserve_user_namespace); |
| 973 |
build_16_32 (b, "v0,v0,s0", group, MODE_n, preserve_user_namespace, false, preds_m_or_none); |
| 974 |
} |
| 975 |
|
| 976 |
tree |
| 977 |
resolve (function_resolver &r) const override |
| 978 |
{ |
| 979 |
unsigned int i, nargs; |
| 980 |
type_suffix_index type; |
| 981 |
if (!r.check_gp_argument (2, i, nargs) |
| 982 |
|| (type = r.infer_vector_type (0)) == NUM_TYPE_SUFFIXES) |
| 983 |
return error_mark_node; |
| 984 |
|
| 985 |
return r.finish_opt_n_resolution (i, 0, type); |
| 986 |
} |
| 987 |
}; |
| 988 |
SHAPE (binary_orrq) |
| 989 |
|
| 990 |
/* <T0>_t vfoo[t0](<T0>_t, <T0>_t) |
| 991 |
<T0>_t vfoo[_n_t0](<T0>_t, int32_t) |
| 992 |
|
| 993 |
Shape for rounding shift left operations. |
| 994 |
|
| 995 |
Example: vrshlq. |
| 996 |
int8x16_t [__arm_]vrshlq[_n_s8](int8x16_t a, int32_t b) |
| 997 |
int8x16_t [__arm_]vrshlq_m_n[_s8](int8x16_t a, int32_t b, mve_pred16_t p) |
| 998 |
int8x16_t [__arm_]vrshlq[_s8](int8x16_t a, int8x16_t b) |
| 999 |
int8x16_t [__arm_]vrshlq_m[_s8](int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) |
| 1000 |
int8x16_t [__arm_]vrshlq_x[_s8](int8x16_t a, int8x16_t b, mve_pred16_t p) */ |
| 1001 |
struct binary_round_lshift_def : public overloaded_base<0> |
| 1002 |
{ |
| 1003 |
bool |
| 1004 |
explicit_mode_suffix_p (enum predication_index pred, enum mode_suffix_index mode) const override |
| 1005 |
{ |
| 1006 |
return ((mode == MODE_n) |
| 1007 |
&& (pred == PRED_m)); |
| 1008 |
} |
| 1009 |
|
| 1010 |
bool |
| 1011 |
skip_overload_p (enum predication_index pred, enum mode_suffix_index mode) const override |
| 1012 |
{ |
| 1013 |
switch (mode) |
| 1014 |
{ |
| 1015 |
case MODE_none: |
| 1016 |
return false; |
| 1017 |
|
| 1018 |
/* For MODE_n, share the overloaded instance with MODE_none, except for PRED_m. */ |
| 1019 |
case MODE_n: |
| 1020 |
return pred != PRED_m; |
| 1021 |
|
| 1022 |
default: |
| 1023 |
gcc_unreachable (); |
| 1024 |
} |
| 1025 |
} |
| 1026 |
|
| 1027 |
void |
| 1028 |
build (function_builder &b, const function_group_info &group, |
| 1029 |
bool preserve_user_namespace) const override |
| 1030 |
{ |
| 1031 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 1032 |
b.add_overloaded_functions (group, MODE_n, preserve_user_namespace); |
| 1033 |
build_all (b, "v0,v0,vs0", group, MODE_none, preserve_user_namespace); |
| 1034 |
build_all (b, "v0,v0,ss32", group, MODE_n, preserve_user_namespace, false, preds_m_or_none); |
| 1035 |
} |
| 1036 |
|
| 1037 |
tree |
| 1038 |
resolve (function_resolver &r) const override |
| 1039 |
{ |
| 1040 |
unsigned int i, nargs; |
| 1041 |
type_suffix_index type; |
| 1042 |
if (!r.check_gp_argument (2, i, nargs) |
| 1043 |
|| (type = r.infer_vector_type (0)) == NUM_TYPE_SUFFIXES) |
| 1044 |
return error_mark_node; |
| 1045 |
|
| 1046 |
return r.finish_opt_n_resolution (i, 0, type, TYPE_signed); |
| 1047 |
} |
| 1048 |
}; |
| 1049 |
SHAPE (binary_round_lshift) |
| 1050 |
|
| 1051 |
/* <T0>_t vfoo[_t0](<T0>_t, <T0>_t) |
| 1052 |
<T0>_t vfoo_n[_t0](<T0>_t, const int) |
| 1053 |
|
| 1054 |
i.e. the standard shape for left shift operations that operate on |
| 1055 |
vector types. |
| 1056 |
|
| 1057 |
For the MODE_n versions, check that 'imm' is in the [0..#bits-1] range. |
| 1058 |
|
| 1059 |
Example: vshlq. |
| 1060 |
int8x16_t [__arm_]vshlq[_s8](int8x16_t a, int8x16_t b) |
| 1061 |
int8x16_t [__arm_]vshlq_m[_s8](int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) |
| 1062 |
int8x16_t [__arm_]vshlq_x[_s8](int8x16_t a, int8x16_t b, mve_pred16_t p) |
| 1063 |
int8x16_t [__arm_]vshlq_n[_s8](int8x16_t a, const int imm) |
| 1064 |
int8x16_t [__arm_]vshlq_m_n[_s8](int8x16_t inactive, int8x16_t a, const int imm, mve_pred16_t p) |
| 1065 |
int8x16_t [__arm_]vshlq_x_n[_s8](int8x16_t a, const int imm, mve_pred16_t p) */ |
| 1066 |
struct binary_lshift_def : public overloaded_base<0> |
| 1067 |
{ |
| 1068 |
bool |
| 1069 |
explicit_mode_suffix_p (enum predication_index, enum mode_suffix_index) const override |
| 1070 |
{ |
| 1071 |
return true; |
| 1072 |
} |
| 1073 |
|
| 1074 |
void |
| 1075 |
build (function_builder &b, const function_group_info &group, |
| 1076 |
bool preserve_user_namespace) const override |
| 1077 |
{ |
| 1078 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 1079 |
b.add_overloaded_functions (group, MODE_n, preserve_user_namespace); |
| 1080 |
build_all (b, "v0,v0,vs0", group, MODE_none, preserve_user_namespace); |
| 1081 |
build_all (b, "v0,v0,ss32", group, MODE_n, preserve_user_namespace); |
| 1082 |
} |
| 1083 |
|
| 1084 |
tree |
| 1085 |
resolve (function_resolver &r) const override |
| 1086 |
{ |
| 1087 |
unsigned int i, nargs; |
| 1088 |
type_suffix_index type; |
| 1089 |
if (!r.check_gp_argument (2, i, nargs) |
| 1090 |
|| (type = r.infer_vector_type (0)) == NUM_TYPE_SUFFIXES) |
| 1091 |
return error_mark_node; |
| 1092 |
|
| 1093 |
return r.finish_opt_n_resolution (i, 0, type, TYPE_signed); |
| 1094 |
} |
| 1095 |
|
| 1096 |
bool |
| 1097 |
check (function_checker &c) const override |
| 1098 |
{ |
| 1099 |
if (c.mode_suffix_id != MODE_n) |
| 1100 |
return true; |
| 1101 |
|
| 1102 |
unsigned int bits = c.type_suffix (0).element_bits; |
| 1103 |
return c.require_immediate_range (1, 0, bits - 1); |
| 1104 |
} |
| 1105 |
}; |
| 1106 |
SHAPE (binary_lshift) |
| 1107 |
|
| 1108 |
/* Used with the above form, but only for the MODE_r case which does |
| 1109 |
not always support the same set of predicates as MODE_none and |
| 1110 |
MODE_n. For vqshlq they are the same, but for vshlq they are not. |
| 1111 |
|
| 1112 |
<T0>_t vfoo_r[_t0](<T0>_t, int32_t) |
| 1113 |
|
| 1114 |
i.e. the standard shape for shift operations that operate on |
| 1115 |
vector types. |
| 1116 |
Example: vshlq. |
| 1117 |
int8x16_t [__arm_]vshlq_r[_s8](int8x16_t a, int32_t b) |
| 1118 |
int8x16_t [__arm_]vshlq_m_r[_s8](int8x16_t a, int32_t b, mve_pred16_t p) */ |
| 1119 |
struct binary_lshift_r_def : public overloaded_base<0> |
| 1120 |
{ |
| 1121 |
bool |
| 1122 |
explicit_mode_suffix_p (enum predication_index, enum mode_suffix_index) const override |
| 1123 |
{ |
| 1124 |
return true; |
| 1125 |
} |
| 1126 |
|
| 1127 |
void |
| 1128 |
build (function_builder &b, const function_group_info &group, |
| 1129 |
bool preserve_user_namespace) const override |
| 1130 |
{ |
| 1131 |
b.add_overloaded_functions (group, MODE_r, preserve_user_namespace); |
| 1132 |
build_all (b, "v0,v0,ss32", group, MODE_r, preserve_user_namespace, false, preds_m_or_none); |
| 1133 |
} |
| 1134 |
|
| 1135 |
tree |
| 1136 |
resolve (function_resolver &r) const override |
| 1137 |
{ |
| 1138 |
unsigned int i, nargs; |
| 1139 |
type_suffix_index type; |
| 1140 |
if (!r.check_gp_argument (2, i, nargs) |
| 1141 |
|| (type = r.infer_vector_type (0)) == NUM_TYPE_SUFFIXES) |
| 1142 |
return error_mark_node; |
| 1143 |
|
| 1144 |
return r.finish_opt_n_resolution (i, 0, type, TYPE_signed); |
| 1145 |
} |
| 1146 |
}; |
| 1147 |
SHAPE (binary_lshift_r) |
| 1148 |
|
| 1149 |
/* <T0:half>_t vfoo[_n_t0](<T0:half>_t, <T0>_t, const int) |
| 1150 |
|
| 1151 |
Narrowing right shifts. |
| 1152 |
Check that 'imm' is in the [1..#bits/2] range. |
| 1153 |
|
| 1154 |
Example: vqrshrnbq. |
| 1155 |
int8x16_t [__arm_]vqrshrnbq[_n_s16](int8x16_t a, int16x8_t b, const int imm) |
| 1156 |
int8x16_t [__arm_]vqrshrnbq_m[_n_s16](int8x16_t a, int16x8_t b, const int imm, mve_pred16_t p) */ |
| 1157 |
struct binary_rshift_narrow_def : public overloaded_base<0> |
| 1158 |
{ |
| 1159 |
void |
| 1160 |
build (function_builder &b, const function_group_info &group, |
| 1161 |
bool preserve_user_namespace) const override |
| 1162 |
{ |
| 1163 |
b.add_overloaded_functions (group, MODE_n, preserve_user_namespace); |
| 1164 |
build_all (b, "vh0,vh0,v0,su64", group, MODE_n, preserve_user_namespace); |
| 1165 |
} |
| 1166 |
|
| 1167 |
tree |
| 1168 |
resolve (function_resolver &r) const override |
| 1169 |
{ |
| 1170 |
unsigned int i, nargs; |
| 1171 |
type_suffix_index type, narrow_suffix; |
| 1172 |
if (!r.check_gp_argument (3, i, nargs) |
| 1173 |
|| (type = r.infer_vector_type (1)) == NUM_TYPE_SUFFIXES |
| 1174 |
|| ((narrow_suffix = half_type_suffix (r, type, r.SAME_TYPE_CLASS)) |
| 1175 |
== NUM_TYPE_SUFFIXES) |
| 1176 |
|| !r.require_integer_immediate (i)) |
| 1177 |
return error_mark_node; |
| 1178 |
|
| 1179 |
if (!r.require_matching_vector_type (0, narrow_suffix)) |
| 1180 |
return error_mark_node; |
| 1181 |
|
| 1182 |
return r.resolve_to (r.mode_suffix_id, type); |
| 1183 |
} |
| 1184 |
|
| 1185 |
bool |
| 1186 |
check (function_checker &c) const override |
| 1187 |
{ |
| 1188 |
unsigned int bits = c.type_suffix (0).element_bits; |
| 1189 |
return c.require_immediate_range (2, 1, bits / 2); |
| 1190 |
} |
| 1191 |
}; |
| 1192 |
SHAPE (binary_rshift_narrow) |
| 1193 |
|
| 1194 |
/* <uT0:half>_t vfoo[_n_t0](<uT0:half>_t, <T0>_t, const int) |
| 1195 |
|
| 1196 |
Vector saturating rounding shift right and narrow. |
| 1197 |
Check that 'imm' is in the [1..#bits/2] range. |
| 1198 |
|
| 1199 |
Example: vqshrunbq. |
| 1200 |
uint8x16_t [__arm_]vqshrunbq[_n_s16](uint8x16_t a, int16x8_t b, const int imm) |
| 1201 |
uint8x16_t [__arm_]vqshrunbq_m[_n_s16](uint8x16_t a, int16x8_t b, const int imm, mve_pred16_t p) */ |
| 1202 |
struct binary_rshift_narrow_unsigned_def : public overloaded_base<0> |
| 1203 |
{ |
| 1204 |
void |
| 1205 |
build (function_builder &b, const function_group_info &group, |
| 1206 |
bool preserve_user_namespace) const override |
| 1207 |
{ |
| 1208 |
b.add_overloaded_functions (group, MODE_n, preserve_user_namespace); |
| 1209 |
build_all (b, "vhu0,vhu0,v0,su64", group, MODE_n, preserve_user_namespace); |
| 1210 |
} |
| 1211 |
|
| 1212 |
tree |
| 1213 |
resolve (function_resolver &r) const override |
| 1214 |
{ |
| 1215 |
unsigned int i, nargs; |
| 1216 |
type_suffix_index type, narrow_suffix; |
| 1217 |
if (!r.check_gp_argument (3, i, nargs) |
| 1218 |
|| (type = r.infer_vector_type (1)) == NUM_TYPE_SUFFIXES |
| 1219 |
|| ((narrow_suffix = half_type_suffix (r, type, TYPE_unsigned)) |
| 1220 |
== NUM_TYPE_SUFFIXES) |
| 1221 |
|| !r.require_integer_immediate (i)) |
| 1222 |
return error_mark_node; |
| 1223 |
|
| 1224 |
if (!r.require_matching_vector_type (0, narrow_suffix)) |
| 1225 |
return error_mark_node; |
| 1226 |
|
| 1227 |
return r.resolve_to (r.mode_suffix_id, type); |
| 1228 |
} |
| 1229 |
|
| 1230 |
bool |
| 1231 |
check (function_checker &c) const override |
| 1232 |
{ |
| 1233 |
unsigned int bits = c.type_suffix (0).element_bits; |
| 1234 |
return c.require_immediate_range (2, 1, bits / 2); |
| 1235 |
} |
| 1236 |
|
| 1237 |
}; |
| 1238 |
SHAPE (binary_rshift_narrow_unsigned) |
| 1239 |
|
| 1240 |
/* <T0:twice>_t vfoo[_t0](<T0>_t, <T0>_t) |
| 1241 |
|
| 1242 |
Example: vmullbq. |
| 1243 |
int32x4_t [__arm_]vmullbq_int[_s16](int16x8_t a, int16x8_t b) |
| 1244 |
int32x4_t [__arm_]vmullbq_int_m[_s16](int32x4_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) |
| 1245 |
int32x4_t [__arm_]vmullbq_int_x[_s16](int16x8_t a, int16x8_t b, mve_pred16_t p) */ |
| 1246 |
struct binary_widen_def : public overloaded_base<0> |
| 1247 |
{ |
| 1248 |
void |
| 1249 |
build (function_builder &b, const function_group_info &group, |
| 1250 |
bool preserve_user_namespace) const override |
| 1251 |
{ |
| 1252 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 1253 |
build_all (b, "vw0,v0,v0", group, MODE_none, preserve_user_namespace); |
| 1254 |
} |
| 1255 |
|
| 1256 |
tree |
| 1257 |
resolve (function_resolver &r) const override |
| 1258 |
{ |
| 1259 |
unsigned int i, nargs; |
| 1260 |
type_suffix_index type, wide_suffix; |
| 1261 |
if (!r.check_gp_argument (2, i, nargs) |
| 1262 |
|| (type = r.infer_vector_type (i - 1)) == NUM_TYPE_SUFFIXES |
| 1263 |
|| ((wide_suffix = long_type_suffix (r, type, r.SAME_TYPE_CLASS)) |
| 1264 |
== NUM_TYPE_SUFFIXES)) |
| 1265 |
return error_mark_node; |
| 1266 |
|
| 1267 |
if (!r.require_matching_vector_type (i, type)) |
| 1268 |
return error_mark_node; |
| 1269 |
|
| 1270 |
/* Check the inactive argument has the wide type. */ |
| 1271 |
if ((r.pred == PRED_m) |
| 1272 |
&& (r.infer_vector_type (0) != wide_suffix)) |
| 1273 |
return r.report_no_such_form (type); |
| 1274 |
|
| 1275 |
return r.resolve_to (r.mode_suffix_id, type); |
| 1276 |
} |
| 1277 |
}; |
| 1278 |
SHAPE (binary_widen) |
| 1279 |
|
| 1280 |
/* <T0:twice>_t vfoo[_t0](<T0>_t, <T0>_t) |
| 1281 |
|
| 1282 |
Example: vmullbq_poly. |
| 1283 |
uint32x4_t [__arm_]vmullbq_poly[_p16](uint16x8_t a, uint16x8_t b) |
| 1284 |
uint32x4_t [__arm_]vmullbq_poly_m[_p16](uint32x4_t inactive, uint16x8_t a, uint16x8_t b, mve_pred16_t p) |
| 1285 |
uint32x4_t [__arm_]vmullbq_poly_x[_p16](uint16x8_t a, uint16x8_t b, mve_pred16_t p) */ |
| 1286 |
struct binary_widen_poly_def : public overloaded_base<0> |
| 1287 |
{ |
| 1288 |
void |
| 1289 |
build (function_builder &b, const function_group_info &group, |
| 1290 |
bool preserve_user_namespace) const override |
| 1291 |
{ |
| 1292 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 1293 |
build_all (b, "vU0,vp0,vp0", group, MODE_none, preserve_user_namespace); |
| 1294 |
} |
| 1295 |
|
| 1296 |
tree |
| 1297 |
resolve (function_resolver &r) const override |
| 1298 |
{ |
| 1299 |
unsigned int i, nargs; |
| 1300 |
type_suffix_index type; |
| 1301 |
if (!r.check_gp_argument (2, i, nargs) |
| 1302 |
|| (type = r.infer_vector_type (i - 1)) == NUM_TYPE_SUFFIXES) |
| 1303 |
return error_mark_node; |
| 1304 |
|
| 1305 |
/* infer_vector_type found the 'unsigned' version of the 'poly' |
| 1306 |
type we are looking for, so find the 'poly' type with the same |
| 1307 |
width. */ |
| 1308 |
type = find_type_suffix (TYPE_poly, type_suffixes[type].element_bits); |
| 1309 |
|
| 1310 |
type_suffix_index wide_suffix |
| 1311 |
= find_type_suffix (TYPE_unsigned, |
| 1312 |
type_suffixes[type].element_bits * 2); |
| 1313 |
|
| 1314 |
/* Require the 'poly' type, require_matching_vector_type would try |
| 1315 |
and fail with the 'unsigned' one. */ |
| 1316 |
if (!r.require_vector_type (i, type_suffixes[type].vector_type)) |
| 1317 |
return error_mark_node; |
| 1318 |
|
| 1319 |
/* Check the inactive argument has the wide type. */ |
| 1320 |
if ((r.pred == PRED_m) |
| 1321 |
&& (r.infer_vector_type (0) != wide_suffix)) |
| 1322 |
return r.report_no_such_form (type); |
| 1323 |
|
| 1324 |
return r.resolve_to (r.mode_suffix_id, type); |
| 1325 |
} |
| 1326 |
}; |
| 1327 |
SHAPE (binary_widen_poly) |
| 1328 |
|
| 1329 |
/* <T0:twice>_t vfoo[_n_t0](<T0>_t, const int) |
| 1330 |
|
| 1331 |
Check that 'imm' is in the [1..#bits] range. |
| 1332 |
|
| 1333 |
Example: vshllbq. |
| 1334 |
int16x8_t [__arm_]vshllbq[_n_s8](int8x16_t a, const int imm) |
| 1335 |
int16x8_t [__arm_]vshllbq_m[_n_s8](int16x8_t inactive, int8x16_t a, const int imm, mve_pred16_t p) |
| 1336 |
int16x8_t [__arm_]vshllbq_x[_n_s8](int8x16_t a, const int imm, mve_pred16_t p) */ |
| 1337 |
struct binary_widen_n_def : public overloaded_base<0> |
| 1338 |
{ |
| 1339 |
void |
| 1340 |
build (function_builder &b, const function_group_info &group, |
| 1341 |
bool preserve_user_namespace) const override |
| 1342 |
{ |
| 1343 |
b.add_overloaded_functions (group, MODE_n, preserve_user_namespace); |
| 1344 |
build_all (b, "vw0,v0,s0", group, MODE_n, preserve_user_namespace); |
| 1345 |
} |
| 1346 |
|
| 1347 |
tree |
| 1348 |
resolve (function_resolver &r) const override |
| 1349 |
{ |
| 1350 |
unsigned int i, nargs; |
| 1351 |
type_suffix_index type, wide_suffix; |
| 1352 |
tree res; |
| 1353 |
if (!r.check_gp_argument (2, i, nargs) |
| 1354 |
|| (type = r.infer_vector_type (i - 1)) == NUM_TYPE_SUFFIXES |
| 1355 |
|| ((wide_suffix = long_type_suffix (r, type, r.SAME_TYPE_CLASS)) |
| 1356 |
== NUM_TYPE_SUFFIXES) |
| 1357 |
|| !r.require_integer_immediate (i)) |
| 1358 |
return error_mark_node; |
| 1359 |
|
| 1360 |
/* Check the inactive argument has the wide type. */ |
| 1361 |
if (((r.pred == PRED_m) && (r.infer_vector_type (0) == wide_suffix)) |
| 1362 |
|| r.pred == PRED_none |
| 1363 |
|| r.pred == PRED_x) |
| 1364 |
if ((res = r.lookup_form (r.mode_suffix_id, type))) |
| 1365 |
return res; |
| 1366 |
|
| 1367 |
return r.report_no_such_form (type); |
| 1368 |
} |
| 1369 |
|
| 1370 |
bool |
| 1371 |
check (function_checker &c) const override |
| 1372 |
{ |
| 1373 |
unsigned int bits = c.type_suffix (0).element_bits; |
| 1374 |
return c.require_immediate_range (1, 1, bits); |
| 1375 |
} |
| 1376 |
|
| 1377 |
}; |
| 1378 |
SHAPE (binary_widen_n) |
| 1379 |
|
| 1380 |
/* <T0:twice>_t vfoo[_t0](<T0>_t, <T0>_t) |
| 1381 |
<T0:twice>_t vfoo[_n_t0](<T0>_t, <S0>_t) |
| 1382 |
|
| 1383 |
Example: vqdmullbq. |
| 1384 |
int32x4_t [__arm_]vqdmulltq[_n_s16](int16x8_t a, int16_t b) |
| 1385 |
int32x4_t [__arm_]vqdmulltq_m[_n_s16](int32x4_t inactive, int16x8_t a, int16_t b, mve_pred16_t p) |
| 1386 |
int32x4_t [__arm_]vqdmulltq[_s16](int16x8_t a, int16x8_t b) |
| 1387 |
int32x4_t [__arm_]vqdmulltq_m[_s16](int32x4_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) */ |
| 1388 |
struct binary_widen_opt_n_def : public overloaded_base<0> |
| 1389 |
{ |
| 1390 |
void |
| 1391 |
build (function_builder &b, const function_group_info &group, |
| 1392 |
bool preserve_user_namespace) const override |
| 1393 |
{ |
| 1394 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 1395 |
build_all (b, "vw0,v0,v0", group, MODE_none, preserve_user_namespace); |
| 1396 |
build_all (b, "vw0,v0,s0", group, MODE_n, preserve_user_namespace); |
| 1397 |
} |
| 1398 |
|
| 1399 |
tree |
| 1400 |
resolve (function_resolver &r) const override |
| 1401 |
{ |
| 1402 |
unsigned int i, nargs; |
| 1403 |
type_suffix_index type, wide_suffix; |
| 1404 |
if (!r.check_gp_argument (2, i, nargs) |
| 1405 |
|| (type = r.infer_vector_type (i - 1)) == NUM_TYPE_SUFFIXES |
| 1406 |
|| ((wide_suffix = long_type_suffix (r, type, r.SAME_TYPE_CLASS)) |
| 1407 |
== NUM_TYPE_SUFFIXES)) |
| 1408 |
return error_mark_node; |
| 1409 |
|
| 1410 |
/* Skip last argument, may be scalar, will be checked below by |
| 1411 |
finish_opt_n_resolution. */ |
| 1412 |
unsigned int last_arg = i--; |
| 1413 |
for (; i > 0; i--) |
| 1414 |
if (!r.require_matching_vector_type (i, type)) |
| 1415 |
return error_mark_node; |
| 1416 |
|
| 1417 |
/* Check the inactive argument has the wide type. */ |
| 1418 |
if ((r.pred == PRED_m) |
| 1419 |
&& (r.infer_vector_type (0) != wide_suffix)) |
| 1420 |
return r.report_no_such_form (type); |
| 1421 |
|
| 1422 |
return r.finish_opt_n_resolution (last_arg, 0, type); |
| 1423 |
} |
| 1424 |
}; |
| 1425 |
SHAPE (binary_widen_opt_n) |
| 1426 |
|
| 1427 |
/* Shape for comparison operations that operate on |
| 1428 |
uniform types. |
| 1429 |
|
| 1430 |
Examples: vcmpq. |
| 1431 |
mve_pred16_t [__arm_]vcmpeqq[_s16](int16x8_t a, int16x8_t b) |
| 1432 |
mve_pred16_t [__arm_]vcmpeqq[_n_s16](int16x8_t a, int16_t b) |
| 1433 |
mve_pred16_t [__arm_]vcmpeqq_m[_s16](int16x8_t a, int16x8_t b, mve_pred16_t p) |
| 1434 |
mve_pred16_t [__arm_]vcmpeqq_m[_n_s16](int16x8_t a, int16_t b, mve_pred16_t p) */ |
| 1435 |
struct cmp_def : public overloaded_base<0> |
| 1436 |
{ |
| 1437 |
void |
| 1438 |
build (function_builder &b, const function_group_info &group, |
| 1439 |
bool preserve_user_namespace) const override |
| 1440 |
{ |
| 1441 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 1442 |
build_all (b, "p,v0,v0", group, MODE_none, preserve_user_namespace); |
| 1443 |
build_all (b, "p,v0,s0", group, MODE_n, preserve_user_namespace); |
| 1444 |
} |
| 1445 |
|
| 1446 |
tree |
| 1447 |
resolve (function_resolver &r) const override |
| 1448 |
{ |
| 1449 |
return r.resolve_uniform_opt_n (2); |
| 1450 |
} |
| 1451 |
}; |
| 1452 |
SHAPE (cmp) |
| 1453 |
|
| 1454 |
/* <T0>xN_t vfoo[_t0](uint64_t, uint64_t) |
| 1455 |
|
| 1456 |
where there are N arguments in total. |
| 1457 |
Example: vcreateq. |
| 1458 |
int16x8_t [__arm_]vcreateq_s16(uint64_t a, uint64_t b) */ |
| 1459 |
struct create_def : public nonoverloaded_base |
| 1460 |
{ |
| 1461 |
void |
| 1462 |
build (function_builder &b, const function_group_info &group, |
| 1463 |
bool preserve_user_namespace) const override |
| 1464 |
{ |
| 1465 |
build_all (b, "v0,su64,su64", group, MODE_none, preserve_user_namespace); |
| 1466 |
} |
| 1467 |
}; |
| 1468 |
SHAPE (create) |
| 1469 |
|
| 1470 |
/* <T0>[xN]_t vfoo_t0(). |
| 1471 |
|
| 1472 |
Example: vuninitializedq. |
| 1473 |
int8x16_t [__arm_]vuninitializedq_s8(void) |
| 1474 |
int8x16_t [__arm_]vuninitializedq(int8x16_t t) */ |
| 1475 |
struct inherent_def : public nonoverloaded_base |
| 1476 |
{ |
| 1477 |
void |
| 1478 |
build (function_builder &b, const function_group_info &group, |
| 1479 |
bool preserve_user_namespace) const override |
| 1480 |
{ |
| 1481 |
build_all (b, "t0", group, MODE_none, preserve_user_namespace); |
| 1482 |
} |
| 1483 |
}; |
| 1484 |
SHAPE (inherent) |
| 1485 |
|
| 1486 |
/* <T0>_t vfoo[_t0](const <s0>_t *) |
| 1487 |
|
| 1488 |
where <s0> is the scalar name of <T0>. |
| 1489 |
|
| 1490 |
Example: vld1q. |
| 1491 |
int8x16_t [__arm_]vld1q[_s8](int8_t const *base) |
| 1492 |
int8x16_t [__arm_]vld1q_z[_s8](int8_t const *base, mve_pred16_t p) */ |
| 1493 |
struct load_def : public overloaded_base<0> |
| 1494 |
{ |
| 1495 |
void |
| 1496 |
build (function_builder &b, const function_group_info &group, |
| 1497 |
bool preserve_user_namespace) const override |
| 1498 |
{ |
| 1499 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 1500 |
build_all (b, "t0,al", group, MODE_none, preserve_user_namespace); |
| 1501 |
} |
| 1502 |
|
| 1503 |
/* Resolve a call based purely on a pointer argument. */ |
| 1504 |
tree |
| 1505 |
resolve (function_resolver &r) const override |
| 1506 |
{ |
| 1507 |
gcc_assert (r.mode_suffix_id == MODE_none); |
| 1508 |
|
| 1509 |
unsigned int i, nargs; |
| 1510 |
type_suffix_index type; |
| 1511 |
if (!r.check_gp_argument (1, i, nargs) |
| 1512 |
|| (type = r.infer_pointer_type (i)) == NUM_TYPE_SUFFIXES) |
| 1513 |
return error_mark_node; |
| 1514 |
|
| 1515 |
return r.resolve_to (r.mode_suffix_id, type); |
| 1516 |
} |
| 1517 |
}; |
| 1518 |
SHAPE (load) |
| 1519 |
|
| 1520 |
/* <T0>_t foo_t0 (const <X>_t *) |
| 1521 |
|
| 1522 |
where <X> is determined by the function base name. |
| 1523 |
|
| 1524 |
Example: vldrq. |
| 1525 |
int32x4_t [__arm_]vldrwq_s32 (int32_t const *base) |
| 1526 |
uint32x4_t [__arm_]vldrhq_z_u32 (uint16_t const *base, mve_pred16_t p) */ |
| 1527 |
struct load_ext_def : public nonoverloaded_base |
| 1528 |
{ |
| 1529 |
void |
| 1530 |
build (function_builder &b, const function_group_info &group, |
| 1531 |
bool preserve_user_namespace) const override |
| 1532 |
{ |
| 1533 |
build_all (b, "t0,al", group, MODE_none, preserve_user_namespace); |
| 1534 |
} |
| 1535 |
}; |
| 1536 |
SHAPE (load_ext) |
| 1537 |
|
| 1538 |
/* Base class for load_ext_gather_offset and load_ext_gather_shifted_offset, |
| 1539 |
which differ only in the units of the displacement. */ |
| 1540 |
struct load_ext_gather : public overloaded_base<0> |
| 1541 |
{ |
| 1542 |
bool |
| 1543 |
explicit_mode_suffix_p (enum predication_index, enum mode_suffix_index) const override |
| 1544 |
{ |
| 1545 |
return true; |
| 1546 |
} |
| 1547 |
|
| 1548 |
bool |
| 1549 |
mode_after_pred () const override |
| 1550 |
{ |
| 1551 |
return false; |
| 1552 |
} |
| 1553 |
}; |
| 1554 |
|
| 1555 |
/* <T0>_t vfoo[_t0](<X>_t, const int) |
| 1556 |
|
| 1557 |
where <X> has the same width as <T0> but is of unsigned type. |
| 1558 |
|
| 1559 |
Example: vldrwq_gather_base |
| 1560 |
int32x4_t [__arm_]vldrwq_gather_base_s32(uint32x4_t addr, const int offset) |
| 1561 |
float32x4_t [__arm_]vldrwq_gather_base_z_f32(uint32x4_t addr, const int offset, mve_pred16_t p) |
| 1562 |
int64x2_t [__arm_]vldrdq_gather_base_wb_s64(uint64x2_t *addr, const int offset) */ |
| 1563 |
struct load_gather_base_def : public nonoverloaded_base |
| 1564 |
{ |
| 1565 |
bool |
| 1566 |
explicit_mode_suffix_p (enum predication_index, enum mode_suffix_index) const override |
| 1567 |
{ |
| 1568 |
return true; |
| 1569 |
} |
| 1570 |
|
| 1571 |
bool |
| 1572 |
mode_after_pred () const override |
| 1573 |
{ |
| 1574 |
return false; |
| 1575 |
} |
| 1576 |
|
| 1577 |
void |
| 1578 |
build (function_builder &b, const function_group_info &group, |
| 1579 |
bool preserve_user_namespace) const override |
| 1580 |
{ |
| 1581 |
build_all (b, "v0,vu0,ss64", group, MODE_none, preserve_user_namespace); |
| 1582 |
build_all (b, "v0,b,ss64", group, MODE_wb, preserve_user_namespace); |
| 1583 |
} |
| 1584 |
|
| 1585 |
bool |
| 1586 |
check (function_checker &c) const override |
| 1587 |
{ |
| 1588 |
unsigned int multiple = c.type_suffix (0).element_bits / 8; |
| 1589 |
int bound = 127 * multiple; |
| 1590 |
return c.require_immediate_range_multiple (1, -bound, bound, multiple); |
| 1591 |
} |
| 1592 |
}; |
| 1593 |
SHAPE (load_gather_base) |
| 1594 |
|
| 1595 |
/* <T0>_t vfoo[_t0](<X>_t const *, <Y>_t) |
| 1596 |
|
| 1597 |
where <X> might be tied to <t0> (for non-extending loads) or might |
| 1598 |
depend on the function base name (for extending loads), |
| 1599 |
<Y> has the same width as <T0> but is of unsigned type. |
| 1600 |
|
| 1601 |
Example: vldrhq_gather_offset |
| 1602 |
int16x8_t [__arm_]vldrhq_gather_offset[_s16](int16_t const *base, uint16x8_t offset) |
| 1603 |
int32x4_t [__arm_]vldrhq_gather_offset_z[_s32](int16_t const *base, uint32x4_t offset, mve_pred16_t p) */ |
| 1604 |
struct load_ext_gather_offset_def : public load_ext_gather |
| 1605 |
{ |
| 1606 |
void |
| 1607 |
build (function_builder &b, const function_group_info &group, |
| 1608 |
bool preserve_user_namespace) const override |
| 1609 |
{ |
| 1610 |
b.add_overloaded_functions (group, MODE_offset, preserve_user_namespace); |
| 1611 |
build_all (b, "v0,al,vu0", group, MODE_offset, preserve_user_namespace); |
| 1612 |
} |
| 1613 |
|
| 1614 |
tree |
| 1615 |
resolve (function_resolver &r) const override |
| 1616 |
{ |
| 1617 |
unsigned int i, nargs; |
| 1618 |
mode_suffix_index mode = MODE_offset; |
| 1619 |
type_suffix_index ptr_type; |
| 1620 |
type_suffix_index offset_type; |
| 1621 |
if (!r.check_gp_argument (2, i, nargs) |
| 1622 |
|| (ptr_type = r.infer_pointer_type (0)) == NUM_TYPE_SUFFIXES |
| 1623 |
|| (offset_type = r.infer_vector_type (1)) == NUM_TYPE_SUFFIXES) |
| 1624 |
return error_mark_node; |
| 1625 |
|
| 1626 |
/* tclass comes from base argument, element bits come from the offset |
| 1627 |
argument. */ |
| 1628 |
type_suffix_index type = find_type_suffix (type_suffixes[ptr_type].tclass, |
| 1629 |
type_suffixes[offset_type].element_bits); |
| 1630 |
|
| 1631 |
return r.resolve_to (mode, type); |
| 1632 |
} |
| 1633 |
}; |
| 1634 |
SHAPE (load_ext_gather_offset) |
| 1635 |
|
| 1636 |
/* <T0>_t vfoo[_t0](<T0>_t) |
| 1637 |
<T0>_t vfoo_n_t0(<sT0>_t) |
| 1638 |
|
| 1639 |
For MODE_n, define only the 16 and 32 bits versions. |
| 1640 |
|
| 1641 |
Example: vmvnq. |
| 1642 |
int16x8_t [__arm_]vmvnq[_s16](int16x8_t a) |
| 1643 |
int16x8_t [__arm_]vmvnq_m[_s16](int16x8_t inactive, int16x8_t a, mve_pred16_t p) |
| 1644 |
int16x8_t [__arm_]vmvnq_x[_s16](int16x8_t a, mve_pred16_t p) |
| 1645 |
int16x8_t [__arm_]vmvnq_n_s16(const int16_t imm) |
| 1646 |
int16x8_t [__arm_]vmvnq_m[_n_s16](int16x8_t inactive, const int16_t imm, mve_pred16_t p) |
| 1647 |
int16x8_t [__arm_]vmvnq_x_n_s16(const int16_t imm, mve_pred16_t p) */ |
| 1648 |
struct mvn_def : public overloaded_base<0> |
| 1649 |
{ |
| 1650 |
void |
| 1651 |
build (function_builder &b, const function_group_info &group, |
| 1652 |
bool preserve_user_namespace) const override |
| 1653 |
{ |
| 1654 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 1655 |
/* Do not build a separate instance for MODE_n, since we want to |
| 1656 |
share vmvnq_m[_n_s16] with vmvnq_m[_s16]. */ |
| 1657 |
build_all (b, "v0,v0", group, MODE_none, preserve_user_namespace); |
| 1658 |
build_16_32 (b, "v0,s0", group, MODE_n, preserve_user_namespace); |
| 1659 |
} |
| 1660 |
|
| 1661 |
tree |
| 1662 |
resolve (function_resolver &r) const override |
| 1663 |
{ |
| 1664 |
unsigned int i, nargs; |
| 1665 |
type_suffix_index type; |
| 1666 |
if (!r.check_gp_argument (1, i, nargs) |
| 1667 |
/* Same type for arg 0 and 1 if _m, so using 0 is OK */ |
| 1668 |
|| (type = r.infer_vector_type (0)) == NUM_TYPE_SUFFIXES) |
| 1669 |
return error_mark_node; |
| 1670 |
|
| 1671 |
/* Skip last argument, may be scalar. */ |
| 1672 |
unsigned int last_arg = i; |
| 1673 |
for (i = 0; i < last_arg; i++) |
| 1674 |
if (!r.require_matching_vector_type (i, type)) |
| 1675 |
return error_mark_node; |
| 1676 |
|
| 1677 |
if (last_arg == 0) |
| 1678 |
return r.resolve_to (r.mode_suffix_id, type); |
| 1679 |
|
| 1680 |
return r.finish_opt_n_resolution (last_arg, 0, type); |
| 1681 |
} |
| 1682 |
}; |
| 1683 |
SHAPE (mvn) |
| 1684 |
|
| 1685 |
/* int64_t foo(int64_t, int32_t) |
| 1686 |
|
| 1687 |
Example: asrl |
| 1688 |
int64_t [__arm_]arsl(int64_t value, int32_t shift) */ |
| 1689 |
struct scalar_s64_shift_def : public nonoverloaded_base |
| 1690 |
{ |
| 1691 |
void |
| 1692 |
build (function_builder &b, const function_group_info &group, |
| 1693 |
bool preserve_user_namespace) const override |
| 1694 |
{ |
| 1695 |
build_all (b, "ss64,ss64,ss32", group, MODE_none, preserve_user_namespace); |
| 1696 |
} |
| 1697 |
}; |
| 1698 |
SHAPE (scalar_s64_shift) |
| 1699 |
|
| 1700 |
/* uint64_t foo(uint64_t, int32_t) |
| 1701 |
|
| 1702 |
Example: lsll. |
| 1703 |
uint64_t [__arm_]lsll(uint64_t value, int32_t shift) */ |
| 1704 |
struct scalar_u64_shift_def : public nonoverloaded_base |
| 1705 |
{ |
| 1706 |
void |
| 1707 |
build (function_builder &b, const function_group_info &group, |
| 1708 |
bool preserve_user_namespace) const override |
| 1709 |
{ |
| 1710 |
build_all (b, "su64,su64,ss32", group, MODE_none, preserve_user_namespace); |
| 1711 |
} |
| 1712 |
}; |
| 1713 |
SHAPE (scalar_u64_shift) |
| 1714 |
|
| 1715 |
/* void vfoo[_t0](<X>_t *, <T0>[xN]_t) |
| 1716 |
|
| 1717 |
where <X> might be tied to <t0> (for non-truncating stores) or might |
| 1718 |
depend on the function base name (for truncating stores). |
| 1719 |
|
| 1720 |
Example: vst1q. |
| 1721 |
void [__arm_]vst1q[_s8](int8_t *base, int8x16_t value) |
| 1722 |
void [__arm_]vst1q_p[_s8](int8_t *base, int8x16_t value, mve_pred16_t p) |
| 1723 |
|
| 1724 |
Example: vstrb. |
| 1725 |
void [__arm_]vstrbq[_s16](int8_t *base, int16x8_t value) |
| 1726 |
void [__arm_]vstrbq_p[_s16](int8_t *base, int16x8_t value, mve_pred16_t p) */ |
| 1727 |
struct store_def : public overloaded_base<0> |
| 1728 |
{ |
| 1729 |
void |
| 1730 |
build (function_builder &b, const function_group_info &group, |
| 1731 |
bool preserve_user_namespace) const override |
| 1732 |
{ |
| 1733 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 1734 |
build_all (b, "_,as,t0", group, MODE_none, preserve_user_namespace); |
| 1735 |
} |
| 1736 |
|
| 1737 |
tree |
| 1738 |
resolve (function_resolver &r) const override |
| 1739 |
{ |
| 1740 |
gcc_assert (r.mode_suffix_id == MODE_none); |
| 1741 |
|
| 1742 |
unsigned int i, nargs; |
| 1743 |
type_suffix_index type; |
| 1744 |
if (!r.check_gp_argument (2, i, nargs) |
| 1745 |
|| !r.require_pointer_type (0) |
| 1746 |
|| (type = r.infer_tuple_type (1)) == NUM_TYPE_SUFFIXES) |
| 1747 |
return error_mark_node; |
| 1748 |
|
| 1749 |
return r.resolve_to (r.mode_suffix_id, type); |
| 1750 |
} |
| 1751 |
}; |
| 1752 |
SHAPE (store) |
| 1753 |
|
| 1754 |
/* Base class for store_scatter_offset and store_scatter_shifted_offset, which |
| 1755 |
differ only in the units of the displacement. Also used by |
| 1756 |
store_scatter_base. */ |
| 1757 |
struct store_scatter : public overloaded_base<0> |
| 1758 |
{ |
| 1759 |
bool |
| 1760 |
explicit_mode_suffix_p (enum predication_index, enum mode_suffix_index) const override |
| 1761 |
{ |
| 1762 |
return true; |
| 1763 |
} |
| 1764 |
|
| 1765 |
bool |
| 1766 |
mode_after_pred () const override |
| 1767 |
{ |
| 1768 |
return false; |
| 1769 |
} |
| 1770 |
}; |
| 1771 |
|
| 1772 |
/* void vfoo[_t0](<X>_t *, <Y>_t, <T0>_t) |
| 1773 |
|
| 1774 |
where <X> might be tied to <t0> (for non-truncating stores) or might |
| 1775 |
depend on the function base name (for truncating stores), |
| 1776 |
<Y> has the same width as <T0> but is of unsigned type. |
| 1777 |
|
| 1778 |
Example: vstrbq_scatter_offset |
| 1779 |
void [__arm_]vstrbq_scatter_offset[_s16](int8_t *base, uint16x8_t offset, int16x8_t value) |
| 1780 |
void [__arm_]vstrbq_scatter_offset_p[_s16](int8_t *base, uint16x8_t offset, int16x8_t value, mve_pred16_t p) */ |
| 1781 |
struct store_scatter_offset_def : public store_scatter |
| 1782 |
{ |
| 1783 |
void |
| 1784 |
build (function_builder &b, const function_group_info &group, |
| 1785 |
bool preserve_user_namespace) const override |
| 1786 |
{ |
| 1787 |
b.add_overloaded_functions (group, MODE_offset, preserve_user_namespace); |
| 1788 |
build_all (b, "_,as,vu0,v0", group, MODE_offset, preserve_user_namespace); |
| 1789 |
} |
| 1790 |
|
| 1791 |
/* Resolve a scatter store that takes a scalar pointer base and a vector |
| 1792 |
displacement. |
| 1793 |
|
| 1794 |
The stored data is the final argument, and it determines the |
| 1795 |
type suffix. */ |
| 1796 |
tree |
| 1797 |
resolve (function_resolver &r) const override |
| 1798 |
{ |
| 1799 |
unsigned int i, nargs; |
| 1800 |
type_suffix_index type; |
| 1801 |
if (!r.check_gp_argument (3, i, nargs) |
| 1802 |
|| !r.require_pointer_type (0) |
| 1803 |
|| (type = r.infer_vector_type (2)) == NUM_TYPE_SUFFIXES) |
| 1804 |
return error_mark_node; |
| 1805 |
|
| 1806 |
/* Offset (arg 1) should be a vector of unsigned with same width as value |
| 1807 |
(arg 2). */ |
| 1808 |
type_suffix_index offset_type |
| 1809 |
= find_type_suffix (TYPE_unsigned, type_suffixes[type].element_bits); |
| 1810 |
if (!r.require_matching_vector_type (1, offset_type)) |
| 1811 |
return error_mark_node; |
| 1812 |
|
| 1813 |
return r.resolve_to (r.mode_suffix_id, type); |
| 1814 |
} |
| 1815 |
}; |
| 1816 |
SHAPE (store_scatter_offset) |
| 1817 |
|
| 1818 |
/* void vfoo[_t0](<Y>_t, const int, <T0>_t) |
| 1819 |
|
| 1820 |
where <X> is tied to <t0>. |
| 1821 |
<Y> has the same width as <T0> but is of unsigned type. |
| 1822 |
|
| 1823 |
Example: vstrbq_scatter_base |
| 1824 |
void [__arm_]vstrwq_scatter_base[_s32](uint32x4_t addr, const int offset, int32x4_t value) |
| 1825 |
void [__arm_]vstrwq_scatter_base_p[_s32](uint32x4_t addr, const int offset, int32x4_t value, mve_pred16_t p) |
| 1826 |
void [__arm_]vstrdq_scatter_base_wb[_s64](uint64x2_t *addr, const int offset, int64x2_t value) */ |
| 1827 |
struct store_scatter_base_def : public store_scatter |
| 1828 |
{ |
| 1829 |
void |
| 1830 |
build (function_builder &b, const function_group_info &group, |
| 1831 |
bool preserve_user_namespace) const override |
| 1832 |
{ |
| 1833 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 1834 |
b.add_overloaded_functions (group, MODE_wb, preserve_user_namespace); |
| 1835 |
build_all (b, "_,vu0,ss64,v0", group, MODE_none, preserve_user_namespace); |
| 1836 |
build_all (b, "_,b,ss64,v0", group, MODE_wb, preserve_user_namespace); |
| 1837 |
} |
| 1838 |
|
| 1839 |
tree |
| 1840 |
resolve (function_resolver &r) const override |
| 1841 |
{ |
| 1842 |
gcc_assert ((r.mode_suffix_id == MODE_none) |
| 1843 |
|| (r.mode_suffix_id == MODE_wb)); |
| 1844 |
|
| 1845 |
unsigned int i, nargs; |
| 1846 |
type_suffix_index type; |
| 1847 |
if (!r.check_gp_argument (3, i, nargs) |
| 1848 |
|| !r.require_integer_immediate (1) |
| 1849 |
|| (type = r.infer_vector_type (2)) == NUM_TYPE_SUFFIXES) |
| 1850 |
return error_mark_node; |
| 1851 |
|
| 1852 |
type_suffix_index base_type |
| 1853 |
= find_type_suffix (TYPE_unsigned, type_suffixes[type].element_bits); |
| 1854 |
|
| 1855 |
if (r.mode_suffix_id == MODE_none) |
| 1856 |
{ |
| 1857 |
/* Base (arg 0) should be a vector of unsigned with same width as value |
| 1858 |
(arg 2). */ |
| 1859 |
if (!r.require_matching_vector_type (0, base_type)) |
| 1860 |
return error_mark_node; |
| 1861 |
} |
| 1862 |
else |
| 1863 |
{ |
| 1864 |
/* Base (arg 0) should be a pointer to a vector of unsigned with the |
| 1865 |
same width as value (arg 2). */ |
| 1866 |
if (!r.require_pointer_to_type (0, r.get_vector_type (base_type))) |
| 1867 |
return error_mark_node; |
| 1868 |
} |
| 1869 |
|
| 1870 |
return r.resolve_to (r.mode_suffix_id, type); |
| 1871 |
} |
| 1872 |
|
| 1873 |
bool |
| 1874 |
check (function_checker &c) const override |
| 1875 |
{ |
| 1876 |
int multiple = c.type_suffix (0).element_bits / 8; |
| 1877 |
int bound = 127 * multiple; |
| 1878 |
return c.require_immediate_range_multiple (1, -bound, bound, multiple); |
| 1879 |
} |
| 1880 |
}; |
| 1881 |
SHAPE (store_scatter_base) |
| 1882 |
|
| 1883 |
/* <T0>_t vfoo[_t0](<T0>_t, <T0>_t, <T0>_t) |
| 1884 |
|
| 1885 |
i.e. the standard shape for ternary operations that operate on |
| 1886 |
uniform types. |
| 1887 |
|
| 1888 |
Example: vqrdmlsdhxq. |
| 1889 |
int8x16_t [__arm_]vqrdmlsdhxq[_s8](int8x16_t inactive, int8x16_t a, int8x16_t b) |
| 1890 |
int8x16_t [__arm_]vqrdmlsdhxq_m[_s8](int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p) */ |
| 1891 |
struct ternary_def : public overloaded_base<0> |
| 1892 |
{ |
| 1893 |
void |
| 1894 |
build (function_builder &b, const function_group_info &group, |
| 1895 |
bool preserve_user_namespace) const override |
| 1896 |
{ |
| 1897 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 1898 |
build_all (b, "v0,v0,v0,v0", group, MODE_none, preserve_user_namespace); |
| 1899 |
} |
| 1900 |
|
| 1901 |
tree |
| 1902 |
resolve (function_resolver &r) const override |
| 1903 |
{ |
| 1904 |
return r.resolve_uniform_opt_n (3); |
| 1905 |
} |
| 1906 |
}; |
| 1907 |
SHAPE (ternary) |
| 1908 |
|
| 1909 |
/* <T0>_t vfoo[_t0](<T0>_t, <T0>_t, const int) |
| 1910 |
|
| 1911 |
i.e. ternary operations that operate on a pair of vectors of the |
| 1912 |
same type as the destination, and take a third integer argument. |
| 1913 |
|
| 1914 |
Check that 'imm' is in the [0..#bits-1] range. |
| 1915 |
|
| 1916 |
Example: vsliq. |
| 1917 |
int16x8_t [__arm_]vsliq[_n_s16](int16x8_t a, int16x8_t b, const int imm) |
| 1918 |
int16x8_t [__arm_]vsliq_m[_n_s16](int16x8_t a, int16x8_t b, const int imm, mve_pred16_t p) */ |
| 1919 |
struct ternary_lshift_def : public overloaded_base<0> |
| 1920 |
{ |
| 1921 |
void |
| 1922 |
build (function_builder &b, const function_group_info &group, |
| 1923 |
bool preserve_user_namespace) const override |
| 1924 |
{ |
| 1925 |
b.add_overloaded_functions (group, MODE_n, preserve_user_namespace); |
| 1926 |
build_all (b, "v0,v0,v0,su64", group, MODE_n, preserve_user_namespace); |
| 1927 |
} |
| 1928 |
|
| 1929 |
tree |
| 1930 |
resolve (function_resolver &r) const override |
| 1931 |
{ |
| 1932 |
return r.resolve_uniform (2, 1); |
| 1933 |
} |
| 1934 |
|
| 1935 |
bool |
| 1936 |
check (function_checker &c) const override |
| 1937 |
{ |
| 1938 |
if (c.mode_suffix_id != MODE_n) |
| 1939 |
return true; |
| 1940 |
|
| 1941 |
unsigned int bits = c.type_suffix (0).element_bits; |
| 1942 |
return c.require_immediate_range (2, 0, bits - 1); |
| 1943 |
} |
| 1944 |
}; |
| 1945 |
SHAPE (ternary_lshift) |
| 1946 |
|
| 1947 |
/* <T0>_t vfoo[_n_t0](<T0>_t, <T0>_t, <S0>_t) |
| 1948 |
|
| 1949 |
i.e. the standard shape for ternary operations that operate on a |
| 1950 |
pair of vectors of the same type as the destination, and take a |
| 1951 |
third scalar argument of the same type as the vector elements. |
| 1952 |
|
| 1953 |
Example: vmlaq. |
| 1954 |
int8x16_t [__arm_]vmlaq[_n_s8](int8x16_t add, int8x16_t m1, int8_t m2) |
| 1955 |
int8x16_t [__arm_]vmlaq_m[_n_s8](int8x16_t add, int8x16_t m1, int8_t m2, mve_pred16_t p) */ |
| 1956 |
struct ternary_n_def : public overloaded_base<0> |
| 1957 |
{ |
| 1958 |
void |
| 1959 |
build (function_builder &b, const function_group_info &group, |
| 1960 |
bool preserve_user_namespace) const override |
| 1961 |
{ |
| 1962 |
b.add_overloaded_functions (group, MODE_n, preserve_user_namespace); |
| 1963 |
build_all (b, "v0,v0,v0,s0", group, MODE_n, preserve_user_namespace); |
| 1964 |
} |
| 1965 |
|
| 1966 |
tree |
| 1967 |
resolve (function_resolver &r) const override |
| 1968 |
{ |
| 1969 |
return r.resolve_uniform (2, 1); |
| 1970 |
} |
| 1971 |
}; |
| 1972 |
SHAPE (ternary_n) |
| 1973 |
|
| 1974 |
/* <T0>_t vfoo[_t0](<T0>_t, <T0>_t, <T0>_t) |
| 1975 |
<T0>_t vfoo[_n_t0](<T0>_t, <T0>_t, <S0>_t) |
| 1976 |
|
| 1977 |
i.e. the standard shape for ternary operations that operate on |
| 1978 |
uniform types. |
| 1979 |
|
| 1980 |
Example: vfmaq. |
| 1981 |
float16x8_t [__arm_]vfmaq[_n_f16](float16x8_t add, float16x8_t m1, float16_t m2) |
| 1982 |
float16x8_t [__arm_]vfmaq_m[_n_f16](float16x8_t add, float16x8_t m1, float16_t m2, mve_pred16_t p) |
| 1983 |
float16x8_t [__arm_]vfmaq[_f16](float16x8_t add, float16x8_t m1, float16x8_t m2) |
| 1984 |
float16x8_t [__arm_]vfmaq_m[_f16](float16x8_t add, float16x8_t m1, float16x8_t m2, mve_pred16_t p) */ |
| 1985 |
struct ternary_opt_n_def : public overloaded_base<0> |
| 1986 |
{ |
| 1987 |
void |
| 1988 |
build (function_builder &b, const function_group_info &group, |
| 1989 |
bool preserve_user_namespace) const override |
| 1990 |
{ |
| 1991 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 1992 |
build_all (b, "v0,v0,v0,v0", group, MODE_none, preserve_user_namespace); |
| 1993 |
build_all (b, "v0,v0,v0,s0", group, MODE_n, preserve_user_namespace); |
| 1994 |
} |
| 1995 |
|
| 1996 |
tree |
| 1997 |
resolve (function_resolver &r) const override |
| 1998 |
{ |
| 1999 |
return r.resolve_uniform_opt_n (3); |
| 2000 |
} |
| 2001 |
}; |
| 2002 |
SHAPE (ternary_opt_n) |
| 2003 |
|
| 2004 |
/* <T0>_t vfoo[_t0](<T0>_t, <T0>_t, const int) |
| 2005 |
|
| 2006 |
i.e. ternary operations that operate on a pair of vectors of the |
| 2007 |
same type as the destination, and take a third integer argument. |
| 2008 |
|
| 2009 |
Check that 'imm' is in the [1..#bits] range. |
| 2010 |
|
| 2011 |
Example: vsriq. |
| 2012 |
int8x16_t [__arm_]vsriq[_n_s8](int8x16_t a, int8x16_t b, const int imm) |
| 2013 |
int8x16_t [__arm_]vsriq_m[_n_s8](int8x16_t a, int8x16_t b, const int imm, mve_pred16_t p) */ |
| 2014 |
struct ternary_rshift_def : public overloaded_base<0> |
| 2015 |
{ |
| 2016 |
void |
| 2017 |
build (function_builder &b, const function_group_info &group, |
| 2018 |
bool preserve_user_namespace) const override |
| 2019 |
{ |
| 2020 |
b.add_overloaded_functions (group, MODE_n, preserve_user_namespace); |
| 2021 |
build_all (b, "v0,v0,v0,su64", group, MODE_n, preserve_user_namespace); |
| 2022 |
} |
| 2023 |
|
| 2024 |
tree |
| 2025 |
resolve (function_resolver &r) const override |
| 2026 |
{ |
| 2027 |
return r.resolve_uniform (2, 1); |
| 2028 |
} |
| 2029 |
|
| 2030 |
bool |
| 2031 |
check (function_checker &c) const override |
| 2032 |
{ |
| 2033 |
if (c.mode_suffix_id != MODE_n) |
| 2034 |
return true; |
| 2035 |
|
| 2036 |
unsigned int bits = c.type_suffix (0).element_bits; |
| 2037 |
return c.require_immediate_range (2, 1, bits); |
| 2038 |
} |
| 2039 |
}; |
| 2040 |
SHAPE (ternary_rshift) |
| 2041 |
|
| 2042 |
/* <T0>_t vfoo[_t0](<T0>_t) |
| 2043 |
|
| 2044 |
i.e. the standard shape for unary operations that operate on |
| 2045 |
uniform types. |
| 2046 |
|
| 2047 |
Example: vabsq. |
| 2048 |
int8x16_t [__arm_]vabsq[_s8](int8x16_t a) |
| 2049 |
int8x16_t [__arm_]vabsq_m[_s8](int8x16_t inactive, int8x16_t a, mve_pred16_t p) |
| 2050 |
int8x16_t [__arm_]vabsq_x[_s8](int8x16_t a, mve_pred16_t p) */ |
| 2051 |
struct unary_def : public overloaded_base<0> |
| 2052 |
{ |
| 2053 |
void |
| 2054 |
build (function_builder &b, const function_group_info &group, |
| 2055 |
bool preserve_user_namespace) const override |
| 2056 |
{ |
| 2057 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 2058 |
build_all (b, "v0,v0", group, MODE_none, preserve_user_namespace); |
| 2059 |
} |
| 2060 |
|
| 2061 |
tree |
| 2062 |
resolve (function_resolver &r) const override |
| 2063 |
{ |
| 2064 |
return r.resolve_unary (); |
| 2065 |
} |
| 2066 |
}; |
| 2067 |
SHAPE (unary) |
| 2068 |
|
| 2069 |
/* <S0:twice>_t vfoo[_<t0>](<T0>_t) |
| 2070 |
|
| 2071 |
i.e. a version of "unary" in which the source elements are half the |
| 2072 |
size of the destination scalar, but have the same type class. |
| 2073 |
|
| 2074 |
Example: vaddlvq. |
| 2075 |
int64_t [__arm_]vaddlvq[_s32](int32x4_t a) |
| 2076 |
int64_t [__arm_]vaddlvq_p[_s32](int32x4_t a, mve_pred16_t p) */ |
| 2077 |
struct unary_acc_def : public overloaded_base<0> |
| 2078 |
{ |
| 2079 |
void |
| 2080 |
build (function_builder &b, const function_group_info &group, |
| 2081 |
bool preserve_user_namespace) const override |
| 2082 |
{ |
| 2083 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 2084 |
build_all (b, "sw0,v0", group, MODE_none, preserve_user_namespace); |
| 2085 |
} |
| 2086 |
|
| 2087 |
tree |
| 2088 |
resolve (function_resolver &r) const override |
| 2089 |
{ |
| 2090 |
/* FIXME: check that the return value is actually |
| 2091 |
twice as wide as arg 0. */ |
| 2092 |
return r.resolve_unary (); |
| 2093 |
} |
| 2094 |
}; |
| 2095 |
SHAPE (unary_acc) |
| 2096 |
|
| 2097 |
/* <T0>_t foo_t0[_t1](<T1>_t) |
| 2098 |
|
| 2099 |
where the target type <t0> must be specified explicitly but the source |
| 2100 |
type <t1> can be inferred. |
| 2101 |
|
| 2102 |
Example: vreinterpretq. |
| 2103 |
int16x8_t [__arm_]vreinterpretq_s16[_s8](int8x16_t a) |
| 2104 |
int32x4_t [__arm_]vreinterpretq_s32[_s8](int8x16_t a) |
| 2105 |
int8x16_t [__arm_]vreinterpretq_s8[_s16](int16x8_t a) |
| 2106 |
int8x16_t [__arm_]vreinterpretq_s8[_s32](int32x4_t a) */ |
| 2107 |
struct unary_convert_def : public overloaded_base<1> |
| 2108 |
{ |
| 2109 |
void |
| 2110 |
build (function_builder &b, const function_group_info &group, |
| 2111 |
bool preserve_user_namespace) const override |
| 2112 |
{ |
| 2113 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 2114 |
build_all (b, "v0,v1", group, MODE_none, preserve_user_namespace); |
| 2115 |
} |
| 2116 |
|
| 2117 |
tree |
| 2118 |
resolve (function_resolver &r) const override |
| 2119 |
{ |
| 2120 |
return r.resolve_unary (); |
| 2121 |
} |
| 2122 |
}; |
| 2123 |
SHAPE (unary_convert) |
| 2124 |
|
| 2125 |
/* [u]int32_t vfoo[_<t0>](<T0>_t) |
| 2126 |
|
| 2127 |
i.e. a version of "unary" which generates a scalar of type int32_t |
| 2128 |
or uint32_t depending on the signedness of the elements of of input |
| 2129 |
vector. |
| 2130 |
|
| 2131 |
Example: vaddvq |
| 2132 |
int32_t [__arm_]vaddvq[_s16](int16x8_t a) |
| 2133 |
int32_t [__arm_]vaddvq_p[_s16](int16x8_t a, mve_pred16_t p) */ |
| 2134 |
struct unary_int32_def : public overloaded_base<0> |
| 2135 |
{ |
| 2136 |
void |
| 2137 |
build (function_builder &b, const function_group_info &group, |
| 2138 |
bool preserve_user_namespace) const override |
| 2139 |
{ |
| 2140 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 2141 |
build_all (b, "sx32,v0", group, MODE_none, preserve_user_namespace); |
| 2142 |
} |
| 2143 |
|
| 2144 |
tree |
| 2145 |
resolve (function_resolver &r) const override |
| 2146 |
{ |
| 2147 |
return r.resolve_uniform (1); |
| 2148 |
} |
| 2149 |
}; |
| 2150 |
SHAPE (unary_int32) |
| 2151 |
|
| 2152 |
/* [u]int32_t vfoo[_<t0>]([u]int32_t, <T0>_t) |
| 2153 |
|
| 2154 |
i.e. a version of "unary" which accumulates into scalar of type |
| 2155 |
int32_t or uint32_t depending on the signedness of the elements of |
| 2156 |
of input vector. |
| 2157 |
|
| 2158 |
Example: vaddvaq. |
| 2159 |
int32_t [__arm_]vaddvaq[_s16](int32_t a, int16x8_t b) |
| 2160 |
int32_t [__arm_]vaddvaq_p[_s16](int32_t a, int16x8_t b, mve_pred16_t p) */ |
| 2161 |
struct unary_int32_acc_def : public overloaded_base<0> |
| 2162 |
{ |
| 2163 |
void |
| 2164 |
build (function_builder &b, const function_group_info &group, |
| 2165 |
bool preserve_user_namespace) const override |
| 2166 |
{ |
| 2167 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 2168 |
build_all (b, "sx32,sx32,v0", group, MODE_none, preserve_user_namespace); |
| 2169 |
} |
| 2170 |
|
| 2171 |
tree |
| 2172 |
resolve (function_resolver &r) const override |
| 2173 |
{ |
| 2174 |
unsigned int i, nargs; |
| 2175 |
type_suffix_index type; |
| 2176 |
const char *first_type_name; |
| 2177 |
|
| 2178 |
if (!r.check_gp_argument (2, i, nargs) |
| 2179 |
|| (type = r.infer_vector_type (1)) == NUM_TYPE_SUFFIXES) |
| 2180 |
return error_mark_node; |
| 2181 |
|
| 2182 |
first_type_name = (type_suffixes[type].unsigned_p |
| 2183 |
? "uint32_t" |
| 2184 |
: "int32_t"); |
| 2185 |
if (!r.require_scalar_type (0, first_type_name)) |
| 2186 |
return error_mark_node; |
| 2187 |
|
| 2188 |
return r.resolve_to (r.mode_suffix_id, type); |
| 2189 |
} |
| 2190 |
}; |
| 2191 |
SHAPE (unary_int32_acc) |
| 2192 |
|
| 2193 |
/* <T0>_t vfoo[_n]_t0(<S0>_t) |
| 2194 |
|
| 2195 |
Example: vdupq. |
| 2196 |
int16x8_t [__arm_]vdupq_n_s16(int16_t a) |
| 2197 |
int16x8_t [__arm_]vdupq_m[_n_s16](int16x8_t inactive, int16_t a, mve_pred16_t p) |
| 2198 |
int16x8_t [__arm_]vdupq_x_n_s16(int16_t a, mve_pred16_t p) */ |
| 2199 |
struct unary_n_def : public overloaded_base<0> |
| 2200 |
{ |
| 2201 |
bool |
| 2202 |
explicit_type_suffix_p (unsigned int, enum predication_index pred, |
| 2203 |
enum mode_suffix_index, type_suffix_info) const override |
| 2204 |
{ |
| 2205 |
return pred != PRED_m; |
| 2206 |
} |
| 2207 |
|
| 2208 |
bool |
| 2209 |
explicit_mode_suffix_p (enum predication_index pred, |
| 2210 |
enum mode_suffix_index mode) const override |
| 2211 |
{ |
| 2212 |
return ((mode == MODE_n) |
| 2213 |
&& (pred != PRED_m)); |
| 2214 |
} |
| 2215 |
|
| 2216 |
bool |
| 2217 |
skip_overload_p (enum predication_index pred, enum mode_suffix_index mode) |
| 2218 |
const override |
| 2219 |
{ |
| 2220 |
switch (mode) |
| 2221 |
{ |
| 2222 |
case MODE_n: |
| 2223 |
return pred != PRED_m; |
| 2224 |
|
| 2225 |
default: |
| 2226 |
gcc_unreachable (); |
| 2227 |
} |
| 2228 |
} |
| 2229 |
|
| 2230 |
void |
| 2231 |
build (function_builder &b, const function_group_info &group, |
| 2232 |
bool preserve_user_namespace) const override |
| 2233 |
{ |
| 2234 |
b.add_overloaded_functions (group, MODE_n, preserve_user_namespace); |
| 2235 |
build_all (b, "v0,s0", group, MODE_n, preserve_user_namespace); |
| 2236 |
} |
| 2237 |
|
| 2238 |
tree |
| 2239 |
resolve (function_resolver &r) const override |
| 2240 |
{ |
| 2241 |
return r.resolve_unary_n (); |
| 2242 |
} |
| 2243 |
}; |
| 2244 |
SHAPE (unary_n) |
| 2245 |
|
| 2246 |
/* <T0:twice>_t vfoo[_t0](<T0>_t) |
| 2247 |
|
| 2248 |
i.e. a version of "unary" in which the source elements are half the |
| 2249 |
size of the destination, but have the same type class. |
| 2250 |
|
| 2251 |
Example: vmovlbq. |
| 2252 |
int32x4_t [__arm_]vmovlbq[_s16](int16x8_t a) |
| 2253 |
int32x4_t [__arm_]vmovlbq_m[_s16](int32x4_t inactive, int16x8_t a, mve_pred16_t p) |
| 2254 |
int32x4_t [__arm_]vmovlbq_x[_s16](int16x8_t a, mve_pred16_t p) */ |
| 2255 |
struct unary_widen_def : public overloaded_base<0> |
| 2256 |
{ |
| 2257 |
void |
| 2258 |
build (function_builder &b, const function_group_info &group, |
| 2259 |
bool preserve_user_namespace) const override |
| 2260 |
{ |
| 2261 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 2262 |
build_all (b, "vw0,v0", group, MODE_none, preserve_user_namespace); |
| 2263 |
} |
| 2264 |
|
| 2265 |
tree |
| 2266 |
resolve (function_resolver &r) const override |
| 2267 |
{ |
| 2268 |
unsigned int i, nargs; |
| 2269 |
type_suffix_index type, wide_suffix; |
| 2270 |
tree res; |
| 2271 |
if (!r.check_gp_argument (1, i, nargs) |
| 2272 |
|| (type = r.infer_vector_type (i)) == NUM_TYPE_SUFFIXES |
| 2273 |
|| ((wide_suffix = long_type_suffix (r, type, r.SAME_TYPE_CLASS)) |
| 2274 |
== NUM_TYPE_SUFFIXES)) |
| 2275 |
return error_mark_node; |
| 2276 |
|
| 2277 |
/* Check the inactive argument has the wide type. */ |
| 2278 |
if ((r.pred == PRED_m) |
| 2279 |
&& (r.infer_vector_type (0) != wide_suffix)) |
| 2280 |
return r.report_no_such_form (type); |
| 2281 |
|
| 2282 |
if ((res = r.lookup_form (r.mode_suffix_id, type))) |
| 2283 |
return res; |
| 2284 |
|
| 2285 |
return r.report_no_such_form (type); |
| 2286 |
} |
| 2287 |
}; |
| 2288 |
SHAPE (unary_widen) |
| 2289 |
|
| 2290 |
/* <S0:twice>_t vfoo[_<t0>](<S0:twice>_t, <T0>_t) |
| 2291 |
|
| 2292 |
i.e. a version of "unary" in which the source elements are half the |
| 2293 |
size of the destination scalar and accumulator, but have the same |
| 2294 |
type class. |
| 2295 |
|
| 2296 |
Example: vaddlvaq. |
| 2297 |
int64_t [__arm_]vaddlvaq[_s32](int64_t a, int32x4_t b) |
| 2298 |
int64_t [__arm_]vaddlvaq_p[_s32](int64_t a, int32x4_t b, mve_pred16_t p) */ |
| 2299 |
struct unary_widen_acc_def : public overloaded_base<0> |
| 2300 |
{ |
| 2301 |
void |
| 2302 |
build (function_builder &b, const function_group_info &group, |
| 2303 |
bool preserve_user_namespace) const override |
| 2304 |
{ |
| 2305 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 2306 |
build_all (b, "sw0,sw0,v0", group, MODE_none, preserve_user_namespace); |
| 2307 |
} |
| 2308 |
|
| 2309 |
tree |
| 2310 |
resolve (function_resolver &r) const override |
| 2311 |
{ |
| 2312 |
unsigned int i, nargs; |
| 2313 |
type_suffix_index type; |
| 2314 |
if (!r.check_gp_argument (2, i, nargs) |
| 2315 |
|| !r.require_derived_scalar_type (0, r.SAME_TYPE_CLASS) |
| 2316 |
|| (type = r.infer_vector_type (i)) == NUM_TYPE_SUFFIXES) |
| 2317 |
return error_mark_node; |
| 2318 |
|
| 2319 |
return r.resolve_to (r.mode_suffix_id, type); |
| 2320 |
} |
| 2321 |
}; |
| 2322 |
SHAPE (unary_widen_acc) |
| 2323 |
|
| 2324 |
/* <T0>_t vfoo[_t0](T0, T0, uint32_t*) |
| 2325 |
|
| 2326 |
Example: vadcq. |
| 2327 |
int32x4_t [__arm_]vadcq[_s32](int32x4_t a, int32x4_t b, unsigned *carry) |
| 2328 |
int32x4_t [__arm_]vadcq_m[_s32](int32x4_t inactive, int32x4_t a, int32x4_t b, unsigned *carry, mve_pred16_t p) */ |
| 2329 |
struct vadc_vsbc_def : public overloaded_base<0> |
| 2330 |
{ |
| 2331 |
void |
| 2332 |
build (function_builder &b, const function_group_info &group, |
| 2333 |
bool preserve_user_namespace) const override |
| 2334 |
{ |
| 2335 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 2336 |
build_all (b, "v0,v0,v0,as", group, MODE_none, preserve_user_namespace); |
| 2337 |
} |
| 2338 |
|
| 2339 |
tree |
| 2340 |
resolve (function_resolver &r) const override |
| 2341 |
{ |
| 2342 |
unsigned int i, nargs; |
| 2343 |
type_suffix_index type; |
| 2344 |
if (!r.check_gp_argument (3, i, nargs) |
| 2345 |
|| (type = r.infer_vector_type (0)) == NUM_TYPE_SUFFIXES) |
| 2346 |
return error_mark_node; |
| 2347 |
|
| 2348 |
if (!r.require_matching_vector_type (1, type)) |
| 2349 |
return error_mark_node; |
| 2350 |
|
| 2351 |
/* Check that last arg is a pointer. */ |
| 2352 |
if (!POINTER_TYPE_P (r.get_argument_type (i))) |
| 2353 |
return error_mark_node; |
| 2354 |
|
| 2355 |
return r.resolve_to (r.mode_suffix_id, type); |
| 2356 |
} |
| 2357 |
}; |
| 2358 |
SHAPE (vadc_vsbc) |
| 2359 |
|
| 2360 |
/* mve_pred16_t foo_t0(uint32_t) |
| 2361 |
|
| 2362 |
Example: vctp16q. |
| 2363 |
mve_pred16_t [__arm_]vctp16q(uint32_t a) |
| 2364 |
mve_pred16_t [__arm_]vctp16q_m(uint32_t a, mve_pred16_t p) */ |
| 2365 |
struct vctp_def : public nonoverloaded_base |
| 2366 |
{ |
| 2367 |
void |
| 2368 |
build (function_builder &b, const function_group_info &group, |
| 2369 |
bool preserve_user_namespace) const override |
| 2370 |
{ |
| 2371 |
build_all (b, "p,su32", group, MODE_none, preserve_user_namespace); |
| 2372 |
} |
| 2373 |
}; |
| 2374 |
SHAPE (vctp) |
| 2375 |
|
| 2376 |
/* <T0>_t foo_t0[_t1](<T1>_t) |
| 2377 |
<T0>_t foo_t0_n[_t1](<T1>_t, const int) |
| 2378 |
|
| 2379 |
Example: vcvtq. |
| 2380 |
float32x4_t [__arm_]vcvtq[_f32_s32](int32x4_t a) |
| 2381 |
float32x4_t [__arm_]vcvtq_m[_f32_s32](float32x4_t inactive, int32x4_t a, mve_pred16_t p) |
| 2382 |
float32x4_t [__arm_]vcvtq_x[_f32_s32](int32x4_t a, mve_pred16_t p) |
| 2383 |
float32x4_t [__arm_]vcvtq_n[_f32_s32](int32x4_t a, const int imm6) |
| 2384 |
float32x4_t [__arm_]vcvtq_m_n[_f32_s32](float32x4_t inactive, int32x4_t a, const int imm6, mve_pred16_t p) |
| 2385 |
float32x4_t [__arm_]vcvtq_x_n[_f32_s32](int32x4_t a, const int imm6, mve_pred16_t p) |
| 2386 |
int32x4_t [__arm_]vcvtq_s32_f32(float32x4_t a) |
| 2387 |
int32x4_t [__arm_]vcvtq_m[_s32_f32](int32x4_t inactive, float32x4_t a, mve_pred16_t p) |
| 2388 |
int32x4_t [__arm_]vcvtq_x_s32_f32(float32x4_t a, mve_pred16_t p) |
| 2389 |
int32x4_t [__arm_]vcvtq_n_s32_f32(float32x4_t a, const int imm6) |
| 2390 |
int32x4_t [__arm_]vcvtq_m_n[_s32_f32](int32x4_t inactive, float32x4_t a, const int imm6, mve_pred16_t p) |
| 2391 |
int32x4_t [__arm_]vcvtq_x_n_s32_f32(float32x4_t a, const int imm6, mve_pred16_t p) */ |
| 2392 |
struct vcvt_def : public overloaded_base<0> |
| 2393 |
{ |
| 2394 |
bool |
| 2395 |
explicit_type_suffix_p (unsigned int i, enum predication_index pred, |
| 2396 |
enum mode_suffix_index, |
| 2397 |
type_suffix_info type_info) const override |
| 2398 |
{ |
| 2399 |
if (pred != PRED_m |
| 2400 |
&& ((i == 0 && type_info.integer_p) |
| 2401 |
|| (i == 1 && type_info.float_p))) |
| 2402 |
return true; |
| 2403 |
return false; |
| 2404 |
} |
| 2405 |
|
| 2406 |
bool |
| 2407 |
explicit_mode_suffix_p (enum predication_index, |
| 2408 |
enum mode_suffix_index) const override |
| 2409 |
{ |
| 2410 |
return true; |
| 2411 |
} |
| 2412 |
|
| 2413 |
void |
| 2414 |
build (function_builder &b, const function_group_info &group, |
| 2415 |
bool preserve_user_namespace) const override |
| 2416 |
{ |
| 2417 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 2418 |
b.add_overloaded_functions (group, MODE_n, preserve_user_namespace); |
| 2419 |
build_all (b, "v0,v1", group, MODE_none, preserve_user_namespace); |
| 2420 |
build_all (b, "v0,v1,su64", group, MODE_n, preserve_user_namespace); |
| 2421 |
} |
| 2422 |
|
| 2423 |
tree |
| 2424 |
resolve (function_resolver &r) const override |
| 2425 |
{ |
| 2426 |
unsigned int i, nargs; |
| 2427 |
type_suffix_index from_type; |
| 2428 |
tree res; |
| 2429 |
unsigned int nimm = (r.mode_suffix_id == MODE_none) ? 0 : 1; |
| 2430 |
|
| 2431 |
if (!r.check_gp_argument (1 + nimm, i, nargs) |
| 2432 |
|| (from_type |
| 2433 |
= r.infer_vector_type (i - nimm)) == NUM_TYPE_SUFFIXES) |
| 2434 |
return error_mark_node; |
| 2435 |
|
| 2436 |
if (nimm > 0 |
| 2437 |
&& !r.require_integer_immediate (i)) |
| 2438 |
return error_mark_node; |
| 2439 |
|
| 2440 |
type_suffix_index to_type; |
| 2441 |
|
| 2442 |
if (type_suffixes[from_type].integer_p) |
| 2443 |
{ |
| 2444 |
to_type = find_type_suffix (TYPE_float, |
| 2445 |
type_suffixes[from_type].element_bits); |
| 2446 |
} |
| 2447 |
else |
| 2448 |
{ |
| 2449 |
/* This should not happen: when 'from_type' is float, the type |
| 2450 |
suffixes are not overloaded (except for "m" predication, |
| 2451 |
handled above). */ |
| 2452 |
gcc_assert (r.pred == PRED_m); |
| 2453 |
|
| 2454 |
/* Get the return type from the 'inactive' argument. */ |
| 2455 |
to_type = r.infer_vector_type (0); |
| 2456 |
} |
| 2457 |
|
| 2458 |
if ((res = r.lookup_form (r.mode_suffix_id, to_type, from_type))) |
| 2459 |
return res; |
| 2460 |
|
| 2461 |
return r.report_no_such_form (from_type); |
| 2462 |
} |
| 2463 |
|
| 2464 |
bool |
| 2465 |
check (function_checker &c) const override |
| 2466 |
{ |
| 2467 |
if (c.mode_suffix_id == MODE_none) |
| 2468 |
return true; |
| 2469 |
|
| 2470 |
unsigned int bits = c.type_suffix (0).element_bits; |
| 2471 |
return c.require_immediate_range (1, 1, bits); |
| 2472 |
} |
| 2473 |
}; |
| 2474 |
SHAPE (vcvt) |
| 2475 |
|
| 2476 |
/* float16x8_t foo_f16_f32(float16x8_t, float32x4_t) |
| 2477 |
|
| 2478 |
Example: vcvttq_f16_f32. |
| 2479 |
float16x8_t [__arm_]vcvttq_f16_f32(float16x8_t a, float32x4_t b) |
| 2480 |
float16x8_t [__arm_]vcvttq_m_f16_f32(float16x8_t a, float32x4_t b, mve_pred16_t p) |
| 2481 |
*/ |
| 2482 |
struct vcvt_f16_f32_def : public nonoverloaded_base |
| 2483 |
{ |
| 2484 |
void |
| 2485 |
build (function_builder &b, const function_group_info &group, |
| 2486 |
bool preserve_user_namespace) const override |
| 2487 |
{ |
| 2488 |
build_all (b, "v0,v0,v1", group, MODE_none, preserve_user_namespace); |
| 2489 |
} |
| 2490 |
}; |
| 2491 |
SHAPE (vcvt_f16_f32) |
| 2492 |
|
| 2493 |
/* float32x4_t foo_f32_f16(float16x8_t) |
| 2494 |
|
| 2495 |
Example: vcvttq_f32_f16. |
| 2496 |
float32x4_t [__arm_]vcvttq_f32_f16(float16x8_t a) |
| 2497 |
float32x4_t [__arm_]vcvttq_m_f32_f16(float32x4_t inactive, float16x8_t a, mve_pred16_t p) |
| 2498 |
float32x4_t [__arm_]vcvttq_x_f32_f16(float16x8_t a, mve_pred16_t p) |
| 2499 |
*/ |
| 2500 |
struct vcvt_f32_f16_def : public nonoverloaded_base |
| 2501 |
{ |
| 2502 |
void |
| 2503 |
build (function_builder &b, const function_group_info &group, |
| 2504 |
bool preserve_user_namespace) const override |
| 2505 |
{ |
| 2506 |
build_all (b, "v0,v1", group, MODE_none, preserve_user_namespace); |
| 2507 |
} |
| 2508 |
}; |
| 2509 |
SHAPE (vcvt_f32_f16) |
| 2510 |
|
| 2511 |
/* <T0>_t foo_t0[_t1](<T1>_t) |
| 2512 |
|
| 2513 |
Example: vcvtaq. |
| 2514 |
int16x8_t [__arm_]vcvtaq_s16_f16(float16x8_t a) |
| 2515 |
int16x8_t [__arm_]vcvtaq_m[_s16_f16](int16x8_t inactive, float16x8_t a, mve_pred16_t p) |
| 2516 |
int16x8_t [__arm_]vcvtaq_x_s16_f16(float16x8_t a, mve_pred16_t p) |
| 2517 |
*/ |
| 2518 |
struct vcvtx_def : public overloaded_base<0> |
| 2519 |
{ |
| 2520 |
bool |
| 2521 |
explicit_type_suffix_p (unsigned int, enum predication_index pred, |
| 2522 |
enum mode_suffix_index, |
| 2523 |
type_suffix_info) const override |
| 2524 |
{ |
| 2525 |
return pred != PRED_m; |
| 2526 |
} |
| 2527 |
|
| 2528 |
bool |
| 2529 |
skip_overload_p (enum predication_index pred, enum mode_suffix_index) |
| 2530 |
const override |
| 2531 |
{ |
| 2532 |
return pred != PRED_m; |
| 2533 |
} |
| 2534 |
|
| 2535 |
void |
| 2536 |
build (function_builder &b, const function_group_info &group, |
| 2537 |
bool preserve_user_namespace) const override |
| 2538 |
{ |
| 2539 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 2540 |
build_all (b, "v0,v1", group, MODE_none, preserve_user_namespace); |
| 2541 |
} |
| 2542 |
|
| 2543 |
tree |
| 2544 |
resolve (function_resolver &r) const override |
| 2545 |
{ |
| 2546 |
unsigned int i, nargs; |
| 2547 |
type_suffix_index from_type; |
| 2548 |
tree res; |
| 2549 |
|
| 2550 |
if (!r.check_gp_argument (1, i, nargs) |
| 2551 |
|| (from_type |
| 2552 |
= r.infer_vector_type (i)) == NUM_TYPE_SUFFIXES) |
| 2553 |
return error_mark_node; |
| 2554 |
|
| 2555 |
type_suffix_index to_type; |
| 2556 |
|
| 2557 |
gcc_assert (r.pred == PRED_m); |
| 2558 |
|
| 2559 |
/* Get the return type from the 'inactive' argument. */ |
| 2560 |
to_type = r.infer_vector_type (0); |
| 2561 |
|
| 2562 |
if ((res = r.lookup_form (r.mode_suffix_id, to_type, from_type))) |
| 2563 |
return res; |
| 2564 |
|
| 2565 |
return r.report_no_such_form (from_type); |
| 2566 |
} |
| 2567 |
}; |
| 2568 |
SHAPE (vcvtx) |
| 2569 |
|
| 2570 |
/* <T0>_t vfoo[_n]_t0(uint32_t, const int) |
| 2571 |
<T0>_t vfoo[_wb]_t0(uint32_t *, const int) |
| 2572 |
|
| 2573 |
Shape for vector increment or decrement and duplicate operations that take |
| 2574 |
an integer or pointer to integer first argument and an immediate, and |
| 2575 |
produce a vector. |
| 2576 |
|
| 2577 |
Check that 'imm' is one of 1, 2, 4 or 8. |
| 2578 |
|
| 2579 |
Example: vddupq. |
| 2580 |
uint8x16_t [__arm_]vddupq[_n]_u8(uint32_t a, const int imm) |
| 2581 |
uint8x16_t [__arm_]vddupq[_wb]_u8(uint32_t *a, const int imm) |
| 2582 |
uint8x16_t [__arm_]vddupq_m[_n_u8](uint8x16_t inactive, uint32_t a, const int imm, mve_pred16_t p) |
| 2583 |
uint8x16_t [__arm_]vddupq_m[_wb_u8](uint8x16_t inactive, uint32_t *a, const int imm, mve_pred16_t p) |
| 2584 |
uint8x16_t [__arm_]vddupq_x[_n]_u8(uint32_t a, const int imm, mve_pred16_t p) |
| 2585 |
uint8x16_t [__arm_]vddupq_x[_wb]_u8(uint32_t *a, const int imm, mve_pred16_t p) */ |
| 2586 |
struct viddup_def : public overloaded_base<0> |
| 2587 |
{ |
| 2588 |
bool |
| 2589 |
explicit_type_suffix_p (unsigned int i, enum predication_index pred, |
| 2590 |
enum mode_suffix_index, |
| 2591 |
type_suffix_info) const override |
| 2592 |
{ |
| 2593 |
return ((i == 0) && (pred != PRED_m)); |
| 2594 |
} |
| 2595 |
|
| 2596 |
bool |
| 2597 |
skip_overload_p (enum predication_index, enum mode_suffix_index mode) const override |
| 2598 |
{ |
| 2599 |
/* For MODE_wb, share the overloaded instance with MODE_n. */ |
| 2600 |
if (mode == MODE_wb) |
| 2601 |
return true; |
| 2602 |
|
| 2603 |
return false; |
| 2604 |
} |
| 2605 |
|
| 2606 |
void |
| 2607 |
build (function_builder &b, const function_group_info &group, |
| 2608 |
bool preserve_user_namespace) const override |
| 2609 |
{ |
| 2610 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 2611 |
build_all (b, "v0,su32,su64", group, MODE_n, preserve_user_namespace); |
| 2612 |
build_all (b, "v0,as,su64", group, MODE_wb, preserve_user_namespace); |
| 2613 |
} |
| 2614 |
|
| 2615 |
tree |
| 2616 |
resolve (function_resolver &r) const override |
| 2617 |
{ |
| 2618 |
unsigned int i, nargs; |
| 2619 |
type_suffix_index type_suffix = NUM_TYPE_SUFFIXES; |
| 2620 |
if (!r.check_gp_argument (2, i, nargs)) |
| 2621 |
return error_mark_node; |
| 2622 |
|
| 2623 |
type_suffix = r.type_suffix_ids[0]; |
| 2624 |
/* With PRED_m, ther is no type suffix, so infer it from the first (inactive) |
| 2625 |
argument. */ |
| 2626 |
if (type_suffix == NUM_TYPE_SUFFIXES) |
| 2627 |
type_suffix = r.infer_vector_type (0); |
| 2628 |
|
| 2629 |
unsigned int last_arg = i - 1; |
| 2630 |
/* Check that last_arg is either scalar or pointer. */ |
| 2631 |
if (!r.scalar_argument_p (last_arg)) |
| 2632 |
return error_mark_node; |
| 2633 |
|
| 2634 |
if (!r.require_integer_immediate (last_arg + 1)) |
| 2635 |
return error_mark_node; |
| 2636 |
|
| 2637 |
/* With MODE_n we expect a scalar, with MODE_wb we expect a pointer. */ |
| 2638 |
mode_suffix_index mode_suffix; |
| 2639 |
if (POINTER_TYPE_P (r.get_argument_type (last_arg))) |
| 2640 |
mode_suffix = MODE_wb; |
| 2641 |
else |
| 2642 |
mode_suffix = MODE_n; |
| 2643 |
|
| 2644 |
return r.resolve_to (mode_suffix, type_suffix); |
| 2645 |
} |
| 2646 |
|
| 2647 |
bool |
| 2648 |
check (function_checker &c) const override |
| 2649 |
{ |
| 2650 |
return c.require_immediate_one_of (1, 1, 2, 4, 8); |
| 2651 |
} |
| 2652 |
}; |
| 2653 |
SHAPE (viddup) |
| 2654 |
|
| 2655 |
/* <T0>_t vfoo[_n]_t0(uint32_t, uint32_t, const int) |
| 2656 |
<T0>_t vfoo[_wb]_t0(uint32_t *, uint32_t, const int) |
| 2657 |
|
| 2658 |
Shape for vector increment or decrement with wrap and duplicate operations |
| 2659 |
that take an integer or pointer to integer first argument, an integer second |
| 2660 |
argument and an immediate, and produce a vector. |
| 2661 |
|
| 2662 |
Check that 'imm' is one of 1, 2, 4 or 8. |
| 2663 |
|
| 2664 |
Example: vdwdupq. |
| 2665 |
uint8x16_t [__arm_]vdwdupq[_n]_u8(uint32_t a, uint32_t b, const int imm) |
| 2666 |
uint8x16_t [__arm_]vdwdupq[_wb]_u8(uint32_t *a, uint32_t b, const int imm) |
| 2667 |
uint8x16_t [__arm_]vdwdupq_m[_n_u8](uint8x16_t inactive, uint32_t a, uint32_t b, const int imm, mve_pred16_t p) |
| 2668 |
uint8x16_t [__arm_]vdwdupq_m[_wb_u8](uint8x16_t inactive, uint32_t *a, uint32_t b, const int imm, mve_pred16_t p) |
| 2669 |
uint8x16_t [__arm_]vdwdupq_x[_n]_u8(uint32_t a, uint32_t b, const int imm, mve_pred16_t p) |
| 2670 |
uint8x16_t [__arm_]vdwdupq_x[_wb]_u8(uint32_t *a, uint32_t b, const int imm, mve_pred16_t p) */ |
| 2671 |
struct vidwdup_def : public overloaded_base<0> |
| 2672 |
{ |
| 2673 |
bool |
| 2674 |
explicit_type_suffix_p (unsigned int i, enum predication_index pred, |
| 2675 |
enum mode_suffix_index, |
| 2676 |
type_suffix_info) const override |
| 2677 |
{ |
| 2678 |
return ((i == 0) && (pred != PRED_m)); |
| 2679 |
} |
| 2680 |
|
| 2681 |
bool |
| 2682 |
skip_overload_p (enum predication_index, enum mode_suffix_index mode) const override |
| 2683 |
{ |
| 2684 |
/* For MODE_wb, share the overloaded instance with MODE_n. */ |
| 2685 |
if (mode == MODE_wb) |
| 2686 |
return true; |
| 2687 |
|
| 2688 |
return false; |
| 2689 |
} |
| 2690 |
|
| 2691 |
void |
| 2692 |
build (function_builder &b, const function_group_info &group, |
| 2693 |
bool preserve_user_namespace) const override |
| 2694 |
{ |
| 2695 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 2696 |
build_all (b, "v0,su32,su32,su64", group, MODE_n, preserve_user_namespace); |
| 2697 |
build_all (b, "v0,as,su32,su64", group, MODE_wb, preserve_user_namespace); |
| 2698 |
} |
| 2699 |
|
| 2700 |
tree |
| 2701 |
resolve (function_resolver &r) const override |
| 2702 |
{ |
| 2703 |
unsigned int i, nargs; |
| 2704 |
type_suffix_index type_suffix = NUM_TYPE_SUFFIXES; |
| 2705 |
if (!r.check_gp_argument (3, i, nargs)) |
| 2706 |
return error_mark_node; |
| 2707 |
|
| 2708 |
type_suffix = r.type_suffix_ids[0]; |
| 2709 |
/* With PRED_m, ther is no type suffix, so infer it from the first (inactive) |
| 2710 |
argument. */ |
| 2711 |
if (type_suffix == NUM_TYPE_SUFFIXES) |
| 2712 |
type_suffix = r.infer_vector_type (0); |
| 2713 |
|
| 2714 |
unsigned int last_arg = i - 2; |
| 2715 |
/* Check that last_arg is either scalar or pointer. */ |
| 2716 |
if (!r.scalar_argument_p (last_arg)) |
| 2717 |
return error_mark_node; |
| 2718 |
|
| 2719 |
if (!r.scalar_argument_p (last_arg + 1)) |
| 2720 |
return error_mark_node; |
| 2721 |
|
| 2722 |
if (!r.require_integer_immediate (last_arg + 2)) |
| 2723 |
return error_mark_node; |
| 2724 |
|
| 2725 |
/* With MODE_n we expect a scalar, with MODE_wb we expect a pointer. */ |
| 2726 |
mode_suffix_index mode_suffix; |
| 2727 |
if (POINTER_TYPE_P (r.get_argument_type (last_arg))) |
| 2728 |
mode_suffix = MODE_wb; |
| 2729 |
else |
| 2730 |
mode_suffix = MODE_n; |
| 2731 |
|
| 2732 |
return r.resolve_to (mode_suffix, type_suffix); |
| 2733 |
} |
| 2734 |
|
| 2735 |
bool |
| 2736 |
check (function_checker &c) const override |
| 2737 |
{ |
| 2738 |
return c.require_immediate_one_of (2, 1, 2, 4, 8); |
| 2739 |
} |
| 2740 |
}; |
| 2741 |
SHAPE (vidwdup) |
| 2742 |
|
| 2743 |
/* <T0>_t vfoo[_t0](<T0>_t, <T0>_t, mve_pred16_t) |
| 2744 |
|
| 2745 |
i.e. a version of the standard ternary shape in which |
| 2746 |
the final argument is always a set of predicates. |
| 2747 |
|
| 2748 |
Example: vpselq. |
| 2749 |
int16x8_t [__arm_]vpselq[_s16](int16x8_t a, int16x8_t b, mve_pred16_t p) */ |
| 2750 |
struct vpsel_def : public overloaded_base<0> |
| 2751 |
{ |
| 2752 |
void |
| 2753 |
build (function_builder &b, const function_group_info &group, |
| 2754 |
bool preserve_user_namespace) const override |
| 2755 |
{ |
| 2756 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 2757 |
build_all (b, "v0,v0,v0,p", group, MODE_none, preserve_user_namespace); |
| 2758 |
} |
| 2759 |
|
| 2760 |
tree |
| 2761 |
resolve (function_resolver &r) const override |
| 2762 |
{ |
| 2763 |
unsigned int i, nargs; |
| 2764 |
type_suffix_index type; |
| 2765 |
if (!r.check_gp_argument (3, i, nargs) |
| 2766 |
|| (type = r.infer_vector_type (0)) == NUM_TYPE_SUFFIXES) |
| 2767 |
return error_mark_node; |
| 2768 |
|
| 2769 |
unsigned int last_arg = i; |
| 2770 |
for (i = 0; i < last_arg; i++) |
| 2771 |
if (!r.require_matching_vector_type (i, type)) |
| 2772 |
return error_mark_node; |
| 2773 |
|
| 2774 |
if (!r.require_vector_type (2 , VECTOR_TYPE_mve_pred16_t)) |
| 2775 |
return error_mark_node; |
| 2776 |
|
| 2777 |
return r.resolve_to (r.mode_suffix_id, type); |
| 2778 |
} |
| 2779 |
}; |
| 2780 |
SHAPE (vpsel) |
| 2781 |
|
| 2782 |
/* <T0>_t vfoo[_t0](T0, uint32_t* , const int) |
| 2783 |
|
| 2784 |
Check that 'imm' is in [1..32]. |
| 2785 |
|
| 2786 |
Example: vshlcq. |
| 2787 |
uint8x16_t [__arm_]vshlcq[_u8](uint8x16_t a, uint32_t *b, const int imm) |
| 2788 |
uint8x16_t [__arm_]vshlcq_m[_u8](uint8x16_t a, uint32_t *b, const int imm, mve_pred16_t p) */ |
| 2789 |
struct vshlc_def : public overloaded_base<0> |
| 2790 |
{ |
| 2791 |
void |
| 2792 |
build (function_builder &b, const function_group_info &group, |
| 2793 |
bool preserve_user_namespace) const override |
| 2794 |
{ |
| 2795 |
b.add_overloaded_functions (group, MODE_none, preserve_user_namespace); |
| 2796 |
build_all (b, "v0,v0,as,su64", group, MODE_none, preserve_user_namespace); |
| 2797 |
} |
| 2798 |
|
| 2799 |
tree |
| 2800 |
resolve (function_resolver &r) const override |
| 2801 |
{ |
| 2802 |
unsigned int i, nargs; |
| 2803 |
type_suffix_index type; |
| 2804 |
if (!r.check_gp_argument (3, i, nargs) |
| 2805 |
|| (type = r.infer_vector_type (0)) == NUM_TYPE_SUFFIXES) |
| 2806 |
return error_mark_node; |
| 2807 |
|
| 2808 |
/* Check that arg #2 is a pointer. */ |
| 2809 |
if (!POINTER_TYPE_P (r.get_argument_type (i - 1))) |
| 2810 |
return error_mark_node; |
| 2811 |
|
| 2812 |
if (!r.require_integer_immediate (i)) |
| 2813 |
return error_mark_node; |
| 2814 |
|
| 2815 |
return r.resolve_to (r.mode_suffix_id, type); |
| 2816 |
} |
| 2817 |
|
| 2818 |
bool |
| 2819 |
check (function_checker &c) const override |
| 2820 |
{ |
| 2821 |
return c.require_immediate_range (2, 1, 32); |
| 2822 |
} |
| 2823 |
}; |
| 2824 |
SHAPE (vshlc) |
| 2825 |
|
| 2826 |
} /* end namespace arm_mve */ |
| 2827 |
|
| 2828 |
#undef SHAPE |