This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: MIPS clz support in longlong.h
- From: Sandra Loosemore <sandra at codesourcery dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Richard Sandiford <richard at codesourcery dot com>
- Date: Wed, 01 Aug 2007 21:49:46 -0400
- Subject: PATCH: MIPS clz support in longlong.h
Here's another little patch related to MIPS clz support. I wasn't sure how to
test specifically that this does something useful, but it does pass the standard
gcc tests. :-)
OK to commit?
-Sandra
2007-08-01 Sandra Loosemore <sandra@codesourcery.com>
Nigel Stephens <nigel@mips.com>
gcc/
* longlong.h [__mips__] (count_leading_zeros, COUNT_LEADING_ZEROS_0):
Define for MIPS32 and MIPS64.
Index: gcc/longlong.h
===================================================================
*** gcc/longlong.h (revision 127137)
--- gcc/longlong.h (working copy)
*************** UDItype __umulsidi3 (USItype, USItype);
*** 624,629 ****
--- 624,634 ----
"d" ((USItype) (v)))
#define UMUL_TIME 10
#define UDIV_TIME 100
+
+ #if (__mips == 32 || __mips == 64) && ! __mips16
+ #define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clz (X))
+ #define COUNT_LEADING_ZEROS_0 32
+ #endif
#endif /* __mips__ */
#if defined (__ns32000__) && W_TYPE_SIZE == 32