diff options
author | Peter Klausler <pklausler@nvidia.com> | 2023-05-06 15:03:39 -0700 |
---|---|---|
committer | Peter Klausler <pklausler@nvidia.com> | 2023-06-01 13:31:35 -0700 |
commit | f674ddc19fee67401b78f360e530bb064aa31ed8 (patch) | |
tree | 4fcbbd77d44e834916714c9993049590a085020a /flang/module | |
parent | 460d1367c3774d41ee0c836d1f9cf74d1127f751 (diff) | |
download | llvm-f674ddc19fee67401b78f360e530bb064aa31ed8.zip llvm-f674ddc19fee67401b78f360e530bb064aa31ed8.tar.gz llvm-f674ddc19fee67401b78f360e530bb064aa31ed8.tar.bz2 |
[flang] CUDA Fortran - part 5/5: statement semantics
Canonicalize !$CUF KERNEL DO loop nests, similar to OpenACC/OpenMP
canonicalization. Check statements and expressions in device contexts
for usage that isn't supported. Add more tests, and include some
tweaks to standard modules needed to build CUDA Fortran modules.
Depends on https://reviews.llvm.org/D150159,
https://reviews.llvm.org/D150161, https://reviews.llvm.org/D150162, &
https://reviews.llvm.org/D150163.
Differential Revision: https://reviews.llvm.org/D150164
Diffstat (limited to 'flang/module')
-rw-r--r-- | flang/module/__fortran_builtins.f90 | 19 | ||||
-rw-r--r-- | flang/module/iso_c_binding.f90 | 3 |
2 files changed, 21 insertions, 1 deletions
diff --git a/flang/module/__fortran_builtins.f90 b/flang/module/__fortran_builtins.f90 index 0ff35cc..295ebbe 100644 --- a/flang/module/__fortran_builtins.f90 +++ b/flang/module/__fortran_builtins.f90 @@ -75,4 +75,23 @@ module __Fortran_builtins intrinsic :: __builtin_compiler_options, __builtin_compiler_version + interface operator(==) + module procedure __builtin_c_ptr_eq + end interface + interface operator(/=) + module procedure __builtin_c_ptr_eq + end interface + +contains + + elemental logical function __builtin_c_ptr_eq(x, y) + type(__builtin_c_ptr), intent(in) :: x, y + __builtin_c_ptr_eq = x%__address == y%__address + end function + + elemental logical function __builtin_c_ptr_ne(x, y) + type(__builtin_c_ptr), intent(in) :: x, y + __builtin_c_ptr_ne = x%__address /= y%__address + end function + end module diff --git a/flang/module/iso_c_binding.f90 b/flang/module/iso_c_binding.f90 index 6803557..a839d949 100644 --- a/flang/module/iso_c_binding.f90 +++ b/flang/module/iso_c_binding.f90 @@ -15,7 +15,8 @@ module iso_c_binding c_ptr => __builtin_c_ptr, & c_funptr => __builtin_c_funptr, & c_sizeof => sizeof, & - c_loc => __builtin_c_loc + c_loc => __builtin_c_loc, & + operator(==), operator(/=) type(c_ptr), parameter :: c_null_ptr = c_ptr(0) type(c_funptr), parameter :: c_null_funptr = c_funptr(0) |