summaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authormrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>2013-08-13 20:41:07 +0000
committermrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>2013-08-13 20:41:07 +0000
commite913b5cd5b6a9bd3a2ad58c65f9e3cd2bb55a28c (patch)
treef52a097017e3dcf89fad6525984e4591489f961e /gcc/config
parent9a5942c1d4d9116ab74b0741cfe3894a89fd17fb (diff)
downloadgcc-e913b5cd5b6a9bd3a2ad58c65f9e3cd2bb55a28c.tar.gz
Add wide-int branch.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/wide-int@201707 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/aarch64/aarch64.c30
-rw-r--r--gcc/config/alpha/alpha.c6
-rw-r--r--gcc/config/alpha/predicates.md2
-rw-r--r--gcc/config/arm/arm.c31
-rw-r--r--gcc/config/avr/avr-log.c21
-rw-r--r--gcc/config/avr/avr.c44
-rw-r--r--gcc/config/bfin/bfin.c4
-rw-r--r--gcc/config/c6x/predicates.md4
-rw-r--r--gcc/config/darwin.c34
-rw-r--r--gcc/config/epiphany/epiphany.c10
-rw-r--r--gcc/config/i386/i386.c38
-rw-r--r--gcc/config/ia64/predicates.md4
-rw-r--r--gcc/config/iq2000/iq2000.c6
-rw-r--r--gcc/config/m32c/m32c-pragma.c6
-rw-r--r--gcc/config/m32c/m32c.c6
-rw-r--r--gcc/config/mep/mep-pragma.c6
-rw-r--r--gcc/config/mep/mep.c6
-rw-r--r--gcc/config/mips/mips.c6
-rw-r--r--gcc/config/picochip/picochip.c2
-rw-r--r--gcc/config/rs6000/rs6000-c.c9
-rw-r--r--gcc/config/rs6000/rs6000.c48
-rw-r--r--gcc/config/s390/s390.c4
-rw-r--r--gcc/config/sh/sh.c6
-rw-r--r--gcc/config/sol2-c.c4
-rw-r--r--gcc/config/sparc/sparc.c58
-rw-r--r--gcc/config/vms/vms-c.c2
26 files changed, 198 insertions, 199 deletions
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index aed035a434e..586a67f926a 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -5996,18 +5996,18 @@ aapcs_vfp_sub_candidate (const_tree type, enum machine_mode *modep)
if (count == -1
|| !index
|| !TYPE_MAX_VALUE (index)
- || !host_integerp (TYPE_MAX_VALUE (index), 1)
+ || !tree_fits_uhwi_p (TYPE_MAX_VALUE (index))
|| !TYPE_MIN_VALUE (index)
- || !host_integerp (TYPE_MIN_VALUE (index), 1)
+ || !tree_fits_uhwi_p (TYPE_MIN_VALUE (index))
|| count < 0)
return -1;
- count *= (1 + tree_low_cst (TYPE_MAX_VALUE (index), 1)
- - tree_low_cst (TYPE_MIN_VALUE (index), 1));
+ count *= (1 + tree_to_uhwi (TYPE_MAX_VALUE (index))
+ - tree_to_uhwi (TYPE_MIN_VALUE (index)));
/* There must be no padding. */
- if (!host_integerp (TYPE_SIZE (type), 1)
- || (tree_low_cst (TYPE_SIZE (type), 1)
+ if (!tree_fits_uhwi_p (TYPE_SIZE (type))
+ || (tree_to_uhwi (TYPE_SIZE (type))
!= count * GET_MODE_BITSIZE (*modep)))
return -1;
@@ -6036,8 +6036,8 @@ aapcs_vfp_sub_candidate (const_tree type, enum machine_mode *modep)
}
/* There must be no padding. */
- if (!host_integerp (TYPE_SIZE (type), 1)
- || (tree_low_cst (TYPE_SIZE (type), 1)
+ if (!tree_fits_uhwi_p (TYPE_SIZE (type))
+ || (tree_to_uhwi (TYPE_SIZE (type))
!= count * GET_MODE_BITSIZE (*modep)))
return -1;
@@ -6068,8 +6068,8 @@ aapcs_vfp_sub_candidate (const_tree type, enum machine_mode *modep)
}
/* There must be no padding. */
- if (!host_integerp (TYPE_SIZE (type), 1)
- || (tree_low_cst (TYPE_SIZE (type), 1)
+ if (!tree_fits_uhwi_p (TYPE_SIZE (type))
+ || (tree_to_uhwi (TYPE_SIZE (type))
!= count * GET_MODE_BITSIZE (*modep)))
return -1;
@@ -6822,7 +6822,7 @@ aarch64_simd_attr_length_move (rtx insn)
static HOST_WIDE_INT
aarch64_simd_vector_alignment (const_tree type)
{
- HOST_WIDE_INT align = tree_low_cst (TYPE_SIZE (type), 0);
+ HOST_WIDE_INT align = tree_to_shwi (TYPE_SIZE (type));
return MIN (align, 128);
}
@@ -7401,8 +7401,8 @@ aarch64_float_const_representable_p (rtx x)
int point_pos = 2 * HOST_BITS_PER_WIDE_INT - 1;
int exponent;
unsigned HOST_WIDE_INT mantissa, mask;
- HOST_WIDE_INT m1, m2;
REAL_VALUE_TYPE r, m;
+ bool &fail
if (!CONST_DOUBLE_P (x))
return false;
@@ -7426,16 +7426,16 @@ aarch64_float_const_representable_p (rtx x)
WARNING: If we ever have a representation using more than 2 * H_W_I - 1
bits for the mantissa, this can fail (low bits will be lost). */
real_ldexp (&m, &r, point_pos - exponent);
- REAL_VALUE_TO_INT (&m1, &m2, m);
+ w = real_to_integer (m, &fail, HOST_BITS_PER_WIDE_INT * 2);
/* If the low part of the mantissa has bits set we cannot represent
the value. */
- if (m1 != 0)
+ if (w.elt (0) != 0)
return false;
/* We have rejected the lower HOST_WIDE_INT, so update our
understanding of how many bits lie in the mantissa and
look only at the high HOST_WIDE_INT. */
- mantissa = m2;
+ mantissa = w.elt (1);
point_pos -= HOST_BITS_PER_WIDE_INT;
/* We can only represent values with a mantissa of the form 1.xxxx. */
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 5f5b33e347b..44b4225072b 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -5857,7 +5857,7 @@ va_list_skip_additions (tree lhs)
if (!CONVERT_EXPR_CODE_P (code)
&& ((code != PLUS_EXPR && code != POINTER_PLUS_EXPR)
|| TREE_CODE (gimple_assign_rhs2 (stmt)) != INTEGER_CST
- || !host_integerp (gimple_assign_rhs2 (stmt), 1)))
+ || !tree_fits_uhwi_p (gimple_assign_rhs2 (stmt))))
return stmt;
lhs = gimple_assign_rhs1 (stmt);
@@ -5983,10 +5983,10 @@ alpha_stdarg_optimize_hook (struct stdarg_info *si, const_gimple stmt)
else
goto escapes;
- if (!host_integerp (gimple_assign_rhs2 (arg2_stmt), 0))
+ if (!tree_fits_shwi_p (gimple_assign_rhs2 (arg2_stmt)))
goto escapes;
- sub = tree_low_cst (gimple_assign_rhs2 (arg2_stmt), 0);
+ sub = tree_to_shwi (gimple_assign_rhs2 (arg2_stmt));
if (code2 == MINUS_EXPR)
sub = -sub;
if (sub < -48 || sub > -32)
diff --git a/gcc/config/alpha/predicates.md b/gcc/config/alpha/predicates.md
index a63d1254a6f..8a2166c1e03 100644
--- a/gcc/config/alpha/predicates.md
+++ b/gcc/config/alpha/predicates.md
@@ -357,7 +357,7 @@
&& !SYMBOL_REF_TLS_MODEL (op))
{
if (SYMBOL_REF_DECL (op))
- max_ofs = tree_low_cst (DECL_SIZE_UNIT (SYMBOL_REF_DECL (op)), 1);
+ max_ofs = tree_to_uhwi (DECL_SIZE_UNIT (SYMBOL_REF_DECL (op)));
}
else
return false;
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index f731bb60beb..fb66dff5916 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -4349,18 +4349,18 @@ aapcs_vfp_sub_candidate (const_tree type, enum machine_mode *modep)
if (count == -1
|| !index
|| !TYPE_MAX_VALUE (index)
- || !host_integerp (TYPE_MAX_VALUE (index), 1)
+ || !tree_fits_uhwi_p (TYPE_MAX_VALUE (index))
|| !TYPE_MIN_VALUE (index)
- || !host_integerp (TYPE_MIN_VALUE (index), 1)
+ || !tree_fits_uhwi_p (TYPE_MIN_VALUE (index))
|| count < 0)
return -1;
- count *= (1 + tree_low_cst (TYPE_MAX_VALUE (index), 1)
- - tree_low_cst (TYPE_MIN_VALUE (index), 1));
+ count *= (1 + tree_to_uhwi (TYPE_MAX_VALUE (index))
+ - tree_to_uhwi (TYPE_MIN_VALUE (index)));
/* There must be no padding. */
- if (!host_integerp (TYPE_SIZE (type), 1)
- || (tree_low_cst (TYPE_SIZE (type), 1)
+ if (!tree_fits_uhwi_p (TYPE_SIZE (type))
+ || (tree_to_uhwi (TYPE_SIZE (type))
!= count * GET_MODE_BITSIZE (*modep)))
return -1;
@@ -4389,8 +4389,8 @@ aapcs_vfp_sub_candidate (const_tree type, enum machine_mode *modep)
}
/* There must be no padding. */
- if (!host_integerp (TYPE_SIZE (type), 1)
- || (tree_low_cst (TYPE_SIZE (type), 1)
+ if (!tree_fits_uhwi_p (TYPE_SIZE (type))
+ || (tree_to_uhwi (TYPE_SIZE (type))
!= count * GET_MODE_BITSIZE (*modep)))
return -1;
@@ -4421,8 +4421,8 @@ aapcs_vfp_sub_candidate (const_tree type, enum machine_mode *modep)
}
/* There must be no padding. */
- if (!host_integerp (TYPE_SIZE (type), 1)
- || (tree_low_cst (TYPE_SIZE (type), 1)
+ if (!tree_fits_uhwi_p (TYPE_SIZE (type))
+ || (tree_to_uhwi (TYPE_SIZE (type))
!= count * GET_MODE_BITSIZE (*modep)))
return -1;
@@ -9242,8 +9242,9 @@ vfp3_const_double_index (rtx x)
int sign, exponent;
unsigned HOST_WIDE_INT mantissa, mant_hi;
unsigned HOST_WIDE_INT mask;
- HOST_WIDE_INT m1, m2;
int point_pos = 2 * HOST_BITS_PER_WIDE_INT - 1;
+ bool fail;
+ wide_int w;
if (!TARGET_VFP3 || !CONST_DOUBLE_P (x))
return -1;
@@ -9263,9 +9264,9 @@ vfp3_const_double_index (rtx x)
WARNING: If there's ever a VFP version which uses more than 2 * H_W_I - 1
bits for the mantissa, this may fail (low bits would be lost). */
real_ldexp (&m, &r, point_pos - exponent);
- REAL_VALUE_TO_INT (&m1, &m2, m);
- mantissa = m1;
- mant_hi = m2;
+ w = real_to_integer (m, &fail, HOST_BITS_PER_WIDE_INT * 2);
+ mantissa = w.elt (0);
+ mant_hi = w.elt (1);
/* If there are bits set in the low part of the mantissa, we can't
represent this value. */
@@ -26650,7 +26651,7 @@ arm_builtin_vectorized_function (tree fndecl, tree type_out, tree type_in)
static HOST_WIDE_INT
arm_vector_alignment (const_tree type)
{
- HOST_WIDE_INT align = tree_low_cst (TYPE_SIZE (type), 0);
+ HOST_WIDE_INT align = tree_to_shwi (TYPE_SIZE (type));
if (TARGET_AAPCS_BASED)
align = MIN (align, 64);
diff --git a/gcc/config/avr/avr-log.c b/gcc/config/avr/avr-log.c
index 9e538e60124..18215679b71 100644
--- a/gcc/config/avr/avr-log.c
+++ b/gcc/config/avr/avr-log.c
@@ -142,28 +142,27 @@ avr_log_set_caller_f (const char *caller)
Splits last digit of *CST (taken as unsigned) in BASE and returns it. */
static unsigned
-avr_double_int_pop_digit (double_int *cst, unsigned base)
+avr_wide_int_pop_digit (wide_int *cst, unsigned base)
{
- double_int drem;
+ wide_int wrem;
- *cst = cst->udivmod (double_int::from_uhwi (base), (int) FLOOR_DIV_EXPR,
- &drem);
+ *cst = cst->udivmod_floor (base, &wrem);
- return (unsigned) drem.to_uhwi();
+ return (unsigned) wrem.to_uhwi();
}
/* Dump VAL as hex value to FILE. */
static void
-avr_dump_double_int_hex (FILE *file, double_int val)
+avr_dump_wide_int_hex (FILE *file, wide_int val)
{
unsigned digit[4];
- digit[0] = avr_double_int_pop_digit (&val, 1 << 16);
- digit[1] = avr_double_int_pop_digit (&val, 1 << 16);
- digit[2] = avr_double_int_pop_digit (&val, 1 << 16);
- digit[3] = avr_double_int_pop_digit (&val, 1 << 16);
+ digit[0] = avr_wide_int_pop_digit (&val, 1 << 16);
+ digit[1] = avr_wide_int_pop_digit (&val, 1 << 16);
+ digit[2] = avr_wide_int_pop_digit (&val, 1 << 16);
+ digit[3] = avr_wide_int_pop_digit (&val, 1 << 16);
fprintf (file, "0x");
@@ -232,7 +231,7 @@ avr_log_vadump (FILE *file, const char *fmt, va_list ap)
break;
case 'D':
- dump_double_int (file, va_arg (ap, double_int), false);
+ dump_double_int (file, va_arg (ap, double_int), false);
break;
case 'X':
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index 14a3eee7c72..e013d5cb2fd 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -11173,24 +11173,24 @@ avr_expand_delay_cycles (rtx operands0)
/* Return VAL * BASE + DIGIT. BASE = 0 is shortcut for BASE = 2^{32} */
-static double_int
-avr_double_int_push_digit (double_int val, int base,
- unsigned HOST_WIDE_INT digit)
+static wide_int
+avr_wide_int_push_digit (wide_int val, int base,
+ unsigned HOST_WIDE_INT digit)
{
val = 0 == base
- ? val.llshift (32, 64)
- : val * double_int::from_uhwi (base);
+ ? val.llshift (32)
+ : val * base;
- return val + double_int::from_uhwi (digit);
+ return val + digit;
}
/* Compute the image of x under f, i.e. perform x --> f(x) */
static int
-avr_map (double_int f, int x)
+avr_map (wide_int f, int x)
{
- return 0xf & f.lrshift (4*x, 64).to_uhwi ();
+ return 0xf & f.lrshift (4*x).to_uhwi ();
}
@@ -11215,7 +11215,7 @@ enum
};
static unsigned
-avr_map_metric (double_int a, int mode)
+avr_map_metric (wide_int a, int mode)
{
unsigned i, metric = 0;
@@ -11248,7 +11248,7 @@ avr_map_metric (double_int a, int mode)
bool
avr_has_nibble_0xf (rtx ival)
{
- return 0 != avr_map_metric (rtx_to_double_int (ival), MAP_MASK_PREIMAGE_F);
+ return 0 != avr_map_metric (wide_int::from_rtx (ival), MAP_MASK_PREIMAGE_F);
}
@@ -11282,7 +11282,7 @@ typedef struct
int cost;
/* The composition F o G^-1 (*, arg) for some function F */
- double_int map;
+ wide_int map;
/* For debug purpose only */
const char *str;
@@ -11313,12 +11313,12 @@ static const avr_map_op_t avr_map_op[] =
If result.cost < 0 then such a decomposition does not exist. */
static avr_map_op_t
-avr_map_decompose (double_int f, const avr_map_op_t *g, bool val_const_p)
+avr_map_decompose (wide_int f, const avr_map_op_t *g, bool val_const_p)
{
int i;
bool val_used_p = 0 != avr_map_metric (f, MAP_MASK_PREIMAGE_F);
avr_map_op_t f_ginv = *g;
- double_int ginv = double_int::from_uhwi (g->ginv);
+ wide_int ginv = wide_int::from_uhwi (g->ginv);
f_ginv.cost = -1;
@@ -11338,7 +11338,7 @@ avr_map_decompose (double_int f, const avr_map_op_t *g, bool val_const_p)
return f_ginv;
}
- f_ginv.map = avr_double_int_push_digit (f_ginv.map, 16, x);
+ f_ginv.map = avr_wide_int_push_digit (f_ginv.map, 16, x);
}
/* Step 2: Compute the cost of the operations.
@@ -11390,7 +11390,7 @@ avr_map_decompose (double_int f, const avr_map_op_t *g, bool val_const_p)
is different to its source position. */
static void
-avr_move_bits (rtx *xop, double_int map, bool fixp_p, int *plen)
+avr_move_bits (rtx *xop, wide_int map, bool fixp_p, int *plen)
{
int bit_dest, b;
@@ -11443,7 +11443,7 @@ avr_move_bits (rtx *xop, double_int map, bool fixp_p, int *plen)
const char*
avr_out_insert_bits (rtx *op, int *plen)
{
- double_int map = rtx_to_double_int (op[1]);
+ wide_int map = wide_int::from_rtx (op[1]);
unsigned mask_fixed;
bool fixp_p = true;
rtx xop[4];
@@ -11891,7 +11891,7 @@ avr_expand_builtin (tree exp, rtx target,
if (TREE_CODE (CALL_EXPR_ARG (exp, 1)) != INTEGER_CST)
break;
- int rbit = (int) TREE_INT_CST_LOW (CALL_EXPR_ARG (exp, 1));
+ int rbit = (int) tree_to_hwi (CALL_EXPR_ARG (exp, 1));
if (rbit >= (int) GET_MODE_FBIT (mode))
{
@@ -12034,7 +12034,7 @@ avr_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED, tree *arg,
tree tval = arg[2];
tree tmap;
tree map_type = TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (fndecl)));
- double_int map;
+ wide_int map;
bool changed = false;
unsigned i;
avr_map_op_t best_g;
@@ -12047,8 +12047,8 @@ avr_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED, tree *arg,
break;
}
- map = tree_to_double_int (arg[0]);
- tmap = double_int_to_tree (map_type, map);
+ map = wide_int::from_tree (arg[0]);
+ tmap = wide_int_to_tree (map_type, map);
if (TREE_CODE (tval) != INTEGER_CST
&& 0 == avr_map_metric (map, MAP_MASK_PREIMAGE_F))
@@ -12075,7 +12075,7 @@ avr_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED, tree *arg,
/* Inserting bits known at compile time is easy and can be
performed by AND and OR with appropriate masks. */
- int bits = TREE_INT_CST_LOW (tbits);
+ int bits = tree_to_hwi (tbits);
int mask_ior = 0, mask_and = 0xff;
for (i = 0; i < 8; i++)
@@ -12152,7 +12152,7 @@ avr_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED, tree *arg,
/* Use map o G^-1 instead of original map to undo the effect of G. */
- tmap = double_int_to_tree (map_type, best_g.map);
+ tmap = wide_int_to_tree (map_type, best_g.map);
return build_call_expr (fndecl, 3, tmap, tbits, tval);
} /* AVR_BUILTIN_INSERT_BITS */
diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
index 7fab975a673..356408c4776 100644
--- a/gcc/config/bfin/bfin.c
+++ b/gcc/config/bfin/bfin.c
@@ -3285,8 +3285,8 @@ bfin_local_alignment (tree type, unsigned align)
memcpy can use 32 bit loads/stores. */
if (TYPE_SIZE (type)
&& TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
- && (TREE_INT_CST_LOW (TYPE_SIZE (type)) > 8
- || TREE_INT_CST_HIGH (TYPE_SIZE (type))) && align < 32)
+ && (!wide_int::gtu_p (TYPE_SIZE (type), 8))
+ && align < 32)
return 32;
return align;
}
diff --git a/gcc/config/c6x/predicates.md b/gcc/config/c6x/predicates.md
index 1a2fe8f69f5..fbcbdd02457 100644
--- a/gcc/config/c6x/predicates.md
+++ b/gcc/config/c6x/predicates.md
@@ -210,9 +210,9 @@
t = DECL_SIZE_UNIT (t);
else
t = TYPE_SIZE_UNIT (TREE_TYPE (t));
- if (t && host_integerp (t, 0))
+ if (t && tree_fits_shwi_p (t))
{
- size = tree_low_cst (t, 0);
+ size = tree_to_shwi (t);
if (size < 0)
size = 0;
}
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index e07fa4c8324..89d5397b1a8 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -1271,22 +1271,18 @@ darwin_mergeable_constant_section (tree exp,
{
tree size = TYPE_SIZE_UNIT (TREE_TYPE (exp));
- if (TREE_CODE (size) == INTEGER_CST
- && TREE_INT_CST_LOW (size) == 4
- && TREE_INT_CST_HIGH (size) == 0)
- return darwin_sections[literal4_section];
- else if (TREE_CODE (size) == INTEGER_CST
- && TREE_INT_CST_LOW (size) == 8
- && TREE_INT_CST_HIGH (size) == 0)
- return darwin_sections[literal8_section];
- else if (HAVE_GAS_LITERAL16
- && TARGET_64BIT
- && TREE_CODE (size) == INTEGER_CST
- && TREE_INT_CST_LOW (size) == 16
- && TREE_INT_CST_HIGH (size) == 0)
- return darwin_sections[literal16_section];
- else
- return readonly_data_section;
+ if (TREE_CODE (size) == INTEGER_CST)
+ {
+ wide_int wsize = size;
+ if (wsize == 4)
+ return darwin_sections[literal4_section];
+ else if (wsize == 8)
+ return darwin_sections[literal8_section];
+ else if (HAVE_GAS_LITERAL16
+ && TARGET_64BIT
+ && wsize == 16)
+ return darwin_sections[literal16_section];
+ }
}
return readonly_data_section;
@@ -1491,7 +1487,7 @@ machopic_select_section (tree decl,
zsize = (DECL_P (decl)
&& (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == CONST_DECL)
- && tree_low_cst (DECL_SIZE_UNIT (decl), 1) == 0);
+ && tree_to_uhwi (DECL_SIZE_UNIT (decl)) == 0);
one = DECL_P (decl)
&& TREE_CODE (decl) == VAR_DECL
@@ -1634,7 +1630,7 @@ machopic_select_section (tree decl,
static bool warned_objc_46 = false;
/* We shall assert that zero-sized objects are an error in ObjC
meta-data. */
- gcc_assert (tree_low_cst (DECL_SIZE_UNIT (decl), 1) != 0);
+ gcc_assert (tree_to_uhwi (DECL_SIZE_UNIT (decl)) != 0);
/* ??? This mechanism for determining the metadata section is
broken when LTO is in use, since the frontend that generated
@@ -2171,7 +2167,7 @@ darwin_asm_declare_object_name (FILE *file,
machopic_define_symbol (DECL_RTL (decl));
}
- size = tree_low_cst (DECL_SIZE_UNIT (decl), 1);
+ size = tree_to_uhwi (DECL_SIZE_UNIT (decl));
#ifdef DEBUG_DARWIN_MEM_ALLOCATORS
fprintf (file, "# dadon: %s %s (%llu, %u) local %d weak %d"
diff --git a/gcc/config/epiphany/epiphany.c b/gcc/config/epiphany/epiphany.c
index fd4c01c49a4..f07f15e888c 100644
--- a/gcc/config/epiphany/epiphany.c
+++ b/gcc/config/epiphany/epiphany.c
@@ -2758,11 +2758,11 @@ epiphany_special_round_type_align (tree type, unsigned computed,
continue;
offset = bit_position (field);
size = DECL_SIZE (field);
- if (!host_integerp (offset, 1) || !host_integerp (size, 1)
- || TREE_INT_CST_LOW (offset) >= try_align
- || TREE_INT_CST_LOW (size) >= try_align)
+ if (!tree_fits_uhwi_p (offset) || !tree_fits_uhwi_p (size)
+ || tree_to_uhwi (offset) >= try_align
+ || tree_to_uhwi (size) >= try_align)
return try_align;
- total = TREE_INT_CST_LOW (offset) + TREE_INT_CST_LOW (size);
+ total = tree_to_hwi (offset) + tree_to_hwi (size);
if (total > max)
max = total;
}
@@ -2785,7 +2785,7 @@ epiphany_adjust_field_align (tree field, unsigned computed)
{
tree elmsz = TYPE_SIZE (TREE_TYPE (TREE_TYPE (field)));
- if (!host_integerp (elmsz, 1) || tree_low_cst (elmsz, 1) >= 32)
+ if (!tree_fits_uhwi_p (elmsz) || tree_to_uhwi (elmsz) >= 32)
return 64;
}
return computed;
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 842f99363b4..6bccc7d9b73 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -62,6 +62,7 @@ along with GCC; see the file COPYING3. If not see
#include "dumpfile.h"
#include "tree-pass.h"
#include "tree-flow.h"
+#include "wide-int.h"
#include "context.h"
#include "pass_manager.h"
@@ -5603,7 +5604,7 @@ ix86_function_regparm (const_tree type, const_tree decl)
attr = lookup_attribute ("regparm", TYPE_ATTRIBUTES (type));
if (attr)
{
- regparm = TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (attr)));
+ regparm = tree_to_hwi (TREE_VALUE (TREE_VALUE (attr)));
return regparm;
}
}
@@ -5730,7 +5731,7 @@ ix86_keep_aggregate_return_pointer (tree fntype)
attr = lookup_attribute ("callee_pop_aggregate_return",
TYPE_ATTRIBUTES (fntype));
if (attr)
- return (TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (attr))) == 0);
+ return (tree_to_hwi (TREE_VALUE (TREE_VALUE (attr))) == 0);
/* For 32-bit MS-ABI the default is to keep aggregate
return pointer. */
@@ -6399,7 +6400,7 @@ classify_argument (enum machine_mode mode, const_tree type,
for (i = (int_bit_position (field)
+ (bit_offset % 64)) / 8 / 8;
i < ((int_bit_position (field) + (bit_offset % 64))
- + tree_low_cst (DECL_SIZE (field), 0)
+ + tree_to_shwi (DECL_SIZE (field))
+ 63) / 8 / 8; i++)
classes[i] =
merge_classes (X86_64_INTEGER_CLASS,
@@ -25694,8 +25695,7 @@ ix86_data_alignment (tree type, int align, bool opt)
&& AGGREGATE_TYPE_P (type)
&& TYPE_SIZE (type)
&& TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
- && (TREE_INT_CST_LOW (TYPE_SIZE (type)) >= (unsigned) max_align
- || TREE_INT_CST_HIGH (TYPE_SIZE (type)))
+ && (wide_int::geu_p (TYPE_SIZE (type), max_align))
&& align < max_align)
align = max_align;
@@ -25706,8 +25706,8 @@ ix86_data_alignment (tree type, int align, bool opt)
if ((opt ? AGGREGATE_TYPE_P (type) : TREE_CODE (type) == ARRAY_TYPE)
&& TYPE_SIZE (type)
&& TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
- && (TREE_INT_CST_LOW (TYPE_SIZE (type)) >= 128
- || TREE_INT_CST_HIGH (TYPE_SIZE (type))) && align < 128)
+ && (wide_int::geu_p (TYPE_SIZE (type), 128))
+ && align < 128)
return 128;
}
@@ -25816,13 +25816,13 @@ ix86_local_alignment (tree exp, enum machine_mode mode,
&& TARGET_SSE)
{
if (AGGREGATE_TYPE_P (type)
- && (va_list_type_node == NULL_TREE
- || (TYPE_MAIN_VARIANT (type)
- != TYPE_MAIN_VARIANT (va_list_type_node)))
- && TYPE_SIZE (type)
- && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
- && (TREE_INT_CST_LOW (TYPE_SIZE (type)) >= 16
- || TREE_INT_CST_HIGH (TYPE_SIZE (type))) && align < 128)
+ && (va_list_type_node == NULL_TREE
+ || (TYPE_MAIN_VARIANT (type)
+ != TYPE_MAIN_VARIANT (va_list_type_node)))
+ && TYPE_SIZE (type)
+ && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
+ && (wide_int::geu_p (TYPE_SIZE (type), 16))
+ && align < 128)
return 128;
}
if (TREE_CODE (type) == ARRAY_TYPE)
@@ -28842,7 +28842,7 @@ ix86_builtin_tm_load (tree type)
{
if (TREE_CODE (type) == VECTOR_TYPE)
{
- switch (tree_low_cst (TYPE_SIZE (type), 1))
+ switch (tree_to_uhwi (TYPE_SIZE (type)))
{
case 64:
return builtin_decl_explicit (BUILT_IN_TM_LOAD_M64);
@@ -28862,7 +28862,7 @@ ix86_builtin_tm_store (tree type)
{
if (TREE_CODE (type) == VECTOR_TYPE)
{
- switch (tree_low_cst (TYPE_SIZE (type), 1))
+ switch (tree_to_uhwi (TYPE_SIZE (type)))
{
case 64:
return builtin_decl_explicit (BUILT_IN_TM_STORE_M64);
@@ -32175,8 +32175,8 @@ get_element_number (tree vec_type, tree arg)
{
unsigned HOST_WIDE_INT elt, max = TYPE_VECTOR_SUBPARTS (vec_type) - 1;
- if (!host_integerp (arg, 1)
- || (elt = tree_low_cst (arg, 1), elt > max))
+ if (!tree_fits_uhwi_p (arg)
+ || (elt = tree_to_uhwi (arg), elt > max))
{
error ("selector must be an integer constant in the range 0..%wi", max);
return 0;
@@ -38179,7 +38179,7 @@ void ix86_emit_swsqrtsf (rtx res, rtx a, enum machine_mode mode,
e2 = gen_reg_rtx (mode);
e3 = gen_reg_rtx (mode);
- real_from_integer (&r, VOIDmode, -3, -1, 0);
+ real_from_integer (&r, VOIDmode, -3, SIGNED);
mthree = CONST_DOUBLE_FROM_REAL_VALUE (r, SFmode);
real_arithmetic (&r, NEGATE_EXPR, &dconsthalf, NULL);
diff --git a/gcc/config/ia64/predicates.md b/gcc/config/ia64/predicates.md
index adfb15ff7b7..da4b393d633 100644
--- a/gcc/config/ia64/predicates.md
+++ b/gcc/config/ia64/predicates.md
@@ -72,9 +72,9 @@
t = DECL_SIZE_UNIT (t);
else
t = TYPE_SIZE_UNIT (TREE_TYPE (t));
- if (t && host_integerp (t, 0))
+ if (t && tree_fits_shwi_p (t))
{
- size = tree_low_cst (t, 0);
+ size = tree_to_shwi (t);
if (size < 0)
size = 0;
}
diff --git a/gcc/config/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c
index 7e19366ae93..689a87cb094 100644
--- a/gcc/config/iq2000/iq2000.c
+++ b/gcc/config/iq2000/iq2000.c
@@ -1279,7 +1279,7 @@ iq2000_function_arg (cumulative_args_t cum_v, enum machine_mode mode,
if (! type || TREE_CODE (type) != RECORD_TYPE
|| ! named || ! TYPE_SIZE_UNIT (type)
- || ! host_integerp (TYPE_SIZE_UNIT (type), 1))
+ || ! tree_fits_uhwi_p (TYPE_SIZE_UNIT (type)))
ret = gen_rtx_REG (mode, regbase + *arg_words + bias);
else
{
@@ -1289,7 +1289,7 @@ iq2000_function_arg (cumulative_args_t cum_v, enum machine_mode mode,
if (TREE_CODE (field) == FIELD_DECL
&& TREE_CODE (TREE_TYPE (field)) == REAL_TYPE
&& TYPE_PRECISION (TREE_TYPE (field)) == BITS_PER_WORD
- && host_integerp (bit_position (field), 0)
+ && tree_fits_shwi_p (bit_position (field))
&& int_bit_position (field) % BITS_PER_WORD == 0)
break;
@@ -1307,7 +1307,7 @@ iq2000_function_arg (cumulative_args_t cum_v, enum machine_mode mode,
/* ??? If this is a packed structure, then the last hunk won't
be 64 bits. */
chunks
- = tree_low_cst (TYPE_SIZE_UNIT (type), 1) / UNITS_PER_WORD;
+ = tree_to_uhwi (TYPE_SIZE_UNIT (type)) / UNITS_PER_WORD;
if (chunks + *arg_words + bias > (unsigned) MAX_ARGS_IN_REGISTERS)
chunks = MAX_ARGS_IN_REGISTERS - *arg_words - bias;
diff --git a/gcc/config/m32c/m32c-pragma.c b/gcc/config/m32c/m32c-pragma.c
index 6b0d05a8aaf..aa16a30453d 100644
--- a/gcc/config/m32c/m32c-pragma.c
+++ b/gcc/config/m32c/m32c-pragma.c
@@ -46,9 +46,9 @@ m32c_pragma_memregs (cpp_reader * reader ATTRIBUTE_UNUSED)
type = pragma_lex (&val);
if (type == CPP_NUMBER)
{
- if (host_integerp (val, 1))
+ if (tree_fits_uhwi_p (val))
{
- i = tree_low_cst (val, 1);
+ i = tree_to_uhwi (val);
type = pragma_lex (&val);
if (type != CPP_EOF)
@@ -95,7 +95,7 @@ m32c_pragma_address (cpp_reader * reader ATTRIBUTE_UNUSED)
{
if (var != error_mark_node)
{
- unsigned uaddr = tree_low_cst (addr, 1);
+ unsigned uaddr = tree_to_uhwi (addr);
m32c_note_pragma_address (IDENTIFIER_POINTER (var), uaddr);
}
diff --git a/gcc/config/m32c/m32c.c b/gcc/config/m32c/m32c.c
index deac40c228f..f78037446fd 100644
--- a/gcc/config/m32c/m32c.c
+++ b/gcc/config/m32c/m32c.c
@@ -2935,8 +2935,8 @@ function_vector_handler (tree * node ATTRIBUTE_UNUSED,
name);
*no_add_attrs = true;
}
- else if (TREE_INT_CST_LOW (TREE_VALUE (args)) < 18
- || TREE_INT_CST_LOW (TREE_VALUE (args)) > 255)
+ else if (tree_to_hwi (TREE_VALUE (args)) < 18
+ || tree_to_hwi (TREE_VALUE (args)) > 255)
{
/* The argument value must be between 18 to 255. */
warning (OPT_Wattributes,
@@ -2968,7 +2968,7 @@ current_function_special_page_vector (rtx x)
{
if (is_attribute_p ("function_vector", TREE_PURPOSE (list)))
{
- num = TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (list)));
+ num = tree_to_hwi (TREE_VALUE (TREE_VALUE (list)));
return num;
}
diff --git a/gcc/config/mep/mep-pragma.c b/gcc/config/mep/mep-pragma.c
index 8a9c577f5a9..45a4b4496a4 100644
--- a/gcc/config/mep/mep-pragma.c
+++ b/gcc/config/mep/mep-pragma.c
@@ -232,9 +232,9 @@ mep_pragma_coprocessor_width (void)
switch (type)
{
case CPP_NUMBER:
- if (! host_integerp (val, 1))
+ if (! tree_fits_uhwi_p (val))
break;
- i = tree_low_cst (val, 1);
+ i = tree_to_uhwi (val);
/* This pragma no longer has any effect. */
#if 0
if (i == 32)
@@ -273,7 +273,7 @@ mep_pragma_coprocessor_subclass (void)
type = mep_pragma_lex (&val);
if (type != CPP_CHAR)
goto syntax_error;
- class_letter = tree_low_cst (val, 1);
+ class_letter = tree_to_uhwi (val);
if (class_letter >= 'A' && class_letter <= 'D')
switch (class_letter)
{
diff --git a/gcc/config/mep/mep.c b/gcc/config/mep/mep.c
index a5b7e6c68be..e1f87698839 100644
--- a/gcc/config/mep/mep.c
+++ b/gcc/config/mep/mep.c
@@ -4209,7 +4209,7 @@ mep_attrlist_to_encoding (tree list, tree decl)
&& TREE_VALUE (TREE_VALUE (list))
&& TREE_CODE (TREE_VALUE (TREE_VALUE (list))) == INTEGER_CST)
{
- int location = TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE(list)));
+ int location = tree_to_hwi (TREE_VALUE (TREE_VALUE(list)));
if (location >= 0
&& location <= 0x1000000)
return 'i';
@@ -4298,7 +4298,7 @@ mep_insert_attributes (tree decl, tree *attributes)
&& TREE_VALUE (attr)
&& TREE_VALUE (TREE_VALUE(attr)))
{
- int location = TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE(attr)));
+ int location = tree_to_hwi (TREE_VALUE (TREE_VALUE(attr)));
static tree previous_value = 0;
static int previous_location = 0;
static tree previous_name = 0;
@@ -4714,7 +4714,7 @@ mep_output_aligned_common (FILE *stream, tree decl, const char *name,
if (attr
&& TREE_VALUE (attr)
&& TREE_VALUE (TREE_VALUE(attr)))
- location = TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE(attr)));
+ location = tree_to_hwi (TREE_VALUE (TREE_VALUE(attr)));
if (location == -1)
return;
if (global)
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 4da80f42e7b..9e4c2acad97 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -5136,7 +5136,7 @@ mips_function_arg (cumulative_args_t cum_v, enum machine_mode mode,
&& type != 0
&& TREE_CODE (type) == RECORD_TYPE
&& TYPE_SIZE_UNIT (type)
- && host_integerp (TYPE_SIZE_UNIT (type), 1))
+ && tree_fits_uhwi_p (TYPE_SIZE_UNIT (type)))
{
tree field;
@@ -5145,7 +5145,7 @@ mips_function_arg (cumulative_args_t cum_v, enum machine_mode mode,
if (TREE_CODE (field) == FIELD_DECL
&& SCALAR_FLOAT_TYPE_P (TREE_TYPE (field))
&& TYPE_PRECISION (TREE_TYPE (field)) == BITS_PER_WORD
- && host_integerp (bit_position (field), 0)
+ && tree_fits_shwi_p (bit_position (field))
&& int_bit_position (field) % BITS_PER_WORD == 0)
break;
@@ -14915,7 +14915,7 @@ r10k_safe_mem_expr_p (tree expr, HOST_WIDE_INT offset)
return false;
offset += bitoffset / BITS_PER_UNIT;
- return offset >= 0 && offset < tree_low_cst (DECL_SIZE_UNIT (inner), 1);
+ return offset >= 0 && offset < tree_to_uhwi (DECL_SIZE_UNIT (inner));
}
/* A for_each_rtx callback for which DATA points to the instruction
diff --git a/gcc/config/picochip/picochip.c b/gcc/config/picochip/picochip.c
index e8575ace160..2e4d0e49758 100644
--- a/gcc/config/picochip/picochip.c
+++ b/gcc/config/picochip/picochip.c
@@ -809,7 +809,7 @@ picochip_compute_arg_size (const_tree type, enum machine_mode mode)
int type_size_in_units = 0;
if (type)
- type_size_in_units = tree_low_cst (TYPE_SIZE_UNIT (type), 1);
+ type_size_in_units = tree_to_uhwi (TYPE_SIZE_UNIT (type));
else
type_size_in_units = GET_MODE_SIZE (mode);
diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
index d58e6865193..ef3fc29f562 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -26,6 +26,7 @@
#include "tm.h"
#include "cpplib.h"
#include "tree.h"
+#include "wide-int.h"
#include "c-family/c-common.h"
#include "c-family/c-pragma.h"
#include "diagnostic-core.h"
@@ -4195,8 +4196,7 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl,
mode = TYPE_MODE (arg1_type);
if ((mode == V2DFmode || mode == V2DImode) && VECTOR_MEM_VSX_P (mode)
&& TREE_CODE (arg2) == INTEGER_CST
- && TREE_INT_CST_HIGH (arg2) == 0
- && (TREE_INT_CST_LOW (arg2) == 0 || TREE_INT_CST_LOW (arg2) == 1))
+ && wide_int::ltu_p (arg2, 2))
{
tree call = NULL_TREE;
@@ -4280,9 +4280,8 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl,
/* If we can use the VSX xxpermdi instruction, use that for insert. */
mode = TYPE_MODE (arg1_type);
if ((mode == V2DFmode || mode == V2DImode) && VECTOR_UNIT_VSX_P (mode)
- && TREE_CODE (arg2) == INTEGER_CST
- && TREE_INT_CST_HIGH (arg2) == 0
- && (TREE_INT_CST_LOW (arg2) == 0 || TREE_INT_CST_LOW (arg2) == 1))
+ && tree_fits_uhwi_p (arg2)
+ && wide_int::ltu_p (arg2, 2))
{
tree call = NULL_TREE;
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 30cd6961f7b..32d618e6a3b 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -3777,7 +3777,7 @@ rs6000_builtin_support_vector_misalignment (enum machine_mode mode,
it's word aligned. */
if (rs6000_vector_alignment_reachable (type, is_packed))
{
- int element_size = TREE_INT_CST_LOW (TYPE_SIZE (type));
+ int element_size = tree_to_hwi (TYPE_SIZE (type));
if (element_size == 64 || element_size == 32)
return true;
@@ -5844,13 +5844,13 @@ offsettable_ok_by_alignment (rtx op, HOST_WIDE_INT offset,
if (!DECL_SIZE_UNIT (decl))
return false;
- if (!host_integerp (DECL_SIZE_UNIT (decl), 1))
+ if (!tree_fits_uhwi_p (DECL_SIZE_UNIT (decl)))
return false;
-
- dsize = tree_low_cst (DECL_SIZE_UNIT (decl), 1);
+
+ dsize = tree_to_uhwi (DECL_SIZE_UNIT (decl));
if (dsize > 32768)
return false;
-
+
return dalign / BITS_PER_UNIT >= dsize;
}
}
@@ -5870,8 +5870,8 @@ offsettable_ok_by_alignment (rtx op, HOST_WIDE_INT offset,
if (TREE_CODE (decl) == STRING_CST)
dsize = TREE_STRING_LENGTH (decl);
else if (TYPE_SIZE_UNIT (type)
- && host_integerp (TYPE_SIZE_UNIT (type), 1))
- dsize = tree_low_cst (TYPE_SIZE_UNIT (type), 1);
+ && tree_fits_uhwi_p (TYPE_SIZE_UNIT (type)))
+ dsize = tree_to_uhwi (TYPE_SIZE_UNIT (type));
else
return false;
if (dsize > 32768)
@@ -8460,7 +8460,7 @@ rs6000_darwin64_record_arg_advance_recurse (CUMULATIVE_ARGS *cum,
mode = TYPE_MODE (ftype);
if (DECL_SIZE (f) != 0
- && host_integerp (bit_position (f), 1))
+ && tree_fits_uhwi_p (bit_position (f)))
bitpos += int_bit_position (f);
/* ??? FIXME: else assume zero offset. */
@@ -8937,7 +8937,7 @@ rs6000_darwin64_record_arg_recurse (CUMULATIVE_ARGS *cum, const_tree type,
mode = TYPE_MODE (ftype);
if (DECL_SIZE (f) != 0
- && host_integerp (bit_position (f), 1))
+ && tree_fits_uhwi_p (bit_position (f)))
bitpos += int_bit_position (f);
/* ??? FIXME: else assume zero offset. */
@@ -10675,7 +10675,7 @@ rs6000_expand_binop_builtin (enum insn_code icode, tree exp, rtx target)
/* Only allow 5-bit unsigned literals. */
STRIP_NOPS (arg1);
if (TREE_CODE (arg1) != INTEGER_CST
- || TREE_INT_CST_LOW (arg1) & ~0x1f)
+ || tree_to_hwi (arg1) & ~0x1f)
{
error ("argument 2 must be a 5-bit unsigned literal");
return const0_rtx;
@@ -10720,7 +10720,7 @@ altivec_expand_predicate_builtin (enum insn_code icode, tree exp, rtx target)
return const0_rtx;
}
else
- cr6_form_int = TREE_INT_CST_LOW (cr6_form);
+ cr6_form_int = tree_to_hwi (cr6_form);
gcc_assert (mode0 == mode1);
@@ -11211,7 +11211,7 @@ rs6000_expand_ternop_builtin (enum insn_code icode, tree exp, rtx target)
/* Only allow 4-bit unsigned literals. */
STRIP_NOPS (arg2);
if (TREE_CODE (arg2) != INTEGER_CST
- || TREE_INT_CST_LOW (arg2) & ~0xf)
+ || tree_to_hwi (arg2) & ~0xf)
{
error ("argument 3 must be a 4-bit unsigned literal");
return const0_rtx;
@@ -11229,7 +11229,7 @@ rs6000_expand_ternop_builtin (enum insn_code icode, tree exp, rtx target)
/* Only allow 2-bit unsigned literals. */
STRIP_NOPS (arg2);
if (TREE_CODE (arg2) != INTEGER_CST
- || TREE_INT_CST_LOW (arg2) & ~0x3)
+ || tree_to_hwi (arg2) & ~0x3)
{
error ("argument 3 must be a 2-bit unsigned literal");
return const0_rtx;
@@ -11241,7 +11241,7 @@ rs6000_expand_ternop_builtin (enum insn_code icode, tree exp, rtx target)
/* Only allow 1-bit unsigned literals. */
STRIP_NOPS (arg2);
if (TREE_CODE (arg2) != INTEGER_CST
- || TREE_INT_CST_LOW (arg2) & ~0x1)
+ || tree_to_hwi (arg2) & ~0x1)
{
error ("argument 3 must be a 1-bit unsigned literal");
return const0_rtx;
@@ -11254,7 +11254,7 @@ rs6000_expand_ternop_builtin (enum insn_code icode, tree exp, rtx target)
range and prepare arguments. */
STRIP_NOPS (arg1);
if (TREE_CODE (arg1) != INTEGER_CST
- || !IN_RANGE (TREE_INT_CST_LOW (arg1), 0, 1))
+ || !IN_RANGE (TREE_INT_CST_ELT (arg1, 0), 0, 1))
{
error ("argument 2 must be 0 or 1");
return const0_rtx;
@@ -11262,7 +11262,7 @@ rs6000_expand_ternop_builtin (enum insn_code icode, tree exp, rtx target)
STRIP_NOPS (arg2);
if (TREE_CODE (arg2) != INTEGER_CST
- || !IN_RANGE (TREE_INT_CST_LOW (arg2), 0, 15))
+ || !IN_RANGE (TREE_INT_CST_ELT (arg2, 0), 0, 15))
{
error ("argument 3 must be in the range 0..15");
return const0_rtx;
@@ -11445,7 +11445,7 @@ altivec_expand_dst_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
*expandedp = true;
STRIP_NOPS (arg2);
if (TREE_CODE (arg2) != INTEGER_CST
- || TREE_INT_CST_LOW (arg2) & ~0x3)
+ || tree_to_hwi (arg2) & ~0x3)
{
error ("argument to %qs must be a 2-bit unsigned literal", d->name);
return const0_rtx;
@@ -11499,8 +11499,8 @@ get_element_number (tree vec_type, tree arg)
{
unsigned HOST_WIDE_INT elt, max = TYPE_VECTOR_SUBPARTS (vec_type) - 1;
- if (!host_integerp (arg, 1)
- || (elt = tree_low_cst (arg, 1), elt > max))
+ if (!tree_fits_uhwi_p (arg)
+ || (elt = tree_to_uhwi (arg), elt > max))
{
error ("selector must be an integer constant in the range 0..%wi", max);
return 0;
@@ -11692,7 +11692,7 @@ altivec_expand_builtin (tree exp, rtx target, bool *expandedp)
return const0_rtx;
if (TREE_CODE (arg0) != INTEGER_CST
- || TREE_INT_CST_LOW (arg0) & ~0x3)
+ || tree_to_hwi (arg0) & ~0x3)
{
error ("argument to dss must be a 2-bit unsigned literal");
return const0_rtx;
@@ -11901,7 +11901,7 @@ spe_expand_builtin (tree exp, rtx target, bool *expandedp)
case SPE_BUILTIN_EVSTWWO:
arg1 = CALL_EXPR_ARG (exp, 2);
if (TREE_CODE (arg1) != INTEGER_CST
- || TREE_INT_CST_LOW (arg1) & ~0x1f)
+ || tree_to_hwi (arg1) & ~0x1f)
{
error ("argument 2 must be a 5-bit unsigned literal");
return const0_rtx;
@@ -12027,7 +12027,7 @@ paired_expand_predicate_builtin (enum insn_code icode, tree exp, rtx target)
return const0_rtx;
}
else
- form_int = TREE_INT_CST_LOW (form);
+ form_int = tree_to_hwi (form);
gcc_assert (mode0 == mode1);
@@ -12099,7 +12099,7 @@ spe_expand_predicate_builtin (enum insn_code icode, tree exp, rtx target)
return const0_rtx;
}
else
- form_int = TREE_INT_CST_LOW (form);
+ form_int = tree_to_hwi (form);
gcc_assert (mode0 == mode1);
@@ -28217,7 +28217,7 @@ rs6000_emit_swrsqrt (rtx dst, rtx src)
gcc_assert (code != CODE_FOR_nothing);
/* Load up the constant 1.5 either as a scalar, or as a vector. */
- real_from_integer (&dconst3_2, VOIDmode, 3, 0, 0);
+ real_from_integer (&dconst3_2, VOIDmode, 3, SIGNED);
SET_REAL_EXP (&dconst3_2, REAL_EXP (&dconst3_2) - 1);
halfthree = rs6000_load_constant_and_splat (mode, dconst3_2);
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 1ea52af0f2b..b12cfc0d31f 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -9986,9 +9986,9 @@ s390_encode_section_info (tree decl, rtx rtl, int first)
SYMBOL_REF_FLAGS (XEXP (rtl, 0)) |= SYMBOL_FLAG_ALIGN1;
if (!DECL_SIZE (decl)
|| !DECL_ALIGN (decl)
- || !host_integerp (DECL_SIZE (decl), 0)
+ || !tree_fits_shwi_p (DECL_SIZE (decl))
|| (DECL_ALIGN (decl) <= 64
- && DECL_ALIGN (decl) != tree_low_cst (DECL_SIZE (decl), 0)))
+ && DECL_ALIGN (decl) != tree_to_shwi (DECL_SIZE (decl))))
SYMBOL_REF_FLAGS (XEXP (rtl, 0)) |= SYMBOL_FLAG_NOT_NATURALLY_ALIGNED;
}
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 60f45452036..fda132c3a21 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -1127,7 +1127,7 @@ sh_print_operand (FILE *stream, rtx x, int code)
DECL_ATTRIBUTES (current_function_decl));
if (trapa_attr)
fprintf (stream, "trapa #%ld",
- (long) TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (trapa_attr))));
+ (long) tree_to_hwi (TREE_VALUE (TREE_VALUE (trapa_attr))));
else if (sh_cfun_interrupt_handler_p ())
{
if (sh_cfun_resbank_handler_p ())
@@ -9575,7 +9575,7 @@ sh2a_handle_function_vector_handler_attribute (tree * node, tree name,
name);
*no_add_attrs = true;
}
- else if (TREE_INT_CST_LOW (TREE_VALUE (args)) > 255)
+ else if (tree_to_hwi (TREE_VALUE (args)) > 255)
{
/* The argument value must be between 0 to 255. */
warning (OPT_Wattributes,
@@ -9624,7 +9624,7 @@ sh2a_get_function_vector_number (rtx x)
{
if (is_attribute_p ("function_vector", TREE_PURPOSE (list)))
{
- num = TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (list)));
+ num = tree_to_hwi (TREE_VALUE (TREE_VALUE (list)));
return num;
}
diff --git a/gcc/config/sol2-c.c b/gcc/config/sol2-c.c
index ee44621591e..86a8d907521 100644
--- a/gcc/config/sol2-c.c
+++ b/gcc/config/sol2-c.c
@@ -93,8 +93,8 @@ solaris_pragma_align (cpp_reader *pfile ATTRIBUTE_UNUSED)
return;
}
- low = TREE_INT_CST_LOW (x);
- if (TREE_INT_CST_HIGH (x) != 0
+ low = tree_to_hwi (x);
+ if (!cst_fits_uhwi_p (x)
|| (low != 1 && low != 2 && low != 4 && low != 8 && low != 16
&& low != 32 && low != 64 && low != 128))
{
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index e5b4662512d..15c30c9d389 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -54,6 +54,7 @@ along with GCC; see the file COPYING3. If not see
#include "opts.h"
#include "tree-pass.h"
#include "context.h"
+#include "wide-int.h"
/* Processor costs */
@@ -6313,7 +6314,7 @@ function_arg_record_value_1 (const_tree type, HOST_WIDE_INT startbitpos,
if (integer_zerop (DECL_SIZE (field)))
continue;
- if (host_integerp (bit_position (field), 1))
+ if (tree_fits_uhwi_p (bit_position (field)))
bitpos += int_bit_position (field);
}
@@ -6461,7 +6462,7 @@ function_arg_record_value_2 (const_tree type, HOST_WIDE_INT startbitpos,
if (integer_zerop (DECL_SIZE (field)))
continue;
- if (host_integerp (bit_position (field), 1))
+ if (tree_fits_uhwi_p (bit_position (field)))
bitpos += int_bit_position (field);
}
@@ -7128,10 +7129,10 @@ sparc_struct_value_rtx (tree fndecl, int incoming)
/* Calculate the return object size */
tree size = TYPE_SIZE_UNIT (TREE_TYPE (fndecl));
- rtx size_rtx = GEN_INT (TREE_INT_CST_LOW (size) & 0xfff);
+ rtx size_rtx = GEN_INT (tree_to_hwi (size) & 0xfff);
/* Construct a temporary return value */
rtx temp_val
- = assign_stack_local (Pmode, TREE_INT_CST_LOW (size), 0);
+ = assign_stack_local (Pmode, tree_to_hwi (size), 0);
/* Implement SPARC 32-bit psABI callee return struct checking:
@@ -10470,31 +10471,31 @@ sparc_handle_vis_mul8x16 (tree *n_elts, int fncode, tree inner_type,
for (i = 0; i < num; ++i)
{
int val
- = sparc_vis_mul8x16 (TREE_INT_CST_LOW (VECTOR_CST_ELT (cst0, i)),
- TREE_INT_CST_LOW (VECTOR_CST_ELT (cst1, i)));
+ = sparc_vis_mul8x16 (tree_to_hwi (VECTOR_CST_ELT (cst0, i)),
+ tree_to_hwi (VECTOR_CST_ELT (cst1, i)));
n_elts[i] = build_int_cst (inner_type, val);
}
break;
case CODE_FOR_fmul8x16au_vis:
- scale = TREE_INT_CST_LOW (VECTOR_CST_ELT (cst1, 0));
+ scale = tree_to_hwi (VECTOR_CST_ELT (cst1, 0));
for (i = 0; i < num; ++i)
{
int val
- = sparc_vis_mul8x16 (TREE_INT_CST_LOW (VECTOR_CST_ELT (cst0, i)),
+ = sparc_vis_mul8x16 (tree_to_hwi (VECTOR_CST_ELT (cst0, i)),
scale);
n_elts[i] = build_int_cst (inner_type, val);
}
break;
case CODE_FOR_fmul8x16al_vis:
- scale = TREE_INT_CST_LOW (VECTOR_CST_ELT (cst1, 1));
+ scale = tree_to_hwi (VECTOR_CST_ELT (cst1, 1));
for (i = 0; i < num; ++i)
{
int val
- = sparc_vis_mul8x16 (TREE_INT_CST_LOW (VECTOR_CST_ELT (cst0, i)),
+ = sparc_vis_mul8x16 (tree_to_hwi (VECTOR_CST_ELT (cst0, i)),
scale);
n_elts[i] = build_int_cst (inner_type, val);
}
@@ -10554,7 +10555,7 @@ sparc_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED,
n_elts = XALLOCAVEC (tree, VECTOR_CST_NELTS (arg0));
for (i = 0; i < VECTOR_CST_NELTS (arg0); ++i)
n_elts[i] = build_int_cst (inner_type,
- TREE_INT_CST_LOW
+ tree_to_hwi
(VECTOR_CST_ELT (arg0, i)) << 4);
return build_vector (rtype, n_elts);
}
@@ -10609,30 +10610,33 @@ sparc_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED,
&& TREE_CODE (arg1) == VECTOR_CST
&& TREE_CODE (arg2) == INTEGER_CST)
{
- bool overflow = false;
- double_int result = TREE_INT_CST (arg2);
- double_int tmp;
+ bool overflow, overall_overflow = false;
+ wide_int result = wide_int::from_tree (arg2);
+ wide_int tmp;
unsigned i;
for (i = 0; i < VECTOR_CST_NELTS (arg0); ++i)
{
- double_int e0 = TREE_INT_CST (VECTOR_CST_ELT (arg0, i));
- double_int e1 = TREE_INT_CST (VECTOR_CST_ELT (arg1, i));
-
- bool neg1_ovf, neg2_ovf, add1_ovf, add2_ovf;
-
- tmp = e1.neg_with_overflow (&neg1_ovf);
- tmp = e0.add_with_sign (tmp, false, &add1_ovf);
- if (tmp.is_negative ())
- tmp = tmp.neg_with_overflow (&neg2_ovf);
+ wide_int e0 = wide_int::from_tree (VECTOR_CST_ELT (arg0, i));
+ wide_int e1 = wide_int::from_tree (VECTOR_CST_ELT (arg1, i));
+
+ tmp = e1.neg (&overflow);
+ overall_overflow |= overall_overflow;
+ tmp = e0.add (tmp, SIGNED, &overflow);
+ overall_overflow |= overall_overflow;
+ if (tmp.neg_p (SIGNED))
+ {
+ tmp = tmp.neg (&overflow);
+ overall_overflow |= overall_overflow;
+ }
- result = result.add_with_sign (tmp, false, &add2_ovf);
- overflow |= neg1_ovf | neg2_ovf | add1_ovf | add2_ovf;
+ result = result.add (tmp, SIGNED, &overflow);
+ overall_overflow |= overall_overflow;
}
- gcc_assert (!overflow);
+ gcc_assert (!overall_overflow);
- return build_int_cst_wide (rtype, result.low, result.high);
+ return wide_int_to_tree (rtype, result);
}
default:
diff --git a/gcc/config/vms/vms-c.c b/gcc/config/vms/vms-c.c
index d56ac1b8a70..5e4ed7cca65 100644
--- a/gcc/config/vms/vms-c.c
+++ b/gcc/config/vms/vms-c.c
@@ -316,7 +316,7 @@ handle_pragma_pointer_size (const char *pragma_name)
int val;
if (TREE_CODE (x) == INTEGER_CST)
- val = TREE_INT_CST_LOW (x);
+ val = tree_to_hwi (x);
else
val = -1;