This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch] Change to argument promotion in fixed conversion library calls
- From: Steve Ellcey <sellcey at imgtec dot com>
- To: Bernd Schmidt <bschmidt at redhat dot com>
- Cc: <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 6 Nov 2015 11:27:53 -0800
- Subject: Re: [Patch] Change to argument promotion in fixed conversion library calls
- Authentication-results: sourceware.org; auth=none
- References: <15881f44-1bed-4fda-a47c-45234f9c091e at BAMAIL02 dot ba dot imgtec dot org> <563CFC33 dot 8050004 at redhat dot com>
- Reply-to: <sellcey at imgtec dot 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