4 ms·
Good to see a detailed study on this --- it's been my experience that Intel's compiler (icc) is far less eager to exploit undefined behaviour, yet generates jus
by userbinator 8y ago
Good to see a detailed study on this --- it's been my experience that Intel's compiler (icc) is far less eager to exploit undefined behaviour, yet generates just as competitive if not sometimes significantly better code than GCC.
It's also worth mentioning the note that the standard has about UB (emphasis mine): "Possible undefined behavior ranges from ignoring the situation completely with unpredictable results, to behaving during translation or program execution in a documented manner characteristic of the environment (with or without the issuance of a diagnostic message), to terminating a translation or execution (with the issuance of a diagnostic message)."
That emphasised part is what the majority of programmers using C expect.
- colejohnson66 8y agoCould that be because of ICC’s dispatch code? It compiles code for different feature sets and then uses the CPUID feature list to know which to run.
- userbinator 8y agoThat's for autovectorisation, but my experience has been that icc's regular scalar code generation is what makes it perform so well. Instruction selection, register allocation, etc.
- conistonwater 8y agoAren't those common to all compilers? So it just does everything that clang/gcc do also, but does it better?
- naikrovek 8y agoDepending on what you are doing a bit, stuff compiled with `icc` runs about 20% faster than the same code compiled with `gcc` or MSVC's compiler on Intel CPUs.
- colejohnson66 8y agoInteresting. Any links to benchmarks?
- earenndil 8y agoHmmm. The one time I tried it (for a crypto miner), it ran about 60% the speed of gcc and clang (which were comparable; one was slightly ahead, I forget which but I think it was gcc). Granted, I may have gotten the flags wrong (there were a lot of them), but I turned all the ones that looked relevant.
- keldaris 8y agoWould you happen to know if recent versions of icc still generate horrible code for AMD CPUs (particularly Ryzen/EPYC)?
- zzo38computer 8y agoGCC has some options that you can specify in order to change how some of the undefined behaviour stuff is implemented.