public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Kugan <kugan.vivekanandarajah@linaro.org>,
	       Richard Henderson <rth@redhat.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH 1/2] Enable setting sign and unsigned promoted mode (SPR_SIGNED_AND_UNSIGNED)
Date: Tue, 24 Jun 2014 12:18:00 -0000	[thread overview]
Message-ID: <20140624121812.GW31640@tucnak.redhat.com> (raw)
In-Reply-To: <53A96657.1030901@linaro.org>

On Tue, Jun 24, 2014 at 09:51:51PM +1000, Kugan wrote:
> Changes the the SUBREG flags to be able to set promoted for sign
> (SRP_SIGNED), unsigned (SRP_UNSIGNED),  sign and unsigned
> (SPR_SIGNED_AND_UNSIGNED) in SUBREG_PROMOTED_VAR_P.

> 2014-06-24  Kugan Vivekanandarajah  <kuganv@linaro.org>
> 
> 	* gcc/calls.c (precompute_arguments): Use new SUBREG_PROMOTED_SET
> 	instead of SUBREG_PROMOTED_UNSIGNED_SET
> 	(expand_call) : Likewise.

gcc/ prefix doesn't belong to gcc/ChangeLog entries (everywhere).

> 	* gcc/expr.c (convert_move) : Use new SUBREG_CHECK_PROMOTED_SIGN

No space before : (everywhere).
> @@ -3365,7 +3364,8 @@ expand_call (tree exp, rtx target, int ignore)
>  
>  	  target = gen_rtx_SUBREG (TYPE_MODE (type), target, offset);
>  	  SUBREG_PROMOTED_VAR_P (target) = 1;
> -	  SUBREG_PROMOTED_UNSIGNED_SET (target, unsignedp);
> +	  SUBREG_PROMOTED_SET (target, unsignedp);
> +
>  	}
>  

Please avoid adding useless blank lines.

> --- a/gcc/expr.c
> +++ b/gcc/expr.c
> @@ -329,7 +329,7 @@ convert_move (rtx to, rtx from, int unsignedp)
>    if (GET_CODE (from) == SUBREG && SUBREG_PROMOTED_VAR_P (from)
>        && (GET_MODE_PRECISION (GET_MODE (SUBREG_REG (from)))
>  	  >= GET_MODE_PRECISION (to_mode))
> -      && SUBREG_PROMOTED_UNSIGNED_P (from) == unsignedp)
> +      && (SUBREG_CHECK_PROMOTED_SIGN (from, unsignedp)))

Please remove the extra ()s, the macro should have ()s around the definition
to make this unnecessary (many times).

> @@ -5202,8 +5202,7 @@ store_expr (tree exp, rtx target, int call_param_p, bool nontemporal)
>  	  && GET_MODE_PRECISION (GET_MODE (target))
>  	     == TYPE_PRECISION (TREE_TYPE (exp)))
>  	{
> -	  if (TYPE_UNSIGNED (TREE_TYPE (exp))
> -	      != SUBREG_PROMOTED_UNSIGNED_P (target))
> +	  if (!(SUBREG_CHECK_PROMOTED_SIGN (target, TYPE_UNSIGNED (TREE_TYPE (exp)))))

Too long line.

> -#define SUBREG_PROMOTED_UNSIGNED_SET(RTX, VAL)				\
> -do {									\
> -  rtx const _rtx = RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_UNSIGNED_SET",	\
> -				    (RTX), SUBREG);			\
> -  if ((VAL) < 0)							\
> -    _rtx->volatil = 1;							\
> -  else {								\
> -    _rtx->volatil = 0;							\
> -    _rtx->unchanging = (VAL);						\
> -  }									\
> -} while (0)
> -
>  /* Valid for subregs which are SUBREG_PROMOTED_VAR_P().  In that case
>     this gives the necessary extensions:
> -   0  - signed
> -   1  - normal unsigned
> +   0  - signed (SPR_SIGNED)
> +   1  - normal unsigned (SPR_UNSIGNED)
> +   2  - value is both sign and unsign extended for mode
> +	(SPR_SIGNED_AND_UNSIGNED).
>     -1 - pointer unsigned, which most often can be handled like unsigned
>          extension, except for generating instructions where we need to
> -	emit special code (ptr_extend insns) on some architectures.  */
> +	emit special code (ptr_extend insns) on some architectures
> +	(SPR_POINTER). */
> +
> +const unsigned int SRP_POINTER  = -1;
> +const unsigned int SRP_SIGNED   = 0;
> +const unsigned int SRP_UNSIGNED = 1;
> +const unsigned int SRP_SIGNED_AND_UNSIGNED = 2;

But most importantly, I thought Richard Henderson suggested
to use SRP_POINTER 0, SRP_SIGNED 1, SRP_UNSIGNED 2, SRP_SIGNED_AND_UNSIGNED 3,
that way when checking e.g. SUBREG_PROMOTED_SIGNED_P or
SUBREG_PROMOTED_UNSIGNED_P you can check just the single bit.
Where something tested for SUBREG_PROMOTED_UNSIGNED_P () == -1 just
use SUBREG_PROMOTED_GET.

	Jakub

  reply	other threads:[~2014-06-24 12:18 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-24 11:48 [PATCH 0/2] Zext/sext elimination using value range Kugan
2014-06-24 11:51 ` [PATCH 1/2] Enable setting sign and unsigned promoted mode (SPR_SIGNED_AND_UNSIGNED) Kugan
2014-06-24 12:18   ` Jakub Jelinek [this message]
2014-06-25  7:21     ` Kugan
2014-06-25  7:50       ` Jakub Jelinek
2014-06-26  1:06         ` Kugan
2014-06-26  2:48           ` Kugan
2014-06-26  5:50           ` Jakub Jelinek
2014-06-26  9:41             ` Kugan
2014-06-26 10:12               ` Jakub Jelinek
2014-06-26 10:42                 ` Jakub Jelinek
2014-07-01  8:21                 ` Kugan
2014-07-07  6:52                   ` Kugan
2014-07-07  8:06                     ` Jakub Jelinek
2014-06-26 10:25               ` Andreas Schwab
2014-07-01  8:28                 ` Kugan
2014-06-24 11:53 ` [PATCH 2/2] Enable elimination of zext/sext Kugan
2014-06-24 12:21   ` Jakub Jelinek
2014-06-25  8:15     ` Kugan
2014-06-25  8:36       ` Jakub Jelinek
2014-07-07  6:55         ` Kugan
2014-07-10 12:15           ` Richard Biener
2014-07-11 11:52             ` Kugan
2014-07-11 12:47               ` Richard Biener
2014-07-14  2:58                 ` Kugan
2014-07-14 20:11                   ` Bernhard Reutner-Fischer
2014-07-23 14:22                   ` Richard Biener
2014-08-01  4:51                     ` Kugan
2014-08-01 11:16                       ` Richard Biener
2014-08-01 16:04                         ` Kugan
2014-08-03 23:56                           ` Kugan
2014-08-05 14:18                           ` Richard Biener
2014-08-05 14:21                             ` Jakub Jelinek
2014-08-06 12:09                               ` Richard Biener
2014-08-06 13:22                                 ` Kugan
2014-08-06 13:29                                   ` Richard Biener
2014-08-07  5:25                                     ` Kugan
2014-08-07  8:09                                       ` Richard Biener

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=20140624121812.GW31640@tucnak.redhat.com \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kugan.vivekanandarajah@linaro.org \
    --cc=rth@redhat.com \
    /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).