+2015-11-06 Ilya Enkovich <enkovich.gnu@gmail.com>
+
+ PR tree-optimization/68145
+ * tree-vect-stmts.c (vectorizable_operation): Fix
+ determination for booleans.
+
2015-11-06 Tom de Vries <tom@codesourcery.com>
* tree-cfg.c (gimple_split_block_before_cond_jump): Split before
+2015-11-06 Ilya Enkovich <enkovich.gnu@gmail.com>
+
+ PR tree-optimization/68145
+ * g++.dg/vect/pr68145.cc: New test.
+
2015-11-06 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR target/68088
--- /dev/null
+/* { dg-do compile } */
+
+struct A {
+ bool operator()(int p1, int p2) { return p1 && p2; }
+};
+class B {
+public:
+ bool *cbegin();
+ bool *cend();
+};
+template <class T> void operator&&(B p1, T p2) {
+ B a;
+ arrayContTransform(p1, p2, a, A());
+}
+
+template <typename _InputIterator1, typename T, typename _OutputIterator,
+ typename _BinaryOperation>
+void myrtransform(_InputIterator1 p1, _OutputIterator p2, T p3,
+ _BinaryOperation p4) {
+ _InputIterator1 b;
+ for (; b != p1; ++b, ++p2)
+ *p2 = p4(*b, p3);
+}
+
+template <typename L, typename R, typename RES, typename BinaryOperator>
+void arrayContTransform(L p1, R p2, RES p3, BinaryOperator p4) {
+ myrtransform(p1.cend(), p3.cbegin(), p2, p4);
+}
+
+class C {
+public:
+ B getArrayBool();
+};
+class D {
+ B getArrayBool(const int &);
+ C lnode_p;
+};
+bool c;
+B D::getArrayBool(const int &) { lnode_p.getArrayBool() && c; }
+
+// { dg-final { scan-tree-dump "vectorized 1 loops" "vect" { target { i?86-*-* x86_64-*-* } } } }
/* If op0 is an external or constant def use a vector type with
the same size as the output vector type. */
if (!vectype)
- vectype = get_same_sized_vectype (TREE_TYPE (op0), vectype_out);
+ {
+ /* For boolean type we cannot determine vectype by
+ invariant value (don't know whether it is a vector
+ of booleans or vector of integers). We use output
+ vectype because operations on boolean don't change
+ type. */
+ if (TREE_CODE (TREE_TYPE (op0)) == BOOLEAN_TYPE)
+ {
+ if (TREE_CODE (TREE_TYPE (scalar_dest)) != BOOLEAN_TYPE)
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "not supported operation on bool value.\n");
+ return false;
+ }
+ vectype = vectype_out;
+ }
+ else
+ vectype = get_same_sized_vectype (TREE_TYPE (op0), vectype_out);
+ }
if (vec_stmt)
gcc_assert (vectype);
if (!vectype)