Skip to content

Commit e79e1b7

Browse files
authored
[NFC][libspirv] Move clamp, max and min from shared into common and integer folders (#19336)
max/min are not shared any more. Shared code in clamp is simple, so it is probably better not to share.
1 parent 2b840ed commit e79e1b7

File tree

8 files changed

+20
-10
lines changed

8 files changed

+20
-10
lines changed

libclc/libspirv/lib/generic/SOURCES

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ atomic/atomic_xor.cl
2121
atomic/atomic_load.cl
2222
atomic/atomic_store.cl
2323
common/degrees.cl
24+
common/fclamp.cl
2425
common/mix.cl
2526
common/radians.cl
2627
common/sign.cl
@@ -38,12 +39,15 @@ geometric/scale.cl
3839
integer/abs.cl
3940
integer/abs_diff.cl
4041
integer/add_sat.cl
42+
integer/clamp.cl
4143
integer/clz.cl
4244
integer/ctz.cl
4345
integer/hadd.cl
4446
integer/mad24.cl
4547
integer/mad_hi.cl
4648
integer/mad_sat.cl
49+
integer/max.cl
50+
integer/min.cl
4751
integer/mul24.cl
4852
integer/mul_hi.cl
4953
integer/popcount.cl
@@ -170,9 +174,6 @@ relational/isordered.cl
170174
relational/isunordered.cl
171175
relational/select.cl
172176
relational/signbit.cl
173-
shared/clamp.cl
174-
shared/max.cl
175-
shared/min.cl
176177
shared/vload.cl
177178
shared/vstore.cl
178179
workitem/get_global_id.cl
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/shared/clc_clamp.h>
10+
#include <libspirv/spirv.h>
11+
12+
#define FUNCTION __spirv_ocl_fclamp
13+
#define __CLC_FUNCTION(x) __clc_clamp
14+
15+
#define __CLC_BODY <clc/shared/ternary_def.inc>
16+
#include <clc/math/gentype.inc>

libclc/libspirv/lib/generic/shared/clamp.cl renamed to libclc/libspirv/lib/generic/integer/clamp.cl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,3 @@
1111

1212
#define __CLC_BODY <clamp.inc>
1313
#include <clc/integer/gentype.inc>
14-
15-
#define __CLC_BODY <clamp.inc>
16-
#include <clc/math/gentype.inc>

libclc/libspirv/lib/generic/shared/clamp.inc renamed to libclc/libspirv/lib/generic/integer/clamp.inc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,11 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifdef __CLC_FPSIZE
10-
#define DECL __spirv_ocl_fclamp
11-
#else
129
#ifdef __CLC_GEN_S
1310
#define DECL __spirv_ocl_s_clamp
1411
#else
1512
#define DECL __spirv_ocl_u_clamp
1613
#endif
17-
#endif
1814

1915
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE DECL(__CLC_GENTYPE x, __CLC_GENTYPE y,
2016
__CLC_GENTYPE z) {

0 commit comments

Comments
 (0)