Hi,

I've tried compiling the following program targeting both MIPS, LM32 and
ARM.

long a, b;

void func(short p)
{
        b = (long)p;
}

int main()
{
        if(a < 2)
                func((short)a);
        return 0;
}

For MIPS and LM32, truncation is performed in the calling function and sign
extension in the called function. One of these operations seems redundant.
For ARM, truncation is performed in the caller, but sign-extension isn't
performed in the callee, which seems more efficient. Why might this be? 

- PROMOTE_MODE is defined for all targets such that HImode should be
promoted.
- TARGET_PROMOTE_FUNCTION_MODE is also defined for all targets such that
function arguments should be promoted.

Are there other target macros that control this?

Thanks,
Jon


Reply via email to