This patch based on one by Peter Collingbourne changes libgo to use the
somewhat portable _mm_pause intrinsic rather than the GCC-specific
__builtin_ia32_pause builtin function. This makes it easier to compile
libgo with compilers other than GCC. Bootstrapped and ran Go testsuite
on x86_64-unknown-linux-gnu. Committed to mainline.
Ian
diff -r 4d88292e0727 libgo/runtime/yield.c
--- a/libgo/runtime/yield.c Thu May 29 13:21:58 2014 -0700
+++ b/libgo/runtime/yield.c Fri May 30 06:51:16 2014 -0700
@@ -14,6 +14,10 @@
#include <sys/select.h>
#endif
+#if defined (__i386__) || defined (__x86_64__)
+#include <xmmintrin.h>
+#endif
+
#include "runtime.h"
/* Spin wait. */
@@ -26,7 +30,7 @@
for (i = 0; i < cnt; ++i)
{
#if defined (__i386__) || defined (__x86_64__)
- __builtin_ia32_pause ();
+ _mm_pause ();
#endif
}
}