diff mbox

wide-int, ada

Message ID C3C2B9D8-4F40-40EB-BF2A-755192576473@comcast.net
State New
Headers show

Commit Message

Mike Stump April 24, 2014, 6:55 p.m. UTC
On Nov 25, 2013, at 12:46 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:

>> Richi has asked the we break the wide-int patch so that the individual port
>> and front end maintainers can review their parts without have to go through
>> the entire patch.    This patch covers the ada front-end.
> 
> I don't think that the mechanical change in UI_From_gnu is correct, see the 
> comment just above.  The annotate_value change is very likely correct, but 
> please double check and, upon positive outcome, remove the last sentence of 
> the comment just above.  The rest looks good, thanks.

So, given the last change, the remaining bit is:

We need this to ensure that 32 to 63 bit values with the high bit set don’t return No_Uint.  This should also address the performance concerns as well.

Ok?

Comments

Eric Botcazou April 25, 2014, 8:42 a.m. UTC | #1
> So, given the last change, the remaining bit is:
> 
> Index: gcc/ada/gcc-interface/cuintp.c
> ===================================================================
> --- gcc/ada/gcc-interface/cuintp.c	(revision 209754)
> +++ gcc/ada/gcc-interface/cuintp.c	(working copy)
> @@ -160,7 +160,11 @@ UI_From_gnu (tree Input)
>       in a signed 64-bit integer.  */
>    if (tree_fits_shwi_p (Input))
>      return UI_From_Int (tree_to_shwi (Input));
> -  else if (wi::neg_p (Input) && TYPE_UNSIGNED (gnu_type))
> +
> +  gcc_assert (TYPE_PRECISION (gnu_type) <= 64);
> +  if (TYPE_UNSIGNED (gnu_type)
> +      && TYPE_PRECISION (gnu_type) == 64
> +      && wi::neg_p (Input, SIGNED))
>      return No_Uint;
>  #endif
> 
> We need this to ensure that 32 to 63 bit values with the high bit set don’t
> return No_Uint.  This should also address the performance concerns as well.

OK, thanks.
diff mbox

Patch

Index: gcc/ada/gcc-interface/cuintp.c
===================================================================
--- gcc/ada/gcc-interface/cuintp.c	(revision 209754)
+++ gcc/ada/gcc-interface/cuintp.c	(working copy)
@@ -160,7 +160,11 @@  UI_From_gnu (tree Input)
      in a signed 64-bit integer.  */
   if (tree_fits_shwi_p (Input))
     return UI_From_Int (tree_to_shwi (Input));
-  else if (wi::neg_p (Input) && TYPE_UNSIGNED (gnu_type))
+
+  gcc_assert (TYPE_PRECISION (gnu_type) <= 64);
+  if (TYPE_UNSIGNED (gnu_type)
+      && TYPE_PRECISION (gnu_type) == 64
+      && wi::neg_p (Input, SIGNED))
     return No_Uint;
 #endif