This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Abusive (?) promotions to int


> -----Original Message-----
> From: Alexandre Courbot [mailto:Alexandre.Courbot@lifl.fr]
> Sent: Wednesday, September 24, 2003 3:31 PM
> To: gcc@gcc.gnu.org
> Subject: Abusive (?) promotions to int
> 
> 
> 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.

C promotes chars to int in such cases automatically. You can't expect
compilers to behave different when standards state unambiguously. 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]