diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c/c-parser.c | 2 | ||||
-rw-r--r-- | gcc/config/vax/vax.c | 3 | ||||
-rw-r--r-- | gcc/doc/tm.texi | 5 | ||||
-rw-r--r-- | gcc/doc/tm.texi.in | 5 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 6 | ||||
-rw-r--r-- | gcc/emit-rtl.c | 6 | ||||
-rw-r--r-- | gcc/fold-const.c | 12 | ||||
-rw-r--r-- | gcc/gcse.c | 7 | ||||
-rw-r--r-- | gcc/gensupport.c | 1 | ||||
-rw-r--r-- | gcc/java/expr.c | 2 | ||||
-rw-r--r-- | gcc/lcm.c | 3 | ||||
-rw-r--r-- | gcc/real.c | 40 | ||||
-rw-r--r-- | gcc/real.h | 7 | ||||
-rw-r--r-- | gcc/recog.c | 13 | ||||
-rw-r--r-- | gcc/rtl.c | 2 | ||||
-rw-r--r-- | gcc/tree-cfg.c | 1 | ||||
-rw-r--r-- | gcc/tree.c | 19 |
17 files changed, 31 insertions, 103 deletions
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 74eb13a3f7e..d8041a7d891 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -13375,7 +13375,7 @@ c_parser_cilk_clause_vectorlength (c_parser *parser, tree clauses) || !TREE_CONSTANT (expr) || !INTEGRAL_TYPE_P (TREE_TYPE (expr))) error_at (loc, "vectorlength must be an integer constant"); - else if (exact_log2 (TREE_INT_CST_LOW (expr)) == -1) + else if (wi::exact_log2 (expr) == -1) error_at (loc, "vectorlength must be a power of 2"); else { diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c index 8bfb945d1eb..2b6fd9aaa6e 100644 --- a/gcc/config/vax/vax.c +++ b/gcc/config/vax/vax.c @@ -43,6 +43,7 @@ along with GCC; see the file COPYING3. If not see #include "tm_p.h" #include "target.h" #include "target-def.h" +#include "wide-int.h" static void vax_option_override (void); static bool vax_legitimate_address_p (enum machine_mode, rtx, bool); @@ -643,7 +644,7 @@ vax_float_literal (rtx c) { int x = 1 << i; bool ok; - REAL_VALUE_FROM_INT (s, x, mode); + real_from_integer (&s, mode, x, SIGNED); if (REAL_VALUES_EQUAL (r, s)) return true; diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 5123889f4d5..12b0724d308 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -9683,11 +9683,6 @@ Returns the negative of the floating point value @var{x}. Returns the absolute value of @var{x}. @end deftypefn -@deftypefn Macro void REAL_VALUE_FROM_INT (REAL_VALUE_TYPE @var{x}, const wide_int_ref &@var{val}, enum machine_mode @var{mode}) -Converts integer @var{val} into a floating-point value which is then -stored into @var{x}. The value is truncated to fit in mode @var{mode}. -@end deftypefn - @node Mode Switching @section Mode Switching Instructions @cindex mode switching diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index b85c8d6ce7f..55e96bbef4f 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -7345,11 +7345,6 @@ Returns the negative of the floating point value @var{x}. Returns the absolute value of @var{x}. @end deftypefn -@deftypefn Macro void REAL_VALUE_FROM_INT (REAL_VALUE_TYPE @var{x}, const wide_int_ref &@var{val}, enum machine_mode @var{mode}) -Converts integer @var{val} into a floating-point value which is then -stored into @var{x}. The value is truncated to fit in mode @var{mode}. -@end deftypefn - @node Mode Switching @section Mode Switching Instructions @cindex mode switching diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 62b2a676107..be056603655 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -13428,12 +13428,6 @@ loc_descriptor (rtx rtl, enum machine_mode mode, if (mode != VOIDmode && (dwarf_version >= 4 || !dwarf_strict)) { - gcc_assert (mode == GET_MODE (rtl) || VOIDmode == GET_MODE (rtl)); - - /* Note that a CONST_DOUBLE rtx could represent either an integer - or a floating-point constant. A CONST_DOUBLE is used whenever - the constant requires more than one word in order to be - adequately represented. We output CONST_DOUBLEs as blocks. */ loc_result = new_loc_descr (DW_OP_implicit_value, GET_MODE_SIZE (mode), 0); loc_result->dw_loc_oprnd2.val_class = dw_val_class_wide_int; diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 3358d2f4dbe..89eb40874ae 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -5820,9 +5820,9 @@ init_emit_once (void) else const_true_rtx = gen_rtx_CONST_INT (VOIDmode, STORE_FLAG_VALUE); - REAL_VALUE_FROM_INT (dconst0, 0, double_mode); - REAL_VALUE_FROM_INT (dconst1, 1, double_mode); - REAL_VALUE_FROM_INT (dconst2, 2, double_mode); + real_from_integer (&dconst0, double_mode, 0, SIGNED); + real_from_integer (&dconst1, double_mode, 1, SIGNED); + real_from_integer (&dconst2, double_mode, 2, SIGNED); dconstm1 = dconst1; dconstm1.sign = 1; diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 306606e95f3..ce24f75712c 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -6527,7 +6527,7 @@ fold_single_bit_test_into_sign_test (location_t loc, /* This is only a win if casting to a signed type is cheap, i.e. when arg00's type is not a partial mode. */ && TYPE_PRECISION (TREE_TYPE (arg00)) - == GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (arg00)))) + == GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (arg00)))) { tree stype = signed_type_for (TREE_TYPE (arg00)); return fold_build2_loc (loc, code == EQ_EXPR ? GE_EXPR : LT_EXPR, @@ -11960,7 +11960,7 @@ fold_binary_loc (location_t loc, zerobits = ((((unsigned HOST_WIDE_INT) 1) << shiftc) - 1); else if (TREE_CODE (arg0) == RSHIFT_EXPR && TYPE_PRECISION (TREE_TYPE (arg0)) - == GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (arg0)))) + == GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (arg0)))) { prec = TYPE_PRECISION (TREE_TYPE (arg0)); tree arg00 = TREE_OPERAND (arg0, 0); @@ -11971,7 +11971,7 @@ fold_binary_loc (location_t loc, { tree inner_type = TREE_TYPE (TREE_OPERAND (arg00, 0)); if (TYPE_PRECISION (inner_type) - == GET_MODE_BITSIZE (TYPE_MODE (inner_type)) + == GET_MODE_PRECISION (TYPE_MODE (inner_type)) && TYPE_PRECISION (inner_type) < prec) { prec = TYPE_PRECISION (inner_type); @@ -13652,15 +13652,11 @@ fold_binary_loc (location_t loc, else if (wi::eq_p (arg1, signed_max) && TYPE_UNSIGNED (arg1_type) - /* KENNY QUESTIONS THE CHECKING OF THE BITSIZE - HERE. HE FEELS THAT THE PRECISION SHOULD BE - CHECKED */ - /* We will flip the signedness of the comparison operator associated with the mode of arg1, so the sign bit is specified by this mode. Check that arg1 is the signed max associated with this sign bit. */ - && prec == GET_MODE_BITSIZE (TYPE_MODE (arg1_type)) + && prec == GET_MODE_PRECISION (TYPE_MODE (arg1_type)) /* signed_type does not work on pointer types. */ && INTEGRAL_TYPE_P (arg1_type)) { diff --git a/gcc/gcse.c b/gcc/gcse.c index a00bbfab881..571e8788c83 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -1997,13 +1997,6 @@ prune_insertions_deletions (int n_elems) bitmap_clear_bit (pre_delete_map[i], j); } - if (dump_file) - { - dump_bitmap_vector (dump_file, "pre_insert_map", "", pre_insert_map, n_edges); - dump_bitmap_vector (dump_file, "pre_delete_map", "", pre_delete_map, - last_basic_block); - } - sbitmap_free (prune_exprs); free (insertions); free (deletions); diff --git a/gcc/gensupport.c b/gcc/gensupport.c index 1b80f956d1d..d9f79401a8a 100644 --- a/gcc/gensupport.c +++ b/gcc/gensupport.c @@ -2807,7 +2807,6 @@ static const struct std_pred_table std_preds[] = { {"immediate_operand", false, true, {UNKNOWN}}, {"const_int_operand", false, false, {CONST_INT}}, #if TARGET_SUPPORTS_WIDE_INT - {"const_wide_int_operand", false, false, {CONST_WIDE_INT}}, {"const_scalar_int_operand", false, false, {CONST_INT, CONST_WIDE_INT}}, {"const_double_operand", false, false, {CONST_DOUBLE}}, #else diff --git a/gcc/java/expr.c b/gcc/java/expr.c index 983822dadcb..268d193e257 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -1259,7 +1259,7 @@ expand_java_pushc (int ival, tree type) else if (type == float_type_node || type == double_type_node) { REAL_VALUE_TYPE x; - REAL_VALUE_FROM_INT (x, ival, TYPE_MODE (type)); + real_from_integer (&x, TYPE_MODE (type), ival, SIGNED); value = build_real (type, x); } else diff --git a/gcc/lcm.c b/gcc/lcm.c index 7471b0e4c38..c13d2a6aa51 100644 --- a/gcc/lcm.c +++ b/gcc/lcm.c @@ -64,7 +64,6 @@ along with GCC; see the file COPYING3. If not see #include "sbitmap.h" #include "dumpfile.h" -#define LCM_DEBUG_INFO 1 /* Edge based LCM routines. */ static void compute_antinout_edge (sbitmap *, sbitmap *, sbitmap *, sbitmap *); static void compute_earliest (struct edge_list *, int, sbitmap *, sbitmap *, @@ -107,7 +106,6 @@ compute_antinout_edge (sbitmap *antloc, sbitmap *transp, sbitmap *antin, /* We want a maximal solution, so make an optimistic initialization of ANTIN. */ bitmap_vector_ones (antin, last_basic_block); - bitmap_vector_clear (antout, last_basic_block); /* Put every block on the worklist; this is necessary because of the optimistic initialization of ANTIN above. */ @@ -434,7 +432,6 @@ pre_edge_lcm (int n_exprs, sbitmap *transp, /* Allocate an extra element for the exit block in the laterin vector. */ laterin = sbitmap_vector_alloc (last_basic_block + 1, n_exprs); - bitmap_vector_clear (laterin, last_basic_block); compute_laterin (edge_list, earliest, antloc, later, laterin); #ifdef LCM_DEBUG_INFO diff --git a/gcc/real.c b/gcc/real.c index 8c592e8ec9c..11bb482b751 100644 --- a/gcc/real.c +++ b/gcc/real.c @@ -2147,45 +2147,7 @@ real_from_string3 (REAL_VALUE_TYPE *r, const char *s, enum machine_mode mode) real_convert (r, mode, r); } -/* Initialize R from a HOST_WIDE_INT. */ - -void -real_from_integer (REAL_VALUE_TYPE *r, enum machine_mode mode, - HOST_WIDE_INT val, signop sgn) -{ - if (val == 0) - get_zero (r, 0); - else - { - memset (r, 0, sizeof (*r)); - r->cl = rvc_normal; - r->sign = val < 0 && sgn == SIGNED; - SET_REAL_EXP (r, HOST_BITS_PER_WIDE_INT); - - /* TODO: This fails for -MAXHOSTWIDEINT, wide_int version would - have worked. */ - if (r->sign) - val = -val; - - if (HOST_BITS_PER_LONG == HOST_BITS_PER_WIDE_INT) - r->sig[SIGSZ-1] = val; - else - { - gcc_assert (HOST_BITS_PER_LONG*2 == HOST_BITS_PER_WIDE_INT); - r->sig[SIGSZ-1] = val >> (HOST_BITS_PER_LONG - 1) >> 1; - r->sig[SIGSZ-2] = val; - } - - normalize (r); - } - - if (DECIMAL_FLOAT_MODE_P (mode)) - decimal_from_integer (r); - else if (mode != VOIDmode) - real_convert (r, mode, r); -} - -/* Initialize R from the integer pair HIGH+LOW. */ +/* Initialize R from the wide_int VAL_IN. The MODE is not VOIDmode,*/ void real_from_integer (REAL_VALUE_TYPE *r, enum machine_mode mode, diff --git a/gcc/real.h b/gcc/real.h index 54b6ed7ac42..67139f54090 100644 --- a/gcc/real.h +++ b/gcc/real.h @@ -277,10 +277,6 @@ extern int real_from_string (REAL_VALUE_TYPE *, const char *); /* Wrapper to allow different internal representation for decimal floats. */ extern void real_from_string3 (REAL_VALUE_TYPE *, const char *, enum machine_mode); -/* Initialize R from an integer. */ -extern void real_from_integer (REAL_VALUE_TYPE *, enum machine_mode, - HOST_WIDE_INT, signop); - extern long real_to_target_fmt (long *, const REAL_VALUE_TYPE *, const struct real_format *); extern long real_to_target (long *, const REAL_VALUE_TYPE *, enum machine_mode); @@ -362,9 +358,6 @@ extern const struct real_format arm_half_format; #define REAL_VALUE_TO_TARGET_SINGLE(IN, OUT) \ ((OUT) = real_to_target (NULL, &(IN), mode_for_size (32, MODE_FLOAT, 0))) -#define REAL_VALUE_FROM_INT(r, val, mode) \ - real_from_integer (&(r), mode, val, SIGNED) - /* Real values to IEEE 754 decimal floats. */ /* IN is a REAL_VALUE_TYPE. OUT is an array of longs. */ diff --git a/gcc/recog.c b/gcc/recog.c index ae2152eba7c..ecb7c06794d 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -1198,19 +1198,6 @@ const_scalar_int_operand (rtx op, enum machine_mode mode) return 1; } -/* Returns 1 if OP is an operand that is a CONST_WIDE_INT of mode - MODE. This most likely is not as useful as - const_scalar_int_operand since it does not accept CONST_INTs, but - is here for consistancy. */ -int -const_wide_int_operand (rtx op, enum machine_mode mode) -{ - if (!CONST_WIDE_INT_P (op)) - return 0; - - return const_scalar_int_operand (op, mode); -} - /* Returns 1 if OP is an operand that is a constant integer or constant floating-point number of MODE. */ diff --git a/gcc/rtl.c b/gcc/rtl.c index a361d4fa891..40538526224 100644 --- a/gcc/rtl.c +++ b/gcc/rtl.c @@ -233,6 +233,8 @@ cwi_output_hex (FILE *outfile, const_rtx x) int i = CWI_GET_NUM_ELEM (x); gcc_assert (i > 0); if (CWI_ELT (x, i-1) == 0) + /* The HOST_WIDE_INT_PRINT_HEX prepends a 0x only if the val is + non zero. We want all numbers to have a 0x prefix. */ fprintf (outfile, "0x"); fprintf (outfile, HOST_WIDE_INT_PRINT_HEX, CWI_ELT (x, --i)); while (--i >= 0) diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index b981b944517..adf31244cb0 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -2718,7 +2718,6 @@ verify_expr (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) return t; } else if (!INTEGRAL_TYPE_P (TREE_TYPE (t)) - && !AGGREGATE_TYPE_P (TREE_TYPE (t)) && TYPE_MODE (TREE_TYPE (t)) != BLKmode && (GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (t))) != tree_to_uhwi (TREE_OPERAND (t, 1)))) diff --git a/gcc/tree.c b/gcc/tree.c index d97904b8e2e..256c6cf75fe 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -8578,8 +8578,23 @@ retry: return true; /* Third, unsigned integers with top bit set never fit signed types. */ - if (!TYPE_UNSIGNED (type) && sgn_c == UNSIGNED && wi::neg_p (c)) - return false; + if (!TYPE_UNSIGNED (type) && sgn_c == UNSIGNED) + { + int uprec = GET_MODE_PRECISION (TYPE_MODE TREE_TYPE (c)); + if (uprec < TYPE_PRECISION (TREE_TYPE (c))) + { + /* When a tree_cst is converted to a wide-int, the precision + is taken from the type. However, if the precision of the + mode underneath the type is smaller than that, it is + possible that the value will not fit. The test below + fails if any bit is set between the sign bit of the + underlying mode and the top bit of the type. */ + if (wi::ne_p (wi::zext (c, uprec - 1), c)) + return false; + } + else if (wi::neg_p (c)) + return false; + } /* If we haven't been able to decide at this point, there nothing more we can check ourselves here. Look at the base type if we have one and it |