summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-math-opts.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2014-05-26 10:42:43 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2014-05-26 10:42:43 +0000
commit3a4303e72edb57c0df8e39b5d895471d8c55afef (patch)
treefde582b2dcf87e56b9531e02e1574d3f2588c798 /gcc/tree-ssa-math-opts.c
parentc048c42c26ba03e6fa9465b7e6699f481594f027 (diff)
downloadgcc-3a4303e72edb57c0df8e39b5d895471d8c55afef.tar.gz
2014-05-23 Richard Biener <rguenther@suse.de>
* system.h: Define __STDC_FORMAT_MACROS before including inttypes.h. * hwint.h (HOST_WIDEST_INT, HOST_BITS_PER_WIDEST_INT, HOST_WIDEST_INT_PRINT, HOST_WIDEST_INT_PRINT_DEC, HOST_WIDEST_INT_PRINT_DEC_C, HOST_WIDEST_INT_PRINT_UNSIGNED, HOST_WIDEST_INT_PRINT_HEX, HOST_WIDEST_INT_PRINT_DOUBLE_HEX, HOST_WIDEST_INT_C): Remove. (PRId64, PRIi64, PRIo64, PRIu64, PRIx64, PRIX64): Define if C99 inttypes.h is not available. * coretypes.h (gcov_type, gcov_type_unsigned): Use [u]int64_t. * gcov-io.h (gcov_type, gcov_type_unsigned): Likewise. * gcov-io.c (gcov_histo_index): Drop non-64bit hwi case. * cfgloop.h (struct niter_desc): Use uint64_t for niter field. * bitmap.c (struct bitmap_descriptor_d): Use uint64_t for counters. (struct output_info): Likewise. (print_statistics): Adjust. (dump_bitmap_statistics): Likewise. * bt-load.c (migrate_btr_defs): Print with PRId64. * cfg.c (dump_edge_info, dump_bb_info): Likewise. (MAX_SAFE_MULTIPLIER): Adjust. * cfghooks.c (dump_bb_for_graph): Print with PRId64. * cgraph.c (cgraph_redirect_edge_call_stmt_to_callee, dump_cgraph_node): Likewise. * final.c (dump_basic_block_info): Likewise. * gcov-dump.c (tag_counters, tag_summary, dump_working_sets): Likewise. * gcov.c (format_gcov): Likewise. * ipa-cp.c (good_cloning_opportunity_p): Likewise. Use int64_t for calculation. (get_clone_agg_value): Use HOST_WIDE_INT for offset. * ipa-inline.c (compute_max_insns): Use int64_t for calcuation. (inline_small_functions, dump_overall_stats, dump_inline_stats): Use PRId64 for dumping. * ipa-profile.c (dump_histogram, ipa_profile): Likewise. * ira-color.c (struct allocno_hard_regs): Use int64_t for cost. (add_allocno_hard_regs): Adjust. * loop-doloop.c (doloop_modify): Print using PRId64. * loop-iv.c (inverse): Compute in uint64_t. (determine_max_iter, iv_number_of_iterations): Likewise. * loop-unroll.c (decide_peel_completely, decide_peel_simple): Print using PRId64. * lto-streamer-out.c (write_symbol): Use uint64_t. * mcf.c (CAP_INFINITY): Use int64_t maximum. (dump_fixup_edge, create_fixup_graph, cancel_negative_cycle, find_max_flow, adjust_cfg_counts): Use int64_t and dump with PRId64. * modulo-sched.c (const_iteration_count): Use int64_t. (sms_schedule): Dump using PRId64. * predict.c (dump_prediction): Likewise. * pretty-print.h (pp_widest_integer): Remove. * profile.c (get_working_sets, is_edge_inconsistent, is_inconsistent, read_profile_edge_counts): Dump using PRId64. * tree-pretty-print.c (pp_double_int): Remove case handling HOST_BITS_PER_DOUBLE_INT == HOST_BITS_PER_WIDEST_INT. * tree-ssa-math-opts.c (struct symbolic_number): Use uint64_t and adjust users. (pass_optimize_bswap::execute): Remove restriction on hosts. * tree-streamer-in.c (streamer_alloc_tree): Use HOST_WIDE_INT. * tree-streamer-out.c (streamer_write_tree_header): Likewise. * tree.c (widest_int_cst_value): Remove. * tree.h (widest_int_cst_value): Likewise. * value-prof.c (dump_histogram_value): Print using PRId64. * gengtype.c (main): Also inject int64_t. * ggc-page.c (struct max_alignment): Use int64_t. * alloc-pool.c (struct allocation_object_def): Likewise. * ira-conflicts.c (build_conflict_bit_table): Use uint64_t for computation. * doc/tm.texi.in: Remove reference to HOST_WIDEST_INT. * doc/tm.texi: Regenerated. * gengtype-lex.l (IWORD): Handle [u]int64_t. * config/sh/sh.c (expand_cbranchdi4): Use gcov_type. * config/mmix/mmix-protos.h (mmix_intval, mmix_shiftable_wyde_value, mmix_output_register_setting): Use [u]int64_t in prototypes. * config/mmix/mmix.c (mmix_print_operand, mmix_output_register_setting, mmix_shiftable_wyde_value, mmix_output_shiftvalue_op_from_str, mmix_output_octa, mmix_output_shifted_value): Adjust. (mmix_intval): Adjust. Remove unreachable case. * config/mmix/mmix.md (*nonlocal_goto_receiver_expanded): Use int64_t. lto/ * lto.c (lto_parse_hex): Use int64_t. (lto_resolution_read): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@210931 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-math-opts.c')
-rw-r--r--gcc/tree-ssa-math-opts.c57
1 files changed, 27 insertions, 30 deletions
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index 7c8c63ac99a..d9afccff6a5 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -1620,7 +1620,7 @@ make_pass_cse_sincos (gcc::context *ctxt)
still have a size of 2 but this time a range of 1. */
struct symbolic_number {
- unsigned HOST_WIDEST_INT n;
+ uint64_t n;
int size;
tree base_addr;
tree offset;
@@ -1633,14 +1633,14 @@ struct symbolic_number {
/* The number which the find_bswap_or_nop_1 result should match in
order to have a nop. The number is masked according to the size of
the symbolic number before using it. */
-#define CMPNOP (sizeof (HOST_WIDEST_INT) < 8 ? 0 : \
- (unsigned HOST_WIDEST_INT)0x08070605 << 32 | 0x04030201)
+#define CMPNOP (sizeof (int64_t) < 8 ? 0 : \
+ (uint64_t)0x08070605 << 32 | 0x04030201)
/* The number which the find_bswap_or_nop_1 result should match in
order to have a byte swap. The number is masked according to the
size of the symbolic number before using it. */
-#define CMPXCHG (sizeof (HOST_WIDEST_INT) < 8 ? 0 : \
- (unsigned HOST_WIDEST_INT)0x01020304 << 32 | 0x05060708)
+#define CMPXCHG (sizeof (int64_t) < 8 ? 0 : \
+ (uint64_t)0x01020304 << 32 | 0x05060708)
/* Perform a SHIFT or ROTATE operation by COUNT bits on symbolic
number N. Return false if the requested operation is not permitted
@@ -1656,8 +1656,8 @@ do_shift_rotate (enum tree_code code,
/* Zero out the extra bits of N in order to avoid them being shifted
into the significant bits. */
- if (n->size < (int)sizeof (HOST_WIDEST_INT))
- n->n &= ((unsigned HOST_WIDEST_INT)1 << (n->size * BITS_PER_UNIT)) - 1;
+ if (n->size < (int)sizeof (int64_t))
+ n->n &= ((uint64_t)1 << (n->size * BITS_PER_UNIT)) - 1;
switch (code)
{
@@ -1677,8 +1677,8 @@ do_shift_rotate (enum tree_code code,
return false;
}
/* Zero unused bits for size. */
- if (n->size < (int)sizeof (HOST_WIDEST_INT))
- n->n &= ((unsigned HOST_WIDEST_INT)1 << (n->size * BITS_PER_UNIT)) - 1;
+ if (n->size < (int)sizeof (int64_t))
+ n->n &= ((uint64_t)1 << (n->size * BITS_PER_UNIT)) - 1;
return true;
}
@@ -1829,8 +1829,8 @@ find_bswap_or_nop_1 (gimple stmt, struct symbolic_number *n, int limit)
n->range = n->size;
n->n = CMPNOP;
- if (n->size < (int)sizeof (HOST_WIDEST_INT))
- n->n &= ((unsigned HOST_WIDEST_INT)1 <<
+ if (n->size < (int)sizeof (int64_t))
+ n->n &= ((uint64_t)1 <<
(n->size * BITS_PER_UNIT)) - 1;
if (!source_expr1)
@@ -1845,8 +1845,8 @@ find_bswap_or_nop_1 (gimple stmt, struct symbolic_number *n, int limit)
case BIT_AND_EXPR:
{
int i;
- unsigned HOST_WIDEST_INT val = widest_int_cst_value (rhs2);
- unsigned HOST_WIDEST_INT tmp = val;
+ uint64_t val = int_cst_value (rhs2);
+ uint64_t tmp = val;
/* Only constants masking full bytes are allowed. */
for (i = 0; i < n->size; i++, tmp >>= BITS_PER_UNIT)
@@ -1871,11 +1871,11 @@ find_bswap_or_nop_1 (gimple stmt, struct symbolic_number *n, int limit)
if (type_size % BITS_PER_UNIT != 0)
return NULL_TREE;
- if (type_size / BITS_PER_UNIT < (int)(sizeof (HOST_WIDEST_INT)))
+ if (type_size / BITS_PER_UNIT < (int)(sizeof (int64_t)))
{
/* If STMT casts to a smaller type mask out the bits not
belonging to the target type. */
- n->n &= ((unsigned HOST_WIDEST_INT)1 << type_size) - 1;
+ n->n &= ((uint64_t)1 << type_size) - 1;
}
n->size = type_size / BITS_PER_UNIT;
if (!n->base_addr)
@@ -1894,7 +1894,7 @@ find_bswap_or_nop_1 (gimple stmt, struct symbolic_number *n, int limit)
{
int i;
struct symbolic_number n1, n2;
- unsigned HOST_WIDEST_INT mask;
+ uint64_t mask;
tree source_expr2;
if (code != BIT_IOR_EXPR)
@@ -1924,7 +1924,7 @@ find_bswap_or_nop_1 (gimple stmt, struct symbolic_number *n, int limit)
if (source_expr1 != source_expr2)
{
- HOST_WIDEST_INT inc, mask;
+ int64_t inc, mask;
unsigned i;
HOST_WIDE_INT off_sub;
struct symbolic_number *n_ptr;
@@ -1950,7 +1950,7 @@ find_bswap_or_nop_1 (gimple stmt, struct symbolic_number *n, int limit)
off_sub = n2.bytepos - n1.bytepos;
/* Check that the range of memory covered < biggest int size. */
- if (off_sub + n2.range > (int) sizeof (HOST_WIDEST_INT))
+ if (off_sub + n2.range > (int) sizeof (int64_t))
return NULL_TREE;
n->range = n2.range + off_sub;
@@ -1962,7 +1962,7 @@ find_bswap_or_nop_1 (gimple stmt, struct symbolic_number *n, int limit)
n_ptr = &n1;
else
n_ptr = &n2;
- for (i = 0; i < sizeof (HOST_WIDEST_INT); i++, inc <<= 8,
+ for (i = 0; i < sizeof (int64_t); i++, inc <<= 8,
mask <<= 8)
{
if (n_ptr->n & mask)
@@ -1984,7 +1984,7 @@ find_bswap_or_nop_1 (gimple stmt, struct symbolic_number *n, int limit)
n->size = n1.size;
for (i = 0, mask = 0xff; i < n->size; i++, mask <<= BITS_PER_UNIT)
{
- unsigned HOST_WIDEST_INT masked1, masked2;
+ uint64_t masked1, masked2;
masked1 = n1.n & mask;
masked2 = n2.n & mask;
@@ -2018,8 +2018,8 @@ find_bswap_or_nop (gimple stmt, struct symbolic_number *n, bool *bswap)
/* The number which the find_bswap_or_nop_1 result should match in order
to have a full byte swap. The number is shifted to the right
according to the size of the symbolic number before using it. */
- unsigned HOST_WIDEST_INT cmpxchg = CMPXCHG;
- unsigned HOST_WIDEST_INT cmpnop = CMPNOP;
+ uint64_t cmpxchg = CMPXCHG;
+ uint64_t cmpnop = CMPNOP;
tree source_expr;
int limit;
@@ -2040,19 +2040,19 @@ find_bswap_or_nop (gimple stmt, struct symbolic_number *n, bool *bswap)
if (n->base_addr)
{
int rsize;
- unsigned HOST_WIDEST_INT tmpn;
+ uint64_t tmpn;
for (tmpn = n->n, rsize = 0; tmpn; tmpn >>= BITS_PER_UNIT, rsize++);
n->range = rsize;
}
/* Zero out the extra bits of N and CMP*. */
- if (n->range < (int)sizeof (HOST_WIDEST_INT))
+ if (n->range < (int)sizeof (int64_t))
{
- unsigned HOST_WIDEST_INT mask;
+ uint64_t mask;
- mask = ((unsigned HOST_WIDEST_INT)1 << (n->range * BITS_PER_UNIT)) - 1;
- cmpxchg >>= (sizeof (HOST_WIDEST_INT) - n->range) * BITS_PER_UNIT;
+ mask = ((uint64_t)1 << (n->range * BITS_PER_UNIT)) - 1;
+ cmpxchg >>= (sizeof (int64_t) - n->range) * BITS_PER_UNIT;
cmpnop &= mask;
}
@@ -2268,9 +2268,6 @@ pass_optimize_bswap::execute (function *fun)
if (BITS_PER_UNIT != 8)
return 0;
- if (sizeof (HOST_WIDEST_INT) < 8)
- return 0;
-
bswap16_p = (builtin_decl_explicit_p (BUILT_IN_BSWAP16)
&& optab_handler (bswap_optab, HImode) != CODE_FOR_nothing);
bswap32_p = (builtin_decl_explicit_p (BUILT_IN_BSWAP32)