Finally: Mac Intel patches

Mikael Pettersson <>
Thu Aug 24 21:49:33 CEST 2006


On Thu, 24 Aug 2006 09:19:03 -0700, Bob Ippolito wrote:
>> > I see. Mea culpa. I've extracted fpe-test.c from erts/configure
>> > and put it in the HiPE snapshot directory. You should download it
>> > and try to compile and run it. How does it fail? With a compile-time
>> > error or a runtime failure?
>>
>> The easiest way out of this is to assume DARWIN + i386 will always
>> have SSE2 ;-).
>
>Well, Apple has never and will never sell an x86 machine without SSE2,
>so that's a rather safe bet. I don't think supporting pure Darwin is
>really very interesting, especially on old hardware.

I've only seen the "bx is clobbered" error with gcc -fPIC before,
so I assume Darwin does that by default?

I'm appending a patch to make Darwin/x86 imply having SSE2, just
like on x86-64 and in Joel's original patches. This should fix
the failed FP exceptions test and the resulting linkage error.
Let us know if it works so I can push the final Darwin changes
into the HiPE/OTP sources.

The patch is also available in the HiPE snapshot directory
as `patch-otp-0804-8-darwin-x86-sse2-unconditional'.

/Mikael

--- otp-0804/erts/configure.in.~1~	2006-08-24 21:03:23.000000000 +0200
+++ otp-0804/erts/configure.in	2006-08-24 21:06:47.000000000 +0200
@@ -1512,7 +1512,7 @@ static void unmask_sse2(void)
     __asm__ __volatile__("ldmxcsr %0" : : "m"(mxcsr));
 }
 
-#if defined(__x86_64__)
+#if defined(__x86_64__) || defined(__DARWIN__)
 static inline int cpu_has_sse2(void) { return 1; }
 #else /* !__x86_64__ */
 /*
--- otp-0804/erts/configure.~1~	2006-08-24 21:03:23.000000000 +0200
+++ otp-0804/erts/configure	2006-08-24 21:06:25.000000000 +0200
@@ -6881,7 +6881,7 @@ static void unmask_sse2(void)
     __asm__ __volatile__("ldmxcsr %0" : : "m"(mxcsr));
 }
 
-#if defined(__x86_64__)
+#if defined(__x86_64__) || defined(__DARWIN__)
 static inline int cpu_has_sse2(void) { return 1; }
 #else /* !__x86_64__ */
 /*
--- otp-0804/erts/emulator/sys/unix/sys_float.c.~1~	2006-08-24 21:03:23.000000000 +0200
+++ otp-0804/erts/emulator/sys/unix/sys_float.c	2006-08-24 21:11:31.000000000 +0200
@@ -109,7 +109,7 @@ static void unmask_sse2(void)
     __asm__ __volatile__("ldmxcsr %0" : : "m"(mxcsr));
 }
 
-#if defined(__x86_64__)
+#if defined(__x86_64__) || defined(__DARWIN__)
 static inline int cpu_has_sse2(void) { return 1; }
 #else /* !__x86_64__ */
 /*



More information about the erlang-questions mailing list