diff options
author | Richard Biener <rguenther@suse.de> | 2021-05-21 11:33:30 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2021-05-31 08:46:04 +0200 |
commit | ef8176e0fac935c095cc39f4ecdfd43cdb8cb3f3 (patch) | |
tree | 89fad1f0a7e3560dc2a1682f62cd2beffe3b9e5d /gcc/internal-fn.h | |
parent | df4e0359dad239854af0ea9eacb8e7e3719557d0 (diff) | |
download | gcc-ef8176e0fac935c095cc39f4ecdfd43cdb8cb3f3.zip gcc-ef8176e0fac935c095cc39f4ecdfd43cdb8cb3f3.tar.gz gcc-ef8176e0fac935c095cc39f4ecdfd43cdb8cb3f3.tar.bz2 |
c++/88601 - [C/C++] __builtin_shufflevector support
This adds support for the clang __builtin_shufflevector extension to
the C and C++ frontends. The builtin is lowered to VEC_PERM_EXPR.
Because VEC_PERM_EXPR does not support different sized vector inputs
or result or the special permute index of -1 (don't-care)
c_build_shufflevector applies lowering by widening inputs and output
to the widest vector, replacing -1 by a defined index and
subsetting the final vector if we produced a wider result than
desired.
Code generation thus can be sub-optimal, followup patches will
aim to fix that by recovering from part of the missing features
during RTL expansion and by relaxing the constraints of the GIMPLE
IL with regard to VEC_PERM_EXPR.
2021-05-21 Richard Biener <rguenther@suse.de>
PR c++/88601
gcc/c-family/
* c-common.c: Include tree-vector-builder.h and
vec-perm-indices.h.
(c_common_reswords): Add __builtin_shufflevector.
(c_build_shufflevector): New funtion.
* c-common.h (enum rid): Add RID_BUILTIN_SHUFFLEVECTOR.
(c_build_shufflevector): Declare.
gcc/c/
* c-decl.c (names_builtin_p): Handle RID_BUILTIN_SHUFFLEVECTOR.
* c-parser.c (c_parser_postfix_expression): Likewise.
gcc/cp/
* cp-objcp-common.c (names_builtin_p): Handle
RID_BUILTIN_SHUFFLEVECTOR.
* cp-tree.h (build_x_shufflevector): Declare.
* parser.c (cp_parser_postfix_expression): Handle
RID_BUILTIN_SHUFFLEVECTOR.
* pt.c (tsubst_copy_and_build): Handle IFN_SHUFFLEVECTOR.
* typeck.c (build_x_shufflevector): Build either a lowered
VEC_PERM_EXPR or an unlowered shufflevector via a temporary
internal function IFN_SHUFFLEVECTOR.
gcc/
* internal-fn.c (expand_SHUFFLEVECTOR): Define.
* internal-fn.def (SHUFFLEVECTOR): New.
* internal-fn.h (expand_SHUFFLEVECTOR): Declare.
* doc/extend.texi: Document __builtin_shufflevector.
gcc/testsuite/
* c-c++-common/builtin-shufflevector-2.c: New testcase.
* c-c++-common/torture/builtin-shufflevector-1.c: Likewise.
* g++.dg/ext/builtin-shufflevector-1.C: Likewise.
* g++.dg/ext/builtin-shufflevector-2.C: Likewise.
Diffstat (limited to 'gcc/internal-fn.h')
-rw-r--r-- | gcc/internal-fn.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/internal-fn.h b/gcc/internal-fn.h index 5bc5660..19d0f84 100644 --- a/gcc/internal-fn.h +++ b/gcc/internal-fn.h @@ -233,6 +233,7 @@ extern void expand_addsub_overflow (location_t, tree_code, tree, tree, tree, extern void expand_internal_call (gcall *); extern void expand_internal_call (internal_fn, gcall *); extern void expand_PHI (internal_fn, gcall *); +extern void expand_SHUFFLEVECTOR (internal_fn, gcall *); extern bool vectorized_internal_fn_supported_p (internal_fn, tree); |