This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR49715, (float)unsigned -> (float)signed


On 07/21/2011 08:09 AM, Richard Guenther wrote:
> +   /* It's not interesting to widen anything smaller than SImode.  */
> +   if (TYPE_PRECISION (TREE_TYPE (rhs1)) < GET_MODE_PRECISION (SImode)
> +       || (!TYPE_UNSIGNED (TREE_TYPE (rhs1))
> + 	  && TYPE_PRECISION (TREE_TYPE (rhs1)) == GET_MODE_PRECISION (SImode)))
> +     return false;

Hard-coding SImode?  Really?  You might as well hard-code 32.  At least
that's "more correct" when someone does have BITS_PER_UNIT != 8.

> +   /* Try if the value fits in a signed SImode integer, that's the only
> +      interesting case.  */
> +   if (!double_int_fits_to_tree_p (intSI_type_node,
> + 				  tree_to_double_int (vr->min))
> +       || !double_int_fits_to_tree_p (intSI_type_node,
> + 				     tree_to_double_int (vr->max)))
> +     return false;

unsigned long long -> long long is also a very interesting transform.

Indeed, that's the one will help 64-bit targets most.  Unsigned SImode
normally just gets zero-extended to signed DImode.  Whereas unsigned
DImode generally has to do the bias/convert/unbias thing.


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]