]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/tree-switch-conversion.c
Merge with trunk.
[thirdparty/gcc.git] / gcc / tree-switch-conversion.c
index f6b17b846dd5d5eec748e5ce8b3a8496756366c9..93a3bff659541da19a5c39369609c79e6810e638 100644 (file)
@@ -449,7 +449,13 @@ emit_case_bit_tests (gimple swtch, tree index_expr,
         if (const & csui) goto target  */
   for (k = 0; k < count; k++)
     {
-      tmp = build_int_cst_wide (word_type_node, test[k].lo, test[k].hi);
+      HOST_WIDE_INT a[2];
+
+      a[0] = test[k].lo;
+      a[1] = test[k].hi;
+      tmp = wide_int_to_tree (word_type_node,
+                             wide_int::from_array (a, 2,
+                                                   TYPE_PRECISION (word_type_node)));
       tmp = fold_build2 (BIT_AND_EXPR, word_type_node, csui, tmp);
       tmp = force_gimple_operand_gsi (&gsi, tmp,
                                      /*simple=*/true, NULL_TREE,
@@ -889,7 +895,7 @@ build_constructors (gimple swtch, struct switch_conv_info *info)
              info->constructors[k]->quick_push (elt);
            }
 
-         pos = int_const_binop (PLUS_EXPR, pos, integer_one_node);
+         pos = int_const_binop (PLUS_EXPR, pos, build_int_cst (TREE_TYPE (pos), 1));
        }
       gcc_assert (tree_int_cst_equal (pos, CASE_LOW (cs)));
 
@@ -914,7 +920,7 @@ build_constructors (gimple swtch, struct switch_conv_info *info)
              elt.value = unshare_expr_without_location (val);
              info->constructors[j]->quick_push (elt);
 
-             pos = int_const_binop (PLUS_EXPR, pos, integer_one_node);
+             pos = int_const_binop (PLUS_EXPR, pos, build_int_cst (TREE_TYPE (pos), 1));
            } while (!tree_int_cst_lt (high, pos)
                     && tree_int_cst_lt (low, pos));
          j++;
@@ -969,26 +975,26 @@ array_value_type (gimple swtch, tree type, int num,
 
   FOR_EACH_VEC_SAFE_ELT (info->constructors[num], i, elt)
     {
-      double_int cst;
+      wide_int cst;
 
       if (TREE_CODE (elt->value) != INTEGER_CST)
        return type;
 
-      cst = TREE_INT_CST (elt->value);
+      cst = elt->value;
       while (1)
        {
          unsigned int prec = GET_MODE_BITSIZE (mode);
          if (prec > HOST_BITS_PER_WIDE_INT)
            return type;
 
-         if (sign >= 0 && cst == cst.zext (prec))
+         if (sign >= 0 && cst == wi::zext (cst, prec))
            {
-             if (sign == 0 && cst == cst.sext (prec))
+             if (sign == 0 && cst == wi::sext (cst, prec))
                break;
              sign = 1;
              break;
            }
-         if (sign <= 0 && cst == cst.sext (prec))
+         if (sign <= 0 && cst == wi::sext (cst, prec))
            {
              sign = -1;
              break;