diff mbox

__intN patch 3/5: main __int128 -> __intN conversion.

Message ID 201410152100.s9FL0wvR009992@greed.delorie.com
State New
Headers show

Commit Message

DJ Delorie Oct. 15, 2014, 9 p.m. UTC
> If you could implement the second option, it would be appreciated.

Could you please test this for me?  It builds as a powerpc-elf
cross-compiler (at least the host half) but I don't have a power
machine here to test on.

Comments

Markus Trippelsdorf Oct. 16, 2014, 5:48 a.m. UTC | #1
On 2014.10.15 at 17:00 -0400, DJ Delorie wrote:
> 
> > If you could implement the second option, it would be appreciated.
> 
> Could you please test this for me?  It builds as a powerpc-elf
> cross-compiler (at least the host half) but I don't have a power
> machine here to test on.
> 
> Index: rs6000-c.c
> ===================================================================
> --- rs6000-c.c	(revision 216241)
> +++ rs6000-c.c	(working copy)
> @@ -157,12 +157,29 @@ init_vector_keywords (void)
>      {
>        __int128_type = get_identifier ("__int128_t");
>        __uint128_type = get_identifier ("__uint128_t");
>      }
>  }
>  
> +/* Helper function to find out which RID_INT_N_* code is the one for
> +   __int128, if any.  Returns RID_MAX+1 if none apply, which is safe
> +   (for our purposes, since we always expect to have __int128) to
> +   compare against.  */
> +static int
> +rid_int128(void)
> +{
> +  int i;
> +
> +  for (i = 0; i < NUM_INT_N_ENTS; i ++)
> +    if (int_n_enabled_p[i]
> +	&& int_n_data[i].bitsize == 128)
> +      return RID_INT_N_0 + i;
> +
> +  return RID_MAX + 1;
> +}
> +
>  /* Called to decide whether a conditional macro should be expanded.
>     Since we have exactly one such macro (i.e, 'vector'), we do not
>     need to examine the 'tok' parameter.  */
>  
>  static cpp_hashnode *
>  rs6000_macro_to_expand (cpp_reader *pfile, const cpp_token *tok)
> @@ -231,13 +248,13 @@ rs6000_macro_to_expand (cpp_reader *pfil
>  
>  	  if (rid_code == RID_UNSIGNED || rid_code == RID_LONG
>  	      || rid_code == RID_SHORT || rid_code == RID_SIGNED
>  	      || rid_code == RID_INT || rid_code == RID_CHAR
>  	      || rid_code == RID_FLOAT
>  	      || (rid_code == RID_DOUBLE && TARGET_VSX)
> -	      || (rid_code == RID_INT128 && TARGET_VADDUQM))
> +	      || (rid_code == rid_int128 () && TARGET_VADDUQM))
>  	    {
>  	      expand_this = C_CPP_HASHNODE (__vector_keyword);
>  	      /* If the next keyword is bool or pixel, it
>  		 will need to be expanded as well.  */
>  	      do
>  		tok = cpp_peek_token (pfile, idx++);
> 

Testing went fine (although there is a lot of noise because of the
-std=gnu11 standard change).
But I cannot approve the patch. Adding more people to CC.

Thanks.
David Edelsohn Oct. 16, 2014, 2:51 p.m. UTC | #2
On Thu, Oct 16, 2014 at 1:48 AM, Markus Trippelsdorf
<markus@trippelsdorf.de> wrote:
> On 2014.10.15 at 17:00 -0400, DJ Delorie wrote:
>>
>> > If you could implement the second option, it would be appreciated.
>>
>> Could you please test this for me?  It builds as a powerpc-elf
>> cross-compiler (at least the host half) but I don't have a power
>> machine here to test on.
>>
>> Index: rs6000-c.c
>> ===================================================================
>> --- rs6000-c.c        (revision 216241)
>> +++ rs6000-c.c        (working copy)
>> @@ -157,12 +157,29 @@ init_vector_keywords (void)
>>      {
>>        __int128_type = get_identifier ("__int128_t");
>>        __uint128_type = get_identifier ("__uint128_t");
>>      }
>>  }
>>
>> +/* Helper function to find out which RID_INT_N_* code is the one for
>> +   __int128, if any.  Returns RID_MAX+1 if none apply, which is safe
>> +   (for our purposes, since we always expect to have __int128) to
>> +   compare against.  */
>> +static int
>> +rid_int128(void)
>> +{
>> +  int i;
>> +
>> +  for (i = 0; i < NUM_INT_N_ENTS; i ++)
>> +    if (int_n_enabled_p[i]
>> +     && int_n_data[i].bitsize == 128)
>> +      return RID_INT_N_0 + i;
>> +
>> +  return RID_MAX + 1;
>> +}
>> +
>>  /* Called to decide whether a conditional macro should be expanded.
>>     Since we have exactly one such macro (i.e, 'vector'), we do not
>>     need to examine the 'tok' parameter.  */
>>
>>  static cpp_hashnode *
>>  rs6000_macro_to_expand (cpp_reader *pfile, const cpp_token *tok)
>> @@ -231,13 +248,13 @@ rs6000_macro_to_expand (cpp_reader *pfil
>>
>>         if (rid_code == RID_UNSIGNED || rid_code == RID_LONG
>>             || rid_code == RID_SHORT || rid_code == RID_SIGNED
>>             || rid_code == RID_INT || rid_code == RID_CHAR
>>             || rid_code == RID_FLOAT
>>             || (rid_code == RID_DOUBLE && TARGET_VSX)
>> -           || (rid_code == RID_INT128 && TARGET_VADDUQM))
>> +           || (rid_code == rid_int128 () && TARGET_VADDUQM))
>>           {
>>             expand_this = C_CPP_HASHNODE (__vector_keyword);
>>             /* If the next keyword is bool or pixel, it
>>                will need to be expanded as well.  */
>>             do
>>               tok = cpp_peek_token (pfile, idx++);
>>
>
> Testing went fine (although there is a lot of noise because of the
> -std=gnu11 standard change).
> But I cannot approve the patch. Adding more people to CC.

This is okay.

There are POWER machines in the GCC Compile Farm, which should have
been used to test the original patch and at least could have been used
to test the fix.

Thanks, David
DJ Delorie Oct. 16, 2014, 8:50 p.m. UTC | #3
> This is okay.

Thanks!  Committed.
diff mbox

Patch

Index: rs6000-c.c
===================================================================
--- rs6000-c.c	(revision 216241)
+++ rs6000-c.c	(working copy)
@@ -157,12 +157,29 @@  init_vector_keywords (void)
     {
       __int128_type = get_identifier ("__int128_t");
       __uint128_type = get_identifier ("__uint128_t");
     }
 }
 
+/* Helper function to find out which RID_INT_N_* code is the one for
+   __int128, if any.  Returns RID_MAX+1 if none apply, which is safe
+   (for our purposes, since we always expect to have __int128) to
+   compare against.  */
+static int
+rid_int128(void)
+{
+  int i;
+
+  for (i = 0; i < NUM_INT_N_ENTS; i ++)
+    if (int_n_enabled_p[i]
+	&& int_n_data[i].bitsize == 128)
+      return RID_INT_N_0 + i;
+
+  return RID_MAX + 1;
+}
+
 /* Called to decide whether a conditional macro should be expanded.
    Since we have exactly one such macro (i.e, 'vector'), we do not
    need to examine the 'tok' parameter.  */
 
 static cpp_hashnode *
 rs6000_macro_to_expand (cpp_reader *pfile, const cpp_token *tok)
@@ -231,13 +248,13 @@  rs6000_macro_to_expand (cpp_reader *pfil
 
 	  if (rid_code == RID_UNSIGNED || rid_code == RID_LONG
 	      || rid_code == RID_SHORT || rid_code == RID_SIGNED
 	      || rid_code == RID_INT || rid_code == RID_CHAR
 	      || rid_code == RID_FLOAT
 	      || (rid_code == RID_DOUBLE && TARGET_VSX)
-	      || (rid_code == RID_INT128 && TARGET_VADDUQM))
+	      || (rid_code == rid_int128 () && TARGET_VADDUQM))
 	    {
 	      expand_this = C_CPP_HASHNODE (__vector_keyword);
 	      /* If the next keyword is bool or pixel, it
 		 will need to be expanded as well.  */
 	      do
 		tok = cpp_peek_token (pfile, idx++);