aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Stubbs <ams@codesourcery.com>2023-06-13 16:44:31 +0100
committerAndrew Stubbs <ams@codesourcery.com>2023-06-19 12:35:34 +0100
commit1f97a0b412ed0984ff4af381b222b87424c08dbd (patch)
tree5b37111f8485c54747704a9f91623e91243659d7
parent8aeabd9f63d8a54a5fa0b038ad4425a999e1cc75 (diff)
downloadgcc-1f97a0b412ed0984ff4af381b222b87424c08dbd.zip
gcc-1f97a0b412ed0984ff4af381b222b87424c08dbd.tar.gz
gcc-1f97a0b412ed0984ff4af381b222b87424c08dbd.tar.bz2
vect: vectorize via libfuncs
This patch allows vectorization when the libfuncs are defined. gcc/ChangeLog: * tree-vect-generic.cc: Include optabs-libfuncs.h. (get_compute_type): Check optab_libfunc. * tree-vect-stmts.cc: Include optabs-libfuncs.h. (vectorizable_operation): Check optab_libfunc.
-rw-r--r--gcc/tree-vect-generic.cc5
-rw-r--r--gcc/tree-vect-stmts.cc5
2 files changed, 7 insertions, 3 deletions
diff --git a/gcc/tree-vect-generic.cc b/gcc/tree-vect-generic.cc
index b7d4a91..df04a0d 100644
--- a/gcc/tree-vect-generic.cc
+++ b/gcc/tree-vect-generic.cc
@@ -44,6 +44,7 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-fold.h"
#include "gimple-match.h"
#include "recog.h" /* FIXME: for insn_data */
+#include "optabs-libfuncs.h"
/* Build a ternary operation and gimplify it. Emit code before GSI.
@@ -1714,7 +1715,9 @@ get_compute_type (enum tree_code code, optab op, tree type)
machine_mode compute_mode = TYPE_MODE (compute_type);
if (VECTOR_MODE_P (compute_mode))
{
- if (op && optab_handler (op, compute_mode) != CODE_FOR_nothing)
+ if (op
+ && (optab_handler (op, compute_mode) != CODE_FOR_nothing
+ || optab_libfunc (op, compute_mode)))
return compute_type;
if (code == MULT_HIGHPART_EXPR
&& can_mult_highpart_p (compute_mode,
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 47baf35..056a0ec 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -56,6 +56,7 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-fold.h"
#include "regs.h"
#include "attribs.h"
+#include "optabs-libfuncs.h"
/* For lang_hooks.types.type_for_mode. */
#include "langhooks.h"
@@ -6530,8 +6531,8 @@ vectorizable_operation (vec_info *vinfo,
"no optab.\n");
return false;
}
- target_support_p = (optab_handler (optab, vec_mode)
- != CODE_FOR_nothing);
+ target_support_p = (optab_handler (optab, vec_mode) != CODE_FOR_nothing
+ || optab_libfunc (optab, vec_mode));
}
bool using_emulated_vectors_p = vect_emulated_vector_p (vectype);