summaryrefslogtreecommitdiff
path: root/libs/pbd/fpu.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-04-24 02:43:52 +0200
committerRobin Gareus <robin@gareus.org>2015-04-24 02:43:52 +0200
commit6cb742c289cd27b987b645d529b10ae07b28bbe3 (patch)
treee2940920c20d958dac042d5c63fc0e227130379e /libs/pbd/fpu.cc
parent63b3d06fd7ef82bca9150b9dd7c178fc97b844e3 (diff)
windows 32bit asm/fpu support.
This still leaves cache_aligned_malloc() in libs/pbd/malign.cc pending _aligned_free (windows crashes when using free() on memory allocated with _aligned_malloc()). So far however there seems to be no issue with default malloc for audio+midi buffers on win32…
Diffstat (limited to 'libs/pbd/fpu.cc')
-rw-r--r--libs/pbd/fpu.cc22
1 files changed, 15 insertions, 7 deletions
diff --git a/libs/pbd/fpu.cc b/libs/pbd/fpu.cc
index ad80e0c93c..76de065d28 100644
--- a/libs/pbd/fpu.cc
+++ b/libs/pbd/fpu.cc
@@ -49,17 +49,12 @@ FPU::FPU ()
#ifdef PLATFORM_WINDOWS
-#ifndef USE_X86_64_ASM
- /* no 32 bit version of assembler for windows */
- return;
-#else
// Get CPU flags using Microsoft function
// It works for both 64 and 32 bit systems
// no need to use assembler for getting info from register, this function does this for us
int cpuInfo[4];
__cpuid (cpuInfo, 1);
cpuflags = cpuInfo[3];
-#endif
#else
@@ -98,7 +93,7 @@ FPU::FPU ()
: "%rax", "%rbx", "%rcx", "%rdx"
);
-#endif /* USE_X86_64_ASM */
+#endif /* _LP64 */
#endif /* PLATFORM_WINDOWS */
if (cpuflags & (1<<25)) {
@@ -122,12 +117,20 @@ FPU::FPU ()
31 for the MXCSR_MASK value. If bit 6 is set, DAZ is
supported, otherwise, it isn't.
*/
-
+
#ifndef HAVE_POSIX_MEMALIGN
+# ifdef PLATFORM_WINDOWS
+ fxbuf = (char **) _aligned_malloc (sizeof (char *), 16);
+ assert (fxbuf);
+ *fxbuf = (char *) _aligned_malloc (512, 16);
+ assert (*fxbuf);
+# else
+# warning using default malloc for aligned memory
fxbuf = (char **) malloc (sizeof (char *));
assert (fxbuf);
*fxbuf = (char *) malloc (512);
assert (*fxbuf);
+# endif
#else
(void) posix_memalign ((void **) &fxbuf, 16, sizeof (char *));
assert (fxbuf);
@@ -163,8 +166,13 @@ FPU::FPU ()
_flags = Flags (_flags | HasDenormalsAreZero);
}
+#if !defined HAVE_POSIX_MEMALIGN && defined PLATFORM_WINDOWS
+ _aligned_free (*fxbuf);
+ _aligned_free (fxbuf);
+#else
free (*fxbuf);
free (fxbuf);
+#endif
}
#endif
}