This is the mail archive of the gcc-help@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: Questions about code generation


On 29/11/2010 03:48, richardcavell@mail.com wrote:
Hi all,

1. Some microchips have errata that can be corrected with a microcode
update (eg Intel Core 2 Duo). Does GCC take these errata into account
when generating code? Does GCC assume that the latest microcode update
is always present?

2. Some microchips have errata that cannot be fixed (eg Motorola 68060).
Does GCC take these errata into account?


Most processors don't have support for updating microcode, and gcc takes known bugs into account.


3. Can GCC emit single-instruction, multiple-data instructions when
compiling C/C++ code that uses builtin variable types (eg int, float,
bool) ?


It is typically possible, but it depends on the compile-time flags you use and the exact formulation of the source code. Don't expect that the compiler will be able to read your mind here - there are all sorts of subtleties that come into play with automatic vectorisation. gcc will err on the side of generating definitely correct code, rather than generating fast code that might be wrong due to things like aliasing issues.


4. Does GCC ever check which model or stepping of a processor is being
used and then provide multiple code pathways, one being more optimised
or less buggy than the other, where the programmer has not done so
explicitly, say with operating system calls?


gcc does not knowingly produce buggy code - therefore it cannot produce code that is "less buggy". But I believe it can produce alternate pathways that are chosen at runtime according to the processor being used - though I haven't worked with such code myself.


5. When compiling code for a 32-bit x86 target, how does the speed of
the generated code compare to that created by Visual C++ from the same
source? I know "it depends", but is it generally slower?


No, I think gcc is "generally" faster - but, as you say, the answer is "it depends". It is going to vary a bit according to the type of code, and also on the effort you are willing to make using different flags and options. Sometimes getting the very best out a particular compiler (gcc, vc++, etc.) will depend on a particular mix of flags and options. An alternative, which will give you the best results if done right, is profile-based optimisation.



If the real reason for your post is to ask if gcc is a suitable choice of compiler for a windows software project, then the answer is simply "yes". Though I don't do much Windows programming in C (I use C on embedded systems, and Python on PC's), I would certainly choose gcc over vc++.



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