New filters on the Home Feed, take a look!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

14
Different SIMD codepaths chosen at runtime based on CPU executing C++ executable
Post Body

Hey guys,

If you release an x86 app which needs some SIMD functions where the instructions are decided at runtime based on the CPU (eg. AMD has 128 bit register whereas new intel has 256 or 512).

Specifically, I want to compile the exe once, and if executed on a Haswell chip would use AVX2 instructions and if used on a Ryzen chip used the respective 128bit register size instructions.

Which compilers do this runtime branching automatically in the auto-vectorizer? I use GCC, clang, MSVC and ICC, and couldn't find documentation on this specifically.

If not do I have to implement this by hand in intrinsics? I wouldn't mind doing it for simple std::vector math operations and releasing it on github.

Author
Account Strength
100%
Account Age
12 years
Verified Email
Yes
Verified Flair
No
Total Karma
149,784
Link Karma
18,628
Comment Karma
129,169
Profile updated: 3 days ago
Posts updated: 6 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
7 years ago