public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com
Subject: Re: [PATCH 1/3] expr: Allow scalar_int_mode target mode when converting a constant
Date: Wed, 22 Jul 2020 10:48:55 +0100	[thread overview]
Message-ID: <20200722094855.dbpua4635rmncz2d@jozef-acer-manjaro> (raw)
In-Reply-To: <mptd04ouexg.fsf@arm.com>

On Wed, Jul 22, 2020 at 09:33:47AM +0100, Richard Sandiford wrote:
> 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.

Is that what the section on MODE_PARTIAL_INT in the description for the
"subreg" RTX refers to?  From "14.8 Registers and Memory" of gccint:

  A MODE_PARTIAL_INT mode behaves as if it were as wide as the corresponding
  MODE_INT mode, except that it has an unknown number of undefined bits.

If so, that whole section seems out of date. I can work on getting it
fixed up.

> 
> > 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.

Thanks, I'll regtest that change and apply if all looks good.

Jozef
> 
> Richard

  reply	other threads:[~2020-07-22  9:48 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
2020-07-22  9:48     ` Jozef Lawrynowicz [this message]
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=20200722094855.dbpua4635rmncz2d@jozef-acer-manjaro \
    --to=jozef.l@mittosystems.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.sandiford@arm.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).