public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix x86_64 __FP_CLZ
@ 2007-01-10 19:31 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2007-01-10 19:31 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Glibc hackers

Hi!

bsrq %rdx, %eax ins not a valid instruction.  While we could tweak these
macros to store result in the same sized variable as input and only then
copy to r and furthermore handle the various sizeof (x) cases, GCC 3.4+
contains __builtin_clz{,l,ll} and the generic soft-fp.h definition already
handles that all (plus __builtin_clz expands to bsrl on i?86/x86_64
and __builtin_clzl on x86_64 to bsrq).

2007-01-10  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/i386/soft-fp/sfp-machine.h (__FP_CLZ): Remove.
	* sysdeps/x86_64/soft-fp/sfp-machine.h (__FP_CLZ): Likewise.

--- libc/sysdeps/i386/soft-fp/sfp-machine.h.jj	2002-11-01 22:49:28.000000000 +0100
+++ libc/sysdeps/i386/soft-fp/sfp-machine.h	2007-01-10 12:15:01.000000000 +0100
@@ -27,12 +27,6 @@
 	  : "0"(xh), "1"(xl), "g"(yh), "g"(yl)				\
 	  : "cc")
 
-#define __FP_CLZ(r, x)							\
-  do {									\
-    __asm__("bsrl %1,%0" : "=r"(r) : "g"(x) : "cc");			\
-    r ^= 31;								\
-  } while (0)
-
 #define _i386_mul_32_64(rh, rl, x, y)					\
   __asm__("mull %2" : "=d"(rh), "=a"(rl) : "%g"(x), "1"(y) : "cc")
 
--- libc/sysdeps/x86_64/soft-fp/sfp-machine.h.jj	2002-11-01 22:49:29.000000000 +0100
+++ libc/sysdeps/x86_64/soft-fp/sfp-machine.h	2007-01-10 12:13:31.000000000 +0100
@@ -3,12 +3,6 @@
 #define _FP_WS_TYPE		signed long
 #define _FP_I_TYPE		long
 
-#define __FP_CLZ(r, x)							\
-  do {									\
-    __asm__("bsrq %1,%0" : "=r"(r) : "g"(x) : "cc");			\
-    r ^= 63;								\
-  } while (0)
-
 #define _FP_NANFRAC_S		_FP_QNANBIT_S
 #define _FP_NANFRAC_D		_FP_QNANBIT_D, 0
 #define _FP_NANFRAC_Q		_FP_QNANBIT_Q, 0, 0, 0

	Jakub

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-01-10 19:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-10 19:31 [PATCH] Fix x86_64 __FP_CLZ Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).