Go patch committed: Handle vector modes

Nathan Froyd froydnj@codesourcery.com
Tue Dec 7 20:58:00 GMT 2010


On Tue, Dec 07, 2010 at 11:32:02AM -0800, Ian Lance Taylor wrote:
> The tree vectorizer calls the type_for_mode langhook with vector modes.
> I'm not sure this makes sense.  If a language doesn't have any vector
> types, then there is nothing sensible that the langhook can return.  It
> seems to me that this should be done entirely in the middle-end, using
> middle-end types, rather than asking the language.
>
>  go_langhook_type_for_mode (enum machine_mode mode, int unsignedp)
>  {
> +  /* Go has no vector types.  Build them here.  FIXME: It does not
> +     make sense for the middle-end to ask the frontend for a type
> +     which the frontend does not support.  However, at least for now
> +     it is required.  See PR 46805.  */
> +  if (VECTOR_MODE_P (mode))
> +    {
> +      tree inner;
> +
> +      inner = go_langhook_type_for_mode (GET_MODE_INNER (mode), unsignedp);
> +      if (inner != NULL_TREE)
> +	return build_vector_type_for_mode (inner, mode);
> +      return NULL_TREE;

It is unfortunate that every language has essentially this same code
(most don't return NULL_TREE, which causes added work in many cases).

-Nathan



More information about the Gcc-patches mailing list