View Single Post
Old 30th January 2017, 00:02   #57  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Now you see why asm is kinda your friend.

There's a pile of pitfalls here you missed. And some you found.

1. You compile the whole file with avx2/whatever instrction set you selected. That means avx2 instructions may be emitted for you plain C++ code too. Solve it by placing the avx2 code in a separate file and use different compiler settings.

2. You can't put sse and avx intrinsics in the same file either. For example subps can get turned into vsubps to reduce register copies. So then the sse path needs avx too...

3. Cpuid is horrible in intrinsics, that's why I use asm. Lrn2yasm. Or write code that requires gcc or clang where convenient intrinsics are available. Clang is even available as a simple dropin for visual studio nowadays.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote