On 10/13/2015 08:14 AM, Ilya Enkovich wrote:
+
+static tree
+build_vec_cmp (tree_code code, tree type,
+              tree arg0, tree arg1)
+{
+  tree zero_vec = build_zero_cst (type);
+  tree minus_one_vec = build_minus_one_cst (type);
+  tree cmp_type = build_same_sized_truth_vector_type (type);
+  tree cmp = build2 (code, cmp_type, arg0, arg1);
+  return build3 (VEC_COND_EXPR, type, cmp, minus_one_vec, zero_vec);
+}
Isn't this implementation the same for C & C++?  Does it make sense to put
it in c-family/c-common.c?

C++ version calls fold_if_not_in_template for generated comparison.  It is 
required there to successfully recognize vector MIN, MAX and ABS templates for 
vector ?: conditional operator.  Vector form of ?: conditional operator is 
supported for C++ only.
Ah, nevermind then.



However, more generally, do we need to do anything for the other languages?

Looking into that I got an impression vector modes are used by C/C++ vector 
extensions only.  And I think regression testing would reveal some failures 
otherwise.
Maybe this stuff hasn't bled into the Fortran front-end, but the gfortran front-end certainly has OpenMP support which presumably has vector extensions.

The fact that nothing's failing in the testsuite is encouraging, but it'd be worth spending a few minutes taking a look to see if there's something that might need updating.

Jeff

Reply via email to