[PATCH] don't use cmov on i[45]86

Nicholas Miell <[email protected]>
Newsgroups gmane.comp.lib.phil
Message-ID <1059454382.18420.1.camel@entropy>
[Please CC:, not subscribed, etc.]

The generic i486 version of pthread_cond_timedwait blindly uses the cmov
instruction, which wasn't introduced until the i686. The attached patch
(against 0.55) fixes pthread_cond_timedwait to use HAVE_CMOV in a manner
similar to pthread_spin_trylock.

With this patch, I can build an (apparently) fully functional
NPTL-enabled glibc for i586 processors.
glibc-nptl-have-cmov.patch (text/plain, 853 B)
--- libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S.~1~	2003-06-27 01:10:23.000000000 -0700
+++ libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S	2003-07-28 21:06:09.000000000 -0700
@@ -226,7 +226,13 @@
 
 	/* We return the result of the mutex_lock operation if it failed.  */
 	testl	%eax, %eax
+#ifdef HAVE_CMOV
 	cmovel	%esi, %eax
+#else
+	jne	22f
+	movl	%esi, %eax
+22:
+#endif
 
 18:	popl	%ebx
 .Lpop_ebx:
--- libc/nptl/sysdeps/unix/sysv/linux/i386/i686/pthread_cond_timedwait.S.~1~	2003-01-28 14:05:38.000000000 -0800
+++ libc/nptl/sysdeps/unix/sysv/linux/i386/i686/pthread_cond_timedwait.S	2003-07-28 21:02:48.000000000 -0700
@@ -17,4 +17,5 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#define HAVE_CMOV 1
 #include "../i486/pthread_cond_timedwait.S"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.