From: Andrew Pinski Date: Thu, 7 Dec 2006 23:40:46 +0000 (+0000) Subject: spu-c.c (spu_build_overload_builtin): Delete. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9838be08d03228cd05701542dfdd2297f816a834;p=gcc.git spu-c.c (spu_build_overload_builtin): Delete. 2006-12-07 Andrew Pinski * 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 Andrew Pinski * gcc.target/spu: New directory. * gcc.target/spu/spu.exp: New file. * gcc.target/spu/intrinsics-1.c: New test. From-SVN: r119637 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fe15e311b53..25a1e7c001f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2006-12-07 Andrew Pinski + + * 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 * config/spu/spu.c (array_to_constant): Correct the order of arguments diff --git a/gcc/config/spu/spu-c.c b/gcc/config/spu/spu-c.c index c88e627a49f..d52d5242c7f 100644 --- a/gcc/config/spu/spu-c.c +++ b/gcc/config/spu/spu-c.c @@ -36,37 +36,14 @@ #include "spu-builtins.h" -/* 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; @@ -119,7 +96,8 @@ spu_resolve_overloaded_builtin (tree fndecl, tree fnargs) 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 @@ -149,7 +127,8 @@ spu_resolve_overloaded_builtin (tree fndecl, tree fnargs) return error_mark_node; } - return spu_build_overload_builtin (match, fnargs); + return build_function_call (match, fnargs); +#undef SCALAR_TYPE_P } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 77c3bf1883a..c5ab9b52fa7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2006-12-07 Andrew Pinski + + * 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 PR c++/29980 diff --git a/gcc/testsuite/gcc.target/spu/intrinsics-1.c b/gcc/testsuite/gcc.target/spu/intrinsics-1.c new file mode 100644 index 00000000000..08458a5219c --- /dev/null +++ b/gcc/testsuite/gcc.target/spu/intrinsics-1.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c99 -pedantic-errors" } */ +#include +/* 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 *-*-* } } */ +} diff --git a/gcc/testsuite/gcc.target/spu/spu.exp b/gcc/testsuite/gcc.target/spu/spu.exp new file mode 100644 index 00000000000..b7669869472 --- /dev/null +++ b/gcc/testsuite/gcc.target/spu/spu.exp @@ -0,0 +1,41 @@ +# 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