aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-12-21 06:57:18 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-12-21 06:57:18 +0000
commit39bb8924559d0487fb7cb6d4dc33d6b1e9c41004 (patch)
tree9887f91a47e5c46de73b822b210ba630c6b62cf2 /gcc/fold-const.c
parenta97d8b982793ba5bf1e54a41d9bb110182b8baf8 (diff)
downloadgcc-39bb8924559d0487fb7cb6d4dc33d6b1e9c41004.zip
gcc-39bb8924559d0487fb7cb6d4dc33d6b1e9c41004.tar.gz
gcc-39bb8924559d0487fb7cb6d4dc33d6b1e9c41004.tar.bz2
poly_int: get_bit_range
This patch makes get_bit_range return the range and position as poly_ints. 2017-12-21 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * expr.h (get_bit_range): Return the bitstart and bitend as poly_uint64s rather than unsigned HOST_WIDE_INTs. Return the bitpos as a poly_int64 rather than a HOST_WIDE_INT. * expr.c (get_bit_range): Likewise. (expand_assignment): Update call accordingly. * fold-const.c (optimize_bit_field_compare): Likewise. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r255912
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 75bc762..0b3cba5 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -4076,12 +4076,13 @@ optimize_bit_field_compare (location_t loc, enum tree_code code,
}
/* Honor the C++ memory model and mimic what RTL expansion does. */
- unsigned HOST_WIDE_INT bitstart = 0;
- unsigned HOST_WIDE_INT bitend = 0;
+ poly_uint64 bitstart = 0;
+ poly_uint64 bitend = 0;
if (TREE_CODE (lhs) == COMPONENT_REF)
{
- get_bit_range (&bitstart, &bitend, lhs, &lbitpos, &offset);
- if (offset != NULL_TREE)
+ poly_int64 plbitpos;
+ get_bit_range (&bitstart, &bitend, lhs, &plbitpos, &offset);
+ if (!plbitpos.is_constant (&lbitpos) || offset != NULL_TREE)
return 0;
}