1 #include "libpbd-config.h"
3 #define _XOPEN_SOURCE 600
4 #include <cstring> // for memset
18 unsigned long cpuflags = 0;
27 #ifndef USE_X86_64_ASM
36 : "%eax", "%ecx", "%edx"
41 /* asm notes: although we explicitly save&restore rbx, we must tell
42 gcc that ebx,rbx is clobbered so that it doesn't try to use it as an intermediate
43 register when storing rbx. gcc 4.3 didn't make this "mistake", but gcc 4.4
44 does, at least on x86_64.
55 : "%rax", "%rbx", "%rcx", "%rdx"
58 #endif /* USE_X86_64_ASM */
60 if (cpuflags & (1<<25)) {
61 _flags = Flags (_flags | (HasSSE|HasFlushToZero));
64 if (cpuflags & (1<<26)) {
65 _flags = Flags (_flags | HasSSE2);
68 if (cpuflags & (1 << 24)) {
72 #ifdef NO_POSIX_MEMALIGN
73 if ((fxbuf = (char *) malloc(512)) == 0)
75 if (posix_memalign ((void**)&fxbuf, 16, 512))
78 error << _("cannot allocate 16 byte aligned buffer for h/w feature detection") << endmsg;
81 memset (fxbuf, 0, 512);
90 uint32_t mxcsr_mask = *((uint32_t*) &fxbuf[28]);
92 /* if the mask is zero, set its default value (from intel specs) */
94 if (mxcsr_mask == 0) {
98 if (mxcsr_mask & (1<<6)) {
99 _flags = Flags (_flags | HasDenormalsAreZero);