This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Abusive (?) promotions to int
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Alexandre Courbot <Alexandre dot Courbot at lifl dot fr>
- Cc: gcc at gcc dot gnu dot org
- Date: 24 Sep 2003 12:20:25 +0200
- Subject: Re: Abusive (?) promotions to int
- Organization: Integrable Solutions
- References: <200309241200.55125.Alexandre.Courbot@lifl.fr>
Alexandre Courbot <Alexandre.Courbot@lifl.fr> writes:
| 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).
Promotion to int is standard C (and C++) requirement.
c + 4 may not be not fit into a QImode without semantics mutation.
I suggest you have a look at what the C and C++ standards have to say
on that.
-- Gaby