diff options
author | Jakub Jelinek <jakub@redhat.com> | 2019-01-07 09:49:08 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2019-01-07 09:49:08 +0100 |
commit | d8fcab689435a29dba2862693689c624b257d1bf (patch) | |
tree | 3ebde208f2b05c57fa2ce4a941e6c4e7811e82c3 /gcc/cp/parser.c | |
parent | f881693c53374c743d3b5d1561708a64dcfe7eb6 (diff) | |
download | gcc-d8fcab689435a29dba2862693689c624b257d1bf.zip gcc-d8fcab689435a29dba2862693689c624b257d1bf.tar.gz gcc-d8fcab689435a29dba2862693689c624b257d1bf.tar.bz2 |
re PR c++/85052 (Implement support for clang's __builtin_convertvector)
PR c++/85052
* tree-vect-generic.c: Include insn-config.h and recog.h.
(expand_vector_piecewise): Add defaulted ret_type argument,
if non-NULL, use that in preference to type for the result type.
(expand_vector_parallel): Formatting fix.
(do_vec_conversion, do_vec_narrowing_conversion,
expand_vector_conversion): New functions.
(expand_vector_operations_1): Call expand_vector_conversion
for VEC_CONVERT ifn calls.
* internal-fn.def (VEC_CONVERT): New internal function.
* internal-fn.c (expand_VEC_CONVERT): New function.
* fold-const-call.c (fold_const_vec_convert): New function.
(fold_const_call): Use it for CFN_VEC_CONVERT.
* doc/extend.texi (__builtin_convertvector): Document.
c-family/
* c-common.h (enum rid): Add RID_BUILTIN_CONVERTVECTOR.
(c_build_vec_convert): Declare.
* c-common.c (c_build_vec_convert): New function.
c/
* c-parser.c (c_parser_postfix_expression): Parse
__builtin_convertvector.
cp/
* cp-tree.h (cp_build_vec_convert): Declare.
* parser.c (cp_parser_postfix_expression): Parse
__builtin_convertvector.
* constexpr.c: Include fold-const-call.h.
(cxx_eval_internal_function): Handle IFN_VEC_CONVERT.
(potential_constant_expression_1): Likewise.
* semantics.c (cp_build_vec_convert): New function.
* pt.c (tsubst_copy_and_build): Handle CALL_EXPR to
IFN_VEC_CONVERT.
testsuite/
* c-c++-common/builtin-convertvector-1.c: New test.
* c-c++-common/torture/builtin-convertvector-1.c: New test.
* g++.dg/ext/builtin-convertvector-1.C: New test.
* g++.dg/cpp0x/constexpr-builtin4.C: New test.
From-SVN: r267632
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r-- | gcc/cp/parser.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 6ad2282..bca1739 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -7031,6 +7031,32 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p, break; } + case RID_BUILTIN_CONVERTVECTOR: + { + tree expression; + tree type; + /* Consume the `__builtin_convertvector' token. */ + cp_lexer_consume_token (parser->lexer); + /* Look for the opening `('. */ + matching_parens parens; + parens.require_open (parser); + /* Now, parse the assignment-expression. */ + expression = cp_parser_assignment_expression (parser); + /* Look for the `,'. */ + cp_parser_require (parser, CPP_COMMA, RT_COMMA); + location_t type_location + = cp_lexer_peek_token (parser->lexer)->location; + /* Parse the type-id. */ + { + type_id_in_expr_sentinel s (parser); + type = cp_parser_type_id (parser); + } + /* Look for the closing `)'. */ + parens.require_close (parser); + return cp_build_vec_convert (expression, type_location, type, + tf_warning_or_error); + } + default: { tree type; |