+2006-12-07 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ * config/spu/spu-c.c (spu_build_overload_builtin): Delete.
+ (spu_resolve_overloaded_builtin): Check for non scalar instead
+ of vector type and check the function call argument type also for non scalar.
+ Call build_function_call instead of spu_build_overload_builtin.
+
2006-12-07 Trevor Smigiel <trevor_smigiel@playstation.sony.com>
* config/spu/spu.c (array_to_constant): Correct the order of arguments
#include "spu-builtins.h"
\f
-/* Helper for spu_resolve_overloaded_builtin. */
-static tree
-spu_build_overload_builtin (tree fndecl, tree fnargs)
-{
- tree param, param_type;
- tree ret_type = TREE_TYPE (TREE_TYPE (fndecl));
- tree arg, arglist = NULL_TREE;
- tree val;
-
- for (param = TYPE_ARG_TYPES (TREE_TYPE (fndecl)), arg = fnargs;
- param != void_list_node;
- param = TREE_CHAIN (param), arg = TREE_CHAIN (arg))
- {
- gcc_assert (arg != NULL_TREE);
- param_type = TREE_VALUE (param);
- val = default_conversion (TREE_VALUE (arg));
- val = fold_convert (param_type, val);
-
- arglist = tree_cons (NULL_TREE, val, arglist);
- }
- gcc_assert (arg == NULL_TREE);
- arglist = nreverse (arglist);
-
- return fold_convert (ret_type, build_function_call_expr (fndecl, arglist));
-}
-
/* target hook for resolve_overloaded_builtin(). Returns a function call
RTX if we can resolve the overloaded builtin */
tree
spu_resolve_overloaded_builtin (tree fndecl, tree fnargs)
{
+#define SCALAR_TYPE_P(t) (INTEGRAL_TYPE_P (t) \
+ || SCALAR_FLOAT_TYPE_P (t) \
+ || POINTER_TYPE_P (t))
spu_function_code new_fcode, fcode =
DECL_FUNCTION_CODE (fndecl) - END_BUILTINS;
struct spu_builtin_description *desc;
checking/promotions for scalar arguments, except for the
first argument of intrinsics which don't have a vector
parameter. */
- if ((TREE_CODE (param_type) == VECTOR_TYPE
+ if ((!SCALAR_TYPE_P (param_type)
+ || !SCALAR_TYPE_P (arg_type)
|| ((fcode == SPU_SPLATS || fcode == SPU_PROMOTE
|| fcode == SPU_HCMPEQ || fcode == SPU_HCMPGT
|| fcode == SPU_MASKB || fcode == SPU_MASKH
return error_mark_node;
}
- return spu_build_overload_builtin (match, fnargs);
+ return build_function_call (match, fnargs);
+#undef SCALAR_TYPE_P
}
+2006-12-07 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ * gcc.target/spu: New directory.
+ * gcc.target/spu/spu.exp: New file.
+ * gcc.target/spu/intrinsics-1.c: New test.
+
2006-12-07 Lee Millward <lee.millward@codesourcery.com>
PR c++/29980
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-std=c99 -pedantic-errors" } */
+#include <spu_intrinsics.h>
+/* With this intrinsics section, we used to ICE as we would try
+ to convert from an vector to an integer type. */
+void f(void)
+{
+ vec_uint4 gt, N;
+ vec_int4 a;
+ int *a1;
+ _Complex double b;
+ gt = spu_cmpgt(a, N); /* { dg-error "parameter list" } */
+ gt = spu_cmpgt(a, a1); /* { dg-error "integer from pointer without a cast" } */
+ gt = spu_cmpgt(a, b); /* { dg-error "parameter list" } */
+ gt = spu_cmpgt(a, a);
+ /* Remove this xfail once, we reject implict conversions between vector types. */
+ a = spu_cmpgt(a, a); /* { dg-error "" "" { xfail *-*-* } } */
+}
--- /dev/null
+# Copyright (C) 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# GCC testsuite that uses the 'dg.exp' driver.
+
+# Exit immediately if this isn't a SPU target.
+if { ![istarget spu-*-*] } then {
+ return
+}
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# Initialize 'dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
+ "" $DEFAULT_CFLAGS
+
+# All done.
+dg-finish