https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94715

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
One could use get_range_pos_neg (op0) for that, so something like:
... if (CONVERT_EXPR_CODE_P (code)
        && INTEGRAL_TYPE_P (type)
        && INTEGRAL_TYPE_P (TREE_TYPE (op0))
        && TYPE_PRECISION (type) > TYPE_PRECISION (TREE_TYPE (op0))
        && get_range_pos_neg (op0) == 1)
      /* Both sign and zero extension achieve the required extension,
         as the operand is guaranteed not to have the most significant
         bit set.  Try to build both conversions and ask the backend
         which one is less expensive.  If both are same costly, use
         the op0's signedness.  */

Reply via email to