[PATCH] D114134: [flang] Add evaluation for the collective intrinsic, co_sum

Katherine Rasmussen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 17 19:54:08 PST 2021


ktras created this revision.
ktras added reviewers: klausler, sscalpone, craig.rasmussen.
ktras added a project: Flang.
Herald added a subscriber: jdoerfert.
ktras requested review of this revision.
Herald added a project: LLVM.

Add co_sum to the list of intrinsic subroutines in
Evaluate/intrinsics.cpp. Remove XFAIL directive in the test for
co_sum, collectives01.f90.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114134

Files:
  flang/lib/Evaluate/intrinsics.cpp
  flang/test/Semantics/collectives01.f90


Index: flang/test/Semantics/collectives01.f90
===================================================================
--- flang/test/Semantics/collectives01.f90
+++ flang/test/Semantics/collectives01.f90
@@ -1,7 +1,5 @@
 ! RUN: %python %S/test_errors.py %s %flang_fc1
-! XFAIL: *
 ! Check for semantic errors in co_sum() subroutine calls
-! To Do: add co_sum to the evaluation stage
 
 module test_co_sum
   implicit none
@@ -29,15 +27,12 @@
     call co_sum(array, result_image=1, stat=status, errmsg=message)
     call co_sum(z, result_image=1, stat=status, errmsg=message)
  
-    ! the error is seen as an incorrect type for the stat= argument
     !ERROR: Actual argument for 'stat=' has bad type 'CHARACTER(KIND=1,LEN=1_8)'
     call co_sum(i, 1, message)
  
-    ! the error is seen as too many arguments to the co_sum() call
     !ERROR: too many actual arguments for intrinsic 'co_sum'
     call co_sum(i,   result_image=1, stat=status, errmsg=message, 3.4)
   
-    ! keyword argument with incorrect type
     !ERROR: unknown keyword argument to intrinsic 'co_sum'
     call co_sum(fake=3.4)
   
Index: flang/lib/Evaluate/intrinsics.cpp
===================================================================
--- flang/lib/Evaluate/intrinsics.cpp
+++ flang/lib/Evaluate/intrinsics.cpp
@@ -1040,6 +1040,16 @@
 
 static const IntrinsicInterface intrinsicSubroutine[]{
     {"abort", {}, {}, Rank::elemental, IntrinsicClass::impureSubroutine},
+    {"co_sum",
+        {{"a", AnyNumeric, Rank::elemental, Optionality::required,
+             common::Intent::InOut},
+            {"result_image", AnyInt, Rank::scalar, Optionality::optional,
+                common::Intent::In},
+            {"stat", AnyInt, Rank::scalar, Optionality::optional,
+                common::Intent::Out},
+            {"errmsg", DefaultChar, Rank::scalar, Optionality::optional,
+                common::Intent::InOut}},
+        {}, Rank::elemental, IntrinsicClass::collectiveSubroutine},
     {"cpu_time",
         {{"time", AnyReal, Rank::scalar, Optionality::required,
             common::Intent::Out}},


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114134.388095.patch
Type: text/x-patch
Size: 2088 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211118/4ba4b19f/attachment.bin>


More information about the llvm-commits mailing list