[PATCH] Fix undefined behaviour in rx port
[PATCH] Fix undefined behaviour in rx port * config/rx/constraints.md (Int08): Fix undefined left shift behaviour. (Sint08, Sint16, Sint24): Likewise. * config/rx/rx.c (rx_get_stack_layout): Likewise. From-SVN: r228254
This commit is contained in:
parent
5c4b7f1c1c
commit
a53378d25f
|
@ -12,6 +12,11 @@
|
||||||
|
|
||||||
2015-09-29 Jeff Law <law@redhat.com>
|
2015-09-29 Jeff Law <law@redhat.com>
|
||||||
|
|
||||||
|
* config/rx/constraints.md (Int08): Fix undefined left shift
|
||||||
|
behaviour.
|
||||||
|
(Sint08, Sint16, Sint24): Likewise.
|
||||||
|
* config/rx/rx.c (rx_get_stack_layout): Likewise.
|
||||||
|
|
||||||
* config/rl78/rl78-expand.md (movqi): Fix undefined left shift
|
* config/rl78/rl78-expand.md (movqi): Fix undefined left shift
|
||||||
behaviour.
|
behaviour.
|
||||||
|
|
||||||
|
|
|
@ -28,28 +28,28 @@
|
||||||
(define_constraint "Int08"
|
(define_constraint "Int08"
|
||||||
"@internal A signed or unsigned 8-bit immediate value"
|
"@internal A signed or unsigned 8-bit immediate value"
|
||||||
(and (match_code "const_int")
|
(and (match_code "const_int")
|
||||||
(match_test "IN_RANGE (ival, (-1 << 8), (1 << 8) - 1)")
|
(match_test "IN_RANGE (ival, (HOST_WIDE_INT_M1U << 8), (1 << 8) - 1)")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
(define_constraint "Sint08"
|
(define_constraint "Sint08"
|
||||||
"@internal A signed 8-bit immediate value"
|
"@internal A signed 8-bit immediate value"
|
||||||
(and (match_code "const_int")
|
(and (match_code "const_int")
|
||||||
(match_test "IN_RANGE (ival, (-1 << 7), (1 << 7) - 1)")
|
(match_test "IN_RANGE (ival, (HOST_WIDE_INT_M1U << 7), (1 << 7) - 1)")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
(define_constraint "Sint16"
|
(define_constraint "Sint16"
|
||||||
"@internal A signed 16-bit immediate value"
|
"@internal A signed 16-bit immediate value"
|
||||||
(and (match_code "const_int")
|
(and (match_code "const_int")
|
||||||
(match_test "IN_RANGE (ival, (-1 << 15), (1 << 15) - 1)")
|
(match_test "IN_RANGE (ival, (HOST_WIDE_INT_M1U << 15), (1 << 15) - 1)")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
(define_constraint "Sint24"
|
(define_constraint "Sint24"
|
||||||
"@internal A signed 24-bit immediate value"
|
"@internal A signed 24-bit immediate value"
|
||||||
(and (match_code "const_int")
|
(and (match_code "const_int")
|
||||||
(match_test "IN_RANGE (ival, (-1 << 23), (1 << 23) - 1)")
|
(match_test "IN_RANGE (ival, (HOST_WIDE_INT_M1U << 23), (1 << 23) - 1)")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1561,7 +1561,7 @@ rx_get_stack_layout (unsigned int * lowest,
|
||||||
PUSHM.
|
PUSHM.
|
||||||
|
|
||||||
FIXME: Is it worth improving this heuristic ? */
|
FIXME: Is it worth improving this heuristic ? */
|
||||||
pushed_mask = (-1 << low) & ~(-1 << (high + 1));
|
pushed_mask = (HOST_WIDE_INT_M1U << low) & ~(HOST_WIDE_INT_M1U << (high + 1));
|
||||||
unneeded_pushes = (pushed_mask & (~ save_mask)) & pushed_mask;
|
unneeded_pushes = (pushed_mask & (~ save_mask)) & pushed_mask;
|
||||||
|
|
||||||
if ((fixed_reg && fixed_reg <= high)
|
if ((fixed_reg && fixed_reg <= high)
|
||||||
|
@ -1667,7 +1667,7 @@ ok_for_max_constant (HOST_WIDE_INT val)
|
||||||
|
|
||||||
/* rx_max_constant_size specifies the maximum number
|
/* rx_max_constant_size specifies the maximum number
|
||||||
of bytes that can be used to hold a signed value. */
|
of bytes that can be used to hold a signed value. */
|
||||||
return IN_RANGE (val, (-1 << (rx_max_constant_size * 8)),
|
return IN_RANGE (val, (HOST_WIDE_INT_M1U << (rx_max_constant_size * 8)),
|
||||||
( 1 << (rx_max_constant_size * 8)));
|
( 1 << (rx_max_constant_size * 8)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue