[Liboil-commit] liboil/liboilcpu-x86.c

David Schleef ds at kemper.freedesktop.org
Mon Dec 8 17:35:10 PST 2008


 liboil/liboilcpu-x86.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 89703e8d6c57c5427a7387d5069af1276d6ca22b
Author: David Schleef <ds at hutch-2.local>
Date:   Mon Dec 8 17:34:46 2008 -0800

    Fix cpu detection on OS/X

diff --git a/liboil/liboilcpu-x86.c b/liboil/liboilcpu-x86.c
index 56f7790..ae7261f 100644
--- a/liboil/liboilcpu-x86.c
+++ b/liboil/liboilcpu-x86.c
@@ -302,7 +302,17 @@ oil_cpu_detect_getisax (void)
 static void
 oil_cpu_detect_kernel_support (void)
 {
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__APPLE__)
+#if defined(__APPLE__)
+  int ret, enabled;
+  size_t len;
+
+  len = sizeof(enabled);
+  ret = sysctlbyname("hw.optional.sse", &enabled, &len, NULL, 0);
+  if (ret || !enabled) {
+    oil_cpu_flags &= ~(OIL_IMPL_FLAG_SSE | OIL_IMPL_FLAG_SSE2 |
+		       OIL_IMPL_FLAG_MMXEXT | OIL_IMPL_FLAG_SSE3);
+  }
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
   int ret, enabled;
   size_t len;
 


More information about the Liboil-commit mailing list