public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] Fix x86_64 __FP_CLZ
Date: Wed, 10 Jan 2007 19:31:00 -0000	[thread overview]
Message-ID: <20070110193335.GA3819@sunsite.mff.cuni.cz> (raw)

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

                 reply	other threads:[~2007-01-10 19:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070110193335.GA3819@sunsite.mff.cuni.cz \
    --to=jakub@redhat.com \
    --cc=drepper@redhat.com \
    --cc=libc-hacker@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).