+2018-05-25 Richard Sandiford <richard.sandiford@linaro.org>
+
+ * tree-vect-patterns.c: Include predict.h.
+ (vect_recog_divmod_pattern): Restrict check for division support
+ to when optimizing for size.
+
2018-05-25 Richard Sandiford <richard.sandiford@linaro.org>
* doc/sourcebuild.texi (vect_double_cond_arith: Document.
#include "attribs.h"
#include "cgraph.h"
#include "omp-simd-clone.h"
+#include "predict.h"
/* Pattern recognition functions */
static gimple *vect_recog_widen_sum_pattern (vec<gimple *> *, tree *,
if (vectype == NULL_TREE)
return NULL;
- /* If the target can handle vectorized division or modulo natively,
- don't attempt to optimize this. */
- optab = optab_for_tree_code (rhs_code, vectype, optab_default);
- if (optab != unknown_optab)
+ if (optimize_bb_for_size_p (gimple_bb (last_stmt)))
{
- machine_mode vec_mode = TYPE_MODE (vectype);
- int icode = (int) optab_handler (optab, vec_mode);
- if (icode != CODE_FOR_nothing)
- return NULL;
+ /* If the target can handle vectorized division or modulo natively,
+ don't attempt to optimize this, since native division is likely
+ to give smaller code. */
+ optab = optab_for_tree_code (rhs_code, vectype, optab_default);
+ if (optab != unknown_optab)
+ {
+ machine_mode vec_mode = TYPE_MODE (vectype);
+ int icode = (int) optab_handler (optab, vec_mode);
+ if (icode != CODE_FOR_nothing)
+ return NULL;
+ }
}
prec = TYPE_PRECISION (itype);