Abusive (?) promotions to int

Alexandre Courbot Alexandre.Courbot@lifl.fr
Wed Sep 24 10:21:00 GMT 2003


Hello everybody,

I've been looking for macros to control integer promotions, especially for 
temporary statements. Consider for instance the following code:

    char c;
    ...
    if (c + 4 > 10) ...

On my target, c gets zero_extended to int, then the addition and comparison 
are performed in SImode, while it is not really necessary (could be done in 
QImode as well and would save the zero_extend). This results in sub-optimal 
code and additional memory requirements (which is important since I'm porting 
to a smartcard target).

Is it possible to get rid of this? Is there a macro that can control that? 
I've been looking at PROMOTE_MODE and SLOW_BYTE_ACCESS but it looks like they 
can't do much for this.

Thanks in advance,
Alex.



More information about the Gcc mailing list