This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR49715, (float)unsigned -> (float)signed
- From: Richard Henderson <rth at redhat dot com>
- To: Richard Guenther <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 21 Jul 2011 08:19:16 -0700
- Subject: Re: [PATCH] Fix PR49715, (float)unsigned -> (float)signed
- References: <alpine.LNX.2.00.1107211701070.810@zhemvz.fhfr.qr>
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~