[flang-commits] [flang] [flang][Lower] Add Lowering for CO_{BROADCAST, MAX, MIN, SUM} to PRIF (PR #154770)

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Fri Aug 22 09:17:33 PDT 2025


================
@@ -397,6 +397,34 @@ static constexpr IntrinsicHandler handlers[]{
     {"cmplx",
      &I::genCmplx,
      {{{"x", asValue}, {"y", asValue, handleDynamicOptional}}}},
+    {"co_broadcast",
+     &I::genCoBroadcast,
+     {{{"a", asBox},
+       {"source_image", asAddr, handleDynamicOptional},
+       {"stat", asAddr, handleDynamicOptional},
+       {"errmsg", asBox, handleDynamicOptional}}},
+     /*isElemental*/ false},
+    {"co_max",
+     &I::genCoMax,
+     {{{"a", asBox},
+       {"result_image", asAddr, handleDynamicOptional},
+       {"stat", asAddr, handleDynamicOptional},
+       {"errmsg", asBox, handleDynamicOptional}}},
+     /*isElemental*/ false},
+    {"co_min",
+     &I::genCoMin,
+     {{{"a", asBox},
+       {"result_image", asAddr, handleDynamicOptional},
+       {"stat", asAddr, handleDynamicOptional},
+       {"errmsg", asBox, handleDynamicOptional}}},
+     /*isElemental*/ false},
+    {"co_sum",
+     &I::genCoSum,
+     {{{"a", asBox},
+       {"result_image", asAddr, handleDynamicOptional},
+       {"stat", asAddr, handleDynamicOptional},
+       {"errmsg", asBox, handleDynamicOptional}}},
----------------
eugeneepshteyn wrote:

My understanding is that "integer scalar" by itself could be an immediate value or an expression. "Integer scalar" with "INTENT(IN)" implies that this entity must have an address and if it doesn't have one, a temporary should be created.  `SOURCE_IMAGE` is an integer scalar that is `INTENT(IN)`, thus it should have an address.

https://github.com/llvm/llvm-project/pull/154770


More information about the flang-commits mailing list