Skip to content

Commit 44c6a23

Browse files
authored
[flang][OpenMP][AMDGPU] Allow REAL(10) to compile on AMDGPU (llvm#129742)
This will allow the following code to compile ``` program p real(10) :: x !$omp target continue !$omp end target end ```
1 parent ab811e7 commit 44c6a23

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

flang/include/flang/Tools/TargetSetup.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,14 @@ namespace Fortran::tools {
4242
targetCharacteristics.set_hasSubnormalFlushingControl(/*kind=*/8);
4343
}
4444

45-
if (targetTriple.getArch() != llvm::Triple::ArchType::x86_64) {
45+
switch (targetTriple.getArch()) {
46+
case llvm::Triple::ArchType::amdgcn:
47+
case llvm::Triple::ArchType::x86_64:
48+
break;
49+
default:
4650
targetCharacteristics.DisableType(
4751
Fortran::common::TypeCategory::Real, /*kind=*/10);
52+
break;
4853
}
4954

5055
// Check for kind=16 support. See flang/runtime/Float128Math/math-entries.h.

flang/test/Lower/OpenMP/real10.f90

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
!REQUIRES: amdgpu-registered-target
2+
3+
!RUN: %flang_fc1 -emit-hlfir -fopenmp -triple amdgcn -fopenmp -fopenmp-is-target-device -o - %s | FileCheck %s
4+
5+
!CHECK: hlfir.declare %0 {uniq_name = "_QFEx"} : (!fir.ref<f80>) -> (!fir.ref<f80>, !fir.ref<f80>)
6+
7+
program p
8+
real(10) :: x
9+
!$omp target
10+
continue
11+
!$omp end target
12+
end
13+

0 commit comments

Comments
 (0)