On 11/09/2013 05:57 AM, Richard Sandiford wrote:
"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);
i guess you are correct. i had assumed that the MAX_BITSIZE.. would always relate to a real integer because partial int modes have to be based on an underlying mode. Obviously you have a counter example in mind, but this code is actually just as good so it ok to install.

kenny

Reply via email to