]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
richards suggestions
authorzadeck <zadeck@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 19 Nov 2013 17:21:21 +0000 (17:21 +0000)
committerzadeck <zadeck@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 19 Nov 2013 17:21:21 +0000 (17:21 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/wide-int@205049 138bc75d-0d04-0410-961f-82ee72b054a4

17 files changed:
gcc/c/c-parser.c
gcc/config/vax/vax.c
gcc/doc/tm.texi
gcc/doc/tm.texi.in
gcc/dwarf2out.c
gcc/emit-rtl.c
gcc/fold-const.c
gcc/gcse.c
gcc/gensupport.c
gcc/java/expr.c
gcc/lcm.c
gcc/real.c
gcc/real.h
gcc/recog.c
gcc/rtl.c
gcc/tree-cfg.c
gcc/tree.c

index 74eb13a3f7e0e15b9c64bc7afecfe6437ec1de78..d8041a7d8917e14113890bb74f6d5feec98bdb38 100644 (file)
@@ -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
     {
index 8bfb945d1eb095ba96bdc9a6413c963a0c36cdfd..2b6fd9aaa6eae14deff63cc0a9f117b3386c6e2e 100644 (file)
@@ -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;
index 5123889f4d52e80be27270110387b5fb557a5cab..12b0724d3081532c751c5b8cd503fcb0ac349ee3 100644 (file)
@@ -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
index b85c8d6ce7fcd1f3f5c119921a493f569d9a7f72..55e96bbef4fd302cd465207d7ce3c62393081523 100644 (file)
@@ -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
index 62b2a67610734d151822f5f32a7cb71677f664e8..be0566036554e1d1790e9a2e31ff68b24a677f21 100644 (file)
@@ -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;
index 3358d2f4dbecc481bc83a8a475ab4318df88fe9b..89eb40874aec5fdae4575cb13b9030acb3add1a7 100644 (file)
@@ -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;
index 306606e95f3343a98a5eef18887732b42a98d4d1..ce24f75712cc9d2f19f33be776b2bccb56f4074f 100644 (file)
@@ -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))
              {
index a00bbfab88175befc8ab7091f8ed1938a9f1aafb..571e8788c83db469d06876e2b9c1e2ea94e9ea36 100644 (file)
@@ -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);
index 1b80f956d1d6c73ef9b41938917f41590d897239..d9f79401a8a05a3c623116a1fdff698547bbfec6 100644 (file)
@@ -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
index 983822dadcb911088770cbf4e161e4fe04ec16d2..268d193e257474d58cc1bed544f6590d1c92dc2b 100644 (file)
@@ -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
index 7471b0e4c38be4a61b893845400730d35e037553..c13d2a6aa5127c089737d21bf708fe028e11cafb 100644 (file)
--- 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
index 8c592e8ec9cdd67c236b2d42564ef8166c7571c1..11bb482b751e84ddd6a7d17d8acaef9300dda624 100644 (file)
@@ -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,
index 54b6ed7ac4219a80409efa8da1d84e57558962c7..67139f540900f4fed76269730fbb31d948a31e35 100644 (file)
@@ -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.  */
index ae2152eba7c3256c5c4fa2b42e5e9f428773c1e0..ecb7c06794d5feb2db36e0596a6e6a5a81f5f432 100644 (file)
@@ -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.  */
 
index a361d4fa8918341df4a9ac4de8ffbead064368d0..40538526224e1791726457462fe8878f728cfa12 100644 (file)
--- 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)
index b981b944517d5623d9c0323c8277d6d207c8ed90..adf31244cb08cc9594c71e13b261911ab42ce07d 100644 (file)
@@ -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))))
index d97904b8e2e0cd77b785a9c400acf477ef27f43a..256c6cf75fe0e8e2ef2944149819b86e5fc9bcf5 100644 (file)
@@ -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