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: Suboptimal code generated for _Bool


Marcin 'Qrczak' Kowalczyk wrote:
The movzbl is completely unnecessary. It's inserted even if the called
function is inline.

This is an issue that has come up several times before already. The culprit is a bit of code near the end of c-decl.c start_function that always promotes return types to int if they are integer types smaller than int. This code has been present since gcc-1.x, and serves no apparent purpose, at least for an ISO C compiler. All it does is make the resulting code run slower.


However, there is some risk that we will introduce silent ABI changes to some ports that were accidentally relying on this bogus code. But if so, those ports should be fixed.

It is possible that there is already a patch in the gcc-patches queue for this. I am way behind on my gcc-patches reading.

Incidentally, there is similar code in the C++ front end in gcc/cp/decl.c, start_preparsed_function. Just search for c_promoting_integer_type_p and whack it.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



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