if ((*arglist)[i] == error_mark_node)
return error_mark_node;
+ /* A difference in front ends is that in contrast to C the C++ FE does no
+ array-to-pointer conversion prior calling resolve_overloaded_builtin().
+ However, we depend on this for finding the proper overloaded builtin or in
+ case of direct expansion. Therefore, do the conversion now. */
+ if (c_dialect_cxx ())
+ for (i = 0; i < in_args_num; ++i)
+ {
+ tree t = (*arglist)[i];
+ if (TREE_CODE (t) == VIEW_CONVERT_EXPR
+ && TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
+ (*arglist)[i] = default_conversion (t);
+ }
+
/* Overloaded builtins without any variants are directly expanded here. */
if (desc_start_for_overloaded_builtin[ob_fcode] ==
S390_OVERLOADED_BUILTIN_VAR_MAX)
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=z13 -mzarch" } */
+/* { dg-final { scan-assembler-times {\tlarl\t(%r1),.LANCHOR0\n\tvllezf\t%v24,0\(\1\)\n\tbr\t%r14} 2 } } */
+/* { dg-final { scan-assembler-times {\tlarl\t(%r1),.LANCHOR0\n\tvl\t%v24,4\(\1\)\n\tbr\t%r14} 1 } } */
+
+/* Test C++ semantics w.r.t. array arguments. */
+
+#include "../../gcc.target/s390/builtin-array-arg-1.c"
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=z13 -mzarch" } */
+/* { dg-final { scan-assembler-times {\tlarl\t(%r1),.LANCHOR0\n\tvllezf\t%v24,0\(\1\)\n\tbr\t%r14} 2 } } */
+/* { dg-final { scan-assembler-times {\tlarl\t(%r1),.LANCHOR0\n\tvl\t%v24,4\(\1\)\n\tbr\t%r14} 1 } } */
+
+/* Accept array arguments which are converted to pointers in the end. */
+
+typedef unsigned int __attribute__ ((vector_size (16))) UV4SI;
+unsigned int a[42];
+
+/* Overloaded builtin. */
+
+UV4SI
+test_vec_insert_and_zero (void)
+{
+ return __builtin_s390_vec_insert_and_zero (a);
+}
+
+/* Non-overloaded builtin. */
+
+UV4SI
+test_vllezf (void)
+{
+ return __builtin_s390_vllezf (a);
+}
+
+/* Directly expanded overloaded builtin. */
+
+UV4SI
+test_vec_xl (void)
+{
+ return __builtin_s390_vec_xl (4, a);
+}