Skip to content

Commit 5475c09

Browse files
committed
[SYCL][LIBCLC] Add sin, cos and sqrt builtins for AMDGCN
1 parent 26b9ffa commit 5475c09

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

libclc/amdgcn-amdhsa/libspirv/SOURCES

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ workitem/get_global_size.cl
22
workitem/get_local_size.cl
33
workitem/get_num_groups.cl
44
synchronization/barrier.cl
5+
math/cos.cl
6+
math/sin.cl
7+
math/sqrt.cl
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include <spirv/spirv.h>
10+
11+
_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp32_t
12+
__spirv_ocl_cos(__clc_fp32_t In) {
13+
return __builtin_amdgcn_cosf(In);
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include <spirv/spirv.h>
10+
11+
_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp32_t
12+
__spirv_ocl_sin(__clc_fp32_t In) {
13+
return __builtin_amdgcn_sinf(In);
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include <spirv/spirv.h>
10+
11+
_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp32_t
12+
__spirv_ocl_sqrt(__clc_fp32_t In) {
13+
return __builtin_amdgcn_sqrtf(In);
14+
}

0 commit comments

Comments
 (0)