bool *);
static tree handle_vector_size_attribute (tree *, tree, tree, int,
bool *) ATTRIBUTE_NONNULL(3);
+static tree handle_vector_mask_attribute (tree *, tree, tree, int,
+ bool *) ATTRIBUTE_NONNULL(3);
static tree handle_nonnull_attribute (tree *, tree, tree, int, bool *);
static tree handle_nonstring_attribute (tree *, tree, tree, int, bool *);
static tree handle_nothrow_attribute (tree *, tree, tree, int, bool *);
handle_unavailable_attribute, NULL },
{ "vector_size", 1, 1, false, true, false, true,
handle_vector_size_attribute, NULL },
+ { "vector_mask", 0, 0, false, true, false, true,
+ handle_vector_mask_attribute, NULL },
{ "visibility", 1, 1, false, false, false, false,
handle_visibility_attribute, NULL },
{ "tls_model", 1, 1, true, false, false, false,
return NULL_TREE;
}
+/* Handle a "vector_mask" attribute; arguments as in
+ struct attribute_spec.handler. */
+
+static tree
+handle_vector_mask_attribute (tree *node, tree name, tree,
+ int ARG_UNUSED (flags),
+ bool *no_add_attrs)
+{
+ *no_add_attrs = true;
+ if (!flag_gimple)
+ {
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
+ return NULL_TREE;
+ }
+
+ /* Determine the "base" type to apply the attribute to. */
+ tree type = type_for_vector_size (*node);
+ if (!VECTOR_TYPE_P (type) || VECTOR_BOOLEAN_TYPE_P (type))
+ {
+ warning (OPT_Wattributes, "%qE attribute only supported on "
+ "non-mask vector types", name);
+ return NULL_TREE;
+ }
+
+ tree new_type = truth_type_for (type);
+
+ /* Build back pointers if needed. */
+ *node = lang_hooks.types.reconstruct_complex_type (*node, new_type);
+
+ return NULL_TREE;
+}
+
/* Handle the "nonnull" attribute. */
static tree
if (lhs.value != error_mark_node
&& rhs.value != error_mark_node)
{
- /* If we parsed a comparison and the next token is a '?' then
- parse a conditional expression. */
- if (COMPARISON_CLASS_P (rhs.value)
+ /* If we parsed a comparison or an identifier and the next token
+ is a '?' then parse a conditional expression. */
+ if ((COMPARISON_CLASS_P (rhs.value)
+ || SSA_VAR_P (rhs.value))
&& c_parser_next_token_is (parser, CPP_QUERY))
{
struct c_expr trueval, falseval;
if (trueval.value == error_mark_node
|| falseval.value == error_mark_node)
return;
- rhs.value = build3_loc (loc, COND_EXPR, TREE_TYPE (trueval.value),
+ rhs.value = build3_loc (loc,
+ VECTOR_TYPE_P (TREE_TYPE (rhs.value))
+ ? VEC_COND_EXPR : COND_EXPR,
+ TREE_TYPE (trueval.value),
rhs.value, trueval.value, falseval.value);
}
if (get_gimple_rhs_class (TREE_CODE (rhs.value)) == GIMPLE_INVALID_RHS)