public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Fortran, accaf, patch, v1] Fixing compatibility with opencoarrays (mostly)
@ 2016-09-22 15:16 Andre Vehreschild
  2016-09-22 17:43 ` Paul Richard Thomas
  0 siblings, 1 reply; 4+ messages in thread
From: Andre Vehreschild @ 2016-09-22 15:16 UTC (permalink / raw)
  To: GCC-Patches-ML, GCC-Fortran-ML, Paul Richard Thomas, Damian Rouson

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

Hi all,

attached patch fixes compatibility with opencoarrays by using the old coarray
interface of caf_get() as long as possible.

Bootstrapped and regtested ok on x86_64-linux/F23. Ok for trunk?

Regards,
	Andre
-- 
Andre Vehreschild * Email: vehre ad gmx dot de 

[-- Attachment #2: accaf_fix_v1.clog --]
[-- Type: text/plain, Size: 329 bytes --]

gcc/fortran/ChangeLog:

2016-09-22  Andre Vehreschild  <vehre@gcc.gnu.org>

	* trans-intrinsic.c (gfc_conv_intrinsic_caf_get): Use the old caf-
	interface where possible.

gcc/testsuite/ChangeLog:

2016-09-22  Andre Vehreschild  <vehre@gcc.gnu.org>

	* gfortran.dg/coarray_lib_comm_1.f90: Using the old caf-interface
	here now.


[-- Attachment #3: accaf_fix_v1.patch --]
[-- Type: text/x-patch, Size: 3015 bytes --]

diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index c6883dc..d3f6842 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -1607,10 +1607,9 @@ gfc_conv_intrinsic_caf_get (gfc_se *se, gfc_expr *expr, tree lhs, tree lhs_kind,
   else
     stat = null_pointer_node;
 
-  /* Always use the new get_by_ref ().  When no allocatable components are
-     present and the lhs does not reallocation then the "old" get () might
-     suffice.  */
-  if (true) //caf_attr->alloc_comp && !may_realloc)
+  /* Only use the new get_by_ref () where it is necessary.  I.e., when the lhs
+     is reallocatable or the right-hand side has allocatable components.  */
+  if (caf_attr->alloc_comp || may_realloc)
     {
       /* Get using caf_get_by_ref.  */
       caf_reference = conv_expr_ref_to_caf_ref (&se->pre, array_expr);
diff --git a/gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90 b/gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90
index 7ab5ab4..cfd1e64 100644
--- a/gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90
@@ -40,7 +40,7 @@ end
 
 ! { dg-final { scan-tree-dump-times "_gfortran_caf_sendget \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, _gfortran_caf_this_image \\\(0\\\), &parm.\[0-9\]+, 0B, caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, 4, 4, 0, 0B\\\);" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "_gfortran_caf_sendget \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, _gfortran_caf_this_image \\\(0\\\), &parm.\[0-9\]+, 0B, caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, 4, 4, 1, 0B\\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_get_by_ref \\\(caf_token.0, 1, &p, &caf_ref.\[0-9\]+, 4, 4, 1, 0, 0B\\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_get_by_ref \\\(caf_token.1, 1, &p, &caf_ref.\[0-9\]+, 4, 4, 0, 0, 0B\\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_get \\\(caf_token.0, \\\(integer\\\(kind=8\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=8\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, &p, 4, 4, 1, 0B\\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_get \\\(caf_token.1, \\\(integer\\\(kind=8\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=8\\\)\\\) b, 1, &parm.\[0-9\]+, 0B, &p, 4, 4, 0, 0B\\\);" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "_gfortran_caf_sendget \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, 4, 4, 0, 0B\\\);" 1 "original" } }
 

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

* Re: [Fortran, accaf, patch, v1] Fixing compatibility with opencoarrays (mostly)
  2016-09-22 15:16 [Fortran, accaf, patch, v1] Fixing compatibility with opencoarrays (mostly) Andre Vehreschild
@ 2016-09-22 17:43 ` Paul Richard Thomas
  2016-09-23 10:40   ` Andre Vehreschild
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Richard Thomas @ 2016-09-22 17:43 UTC (permalink / raw)
  To: Andre Vehreschild; +Cc: GCC-Patches-ML, GCC-Fortran-ML, Damian Rouson

Dear Andre,

Yes, this is fine for trunk. Thanks for fixing it so quickly.

Best regards

Paul

On 22 September 2016 at 17:09, Andre Vehreschild <vehre@gmx.de> wrote:
> Hi all,
>
> attached patch fixes compatibility with opencoarrays by using the old coarray
> interface of caf_get() as long as possible.
>
> Bootstrapped and regtested ok on x86_64-linux/F23. Ok for trunk?
>
> Regards,
>         Andre
> --
> Andre Vehreschild * Email: vehre ad gmx dot de



-- 
The difference between genius and stupidity is; genius has its limits.

Albert Einstein

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

* Re: [Fortran, accaf, patch, v1] Fixing compatibility with opencoarrays (mostly)
  2016-09-22 17:43 ` Paul Richard Thomas
@ 2016-09-23 10:40   ` Andre Vehreschild
  2016-09-24 18:50     ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: Andre Vehreschild @ 2016-09-23 10:40 UTC (permalink / raw)
  To: Paul Richard Thomas; +Cc: GCC-Patches-ML, GCC-Fortran-ML, Damian Rouson

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

Hi Paul,

thanks for the review. Committed as r240419.

Regards,
	Andre

On Thu, 22 Sep 2016 19:28:49 +0200
Paul Richard Thomas <paul.richard.thomas@gmail.com> wrote:

> Dear Andre,
> 
> Yes, this is fine for trunk. Thanks for fixing it so quickly.
> 
> Best regards
> 
> Paul
> 
> On 22 September 2016 at 17:09, Andre Vehreschild <vehre@gmx.de> wrote:
> > Hi all,
> >
> > attached patch fixes compatibility with opencoarrays by using the old
> > coarray interface of caf_get() as long as possible.
> >
> > Bootstrapped and regtested ok on x86_64-linux/F23. Ok for trunk?
> >
> > Regards,
> >         Andre
> > --
> > Andre Vehreschild * Email: vehre ad gmx dot de  
> 
> 
> 


-- 
Andre Vehreschild * Email: vehre ad gmx dot de 

[-- Attachment #2: submit.diff --]
[-- Type: text/x-patch, Size: 3891 bytes --]

Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog	(Revision 240418)
+++ gcc/fortran/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,8 @@
+2016-09-22  Andre Vehreschild  <vehre@gcc.gnu.org>
+
+	* trans-intrinsic.c (gfc_conv_intrinsic_caf_get): Use the old caf-
+	interface where possible.
+
 2016-09-22  Paul Thomas  <pault@gcc.gnu.org>
 
 	* interface.c (check_dtio_interface1): Introduce errors for
Index: gcc/fortran/trans-intrinsic.c
===================================================================
--- gcc/fortran/trans-intrinsic.c	(Revision 240418)
+++ gcc/fortran/trans-intrinsic.c	(Arbeitskopie)
@@ -1607,10 +1607,9 @@
   else
     stat = null_pointer_node;
 
-  /* Always use the new get_by_ref ().  When no allocatable components are
-     present and the lhs does not reallocation then the "old" get () might
-     suffice.  */
-  if (true) //caf_attr->alloc_comp && !may_realloc)
+  /* Only use the new get_by_ref () where it is necessary.  I.e., when the lhs
+     is reallocatable or the right-hand side has allocatable components.  */
+  if (caf_attr->alloc_comp || may_realloc)
     {
       /* Get using caf_get_by_ref.  */
       caf_reference = conv_expr_ref_to_caf_ref (&se->pre, array_expr);
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog	(Revision 240418)
+++ gcc/testsuite/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,8 @@
+2016-09-23  Andre Vehreschild  <vehre@gcc.gnu.org>
+
+	* gfortran.dg/coarray_lib_comm_1.f90: Using the old caf-interface
+	here now.
+
 2016-09-23  Matthew Wahab  <matthew.wahab@arm.com>
 
 	* gcc.target/arm/armv8_2-fp16-arith-1.c: Use arm_v8_2a_fp16_neon
Index: gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90
===================================================================
--- gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90	(Revision 240418)
+++ gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90	(Arbeitskopie)
@@ -40,7 +40,7 @@
 
 ! { dg-final { scan-tree-dump-times "_gfortran_caf_sendget \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, _gfortran_caf_this_image \\\(0\\\), &parm.\[0-9\]+, 0B, caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, 4, 4, 0, 0B\\\);" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "_gfortran_caf_sendget \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, _gfortran_caf_this_image \\\(0\\\), &parm.\[0-9\]+, 0B, caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, 4, 4, 1, 0B\\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_get_by_ref \\\(caf_token.0, 1, &p, &caf_ref.\[0-9\]+, 4, 4, 1, 0, 0B\\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_get_by_ref \\\(caf_token.1, 1, &p, &caf_ref.\[0-9\]+, 4, 4, 0, 0, 0B\\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_get \\\(caf_token.0, \\\(integer\\\(kind=8\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=8\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, &p, 4, 4, 1, 0B\\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_get \\\(caf_token.1, \\\(integer\\\(kind=8\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=8\\\)\\\) b, 1, &parm.\[0-9\]+, 0B, &p, 4, 4, 0, 0B\\\);" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "_gfortran_caf_sendget \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, 4, 4, 0, 0B\\\);" 1 "original" } }
 

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

* Re: [Fortran, accaf, patch, v1] Fixing compatibility with opencoarrays (mostly)
  2016-09-23 10:40   ` Andre Vehreschild
@ 2016-09-24 18:50     ` Andreas Schwab
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2016-09-24 18:50 UTC (permalink / raw)
  To: Andre Vehreschild
  Cc: Paul Richard Thomas, GCC-Patches-ML, GCC-Fortran-ML, Damian Rouson

FAIL: gfortran.dg/coarray_lib_comm_1.f90   -O0   scan-tree-dump-times original "_gfortran_caf_get \\(caf_token.0, \\(integer\\(kind=8\\)\\) parm.[0-9]+.data - \\(integer\\(kind=8\\)\\) a, 1, &parm.[0-9]+, 0B, &p, 4, 4, 1, 0B\\);" 1
FAIL: gfortran.dg/coarray_lib_comm_1.f90   -O0   scan-tree-dump-times original "_gfortran_caf_get \\(caf_token.1, \\(integer\\(kind=8\\)\\) parm.[0-9]+.data - \\(integer\\(kind=8\\)\\) b, 1, &parm.[0-9]+, 0B, &p, 4, 4, 0, 0B\\);" 1

$ grep _gfortran_caf_get coarray_lib_comm_1.f90.003t.original
    _gfortran_caf_get (caf_token.0, (integer(kind=4)) parm.22.data - (integer(kind=4)) a, 1, &parm.22, 0B, &p, 4, 4, 1, 0B);
    _gfortran_caf_get (caf_token.1, (integer(kind=4)) parm.28.data - (integer(kind=4)) b, 1, &parm.28, 0B, &p, 4, 4, 0, 0B);

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

end of thread, other threads:[~2016-09-24 18:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-22 15:16 [Fortran, accaf, patch, v1] Fixing compatibility with opencoarrays (mostly) Andre Vehreschild
2016-09-22 17:43 ` Paul Richard Thomas
2016-09-23 10:40   ` Andre Vehreschild
2016-09-24 18:50     ` Andreas Schwab

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).