'How to instruct c++ compiler to automatically use SIMD instructions? [duplicate]

Let's say I have a generic c++ code based on c++ standard. This code is meant to run on windows 64 bit and Linux 64 bit.

Can we direct the compiler to make use of intrinsics automatically? i.e. I don't want to write any instructions available. What I want is to compiler automatically use any intrinsics if available for my normal c++ code. If this is possible, then how to do it for Visual studio in windows and on Linux?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source