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


Thanks, David. Some follow up questions:

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.

Is the best solution to use variable types that are architecture-specific? For example, defining a series of variable types that reflect every possible interpretation of the x86 XMM register file? Or should we be more general about it and allow for arrays of type int/float and hope that the compiler will vectorise them? There are certain groups that are commonly used - for example, a matrix of 2x2 floating point numbers, or an array of 3 or 4 pairs of floats. Should they have their own variable type?

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.

Well, some code that is perfectly legal for both the 68000 and 68060 chips will not work correctly on the 68060 due to errata. Certain instruction sequences are not executed correctly even though they should be - and one would only know if one reads the errata documents. I wonder whether gcc avoids such instruction sequences.


Richard



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