RFC: Variable-length VECTOR_CSTs
David Malcolm
dmalcolm@redhat.com
Wed Nov 29 15:11:00 GMT 2017
On Wed, 2017-11-29 at 11:57 +0000, Richard Sandiford wrote:
[...]
I can't really comment on the representation ideas, but I'm always
happy to see new selftests...
*************** test_labels ()
> *** 13954,13959 ****
> --- 14179,14350 ----
> ASSERT_FALSE (FORCED_LABEL (label_decl));
> }
>
> + /* Check that VECTOR_CST Y contains the elements in X. */
> +
> + static void
> + check_vector_cst (vec<tree> x, tree y)
> + {
> + for (unsigned int i = 0; i < x.length (); ++i)
> + ASSERT_EQ (wi::to_wide (x[i]), wi::to_wide (vector_cst_elt (y,
> i)));
> + }
...a couple of nits/suggestions:
(a) How about renaming "x" to "expected"? Maybe rename "y" to
"actual"? (to better document the sense of the test).
(b) At first glance, I wondered if this routine should also have
something like:
ASSERT_EQ (expected.length (), VECTOR_CST_NELTS (actual));
Though that seems to come from the vector type, and it's always 8 in
these examples, so I'm not sure.
Hope this is constructive
Dave
More information about the Gcc-patches
mailing list