[lto] intN follow-up patch
diff mbox

Message ID 201506120128.t5C1SpwU006908@greed.delorie.com
State New
Headers show

Commit Message

DJ Delorie June 12, 2015, 1:28 a.m. UTC
This was missed in the big intN patch set I did last year; it only
shows up if you have a target with an N-bit type that isn't also used
for a pointer type but is used for unwinding (which is a change I also
have pending, hence I noticed ;).  Tested on x86-64 and msp430 (with
the pending patch) with no regressions.  Ok?

	* lto-lang.c (lto_type_for_size): Include intN types.
	(lto_type_for_mode): Likewise.

Comments

Richard Biener June 12, 2015, 5:45 a.m. UTC | #1
On June 12, 2015 3:28:51 AM GMT+02:00, DJ Delorie <dj@redhat.com> wrote:
>
>This was missed in the big intN patch set I did last year; it only
>shows up if you have a target with an N-bit type that isn't also used
>for a pointer type but is used for unwinding (which is a change I also
>have pending, hence I noticed ;).  Tested on x86-64 and msp430 (with
>the pending patch) with no regressions.  Ok?

OK.

Thanks,
Richard.

>	* lto-lang.c (lto_type_for_size): Include intN types.
>	(lto_type_for_mode): Likewise.
>
>Index: gcc/lto/lto-lang.c
>===================================================================
>--- gcc/lto/lto-lang.c	(revision 224364)
>+++ gcc/lto/lto-lang.c	(working copy)
>@@ -827,12 +827,14 @@ lto_post_options (const char **pfilename
> /* Return an integer type with PRECISION bits of precision,
>    that is unsigned if UNSIGNEDP is nonzero, otherwise signed.  */
> 
> static tree
> lto_type_for_size (unsigned precision, int unsignedp)
> {
>+  int i;
>+
>   if (precision == TYPE_PRECISION (integer_type_node))
>     return unsignedp ? unsigned_type_node : integer_type_node;
> 
>   if (precision == TYPE_PRECISION (signed_char_type_node))
>    return unsignedp ? unsigned_char_type_node : signed_char_type_node;
> 
>@@ -844,12 +846,18 @@ lto_type_for_size (unsigned precision, i
> 
>   if (precision == TYPE_PRECISION (long_long_integer_type_node))
>     return unsignedp
> 	   ? long_long_unsigned_type_node
> 	   : long_long_integer_type_node;
> 
>+  for (i = 0; i < NUM_INT_N_ENTS; i ++)
>+    if (int_n_enabled_p[i]
>+	&& precision == int_n_data[i].bitsize)
>+      return (unsignedp ? int_n_trees[i].unsigned_type
>+	      : int_n_trees[i].signed_type);
>+
>   if (precision <= TYPE_PRECISION (intQI_type_node))
>     return unsignedp ? unsigned_intQI_type_node : intQI_type_node;
> 
>   if (precision <= TYPE_PRECISION (intHI_type_node))
>     return unsignedp ? unsigned_intHI_type_node : intHI_type_node;
> 
>@@ -873,12 +881,13 @@ lto_type_for_size (unsigned precision, i
> then UNSIGNEDP selects between saturating and nonsaturating types.  */
> 
> static tree
> lto_type_for_mode (machine_mode mode, int unsigned_p)
> {
>   tree t;
>+  int i;
> 
>   if (mode == TYPE_MODE (integer_type_node))
>     return unsigned_p ? unsigned_type_node : integer_type_node;
> 
>   if (mode == TYPE_MODE (signed_char_type_node))
>   return unsigned_p ? unsigned_char_type_node : signed_char_type_node;
>@@ -889,12 +898,18 @@ lto_type_for_mode (machine_mode mode, in
>   if (mode == TYPE_MODE (long_integer_type_node))
>  return unsigned_p ? long_unsigned_type_node : long_integer_type_node;
> 
>   if (mode == TYPE_MODE (long_long_integer_type_node))
>return unsigned_p ? long_long_unsigned_type_node :
>long_long_integer_type_node;
> 
>+  for (i = 0; i < NUM_INT_N_ENTS; i ++)
>+    if (int_n_enabled_p[i]
>+	&& mode == int_n_data[i].m)
>+      return (unsigned_p ? int_n_trees[i].unsigned_type
>+	      : int_n_trees[i].signed_type);
>+
>   if (mode == QImode)
>     return unsigned_p ? unsigned_intQI_type_node : intQI_type_node;
> 
>   if (mode == HImode)
>     return unsigned_p ? unsigned_intHI_type_node : intHI_type_node;
>
DJ Delorie June 12, 2015, 5:59 a.m. UTC | #2
Thanks!  Committed.

Patch
diff mbox

Index: gcc/lto/lto-lang.c
===================================================================
--- gcc/lto/lto-lang.c	(revision 224364)
+++ gcc/lto/lto-lang.c	(working copy)
@@ -827,12 +827,14 @@  lto_post_options (const char **pfilename
 /* Return an integer type with PRECISION bits of precision,
    that is unsigned if UNSIGNEDP is nonzero, otherwise signed.  */
 
 static tree
 lto_type_for_size (unsigned precision, int unsignedp)
 {
+  int i;
+
   if (precision == TYPE_PRECISION (integer_type_node))
     return unsignedp ? unsigned_type_node : integer_type_node;
 
   if (precision == TYPE_PRECISION (signed_char_type_node))
     return unsignedp ? unsigned_char_type_node : signed_char_type_node;
 
@@ -844,12 +846,18 @@  lto_type_for_size (unsigned precision, i
 
   if (precision == TYPE_PRECISION (long_long_integer_type_node))
     return unsignedp
 	   ? long_long_unsigned_type_node
 	   : long_long_integer_type_node;
 
+  for (i = 0; i < NUM_INT_N_ENTS; i ++)
+    if (int_n_enabled_p[i]
+	&& precision == int_n_data[i].bitsize)
+      return (unsignedp ? int_n_trees[i].unsigned_type
+	      : int_n_trees[i].signed_type);
+
   if (precision <= TYPE_PRECISION (intQI_type_node))
     return unsignedp ? unsigned_intQI_type_node : intQI_type_node;
 
   if (precision <= TYPE_PRECISION (intHI_type_node))
     return unsignedp ? unsigned_intHI_type_node : intHI_type_node;
 
@@ -873,12 +881,13 @@  lto_type_for_size (unsigned precision, i
    then UNSIGNEDP selects between saturating and nonsaturating types.  */
 
 static tree
 lto_type_for_mode (machine_mode mode, int unsigned_p)
 {
   tree t;
+  int i;
 
   if (mode == TYPE_MODE (integer_type_node))
     return unsigned_p ? unsigned_type_node : integer_type_node;
 
   if (mode == TYPE_MODE (signed_char_type_node))
     return unsigned_p ? unsigned_char_type_node : signed_char_type_node;
@@ -889,12 +898,18 @@  lto_type_for_mode (machine_mode mode, in
   if (mode == TYPE_MODE (long_integer_type_node))
     return unsigned_p ? long_unsigned_type_node : long_integer_type_node;
 
   if (mode == TYPE_MODE (long_long_integer_type_node))
     return unsigned_p ? long_long_unsigned_type_node : long_long_integer_type_node;
 
+  for (i = 0; i < NUM_INT_N_ENTS; i ++)
+    if (int_n_enabled_p[i]
+	&& mode == int_n_data[i].m)
+      return (unsigned_p ? int_n_trees[i].unsigned_type
+	      : int_n_trees[i].signed_type);
+
   if (mode == QImode)
     return unsigned_p ? unsigned_intQI_type_node : intQI_type_node;
 
   if (mode == HImode)
     return unsigned_p ? unsigned_intHI_type_node : intHI_type_node;