diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 03f566c2cd9..1b9985af4da 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-09-29 Jeff Law + + * config/msp430/msp430.c (msp430_legitimate_constant): Fix undefined + left shift behaviour. + * config/msp430/constraints.md ('L' constraint): Similarly. + ('Ys' constraint): Similarly. + 2015-09-29 Richard Biener PR tree-optimization/67170 diff --git a/gcc/config/msp430/constraints.md b/gcc/config/msp430/constraints.md index 30f944c790e..dfda1528a04 100644 --- a/gcc/config/msp430/constraints.md +++ b/gcc/config/msp430/constraints.md @@ -32,7 +32,7 @@ (define_constraint "L" "Integer constant -1^20..1^19." (and (match_code "const_int") - (match_test "IN_RANGE (ival, -1 << 20, 1 << 19)"))) + (match_test "IN_RANGE (ival, HOST_WIDE_INT_M1U << 20, 1 << 19)"))) (define_constraint "M" "Integer constant 1-4." @@ -77,7 +77,7 @@ (and (match_code "plus" "0") (and (match_code "reg" "00") (match_test ("CONST_INT_P (XEXP (XEXP (op, 0), 1))")) - (match_test ("IN_RANGE (INTVAL (XEXP (XEXP (op, 0), 1)), -1 << 15, (1 << 15)-1)")))) + (match_test ("IN_RANGE (INTVAL (XEXP (XEXP (op, 0), 1)), HOST_WIDE_INT_M1U << 15, (1 << 15)-1)")))) (match_code "reg" "0") ))) diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c index d2308cb064d..ba8d8628846 100644 --- a/gcc/config/msp430/msp430.c +++ b/gcc/config/msp430/msp430.c @@ -998,7 +998,7 @@ msp430_legitimate_constant (machine_mode mode, rtx x) /* GCC does not know the width of the PSImode, so make sure that it does not try to use a constant value that is out of range. */ - || (INTVAL (x) < (1 << 20) && INTVAL (x) >= (-1 << 20)); + || (INTVAL (x) < (1 << 20) && INTVAL (x) >= (HOST_WIDE_INT)(HOST_WIDE_INT_M1U << 20)); }