[flang-commits] [flang] [Flang][Docs][NFC] Move OpenMP API extensions to separate document (PR #186981)
Michael Klemm via flang-commits
flang-commits at lists.llvm.org
Thu Mar 19 06:53:55 PDT 2026
https://github.com/mjklemm updated https://github.com/llvm/llvm-project/pull/186981
>From ca8132f67f6189d32f13ebba44ce26747f889c2d Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Tue, 17 Mar 2026 10:16:12 +0100
Subject: [PATCH 1/3] [Flang][Docs][NFC] Move OpenMP API extensions to separate
document
This PR follows suit of the Extensions.md document and provides the same
file for OpenMP API extensions. These have previously been stored in
OpenMPSupport.md. Having a more centralized view and place for these
extensions seems useful.
---
flang/docs/OpenMP-extensions.md | 36 +++++++++++++++++++++++++++++++++
flang/docs/OpenMPSupport.md | 11 ----------
2 files changed, 36 insertions(+), 11 deletions(-)
create mode 100644 flang/docs/OpenMP-extensions.md
diff --git a/flang/docs/OpenMP-extensions.md b/flang/docs/OpenMP-extensions.md
new file mode 100644
index 0000000000000..ca3e1dacbb347
--- /dev/null
+++ b/flang/docs/OpenMP-extensions.md
@@ -0,0 +1,36 @@
+<!--===- docs/OpenMP-extensions.md
+
+ Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+ See https://llvm.org/LICENSE.txt for license information.
+ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+-->
+
+# OpenMP API Extensions Supported by Flang
+
+```{contents}
+---
+local:
+---
+```
+The Flang compiler supports several extensions to OpenMP API features, providing enhanced parallelism and data management capabilities for Fortran applications. This document outlines the supported extensions and their usage within Flang.
+
+
+## Supported OpenMP API Extensions
+
+The following extensions are supported by Flang.
+
+
+### ATOMIC Construct
+The implementation of the ATOMIC construct follows OpenMP 6.0 with the following extensions:
+- `x = x` is an allowed form of ATOMIC UPDATE.
+This is motivated by the fact that the equivalent forms `x = x+0` or `x = x*1` are allowed.
+- Explicit type conversions are allowed in ATOMIC READ, WRITE or UPDATE constructs, and in the capture statement in ATOMIC UPDATE CAPTURE.
+The OpenMP spec requires intrinsic- or pointer-assignments, which include (as per the Fortran standard) implicit type conversions. Since such conversions need to be handled, allowing explicit conversions comes at no extra cost.
+- A literal `.true.` or `.false.` is an allowed condition in ATOMIC UPDATE COMPARE. [1]
+- A logical variable is an allowed form of the condition even if its value is not computed within the ATOMIC UPDATE COMPARE construct [1].
+- `expr equalop x` is an allowed condition in ATOMIC UPDATE COMPARE. [1]
+
+
+### Data-sharing Clauses and Directives
+- Using `COMMON` block variables in an `EQUIVALENCE` statement in `THREADPRIVATE` directives.
diff --git a/flang/docs/OpenMPSupport.md b/flang/docs/OpenMPSupport.md
index 274297a22140b..e37c3293668d0 100644
--- a/flang/docs/OpenMPSupport.md
+++ b/flang/docs/OpenMPSupport.md
@@ -61,15 +61,4 @@ Note : No distinction is made between the support in Parser/Semantics, MLIR, Low
| teams distribute parallel loop simd construct | P | Implicit linearization is skipped if iv is a pointer or allocatable |
| target teams distribute parallel loop simd construct | P | Implicit linearization is completely skipped |
-## Extensions
-### ATOMIC construct
-The implementation of the ATOMIC construct follows OpenMP 6.0 with the following extensions:
-- `x = x` is an allowed form of ATOMIC UPDATE.
-This is motivated by the fact that the equivalent forms `x = x+0` or `x = x*1` are allowed.
-- Explicit type conversions are allowed in ATOMIC READ, WRITE or UPDATE constructs, and in the capture statement in ATOMIC UPDATE CAPTURE.
-The OpenMP spec requires intrinsic- or pointer-assignments, which include (as per the Fortran standard) implicit type conversions. Since such conversions need to be handled, allowing explicit conversions comes at no extra cost.
-- A literal `.true.` or `.false.` is an allowed condition in ATOMIC UPDATE COMPARE. [1]
-- A logical variable is an allowed form of the condition even if its value is not computed within the ATOMIC UPDATE COMPARE construct [1].
-- `expr equalop x` is an allowed condition in ATOMIC UPDATE COMPARE. [1]
-
[1] Code generation for ATOMIC UPDATE COMPARE is not implemented yet.
>From 356e48dc68d6529432ce8d2f13d713d9738080a5 Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Thu, 19 Mar 2026 14:50:05 +0100
Subject: [PATCH 2/3] Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot at users.noreply.github.com>
---
flang/docs/OpenMP-extensions.md | 3 +++
1 file changed, 3 insertions(+)
diff --git a/flang/docs/OpenMP-extensions.md b/flang/docs/OpenMP-extensions.md
index ca3e1dacbb347..205e515f1c73d 100644
--- a/flang/docs/OpenMP-extensions.md
+++ b/flang/docs/OpenMP-extensions.md
@@ -6,8 +6,11 @@
-->
+(openmp-extensions)=
# OpenMP API Extensions Supported by Flang
+See also {doc}`OpenMPSupport` for a general overview of OpenMP support in Flang.
+
```{contents}
---
local:
>From b7118dc105e78e1009622ada4afd0b460037450e Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Thu, 19 Mar 2026 14:52:05 +0100
Subject: [PATCH 3/3] Apply suggestions of the Copilot review
---
flang/docs/OpenMP-extensions.md | 8 +++++---
flang/docs/OpenMPSupport.md | 3 +--
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/flang/docs/OpenMP-extensions.md b/flang/docs/OpenMP-extensions.md
index 205e515f1c73d..8724b82795670 100644
--- a/flang/docs/OpenMP-extensions.md
+++ b/flang/docs/OpenMP-extensions.md
@@ -16,6 +16,7 @@ See also {doc}`OpenMPSupport` for a general overview of OpenMP support in Flang.
local:
---
```
+
The Flang compiler supports several extensions to OpenMP API features, providing enhanced parallelism and data management capabilities for Fortran applications. This document outlines the supported extensions and their usage within Flang.
@@ -27,13 +28,14 @@ The following extensions are supported by Flang.
### ATOMIC Construct
The implementation of the ATOMIC construct follows OpenMP 6.0 with the following extensions:
- `x = x` is an allowed form of ATOMIC UPDATE.
-This is motivated by the fact that the equivalent forms `x = x+0` or `x = x*1` are allowed.
+ This is motivated by the fact that the equivalent forms `x = x+0` or `x = x*1` are allowed.
- Explicit type conversions are allowed in ATOMIC READ, WRITE or UPDATE constructs, and in the capture statement in ATOMIC UPDATE CAPTURE.
-The OpenMP spec requires intrinsic- or pointer-assignments, which include (as per the Fortran standard) implicit type conversions. Since such conversions need to be handled, allowing explicit conversions comes at no extra cost.
-- A literal `.true.` or `.false.` is an allowed condition in ATOMIC UPDATE COMPARE. [1]
+ The OpenMP spec requires intrinsic- or pointer-assignments, which include (as per the Fortran standard) implicit type conversions. Since such conversions need to be handled, allowing explicit conversions comes at no extra cost.
+- A literal `.true.` or `.false.` is an allowed condition in ATOMIC UPDATE COMPARE. (Code generation for ATOMIC UPDATE COMPARE is not implemented yet.)
- A logical variable is an allowed form of the condition even if its value is not computed within the ATOMIC UPDATE COMPARE construct [1].
- `expr equalop x` is an allowed condition in ATOMIC UPDATE COMPARE. [1]
### Data-sharing Clauses and Directives
- Using `COMMON` block variables in an `EQUIVALENCE` statement in `THREADPRIVATE` directives.
+
diff --git a/flang/docs/OpenMPSupport.md b/flang/docs/OpenMPSupport.md
index e37c3293668d0..3c5762dfaa6c4 100644
--- a/flang/docs/OpenMPSupport.md
+++ b/flang/docs/OpenMPSupport.md
@@ -48,7 +48,7 @@ Note : No distinction is made between the support in Parser/Semantics, MLIR, Low
| distribute parallel loop simd construct | P | Implicit linearization is skipped if iv is a pointer or allocatable |
| depend clause | Y | |
| declare reduction construct | N | |
-| atomic construct extensions | Y | |
+| atomic construct extensions | Y | Code generation for ATOMIC UPDATE COMPARE is not implemented yet. |
| cancel construct | Y | |
| cancellation point construct | Y | |
| parallel do simd construct | P | Implicit linearization is skipped if iv is a pointer or allocatable |
@@ -61,4 +61,3 @@ Note : No distinction is made between the support in Parser/Semantics, MLIR, Low
| teams distribute parallel loop simd construct | P | Implicit linearization is skipped if iv is a pointer or allocatable |
| target teams distribute parallel loop simd construct | P | Implicit linearization is completely skipped |
-[1] Code generation for ATOMIC UPDATE COMPARE is not implemented yet.
More information about the flang-commits
mailing list