This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[wide-int] Use MAX_MODE_INT rather than mode_for_size
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: zadeck at naturalbridge dot com, mikestump at comcast dot net
- Date: Sat, 09 Nov 2013 10:57:01 +0000
- Subject: [wide-int] Use MAX_MODE_INT rather than mode_for_size
- Authentication-results: sourceware.org; auth=none
"mode_for_size (MAX_BITSIZE_MODE_ANY_INT, MODE_INT, 0)" isn't safe
because the widest mode might not have an integer counterpart.
We can get the widest integer mode directly using MAX_MODE_INT.
Tested on powerpc64-linux-gnu and by rerunning the assembly comparison.
OK to install?
Thanks,
Richard
Index: gcc/simplify-rtx.c
===================================================================
--- gcc/simplify-rtx.c 2013-11-09 09:39:28.925815686 +0000
+++ gcc/simplify-rtx.c 2013-11-09 09:39:29.461819309 +0000
@@ -1619,7 +1619,7 @@ simplify_const_unary_operation (enum rtx
a dangerous assumption as many times CONST_INTs are
created and used with garbage in the bits outside of the
precision of the implied mode of the const_int. */
- op_mode = mode_for_size (MAX_BITSIZE_MODE_ANY_INT, MODE_INT, 0);
+ op_mode = MAX_MODE_INT;
}
real_from_integer (&d, mode, std::make_pair (op, op_mode), SIGNED);
@@ -1637,7 +1637,7 @@ simplify_const_unary_operation (enum rtx
a dangerous assumption as many times CONST_INTs are
created and used with garbage in the bits outside of the
precision of the implied mode of the const_int. */
- op_mode = mode_for_size (MAX_BITSIZE_MODE_ANY_INT, MODE_INT, 0);
+ op_mode = MAX_MODE_INT;
}
real_from_integer (&d, mode, std::make_pair (op, op_mode), UNSIGNED);