We are trying to add a 16bit integer division library function for
bfin port. I just found GCC didn't do integral promotions when calling
library function.

For example, in function foo, I can assume both arguments are zero
extended from unsigned short to unsigned int.

extern unsigned short foo (unsigned short, unsigned short);
unsigned int a;
unsigned int b;
unsigned short bar ()
{
    return foo ((unsigned short) a, (unsigned short) b);
}

But with the following code, I can't assume that the high halves of R0
and R1, which are the first two registers for argument passing, are
all zeros.

unsigned int a;
unsigned int b;
unsigned short bar ()
{
    return (unsigned short) a / (unsigned short) b;
}

Is this expected?

Thanks,
Jie

Reply via email to