]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/83064 (DO CONCURRENT and auto-parallelization)
authorThomas Koenig <tkoenig@gcc.gnu.org>
Thu, 12 Apr 2018 21:58:54 +0000 (21:58 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Thu, 12 Apr 2018 21:58:54 +0000 (21:58 +0000)
2018-04-12  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/83064
PR testsuite/85346
* trans-stmt.c (gfc_trans_forall_loop): Use annot_expr_ivdep_kind
for annotation and remove dependence on -ftree-parallelize-loops.

2018-04-12  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/83064
PR testsuite/85346
* gfortran.dg/do_concurrent_5.f90: Dynamically allocate main work
array and move test to libgomp/testsuite/libgomp.fortran.
* gfortran.dg/do_concurrent_6.f90: New test.

2018-04-12  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/83064
PR testsuite/85346
* testsuite/libgomp.fortran/do_concurrent_5.f90: Move modified
test from gfortran.dg to here.

From-SVN: r259359

gcc/fortran/ChangeLog
gcc/fortran/trans-stmt.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/do_concurrent_6.f90 [new file with mode: 0644]
libgomp/ChangeLog
libgomp/testsuite/libgomp.fortran/do_concurrent_5.f90 [moved from gcc/testsuite/gfortran.dg/do_concurrent_5.f90 with 86% similarity]

index 75d0a7e8d1fc81869378326f13dd7cd990f7bfd3..3064ab6e9214d4ea6c702d29590a54861184f365 100644 (file)
@@ -1,3 +1,10 @@
+2018-04-12  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/83064
+       PR testsuite/85346
+       * trans-stmt.c (gfc_trans_forall_loop): Use annot_expr_ivdep_kind
+       for annotation and remove dependence on -ftree-parallelize-loops.
+
 2018-04-10  Jakub Jelinek  <jakub@redhat.com>
 
        PR fortran/85313
index c44450e6aa587d3a85df2087184688721720dfcc..1952f6cdc0847fb6b945cddb9dab469291187dd3 100644 (file)
@@ -3643,12 +3643,12 @@ gfc_trans_forall_loop (forall_info *forall_tmp, tree body,
       cond = fold_build2_loc (input_location, LE_EXPR, logical_type_node,
                              count, build_int_cst (TREE_TYPE (count), 0));
 
-      /* PR 83064 means that we cannot use the annotation if the
-        autoparallelizer is active.  */
-      if (forall_tmp->do_concurrent && ! flag_tree_parallelize_loops)
+      /* PR 83064 means that we cannot use annot_expr_parallel_kind until
+       the autoparallelizer can hande this.  */
+      if (forall_tmp->do_concurrent)
        cond = build3 (ANNOTATE_EXPR, TREE_TYPE (cond), cond,
                       build_int_cst (integer_type_node,
-                                     annot_expr_parallel_kind),
+                                     annot_expr_ivdep_kind),
                       integer_zero_node);
 
       tmp = build1_v (GOTO_EXPR, exit_label);
index 73a358e6c1f9e139e622a9a541c232bcd983b1c5..16d39a283cfcf6c9fd4ba522552c9df680aff98d 100644 (file)
@@ -1,3 +1,11 @@
+2018-04-12  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/83064
+       PR testsuite/85346
+       * gfortran.dg/do_concurrent_5.f90: Dynamically allocate main work
+       array and move test to libgomp/testsuite/libgomp.fortran.
+       * gfortran.dg/do_concurrent_6.f90: New test.
+
 2018-04-12  Marek Polacek  <polacek@redhat.com>
 
        PR c++/85258
diff --git a/gcc/testsuite/gfortran.dg/do_concurrent_6.f90 b/gcc/testsuite/gfortran.dg/do_concurrent_6.f90
new file mode 100644 (file)
index 0000000..9585a9f
--- /dev/null
@@ -0,0 +1,13 @@
+! { dg-do compile }
+! { dg-additional-options "-fdump-tree-original" }
+
+program main
+  real, dimension(100) :: a,b
+  call random_number(a)
+  do concurrent (i=1:100)
+     b(i) = a(i)*a(i)
+  end do
+  print *,sum(a)
+end program main
+
+! { dg-final { scan-tree-dump-times "ivdep" 1 "original" } }
index ea28859efda63473794966aac563af757805d33c..9568a73738ef4f0b46b9e212131aac81dba63487 100644 (file)
@@ -1,3 +1,10 @@
+2018-04-12  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/83064
+       PR testsuite/85346
+       * testsuite/libgomp.fortran/do_concurrent_5.f90: Move modified
+       test from gfortran.dg to here.
+
 2018-04-05  Tom de Vries  <tom@codesourcery.com>
 
        PR target/85204
similarity index 86%
rename from gcc/testsuite/gfortran.dg/do_concurrent_5.f90
rename to libgomp/testsuite/libgomp.fortran/do_concurrent_5.f90
index feee4c9b00a879a7c6f8141c7e64be0f9b17b4ca..6fb9d1e8d964ec245ffc954d6134ab268522148a 100644 (file)
@@ -1,6 +1,6 @@
 ! { dg-do  run }
 ! PR 83064 - this used to give wrong results.
-! { dg-options "-O3 -ftree-parallelize-loops=2" }
+! { dg-additional-options "-O1 -ftree-parallelize-loops=2" }
 ! Original test case by Christian Felter
 
 program main
@@ -8,10 +8,12 @@ program main
     implicit none
 
     integer, parameter :: nsplit = 4
-    integer(int64), parameter :: ne = 20000000
-    integer(int64) :: stride, low(nsplit), high(nsplit), edof(ne), i
+    integer(int64), parameter :: ne = 2**20
+    integer(int64) :: stride, low(nsplit), high(nsplit), i
     real(real64), dimension(nsplit) :: pi
-    
+    integer(int64), dimension(:), allocatable :: edof 
+
+    allocate (edof(ne))
     edof(1::4) = 1
     edof(2::4) = 2
     edof(3::4) = 3
@@ -31,7 +33,7 @@ program main
     do concurrent (i = 1:nsplit)
         pi(i) = sum(compute( low(i), high(i) ))
     end do
-    if (abs (sum(pi) - atan(1.0d0)) > 1e-5) call abort
+    if (abs (sum(pi) - atan(1.0d0)) > 1e-5) STOP 1
     
 contains