diff mbox

[x32] PATCH: Use long long builtins of zero counting for x86-64

Message ID 20110220205851.GA30669@intel.com
State New
Headers show

Commit Message

H.J. Lu Feb. 20, 2011, 8:58 p.m. UTC
For x32, long is 32bit and long long is 64bit.  This patch uses long
long builtins of zero counting for x86-64 to count zeros in 64bit int.


H.J.
---
commit aa54f5a4b49fc8e407c67393180db726f71b3624
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Feb 20 12:52:25 2011 -0800

    Use long long builtins of zero counting for x86-64.
diff mbox

Patch

diff --git a/gcc/ChangeLog.x32 b/gcc/ChangeLog.x32
index 735d831..364851c 100644
--- a/gcc/ChangeLog.x32
+++ b/gcc/ChangeLog.x32
@@ -1,3 +1,9 @@ 
+2011-02-20  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* longlong.h (count_leading_zeros): Use long long builtin for
+	x86-64.
+	(count_trailing_zeros): Likewise.
+
 2011-02-19  H.J. Lu  <hongjiu.lu@intel.com>
 
 	PR middle-end/47364
diff --git a/gcc/longlong.h b/gcc/longlong.h
index 5937a48..13d72f9 100644
--- a/gcc/longlong.h
+++ b/gcc/longlong.h
@@ -430,8 +430,8 @@  UDItype __umulsidi3 (USItype, USItype);
 	   : "0" ((UDItype) (n0)),					\
 	     "1" ((UDItype) (n1)),					\
 	     "rm" ((UDItype) (dv)))
-#define count_leading_zeros(count, x)	((count) = __builtin_clzl (x))
-#define count_trailing_zeros(count, x)	((count) = __builtin_ctzl (x))
+#define count_leading_zeros(count, x)	((count) = __builtin_clzll (x))
+#define count_trailing_zeros(count, x)	((count) = __builtin_ctzll (x))
 #define UMUL_TIME 40
 #define UDIV_TIME 40
 #endif /* x86_64 */