Skip to content

Commit 446a453

Browse files
authored
[libspirv][math] Implement OpFMod and OpFRem (#20610)
1 parent 33bb26d commit 446a453

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

libclc/libspirv/lib/generic/SOURCES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ math/fmax_common.cl
9292
math/fmin.cl
9393
math/fmin_common.cl
9494
math/fmod.cl
95+
math/FMod.cl
96+
math/FRem.cl
9597
math/fract.cl
9698
math/frexp.cl
9799
math/half_cos.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 <clc/math/clc_copysign.h>
10+
#include <clc/math/clc_fmod.h>
11+
#include <libspirv/spirv.h>
12+
13+
#define __CLC_BODY <FMod.inc>
14+
#include <clc/math/gentype.inc>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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+
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __spirv_FMod(__CLC_GENTYPE x,
10+
__CLC_GENTYPE y) {
11+
return __clc_copysign(__clc_fmod(x, y), y);
12+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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 <clc/math/clc_fmod.h>
10+
#include <libspirv/spirv.h>
11+
12+
#define __CLC_FUNCTION __spirv_FRem
13+
#define __CLC_IMPL_FUNCTION(x) __clc_fmod
14+
#define __CLC_BODY <clc/shared/binary_def.inc>
15+
16+
#include <clc/math/gentype.inc>

0 commit comments

Comments
 (0)