diff mbox

wide-int, aarch64

Message ID 6D507552-5B81-4844-9A73-39042973E5D5@comcast.net
State New
Headers show

Commit Message

Mike Stump Nov. 23, 2013, 7:19 p.m. UTC
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 aarch64 port.

Ok?
* config/aarch64/aarch64.c
	(aapcs_vfp_sub_candidate): Use wide-int interfaces.
	(aarch64_float_const_representable_p): Likewise.

Comments

Andrew Pinski Nov. 23, 2013, 9:36 p.m. UTC | #1
On Sat, Nov 23, 2013 at 11:19 AM, Mike Stump <mikestump@comcast.net> 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 aarch64 port.


+  wide_int w = real_to_integer (&m, &fail, HOST_BITS_PER_WIDE_INT * 2);

Should we have a gcc_assert (!fail); after the real_to_integer?  Other
than that this seems obvious.

Thanks,
Andrew


>
> Ok?
>
Kenneth Zadeck Nov. 24, 2013, 3:14 a.m. UTC | #2
On 11/23/2013 04:36 PM, Andrew Pinski wrote:
> On Sat, Nov 23, 2013 at 11:19 AM, Mike Stump <mikestump@comcast.net> 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 aarch64 port.
>
> +  wide_int w = real_to_integer (&m, &fail, HOST_BITS_PER_WIDE_INT * 2);
>
> Should we have a gcc_assert (!fail); after the real_to_integer?  Other
> than that this seems obvious.
It actually is not obvious.   In general we did not add checking where 
there was none before.   the fact that this interface allows the 
checking the trunk interface did not does not mean that we are obligated 
to do that.
> Thanks,
> Andrew
>
>
>> Ok?
>>
Mike Stump Nov. 26, 2013, 1:29 a.m. UTC | #3
On Nov 23, 2013, at 1:36 PM, Andrew Pinski <pinskia@gmail.com> wrote:
> On Sat, Nov 23, 2013 at 11:19 AM, Mike Stump <mikestump@comcast.net> 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 aarch64 port.
> 
> +  wide_int w = real_to_integer (&m, &fail, HOST_BITS_PER_WIDE_INT * 2);

> Other than that this seems obvious.

Thanks for the review and comments.  I'm doing point on tracking the approvals, and plan on pinging til a reviewer Oks each of the patches.  I see the benefit for the code base by using a bit more formal review process with this work.
Richard Earnshaw Nov. 26, 2013, 11:18 a.m. UTC | #4
On 23/11/13 19:19, Mike Stump 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 aarch64 port.
> 
> Ok?
> 
> 
> wide-int-aarch64.diffs.txt
> 
> 
> 	* config/aarch64/aarch64.c
> 	(aapcs_vfp_sub_candidate): Use wide-int interfaces.
> 	(aarch64_float_const_representable_p): Likewise.
> 

OK.

R.
diff mbox

Patch

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index aad9a29..b175e6c 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -6047,9 +6047,7 @@  aapcs_vfp_sub_candidate (const_tree type, enum machine_mode *modep)
 		      - tree_to_uhwi (TYPE_MIN_VALUE (index)));
 
 	/* There must be no padding.  */
-	if (!tree_fits_uhwi_p (TYPE_SIZE (type))
-	    || ((HOST_WIDE_INT) tree_to_uhwi (TYPE_SIZE (type))
-		!= count * GET_MODE_BITSIZE (*modep)))
+	if (wi::ne_p (TYPE_SIZE (type), count * GET_MODE_BITSIZE (*modep)))
 	  return -1;
 
 	return count;
@@ -6077,9 +6075,7 @@  aapcs_vfp_sub_candidate (const_tree type, enum machine_mode *modep)
 	  }
 
 	/* There must be no padding.  */
-	if (!tree_fits_uhwi_p (TYPE_SIZE (type))
-	    || ((HOST_WIDE_INT) tree_to_uhwi (TYPE_SIZE (type))
-		!= count * GET_MODE_BITSIZE (*modep)))
+	if (wi::ne_p (TYPE_SIZE (type), count * GET_MODE_BITSIZE (*modep)))
 	  return -1;
 
 	return count;
@@ -6109,9 +6105,7 @@  aapcs_vfp_sub_candidate (const_tree type, enum machine_mode *modep)
 	  }
 
 	/* There must be no padding.  */
-	if (!tree_fits_uhwi_p (TYPE_SIZE (type))
-	    || ((HOST_WIDE_INT) tree_to_uhwi (TYPE_SIZE (type))
-		!= count * GET_MODE_BITSIZE (*modep)))
+	if (wi::ne_p (TYPE_SIZE (type), count * GET_MODE_BITSIZE (*modep)))
 	  return -1;
 
 	return count;
@@ -7449,8 +7443,8 @@  aarch64_float_const_representable_p (rtx x)
   int point_pos = 2 * HOST_BITS_PER_WIDE_INT - 1;
   int exponent;
   unsigned HOST_WIDE_INT mantissa, mask;
-  HOST_WIDE_INT m1, m2;
   REAL_VALUE_TYPE r, m;
+  bool fail;
 
   if (!CONST_DOUBLE_P (x))
     return false;
@@ -7474,16 +7468,16 @@  aarch64_float_const_representable_p (rtx x)
      WARNING: If we ever have a representation using more than 2 * H_W_I - 1
      bits for the mantissa, this can fail (low bits will be lost).  */
   real_ldexp (&m, &r, point_pos - exponent);
-  REAL_VALUE_TO_INT (&m1, &m2, m);
+  wide_int w = real_to_integer (&m, &fail, HOST_BITS_PER_WIDE_INT * 2);
 
   /* If the low part of the mantissa has bits set we cannot represent
      the value.  */
-  if (m1 != 0)
+  if (w.elt (0) != 0)
     return false;
   /* We have rejected the lower HOST_WIDE_INT, so update our
      understanding of how many bits lie in the mantissa and
      look only at the high HOST_WIDE_INT.  */
-  mantissa = m2;
+  mantissa = w.elt (1);
   point_pos -= HOST_BITS_PER_WIDE_INT;
 
   /* We can only represent values with a mantissa of the form 1.xxxx.  */