public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH], Simplify setup of complex types
@ 2016-06-21 13:48 Michael Meissner
  2016-06-21 20:02 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Meissner @ 2016-06-21 13:48 UTC (permalink / raw)
  To: gcc-patches, David Edelsohn, Bill Schmidt, Segher Boessenkool

[-- Attachment #1: Type: text/plain, Size: 1117 bytes --]

When I submitted the back port to allow complex __float128 to be created on the
PowerPC to the GCC 6.2 branch, Richard Biener suggested a simpler way to set
the complex type:
https://gcc.gnu.org/ml/gcc-patches/2016-06/msg01114.html

This patch implements this change for the trunk.  I have a companion patch for
6.2 once this goes into the trunk.

I bootstrapped the compiler and did a make check with no regressions on a big
endian Power 7 system and a little endian Power 8 system.  Is it ok to go into
the trunk?

[gcc]
2016-06-21  Michael Meissner  <meissner@linux.vnet.ibm.com>

	* stor-layout.c (layout_type): Move setting complex MODE to
	layout_type, instead of setting it ahead of time by the caller.
	* tree.c (build_complex_type): Likewise.

[gcc/fortran]
2016-06-21  Michael Meissner  <meissner@linux.vnet.ibm.com>

	* trans-types.c (gfc_build_complex_type): Move setting complex
	MODE to layout_type, instead of setting it ahead of time by the
	caller.

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.vnet.ibm.com, phone: +1 (978) 899-4797

[-- Attachment #2: gcc-stage7.complex004b --]
[-- Type: text/plain, Size: 1810 bytes --]

Index: gcc/stor-layout.c
===================================================================
--- gcc/stor-layout.c	(revision 237612)
+++ gcc/stor-layout.c	(working copy)
@@ -2146,12 +2146,8 @@ layout_type (tree type)
 
     case COMPLEX_TYPE:
       TYPE_UNSIGNED (type) = TYPE_UNSIGNED (TREE_TYPE (type));
-
-      /* build_complex_type and fortran's gfc_build_complex_type have set the
-	 expected mode to allow having multiple complex types for multiple
-	 floating point types that have the same size such as the PowerPC with
-	 __ibm128 and __float128.  */
-      gcc_assert (TYPE_MODE (type) != VOIDmode);
+      SET_TYPE_MODE (type,
+		     GET_MODE_COMPLEX_MODE (TYPE_MODE (TREE_TYPE (type))));
 
       TYPE_SIZE (type) = bitsize_int (GET_MODE_BITSIZE (TYPE_MODE (type)));
       TYPE_SIZE_UNIT (type) = size_int (GET_MODE_SIZE (TYPE_MODE (type)));
Index: gcc/tree.c
===================================================================
--- gcc/tree.c	(revision 237612)
+++ gcc/tree.c	(working copy)
@@ -8783,7 +8783,6 @@ build_complex_type (tree component_type)
   t = make_node (COMPLEX_TYPE);
 
   TREE_TYPE (t) = TYPE_MAIN_VARIANT (component_type);
-  SET_TYPE_MODE (t, GET_MODE_COMPLEX_MODE (TYPE_MODE (component_type)));
 
   /* If we already have such a type, use the old one.  */
   hstate.add_object (TYPE_HASH (component_type));
Index: gcc/fortran/trans-types.c
===================================================================
--- gcc/fortran/trans-types.c	(revision 237613)
+++ gcc/fortran/trans-types.c	(working copy)
@@ -828,7 +828,6 @@ gfc_build_complex_type (tree scalar_type
 
   new_type = make_node (COMPLEX_TYPE);
   TREE_TYPE (new_type) = scalar_type;
-  SET_TYPE_MODE (new_type, GET_MODE_COMPLEX_MODE (TYPE_MODE (scalar_type)));
   layout_type (new_type);
   return new_type;
 }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH], Simplify setup of complex types
  2016-06-21 13:48 [PATCH], Simplify setup of complex types Michael Meissner
@ 2016-06-21 20:02 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2016-06-21 20:02 UTC (permalink / raw)
  To: Michael Meissner, gcc-patches, David Edelsohn, Bill Schmidt,
	Segher Boessenkool

On 06/21/2016 07:48 AM, Michael Meissner wrote:
> When I submitted the back port to allow complex __float128 to be created on the
> PowerPC to the GCC 6.2 branch, Richard Biener suggested a simpler way to set
> the complex type:
> https://gcc.gnu.org/ml/gcc-patches/2016-06/msg01114.html
>
> This patch implements this change for the trunk.  I have a companion patch for
> 6.2 once this goes into the trunk.
>
> I bootstrapped the compiler and did a make check with no regressions on a big
> endian Power 7 system and a little endian Power 8 system.  Is it ok to go into
> the trunk?
>
> [gcc]
> 2016-06-21  Michael Meissner  <meissner@linux.vnet.ibm.com>
>
> 	* stor-layout.c (layout_type): Move setting complex MODE to
> 	layout_type, instead of setting it ahead of time by the caller.
> 	* tree.c (build_complex_type): Likewise.
>
> [gcc/fortran]
> 2016-06-21  Michael Meissner  <meissner@linux.vnet.ibm.com>
>
> 	* trans-types.c (gfc_build_complex_type): Move setting complex
> 	MODE to layout_type, instead of setting it ahead of time by the
> 	caller.
OK.

Jeff

ps.  Thanks for the pointer back to the prior discussion with Richi -- 
that makes it a lot easier to pick up state on this while Richi is on PTO.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-21 20:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-21 13:48 [PATCH], Simplify setup of complex types Michael Meissner
2016-06-21 20:02 ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).