Re:Getting 4 bytes or a full cache line: same speed or not?
by Const-me on Thursday August 02, 2018 @01:48PM
(#17673641)
> You need not to change arch
See the pics: http://const.me/tmp/vc/codegen.png http://const.me/tmp/vc/optimize.png
> You need to find docs on compiler optimization techniques
Indeed, #pragma loop(no_vector) in the source code before the inner loop did the trick. The results are very close to GCC.
It doesn't matter really. It is amount of work that needed for experiment.
> I can’t. When I try, the compiler says “Command line warning D9002: ignoring unknown option '/arch:IA32'”
I have zero experience with msvc, but I believe you are doing it wrong. You need not to change arch, you need to control over optimizations. For example, gcc has options -ftree-vectorize, -ftree-loop-vectorize, and -fno-tree-vectorize and so on. You need to find docs on compiler optimization techniques and on options that allow to control them.
> MS compiler doesn’t support scalar code anymore.
Strange, but ok. If we return to the starting question "why the author didn't write the code portably", than we now know the answer. There are no way to write scalar code with MSVC. MSVC doesn't allow make this kind of experiments, so there are no reasons to make such tests portable to msvc.