[flang-commits] [flang] 09505b1 - [flang][cuda] Add missing interface for __cosf (#153306)
via flang-commits
flang-commits at lists.llvm.org
Tue Aug 12 22:48:48 PDT 2025
Author: Valentin Clement (バレンタイン クレメン)
Date: 2025-08-12T22:48:45-07:00
New Revision: 09505b11e5c31611a2630a3b04dfb3ffc7aa32bc
URL: https://github.com/llvm/llvm-project/commit/09505b11e5c31611a2630a3b04dfb3ffc7aa32bc
DIFF: https://github.com/llvm/llvm-project/commit/09505b11e5c31611a2630a3b04dfb3ffc7aa32bc.diff
LOG: [flang][cuda] Add missing interface for __cosf (#153306)
`__cosf` is mentioned to be supported here:
https://docs.nvidia.com/hpc-sdk/compilers/cuda-fortran-prog-guide/index.html#fortran-device-modules
Add the missing interface with a bind c name linking it to `__nv_cosf`
Added:
Modified:
flang/test/Lower/CUDA/cuda-device-proc.cuf
Removed:
################################################################################
diff --git a/flang/test/Lower/CUDA/cuda-device-proc.cuf b/flang/test/Lower/CUDA/cuda-device-proc.cuf
index 1947fadace02d..2fea9a0ccbc96 100644
--- a/flang/test/Lower/CUDA/cuda-device-proc.cuf
+++ b/flang/test/Lower/CUDA/cuda-device-proc.cuf
@@ -59,7 +59,8 @@ attributes(global) subroutine devsub()
res = __brev(ai)
resl = __brev(al)
res = __clz(ai)
- res = __clz(al)
+ res = __clz(al)
+ af = __cosf(af)
ai = __mul24(ai, ai)
ai = __umul24(ai, ai)
end
@@ -110,11 +111,10 @@ end
! CHECK: %{{.*}} = fir.call @__nv_brevll(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> i64
! CHECK: %{{.*}} = fir.call @__nv_clz(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32) -> i32
! CHECK: %{{.*}} = fir.call @__nv_clzll(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i64) -> i32
-
+! CHECK: %{{.*}} = fir.call @__nv_cosf(%{{.*}}) proc_attrs<bind_c> fastmath<contract> : (f32) -> f32
! CHECK: %{{.*}} = fir.call @__nv_mul24(%{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32, i32) -> i32
! CHECK: %{{.*}} = fir.call @__nv_umul24(%{{.*}}, %{{.*}}) proc_attrs<bind_c> fastmath<contract> : (i32, i32) -> i32
-
subroutine host1()
integer, device :: a(32)
integer, device :: ret
More information about the flang-commits
mailing list