public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 1/3] expr: Allow scalar_int_mode target mode when converting a constant
Date: Wed, 22 Jul 2020 09:33:47 +0100	[thread overview]
Message-ID: <mptd04ouexg.fsf@arm.com> (raw)
In-Reply-To: <20200721182415.xekt7zd5eiwqr2my@jozef-acer-manjaro> (Jozef Lawrynowicz's message of "Tue, 21 Jul 2020 19:24:15 +0100")

Jozef Lawrynowicz <jozef.l@mittosystems.com> writes:
> is_int_mode does not allow MODE_PARTIAL_INT modes, so convert_modes was
> not allowing a constant value to be converted to a MODE_PARTIAL_INT for
> use as operand 2 in patterns such as ashlpsi3. The constant had
> to be copied into a register before it could be used, but now can be
> used directly as an operand without any copying.

Yeah.  I guess this dates back to when MODE_PARTIAL_INTs didn't have
a known precision.

> diff --git a/gcc/expr.c b/gcc/expr.c
> index c7c3e9fd655..5a252f0935f 100644
> --- a/gcc/expr.c
> +++ b/gcc/expr.c
> @@ -696,7 +696,7 @@ convert_modes (machine_mode mode, machine_mode oldmode, rtx x, int unsignedp)
>      return x;
>  
>    if (CONST_SCALAR_INT_P (x)
> -      && is_int_mode (mode, &int_mode))
> +      && is_a <scalar_int_mode> (mode, &int_mode))
>      {
>        /* If the caller did not tell us the old mode, then there is not
>  	 much to do with respect to canonicalization.  We have to

I think we also need to change the condition in:

      /* If the caller did not tell us the old mode, then there is not
	 much to do with respect to canonicalization.  We have to
	 assume that all the bits are significant.  */
      if (GET_MODE_CLASS (oldmode) != MODE_INT)

to is_a <scalar_int_mode> (old_mode)

OK with that, thanks.

Richard

  reply	other threads:[~2020-07-22  8:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-21 18:17 [PATCH 0/3] MSP430: Improve code-generation for shift instructions Jozef Lawrynowicz
2020-07-21 18:24 ` [PATCH 1/3] expr: Allow scalar_int_mode target mode when converting a constant Jozef Lawrynowicz
2020-07-22  8:33   ` Richard Sandiford [this message]
2020-07-22  9:48     ` Jozef Lawrynowicz
2020-07-24 14:14       ` Richard Sandiford
2020-07-21 18:26 ` [PATCH 2/3] expmed: Fix possible use of NULL_RTX return value from emit_store_flag Jozef Lawrynowicz
2020-07-22  8:38   ` Richard Sandiford
2020-07-21 18:29 ` [PATCH 3/3] MSP430: Simplify and extend shift instruction patterns Jozef Lawrynowicz
2020-08-07 10:55   ` ping " Jozef Lawrynowicz
2020-08-25 19:16   ` Jeff Law

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=mptd04ouexg.fsf@arm.com \
    --to=richard.sandiford@arm.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).