None of them are exposed on ANSI C.
None of them are exposed on ANSI C.
#include <mmintrin.h> // Intel MMX
#include <xmmintrin.h> // Intel SSE
#include <emmintrin.h> // Intel SSE2
#include <pmmintrin.h> // Intel SSE3
#include <tmmintrin.h> // Intel SSSE3
#include <smmintrin.h> // Intel SSE4.1
#include <nmmintrin.h> // Intel SSE4.2
#include <ammintrin.h> // Intel SSE4A
#include <wmmintrin.h> // Intel AES
#include <immintrin.h> // Intel AVX
#include <zmmintrin.h> // Intel AVX-512
#include <arm_neon.h> // ARM NEON
#include <mmintrin.h> // ARM WMMX
And a full list of what is possible in Microsoft Visual C: http://msdn.microsoft.com/en-us/library/hh977022.aspx
Now the reason why they are not in ANSI C is that low-level CPU features (just like raw instructions) are not portable by nature.
Additionally not all C compilers provide such headers.
http://msdn.microsoft.com/en-us/library/hh977022.aspx
I do not think one has full control over OOO execution on x86-64 processors. Also I do not believe one has control over the execution pipeline even in assembly, although I do not know exactly what you mean by that, so it could just be a misunderstanding.
With NUMA physical memory ordering gets even uglier, usually each physical socket's memory is in a big chunk, but sometimes it's also interleaved every 4 kB.
From the Linux kernel:
struct boot_params boot_params __attribute__((aligned(16)));
#if !__GNUC__
#define __attribute__(x)
#endif
I think that's a better way to do it than ASM (which totally hoses your portability).Some of them are no different than just writing plain Assembly.
Hence why even if C looks like a portable high level Assembler, there are many modern CPU features not available.
Even most common extensions just cover part of them.
Not all titles do this, since most titles are cross-platform and you're not going to do tons of optimization for a specific one unless there is a huge payoff.
Instruction set extensions (which I believe might be what you were thinking of) are used via intrinsics and assembly programming by pretty much any performance-oriented code. For example look at the dozens of architecture-specific implementations of glibc functions: x86-64[0], arm[1].
[0] https://sourceware.org/git/?p=glibc.git;a=tree;f=sysdeps/x86... [1] https://sourceware.org/git/?p=glibc.git;a=tree;f=sysdeps/arm...
The headers I linked to here: https://news.ycombinator.com/item?id=8873764 Cover most useful Intel CPU extensions. And you can use them easily in code, it just sucks when you have to do CPU feature detection and have different code paths for different CPUs.
In the Linux kernel they went so far as to actually replacing instructions at boot-time at known locations, based on the capabilities of the CPU the code is executing on. This prevents them from maintaining many paths in the compiled code.