]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/44646 ([F08] Implement DO CONCURRENT)
authorTobias Burnus <burnus@net-b.de>
Thu, 24 Oct 2013 16:30:22 +0000 (18:30 +0200)
committerTobias Burnus <burnus@gcc.gnu.org>
Thu, 24 Oct 2013 16:30:22 +0000 (18:30 +0200)
2013-10-24  Tobias Burnus  <burnus@net-b.de>

        PR fortran/44646
        * trans-stmt.c (struct forall_info): Add do_concurrent field.
        (gfc_trans_forall_1): Set it for do concurrent.
        (gfc_trans_forall_loop): Mark those as annot_expr_ivdep_kind.

2013-10-24  Tobias Burnus  <burnus@net-b.de>

        PR fortran/44646
        * gfortran.dg/vect/vect-do-concurrent-1.f90: New.

From-SVN: r204023

gcc/fortran/ChangeLog
gcc/fortran/trans-stmt.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/vect/vect-do-concurrent-1.f90 [new file with mode: 0644]

index f152933a9be2a25cabed63b449f15508fd05ec18..80697ff98d0a775fae879c8f680e7aac5fb51d76 100644 (file)
@@ -1,3 +1,10 @@
+2013-10-24  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/44646
+       * trans-stmt.c (struct forall_info): Add do_concurrent field.
+       (gfc_trans_forall_1): Set it for do concurrent.
+       (gfc_trans_forall_loop): Mark those as annot_expr_ivdep_kind.
+
 2013-10-23  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/58793
index edd2dacf579f0e7630ff4300c903128f68fc52ca..62e690d407c7a1ac2fe33dcb3830567df0430730 100644 (file)
@@ -53,6 +53,7 @@ typedef struct forall_info
   int nvar;
   tree size;
   struct forall_info  *prev_nest;
+  bool do_concurrent;
 }
 forall_info;
 
@@ -2759,6 +2760,11 @@ gfc_trans_forall_loop (forall_info *forall_tmp, tree body,
       /* The exit condition.  */
       cond = fold_build2_loc (input_location, LE_EXPR, boolean_type_node,
                              count, build_int_cst (TREE_TYPE (count), 0));
+      if (forall_tmp->do_concurrent)
+       cond = build2 (ANNOTATE_EXPR, TREE_TYPE (cond), cond,
+                      build_int_cst (integer_type_node,
+                                     annot_expr_ivdep_kind));
+
       tmp = build1_v (GOTO_EXPR, exit_label);
       tmp = fold_build3_loc (input_location, COND_EXPR, void_type_node,
                             cond, tmp, build_empty_stmt (input_location));
@@ -3842,6 +3848,7 @@ gfc_trans_forall_1 (gfc_code * code, forall_info * nested_forall_info)
        }
 
       tmp = gfc_finish_block (&body);
+      nested_forall_info->do_concurrent = true;
       tmp = gfc_trans_nested_forall_loop (nested_forall_info, tmp, 1);
       gfc_add_expr_to_block (&block, tmp);
       goto done;
index 5694dcdb176627a4d4eb4e10a1c3aa70093ebc35..d2c2cd645240d8626c8f4d08958f9da17b16d7cd 100644 (file)
@@ -1,3 +1,8 @@
+2013-08-24  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/44646
+       * gfortran.dg/vect/vect-do-concurrent-1.f90: New.
+
 2013-10-24  Dehao Chen  <dehao@google.com>
 
        * g++.dg/opt/devirt3.C: New test.
diff --git a/gcc/testsuite/gfortran.dg/vect/vect-do-concurrent-1.f90 b/gcc/testsuite/gfortran.dg/vect/vect-do-concurrent-1.f90
new file mode 100644 (file)
index 0000000..7d56241
--- /dev/null
@@ -0,0 +1,17 @@
+! { dg-do compile }
+! { dg-require-effective-target vect_float }
+! { dg-options "-O3 -fopt-info-vec-optimized" }
+
+subroutine test(n, a, b, c)
+  integer, value :: n
+  real, contiguous,  pointer :: a(:), b(:), c(:)
+  integer :: i
+  do concurrent (i = 1:n)
+    a(i) = b(i) + c(i)
+  end do
+end subroutine test
+
+! { dg-message "loop vectorized" "" { target *-*-* } 0 }
+! { dg-bogus "version" "" { target *-*-* } 0 }
+! { dg-bogus "alias" "" { target *-*-* } 0 }
+! { dg-final { cleanup-tree-dump "vect" } }