diff options
author | Richard Guenther <rguenther@suse.de> | 2010-08-04 09:15:51 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2010-08-04 09:15:51 +0000 |
commit | 552cbe64b6e53a613e67e1aef1ecaed66bd71ed7 (patch) | |
tree | 048c888ac173b7ff5e353331c625f86b580387ee /gcc | |
parent | 31af83671c566af8a0c434d3bb1aabb58d7d7ac3 (diff) | |
download | gcc-552cbe64b6e53a613e67e1aef1ecaed66bd71ed7.zip gcc-552cbe64b6e53a613e67e1aef1ecaed66bd71ed7.tar.gz gcc-552cbe64b6e53a613e67e1aef1ecaed66bd71ed7.tar.bz2 |
Makefile.in (double-int.o): Add $(TOPLEV_H) dependency.
2010-08-04 Richard Guenther <rguenther@suse.de>
* Makefile.in (double-int.o): Add $(TOPLEV_H) dependency.
* double-int.h (double_int_ctz): Declare.
* double-int.c (double_int_ctz): New function.
From-SVN: r162859
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/Makefile.in | 3 | ||||
-rw-r--r-- | gcc/double-int.c | 21 | ||||
-rw-r--r-- | gcc/double-int.h | 2 |
4 files changed, 31 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7b338e4..e89469f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-08-04 Richard Guenther <rguenther@suse.de> + + * Makefile.in (double-int.o): Add $(TOPLEV_H) dependency. + * double-int.h (double_int_ctz): Declare. + * double-int.c (double_int_ctz): New function. + 2010-08-04 Hariharan Sandanagobalane <hariharan@picochip.com> * config/picochip/picochip.c (TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE): diff --git a/gcc/Makefile.in b/gcc/Makefile.in index a6b3460..030b9c0 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -2279,7 +2279,8 @@ stringpool.o: stringpool.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ convert.o: convert.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ $(FLAGS_H) convert.h $(TOPLEV_H) $(DIAGNOSTIC_CORE_H) langhooks.h -double-int.o: double-int.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) +double-int.o: double-int.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ + $(TOPLEV_H) $(TREE_H) # lto-compress.o needs $(ZLIBINC) added to the include flags. lto-compress.o: lto-compress.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ diff --git a/gcc/double-int.c b/gcc/double-int.c index 924e91b..29e720b 100644 --- a/gcc/double-int.c +++ b/gcc/double-int.c @@ -22,6 +22,7 @@ along with GCC; see the file COPYING3. If not see #include "coretypes.h" #include "tm.h" #include "tree.h" +#include "toplev.h" /* We know that A1 + B1 = SUM1, using 2's complement arithmetic and ignoring overflow. Suppose A, B and SUM have the same respective signs as A1, B1, @@ -850,6 +851,26 @@ double_int_setbit (double_int a, unsigned bitpos) return a; } +/* Count trailing zeros in A. */ +int +double_int_ctz (double_int a) +{ + unsigned HOST_WIDE_INT w = a.low ? a.low : (unsigned HOST_WIDE_INT) a.high; + unsigned bits = a.low ? 0 : HOST_BITS_PER_WIDE_INT; + if (!w) + return HOST_BITS_PER_DOUBLE_INT; +#if (GCC_VERSION >= 3004) + bits += CTZ_HWI (w); +#else + while (!(w & 1)) + { + w >>= 1; + bits += 1; + } +#endif + return bits; +} + /* Shift A left by COUNT places keeping only PREC bits of result. Shift right if COUNT is negative. ARITH true specifies arithmetic shifting; otherwise use logical shift. */ diff --git a/gcc/double-int.h b/gcc/double-int.h index b14693d..c2f74e9 100644 --- a/gcc/double-int.h +++ b/gcc/double-int.h @@ -148,7 +148,9 @@ double_int double_int_umod (double_int, double_int, unsigned); double_int double_int_divmod (double_int, double_int, bool, unsigned, double_int *); double_int double_int_sdivmod (double_int, double_int, unsigned, double_int *); double_int double_int_udivmod (double_int, double_int, unsigned, double_int *); + double_int double_int_setbit (double_int, unsigned); +int double_int_ctz (double_int); /* Logical operations. */ |