From 31ac7341323c04ca2b0b40ba5db47d9c4cb94be1 Mon Sep 17 00:00:00 2001 From: meissner Date: Sat, 27 Mar 2010 10:27:39 +0000 Subject: [PATCH] PR 43544, change TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION to take a tree argument git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157770 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 15 +++++++++++++++ gcc/config/i386/i386.c | 6 ++++-- gcc/config/rs6000/rs6000.c | 8 +++++--- gcc/doc/tm.texi | 14 +++++++------- gcc/target.h | 2 +- gcc/targhooks.c | 4 ++-- gcc/targhooks.h | 4 ++-- gcc/tree-vect-stmts.c | 8 +++----- 8 files changed, 39 insertions(+), 22 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eb2928d..c89990b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2010-03-26 Michael Meissner + + PR tree-optimization/43544 + * doc/tm.texi (TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION): + First argument for builtin vectorized function hook is now a + tree to be able to distinguish between machine specific and + standard builtins. + * targhooks.c (default_builtin_vectorized_function): Ditto. + * targhooks.h (default_builtin_vectorized_function): Ditto. + * target.h (struct gcc_target): Ditto. + * tree-vect-stmts.c (vectorizable_function): Ditto. + * config/i386/i386.c (ix86_builtin_vectorized_function): Ditto. + * config/rs6000/rs6000.c (rs6000_builtin_vectorized_function): + Ditto. + 2010-03-26 Joseph Myers PR c/43381 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 985a3e5..39b1da4 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -24375,14 +24375,16 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED, if it is not available. */ static tree -ix86_builtin_vectorized_function (unsigned int fn, tree type_out, +ix86_builtin_vectorized_function (tree fndecl, tree type_out, tree type_in) { enum machine_mode in_mode, out_mode; int in_n, out_n; + enum built_in_function fn = DECL_FUNCTION_CODE (fndecl); if (TREE_CODE (type_out) != VECTOR_TYPE - || TREE_CODE (type_in) != VECTOR_TYPE) + || TREE_CODE (type_in) != VECTOR_TYPE + || DECL_BUILT_IN_CLASS (fndecl) != BUILT_IN_NORMAL) return NULL_TREE; out_mode = TYPE_MODE (TREE_TYPE (type_out)); diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 98b4d94..91f66a9 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -909,7 +909,7 @@ static rtx rs6000_emit_stack_reset (rs6000_stack_t *, rtx, rtx, int, bool); static rtx rs6000_make_savres_rtx (rs6000_stack_t *, rtx, int, enum machine_mode, bool, bool, bool); static bool rs6000_reg_live_or_pic_offset_p (int); -static tree rs6000_builtin_vectorized_function (unsigned int, tree, tree); +static tree rs6000_builtin_vectorized_function (tree, tree, tree); static int rs6000_savres_strategy (rs6000_stack_t *, bool, int, int); static void rs6000_restore_saved_cr (rtx, int); static void rs6000_output_function_prologue (FILE *, HOST_WIDE_INT); @@ -3179,15 +3179,17 @@ rs6000_parse_fpu_option (const char *option) if it is not available. */ static tree -rs6000_builtin_vectorized_function (unsigned int fn, tree type_out, +rs6000_builtin_vectorized_function (tree fndecl, tree type_out, tree type_in) { enum machine_mode in_mode, out_mode; int in_n, out_n; + enum built_in_function fn = DECL_FUNCTION_CODE (fndecl); if (TREE_CODE (type_out) != VECTOR_TYPE || TREE_CODE (type_in) != VECTOR_TYPE - || !TARGET_VECTORIZE_BUILTINS) + || !TARGET_VECTORIZE_BUILTINS + || DECL_BUILT_IN_CLASS (fndecl) != BUILT_IN_NORMAL) return NULL_TREE; out_mode = TYPE_MODE (TREE_TYPE (type_out)); diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index a11e99e..012edd7 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -5717,13 +5717,13 @@ If this hook is defined, the autovectorizer will use the conversion. Otherwise, it will return @code{NULL_TREE}. @end deftypefn -@deftypefn {Target Hook} tree TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION (unsigned @var{code}, tree @var{vec_type_out}, tree @var{vec_type_in}) -This hook should return the decl of a function that implements the vectorized -variant of the builtin function with builtin function code @var{code} or -@code{NULL_TREE} if such a function is not available. The value of @var{code} -is one of the enumerators in @code{enum built_in_function}. The return type of -the vectorized function shall be of vector type @var{vec_type_out} and the -argument types should be @var{vec_type_in}. +@deftypefn {Target Hook} tree TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION (tree @var{fndecl}, tree @var{vec_type_out}, tree @var{vec_type_in}) +This hook should return the decl of a function that implements the +vectorized variant of the builtin function with builtin function code +@var{code} or @code{NULL_TREE} if such a function is not available. +The value of @var{fndecl} is the builtin function declaration. The +return type of the vectorized function shall be of vector type +@var{vec_type_out} and the argument types should be @var{vec_type_in}. @end deftypefn @deftypefn {Target Hook} bool TARGET_SUPPORT_VECTOR_MISALIGNMENT (enum machine_mode @var{mode}, const_tree @var{type}, int @var{misalignment}, bool @var{is_packed}) diff --git a/gcc/target.h b/gcc/target.h index 645bd0a..41ae3e3 100644 --- a/gcc/target.h +++ b/gcc/target.h @@ -471,7 +471,7 @@ struct gcc_target /* Returns a code for builtin that realizes vectorized version of function, or NULL_TREE if not available. */ - tree (* builtin_vectorized_function) (unsigned, tree, tree); + tree (* builtin_vectorized_function) (tree, tree, tree); /* Returns a code for builtin that realizes vectorized version of conversion, or NULL_TREE if not available. */ diff --git a/gcc/targhooks.c b/gcc/targhooks.c index d619ae5..d9a7a9d 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -1,5 +1,5 @@ /* Default target hook functions. - Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009 + Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GCC. @@ -419,7 +419,7 @@ default_invalid_within_doloop (const_rtx insn) /* Mapping of builtin functions to vectorized variants. */ tree -default_builtin_vectorized_function (unsigned int fn ATTRIBUTE_UNUSED, +default_builtin_vectorized_function (tree fndecl ATTRIBUTE_UNUSED, tree type_out ATTRIBUTE_UNUSED, tree type_in ATTRIBUTE_UNUSED) { diff --git a/gcc/targhooks.h b/gcc/targhooks.h index 631bdf2..b2b9097 100644 --- a/gcc/targhooks.h +++ b/gcc/targhooks.h @@ -1,5 +1,5 @@ /* Default target hook functions. - Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009 + Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GCC. @@ -70,7 +70,7 @@ extern bool default_fixed_point_supported_p (void); extern const char * default_invalid_within_doloop (const_rtx); -extern tree default_builtin_vectorized_function (unsigned int, tree, tree); +extern tree default_builtin_vectorized_function (tree, tree, tree); extern tree default_builtin_vectorized_conversion (unsigned int, tree); diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 4bce61a..c280e81 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -1,6 +1,6 @@ /* Statement Analysis and Transformation for Vectorization - Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software - Foundation, Inc. + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. Contributed by Dorit Naishlos and Ira Rosen @@ -1189,7 +1189,6 @@ tree vectorizable_function (gimple call, tree vectype_out, tree vectype_in) { tree fndecl = gimple_call_fndecl (call); - enum built_in_function code; /* We only handle functions that do not read or clobber memory -- i.e. const or novops ones. */ @@ -1201,8 +1200,7 @@ vectorizable_function (gimple call, tree vectype_out, tree vectype_in) || !DECL_BUILT_IN (fndecl)) return NULL_TREE; - code = DECL_FUNCTION_CODE (fndecl); - return targetm.vectorize.builtin_vectorized_function (code, vectype_out, + return targetm.vectorize.builtin_vectorized_function (fndecl, vectype_out, vectype_in); } -- 2.7.4