diff options
author | Andrew Pinski <andrew_pinski@playstation.sony.com> | 2006-12-07 23:40:46 +0000 |
---|---|---|
committer | Andrew Pinski <pinskia@gcc.gnu.org> | 2006-12-07 15:40:46 -0800 |
commit | 9838be08d03228cd05701542dfdd2297f816a834 (patch) | |
tree | b3ffe28627015610778123f9b24441be20a6d670 /gcc | |
parent | 9dc5f9bad9be09c039a68047121d80a2d53caa63 (diff) | |
download | gcc-9838be08d03228cd05701542dfdd2297f816a834.zip gcc-9838be08d03228cd05701542dfdd2297f816a834.tar.gz gcc-9838be08d03228cd05701542dfdd2297f816a834.tar.bz2 |
spu-c.c (spu_build_overload_builtin): Delete.
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 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.
From-SVN: r119637
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/spu/spu-c.c | 35 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/spu/intrinsics-1.c | 18 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/spu/spu.exp | 41 |
5 files changed, 79 insertions, 28 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fe15e31..25a1e7c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +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 diff --git a/gcc/config/spu/spu-c.c b/gcc/config/spu/spu-c.c index c88e627..d52d524 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 77c3bf1..c5ab9b5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +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 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 0000000..08458a5 --- /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 <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 *-*-* } } */ +} diff --git a/gcc/testsuite/gcc.target/spu/spu.exp b/gcc/testsuite/gcc.target/spu/spu.exp new file mode 100644 index 0000000..b766986 --- /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 |