aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-02-24 06:43:37 +0000
committerRichard Stallman <rms@gnu.org>1993-02-24 06:43:37 +0000
commit13af526d4f317b9a8ac4cb1d3d66a6c160da6ca7 (patch)
tree0575a6ad99ddeb3882b85e89c9b0d6ebd0437430 /gcc/fold-const.c
parent44735512c91eed6880c4de2c01f903c48f6f3013 (diff)
downloadgcc-13af526d4f317b9a8ac4cb1d3d66a6c160da6ca7.zip
gcc-13af526d4f317b9a8ac4cb1d3d66a6c160da6ca7.tar.gz
gcc-13af526d4f317b9a8ac4cb1d3d66a6c160da6ca7.tar.bz2
(all_ones_mask_p): Really use tmask.
(all_ones_mask_p): Declare tmask to be `tree'. (optimize_bit_field_compare) Add missing semicolon. (decode_field_reference): Use force_fit_type instead of convert to avoid truncated integer warning. (all_ones_mask_p): Likewise. From-SVN: r3519
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 4708f88..e659a36 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -2294,7 +2294,10 @@ optimize_bit_field_compare (code, compare_type, lhs, rhs)
#endif
/* Make the mask to be used against the extracted field. */
- mask = convert (unsigned_type, build_int_2 (~0, ~0));
+ mask = build_int_2 (~0, ~0);
+ TREE_TYPE (mask) = unsigned_type;
+ force_fit_type (mask);
+ mask = convert (unsigned_type, mask);
mask = const_binop (LSHIFT_EXPR, mask, size_int (lnbitsize - lbitsize), 0);
mask = const_binop (RSHIFT_EXPR, mask,
size_int (lnbitsize - lbitsize - lbitpos), 0);
@@ -2451,13 +2454,15 @@ all_ones_mask_p (mask, size)
{
tree type = TREE_TYPE (mask);
int precision = TYPE_PRECISION (type);
+ tree tmask;
+ tmask = build_int_2 (~0, ~0);
+ TREE_TYPE (tmask) = signed_type (type);
+ force_fit_type (tmask);
return
operand_equal_p (mask,
const_binop (RSHIFT_EXPR,
- const_binop (LSHIFT_EXPR,
- convert (signed_type (type),
- build_int_2 (~0, ~0)),
+ const_binop (LSHIFT_EXPR, tmask,
size_int (precision - size), 0),
size_int (precision - size), 0),
0);