public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Steve Ellcey <sellcey@imgtec.com>
To: Bernd Schmidt <bschmidt@redhat.com>
Cc: <gcc-patches@gcc.gnu.org>
Subject: Re: [Patch] Change to argument promotion in fixed conversion library calls
Date: Fri, 06 Nov 2015 19:28:00 -0000	[thread overview]
Message-ID: <1446838073.3867.19.camel@ubuntu-sellcey> (raw)
In-Reply-To: <563CFC33.8050004@redhat.com>

On Fri, 2015-11-06 at 20:14 +0100, Bernd Schmidt wrote:

> 
> > +  if (SCALAR_INT_MODE_P (from_mode))
> > +    {
> > +      /*  If we need to promote the integer function argument we need to do
> 
> Extra space at the start of the comment.
> 
> > +	  it here instead of inside emit_library_call_value because here we
> > +	  know if we should be doing a signed or unsigned promotion.  */
> > +
> > +      machine_mode arg_mode;
> > +      int unsigned_p = 0;
> > +
> > +      arg_mode = promote_function_mode (NULL_TREE, from_mode,
> > +					&unsigned_p, NULL_TREE, 0);
> > +      if (arg_mode != from_mode)
> > +	{
> > +	  from = convert_to_mode (arg_mode, from, uintp);
> > +	  from_mode = arg_mode;
> > +	}
> > +    }
> 
> Move this into a separate function (prepare_libcall_arg)? I'll think 
> about it over the weekend and let others chime in if they want, but I 
> think I'll probably end up approving it with that change.
> 
> 
> Bernd

Are you thinking of a simple function that is called on all targets or a
target specific function?  Maybe a target specific function would be
safer.

We could have:

from = targetm.prepare_libcall_arg (from, uintp);
from_mode = GET_MODE (from);

And have the default prepare_libcall_arg simply return the original
'from' rtx value.  We could also pass some other arguments, maybe the
library call rtx (fun) and an integer to specify what argument this is
(1, 2, 3, ...) if we wanted to try and generalize it even more.

Steve Ellcey
sellcey@imgtec.com



  reply	other threads:[~2015-11-06 19:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-06 19:04 Steve Ellcey 
2015-11-06 19:15 ` Bernd Schmidt
2015-11-06 19:28   ` Steve Ellcey [this message]
2015-11-06 19:29     ` Bernd Schmidt
2015-11-09 16:59       ` Steve Ellcey
2015-11-09 20:47         ` Bernd Schmidt
2015-11-09 21:10           ` Steve Ellcey
2015-11-09 23:33             ` Bernd Schmidt
2015-11-09 15:03   ` 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=1446838073.3867.19.camel@ubuntu-sellcey \
    --to=sellcey@imgtec.com \
    --cc=bschmidt@redhat.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).