Skip to content

Commit a3f4959

Browse files
authored
[libspirv] Add __spirv_BitFieldUExtract/SExtract/Insert implementation (#20450)
1 parent 066e266 commit a3f4959

File tree

7 files changed

+86
-0
lines changed

7 files changed

+86
-0
lines changed

libclc/libspirv/lib/generic/SOURCES

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ geometric/scale.cl
3939
integer/abs.cl
4040
integer/abs_diff.cl
4141
integer/add_sat.cl
42+
integer/bitfield_extract_signed.cl
43+
integer/bitfield_extract_unsigned.cl
44+
integer/bitfield_insert.cl
4245
integer/bit_reverse.cl
4346
integer/clamp.cl
4447
integer/clz.cl
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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/integer/clc_bitfield_extract_signed.h>
10+
#include <libspirv/spirv.h>
11+
12+
#define __CLC_BODY <bitfield_extract_signed.inc>
13+
#include <clc/integer/gentype.inc>
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+
#ifdef __CLC_GEN_S
10+
11+
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE
12+
__spirv_BitFieldSExtract(__CLC_GENTYPE base, uint offset, uint count) {
13+
return __clc_bitfield_extract_signed(base, offset, count);
14+
}
15+
16+
#endif
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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/integer/clc_bitfield_extract_unsigned.h>
10+
#include <libspirv/spirv.h>
11+
12+
#define __CLC_BODY <bitfield_extract_unsigned.inc>
13+
#include <clc/integer/gentype.inc>
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+
#ifdef __CLC_GEN_U
10+
11+
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE
12+
__spirv_BitFieldUExtract(__CLC_GENTYPE base, uint offset, uint count) {
13+
return __clc_bitfield_extract_unsigned(base, offset, count);
14+
}
15+
16+
#endif
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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/integer/clc_bitfield_insert.h>
10+
#include <libspirv/spirv.h>
11+
12+
#define __CLC_BODY <bitfield_insert.inc>
13+
#include <clc/integer/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_BitFieldInsert(
10+
__CLC_GENTYPE base, __CLC_GENTYPE insert, uint offset, uint count) {
11+
return __clc_bitfield_insert(base, insert, offset, count);
12+
}

0 commit comments

Comments
 (0)