* expmed.c (ceil_log2): Move from here...
* hwint.c: ... to here for older GCCs...
* hwint.h: ... and here for newer GCCs.
* rtl.h (ceil_log2): Remove prototype.
* tree-phinodes.c: Do not include rtl.h.
* Makefile.in (tree-phinodes.o): Do not depend on RTL_H.
From-SVN: r188710
+2012-06-17 Steven Bosscher <steven@gcc.gnu.org>
+
+ * expmed.c (ceil_log2): Move from here...
+ * hwint.c: ... to here for older GCCs...
+ * hwint.h: ... and here for newer GCCs.
+ * rtl.h (ceil_log2): Remove prototype.
+
+ * tree-phinodes.c: Do not include rtl.h.
+ * Makefile.in (tree-phinodes.o): Do not depend on RTL_H.
+
2012-06-17 Steven Bosscher <steven@gcc.gnu.org>
* config/cris/cris.h (TARGET_ELF): Remove.
$(TM_H) $(TREE_H) $(TREE_FLOW_H) $(TREE_PASS_H)
tree-phinodes.o : tree-phinodes.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(TREE_H) $(GGC_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) \
- gt-tree-phinodes.h $(RTL_H) $(DIAGNOSTIC_CORE_H) $(GIMPLE_H)
+ gt-tree-phinodes.h $(DIAGNOSTIC_CORE_H) $(GIMPLE_H)
domwalk.o : domwalk.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(BASIC_BLOCK_H) domwalk.h sbitmap.h
tree-ssa-live.o : tree-ssa-live.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
unsignedp, OPTAB_LIB_WIDEN);
}
\f
-/* Return the smallest n such that 2**n >= X. */
-
-int
-ceil_log2 (unsigned HOST_WIDE_INT x)
-{
- return floor_log2 (x - 1) + 1;
-}
-
/* Choose a minimal N + 1 bit approximation to 1/D that can be used to
replace division by D, and put the least significant N bits of the result
in *MULTIPLIER_PTR and return the most significant bit.
#if GCC_VERSION < 3004
-/* The functions clz_hwi, ctz_hwi, ffs_hwi, floor_log2 and exact_log2
- are defined as inline functions in hwint.h if GCC_VERSION >= 3004.
- The definitions here are used for older versions of GCC and non-GCC
- bootstrap compilers. */
+/* The functions clz_hwi, ctz_hwi, ffs_hwi, floor_log2, ceil_log2,
+ and exact_log2 are defined as inline functions in hwint.h
+ if GCC_VERSION >= 3004.
+ The definitions here are used for older versions of GCC and
+ non-GCC bootstrap compilers. */
/* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
If X is 0, return -1. */
return t;
}
+/* Given X, an unsigned number, return the largest Y such that 2**Y >= X. */
+
+int
+ceil_log2 (unsigned HOST_WIDE_INT x)
+{
+ return floor_log2 (x - 1) + 1;
+}
+
/* Return the logarithm of X, base 2, considering X unsigned,
if X is a power of 2. Otherwise, returns -1. */
/* Return floor of log2, with -1 for zero. */
extern int floor_log2 (unsigned HOST_WIDE_INT);
+/* Return the smallest n such that 2**n >= X. */
+extern int ceil_log2 (unsigned HOST_WIDE_INT);
+
#else /* GCC_VERSION >= 3004 */
/* For convenience, define 0 -> word_size. */
return HOST_BITS_PER_WIDE_INT - 1 - clz_hwi (x);
}
+static inline int
+ceil_log2 (unsigned HOST_WIDE_INT x)
+{
+ return floor_log2 (x - 1) + 1;
+}
+
static inline int
exact_log2 (unsigned HOST_WIDE_INT x)
{
/* Generally useful functions. */
-/* In expmed.c */
-extern int ceil_log2 (unsigned HOST_WIDE_INT);
-
/* In explow.c */
extern HOST_WIDE_INT trunc_int_for_mode (HOST_WIDE_INT, enum machine_mode);
extern rtx plus_constant (enum machine_mode, rtx, HOST_WIDE_INT);
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
-#include "rtl.h" /* FIXME: Only for ceil_log2, of all things... */
#include "ggc.h"
#include "basic-block.h"
#include "tree-flow.h"