Add a wi::to_wide helper function
authorRichard Sandiford <richard.sandiford@arm.com>
Mon, 2 May 2016 09:40:09 +0000 (09:40 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Mon, 2 May 2016 09:40:09 +0000 (09:40 +0000)
commit697e0b28cca9e5f3e1ee59131c048ef93014fb2f
tree8813b12d24cde53b2b940740605d9108aa099d28
parent8de73453a42758af02bb23ed58f4b1e78ad11bc7
Add a wi::to_wide helper function

As Richard says, we ought to have a convenient way of converting
an INTEGER_CST to a wide_int of a particular precision without
having to extract the sign of the INTEGER_CST's type each time.
This patch adds a wi::to_wide helper for that, alongside the
existing wi::to_offset and wi::to_widest.

Tested on x86_64-linux-gnu and aarch64-linux-gnu.

gcc/
* tree.h (wi::to_wide): New function.
* expr.c (expand_expr_real_1): Use wi::to_wide.
* fold-const.c (int_const_binop_1): Likewise.
(extract_muldiv_1): Likewise.

gcc/c-family/
* c-common.c (shorten_compare): Use wi::to_wide.

From-SVN: r235721
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/expr.c
gcc/fold-const.c
gcc/tree.h