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: Mon, 9 Nov 2015 13:10:49 -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> <1446838073 dot 3867 dot 19 dot camel at ubuntu-sellcey> <563CFF8A dot 9050900 at redhat dot com> <1447088342 dot 3867 dot 27 dot camel at ubuntu-sellcey> <56410672 dot 6050807 at redhat dot com>
- Reply-to: <sellcey at imgtec dot com>
On Mon, 2015-11-09 at 21:47 +0100, Bernd Schmidt wrote:
> On 11/09/2015 05:59 PM, Steve Ellcey wrote:
> > Here is a version with the code moved into a new function. How does
> > this look?
> >
> > 2015-11-09 Steve Ellcey <sellcey@imgtec.com>
> >
> > * optabs.c (prepare_libcall_arg): New function.
> > (expand_fixed_convert): Add call to prepare_libcall_arg.
>
> Hold on a moment - I see that emit_library_call_value_1 calls
> promote_function_mode for arguments. Can you investigate why that
> doesn't do what you need?
>
>
> Bernd
emit_library_call_value_1 has no way of knowing if the promotion should
be signed or unsigned because it has a mode (probably QImode or HImode)
that it knows may need to be promoted to SImode but it has no way to
know if that should be a signed or unsigned promotion because it has no
tree type information about the library call argument types.
Right now it guesses based on the return type but it may guess wrong
when converting an unsigned int to a signed fixed type or visa versa.
By doing the promotion in expand_fixed_convert GCC can use the uintp
argument to ensure that the signedness of the promotion is done
correctly. We could pass that argument into emit_library_call_value_1
so it can do the correct promotion but that would require changing the
argument list for emit_library_call and emit_library_call_value_1 and
changing all the other call locations for those functions and that
seemed like overkill.
Steve Ellcey