This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Integer promotion for register based arguments
On 07/26/2012 09:03 AM, Jon Beniston wrote:
> Hi Eric,
>
>>> I guess my question is what would I need to change to make it work
>>> like the ARM port? I can't see how this is being controlled.
>>
>> Try TARGET_PROMOTE_PROTOTYPES.
>
> Thanks, actually it does turn out to be this, but I was confused by the
> documentation. If this returns true, I see sign extension performed in the
> callee, if false, no sign extension is performed in the callee.
>
> The documentation for this comes under the " Passing Function Arguments on
> the Stack" section, which says:
>
> "This target hook returns true if an argument declared in a prototype as an
> integral type smaller than int should actually be passed as an int. In
> addition to avoiding errors in certain cases of mismatch, it also makes for
> better code on certain machines."
>
> I would have thought if the args smaller than an int are actually passed as
> an int, that would have meant the promotion had already taken place and so
> wasn't needed in the callee. It could also be said that it makes worse code
> on other machines :)
Indeed. If that's true, then either the doc or the code is wrong, or at
least highly misleading.
Andrew.
.