+2014-11-20 Markus Trippelsdorf <markus@trippelsdorf.de>
+
+ * config/rs6000/constraints.md: Avoid signed integer overflows.
+ * config/rs6000/predicates.md: Likewise.
+ * config/rs6000/rs6000.c (num_insns_constant_wide): Likewise.
+ (includes_rldic_lshift_p): Likewise.
+ (includes_rldicr_lshift_p): Likewise.
+ * emit-rtl.c (const_wide_int_htab_hash): Likewise.
+ * loop-iv.c (determine_max_iter): Likewise.
+ (iv_number_of_iterations): Likewise.
+ * tree-ssa-loop-ivopts.c (get_computation_cost_at): Likewise.
+ * varasm.c (get_section_anchor): Likewise.
+
2014-11-20 Charles Baylis <charles.baylis@linaro.org>
PR target/63870
(define_constraint "P"
"constant whose negation is signed 16-bit constant"
(and (match_code "const_int")
- (match_test "(unsigned HOST_WIDE_INT) ((- ival) + 0x8000) < 0x10000")))
+ (match_test "((- (unsigned HOST_WIDE_INT) ival) + 0x8000) < 0x10000")))
;; Floating-point constraints
(define_predicate "reg_or_sub_cint_operand"
(if_then_else (match_code "const_int")
(match_test "(unsigned HOST_WIDE_INT)
- (- INTVAL (op) + (mode == SImode ? 0x80000000 : 0x80008000))
+ (- UINTVAL (op) + (mode == SImode ? 0x80000000 : 0x80008000))
< (unsigned HOST_WIDE_INT) 0x100000000ll")
(match_operand 0 "gpc_reg_operand")))
num_insns_constant_wide (HOST_WIDE_INT value)
{
/* signed constant loadable with addi */
- if ((unsigned HOST_WIDE_INT) (value + 0x8000) < 0x10000)
+ if (((unsigned HOST_WIDE_INT) value + 0x8000) < 0x10000)
return 1;
/* constant loadable with addis */
{
if (GET_CODE (andop) == CONST_INT)
{
- HOST_WIDE_INT c, lsb, shift_mask;
+ unsigned HOST_WIDE_INT c, lsb, shift_mask;
c = INTVAL (andop);
if (c == 0 || c == ~0)
{
if (GET_CODE (andop) == CONST_INT)
{
- HOST_WIDE_INT c, lsb, shift_mask;
+ unsigned HOST_WIDE_INT c, lsb, shift_mask;
shift_mask = ~0;
shift_mask <<= INTVAL (shiftop);
const_wide_int_hasher::hash (rtx x)
{
int i;
- HOST_WIDE_INT hash = 0;
+ unsigned HOST_WIDE_INT hash = 0;
const_rtx xr = x;
for (i = 0; i < CONST_WIDE_INT_NUNITS (xr); i++)
}
get_mode_bounds (desc->mode, desc->signed_p, desc->mode, &mmin, &mmax);
- nmax = INTVAL (mmax) - INTVAL (mmin);
+ nmax = UINTVAL (mmax) - UINTVAL (mmin);
if (GET_CODE (niter) == UDIV)
{
down = INTVAL (CONST_INT_P (iv0.base)
? iv0.base
: mode_mmin);
- max = (up - down) / inc + 1;
+ max = (uint64_t) (up - down) / inc + 1;
if (!desc->infinite
&& !desc->assumptions)
record_niter_bound (loop, max, false, true);
if (cst_and_fits_in_hwi (cbase))
{
- offset = - ratio * int_cst_value (cbase);
+ offset = - ratio * (unsigned HOST_WIDE_INT) int_cst_value (cbase);
cost = difference_cost (data,
ubase, build_int_cst (utype, 0),
&symbol_present, &var_present, &offset,
offset = 0;
else
{
- bias = 1 << (GET_MODE_BITSIZE (ptr_mode) - 1);
+ bias = HOST_WIDE_INT_1U << (GET_MODE_BITSIZE (ptr_mode) - 1);
if (offset < 0)
{
delta = -(unsigned HOST_WIDE_INT) offset + max_offset;