public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Ilya Enkovich <enkovich.gnu@gmail.com>, gcc-patches@gcc.gnu.org
Subject: Re: [Boolean Vector, patch 1/5] Introduce boolean vector to be used as a vector comparison type
Date: Fri, 09 Oct 2015 20:43:00 -0000	[thread overview]
Message-ID: <561826D6.3050101@redhat.com> (raw)
In-Reply-To: <20151002135921.GE26618@msticlxl57.ims.intel.com>

On 10/02/2015 07:59 AM, Ilya Enkovich wrote:
> 2015-10-02  Ilya Enkovich  <enkovich.gnu@gmail.com>
>
> 	* doc/tm.texi: Regenerated.
> 	* doc/tm.texi.in (TARGET_VECTORIZE_GET_MASK_MODE): New.
> 	* stor-layout.c (layout_type): Use mode to get vector mask size.
> 	* target.def (get_mask_mode): New.
> 	* targhooks.c (default_get_mask_mode): New.
> 	* targhooks.h (default_get_mask_mode): New.
> 	* gcc/tree-vect-stmts.c (get_same_sized_vectype): Add special case
> 	for boolean vector.
> 	* tree.c (MAX_BOOL_CACHED_PREC): New.
> 	(nonstandard_boolean_type_cache): New.
> 	(build_nonstandard_boolean_type): New.
> 	(make_vector_type): Vector mask has no canonical type.
> 	(build_truth_vector_type): New.
> 	(build_same_sized_truth_vector_type): New.
> 	(truth_type_for): Support vector masks.
> 	* tree.h (VECTOR_BOOLEAN_TYPE_P): New.
> 	(build_truth_vector_type): New.
> 	(build_same_sized_truth_vector_type): New.
> 	(build_nonstandard_boolean_type): New.
>
>
> diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
> index eb495a8..098213e 100644
> --- a/gcc/doc/tm.texi
> +++ b/gcc/doc/tm.texi
> @@ -5688,6 +5688,11 @@ mode returned by @code{TARGET_VECTORIZE_PREFERRED_SIMD_MODE}.
>   The default is zero which means to not iterate over other vector sizes.
>   @end deftypefn
>
> +@deftypefn {Target Hook} machine_mode TARGET_VECTORIZE_GET_MASK_MODE (unsigned @var{nunits}, unsigned @var{length})
> +This hook returns mode to be used for a mask to be used for a vector
> +of specified @var{length} with @var{nunits} elements.
> +@end deftypefn
Does it make sense to indicate the default used if the target does not 
provide a definition for this hook?




> diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
> index 938e54b..58ecd7b 100644
> --- a/gcc/stor-layout.c
> +++ b/gcc/stor-layout.c
> @@ -2184,10 +2184,16 @@ layout_type (tree type)
>
>   	TYPE_SATURATING (type) = TYPE_SATURATING (TREE_TYPE (type));
>           TYPE_UNSIGNED (type) = TYPE_UNSIGNED (TREE_TYPE (type));
> -	TYPE_SIZE_UNIT (type) = int_const_binop (MULT_EXPR,
> -					         TYPE_SIZE_UNIT (innertype),
> -					         size_int (nunits));
> -	TYPE_SIZE (type) = int_const_binop (MULT_EXPR, TYPE_SIZE (innertype),
> +	/* Several boolean vector elements may fit in a single unit.  */
> +	if (VECTOR_BOOLEAN_TYPE_P (type))
> +	  TYPE_SIZE_UNIT (type)
> +	    = size_int (GET_MODE_SIZE (type->type_common.mode));
Shouldn't this be TYPE_MODE rather than accessing the internals of the 
tree node directly?


> diff --git a/gcc/tree.c b/gcc/tree.c
> index 84fd34d..0cb8361 100644
> --- a/gcc/tree.c
> +++ b/gcc/tree.c
> @@ -11067,9 +11130,10 @@ truth_type_for (tree type)
>   {
>     if (TREE_CODE (type) == VECTOR_TYPE)
>       {
> -      tree elem = lang_hooks.types.type_for_size
> -        (GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (type))), 0);
> -      return build_opaque_vector_type (elem, TYPE_VECTOR_SUBPARTS (type));
> +      if (VECTOR_BOOLEAN_TYPE_P (type))
> +	return type;
> +      return build_truth_vector_type (TYPE_VECTOR_SUBPARTS (type),
> +				      GET_MODE_SIZE (TYPE_MODE (type)));
Presumably you're not building an opaque type anymore because you want 
warnings if somethings tries to do a conversion?  I'm going to assume 
this was intentional.


With the doc update and the fix to use TYPE_MODE (assuming there's not a 
good reason to be looking at the underlying type directly) this is OK.

jeff

  reply	other threads:[~2015-10-09 20:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-02 13:59 Ilya Enkovich
2015-10-09 20:43 ` Jeff Law [this message]
2015-10-13 13:17   ` Richard Biener
2015-10-13 13:35     ` Ilya Enkovich
2015-10-13 13:17   ` Ilya Enkovich
2015-10-22 10:24 ` Andreas Schwab
2015-10-22 10:35   ` Ilya Enkovich
2015-10-22 10:51     ` Andreas Schwab
2015-10-22 16:24       ` Ilya Enkovich
2015-10-22 16:45         ` Jeff Law
2015-10-23  9:43         ` Richard Biener
2015-10-23 11:13           ` Ilya Enkovich
2015-10-23 12:57             ` Richard Biener
2015-10-28 13:55               ` Christophe Lyon
2015-10-28 16:54                 ` Bill Schmidt
2015-10-28 19:39                   ` Ilya Enkovich
2015-10-29 13:13                     ` Ilya Enkovich
2015-11-02 19:41                       ` Jeff Law
2015-11-03 11:26                         ` Richard Biener
2015-11-03 13:42                           ` Jeff Law
2015-11-03 16:02                       ` Jeff Law
2015-10-28 14:57 ` James Greenhalgh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=561826D6.3050101@redhat.com \
    --to=law@redhat.com \
    --cc=enkovich.gnu@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).