aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2015-11-17 18:54:36 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2015-11-17 18:54:36 +0000
commitb4e5bc4782bafd5f44b12f43f86ad3bf31182206 (patch)
tree03c2b90c6bf3c9064ace36e1d8a6dbb5ad9a9db2
parent03dc244a81378e83fd824c920ff680607e17f239 (diff)
downloadgcc-b4e5bc4782bafd5f44b12f43f86ad3bf31182206.zip
gcc-b4e5bc4782bafd5f44b12f43f86ad3bf31182206.tar.gz
gcc-b4e5bc4782bafd5f44b12f43f86ad3bf31182206.tar.bz2
Use IFN_SQRT in tree-vect-patterns.c
In practice all targets that can vectorise sqrt define the appropriate sqrt<mode>2 optab. The only case where this isn't immediately obvious is the libmass support in rs6000.c, but Mike Meissner said that it shouldn't be exercised for sqrt. This patch therefore uses the internal function interface instead of going via the target hook. Tested on x86_64-linux-gnu, aarch64-linux-gnu, arm-linux-gnueabi and powerpc64-linux-gnu. gcc/ * tree-vect-patterns.c: Include internal-fn.h. (vect_recog_pow_pattern): Use IFN_SQRT instead of BUILT_IN_SQRT*. From-SVN: r230490
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/tree-vect-patterns.c16
2 files changed, 11 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e1be75f..c6ddc5a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2015-11-17 Richard Sandiford <richard.sandiford@arm.com>
+ * tree-vect-patterns.c: Include internal-fn.h.
+ (vect_recog_pow_pattern): Use IFN_SQRT instead of BUILT_IN_SQRT*.
+
+2015-11-17 Richard Sandiford <richard.sandiford@arm.com>
+
* tree.h (BUILTIN_EXP10_P, BUILTIN_EXPONENT_P, BUILTIN_SQRT_P)
(BUILTIN_CBRT_P, BUILTIN_ROOT_P): Delete.
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index a8d4a82..5bab1f5 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -39,6 +39,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-vectorizer.h"
#include "dumpfile.h"
#include "builtins.h"
+#include "internal-fn.h"
#include "case-cfn-macros.h"
/* Pattern recognition functions */
@@ -1054,18 +1055,13 @@ vect_recog_pow_pattern (vec<gimple *> *stmts, tree *type_in,
if (TREE_CODE (exp) == REAL_CST
&& real_equal (&TREE_REAL_CST (exp), &dconsthalf))
{
- tree newfn = mathfn_built_in (TREE_TYPE (base), BUILT_IN_SQRT);
*type_in = get_vectype_for_scalar_type (TREE_TYPE (base));
- if (*type_in)
+ if (*type_in && direct_internal_fn_supported_p (IFN_SQRT, *type_in))
{
- gcall *stmt = gimple_build_call (newfn, 1, base);
- if (vectorizable_function (stmt, *type_in, *type_in)
- != NULL_TREE)
- {
- var = vect_recog_temp_ssa_var (TREE_TYPE (base), stmt);
- gimple_call_set_lhs (stmt, var);
- return stmt;
- }
+ gcall *stmt = gimple_build_call_internal (IFN_SQRT, 1, base);
+ var = vect_recog_temp_ssa_var (TREE_TYPE (base), stmt);
+ gimple_call_set_lhs (stmt, var);
+ return stmt;
}
}