https://github.com/wenju-he updated 
https://github.com/llvm/llvm-project/pull/149070

>From 9f8b12e6cf600cd05bab586e3d521e5354789e12 Mon Sep 17 00:00:00 2001
From: Wenju He <wenju...@intel.com>
Date: Wed, 16 Jul 2025 12:44:48 +0200
Subject: [PATCH 1/3] [libclc] Add generic implementation of
 bitfield_insert/extract,bit_reverse

The implementation is based on reference implementation in 
OpenCL-CTS/test_integer_ops.
The generic implementations pass OpenCL-CTS/test_integer_ops tests on Intel GPU.
---
 .../clc/include/clc/integer/clc_bit_reverse.h | 19 +++++++++++++++
 .../clc/integer/clc_bitfield_extract.inc      | 10 ++++++++
 .../clc/integer/clc_bitfield_extract_signed.h | 23 +++++++++++++++++++
 .../integer/clc_bitfield_extract_unsigned.h   | 23 +++++++++++++++++++
 .../include/clc/integer/clc_bitfield_insert.h | 17 ++++++++++++++
 .../clc/integer/clc_bitfield_insert.inc       | 10 ++++++++
 libclc/clc/lib/generic/SOURCES                |  4 ++++
 .../lib/generic/integer/clc_bit_reverse.cl    | 15 ++++++++++++
 .../integer/clc_bitfield_extract_signed.cl    | 12 ++++++++++
 .../integer/clc_bitfield_extract_signed.inc   | 19 +++++++++++++++
 .../integer/clc_bitfield_extract_unsigned.cl  | 12 ++++++++++
 .../integer/clc_bitfield_extract_unsigned.inc | 16 +++++++++++++
 .../generic/integer/clc_bitfield_insert.cl    | 12 ++++++++++
 .../generic/integer/clc_bitfield_insert.inc   | 20 ++++++++++++++++
 .../include/clc/opencl/integer/bit_reverse.h  | 21 +++++++++++++++++
 .../clc/opencl/integer/bitfield_extract.inc   | 10 ++++++++
 .../opencl/integer/bitfield_extract_signed.h  | 23 +++++++++++++++++++
 .../integer/bitfield_extract_unsigned.h       | 23 +++++++++++++++++++
 .../clc/opencl/integer/bitfield_insert.h      | 19 +++++++++++++++
 .../clc/opencl/integer/bitfield_insert.inc    | 11 +++++++++
 libclc/opencl/lib/generic/SOURCES             |  4 ++++
 .../opencl/lib/generic/integer/bit_reverse.cl | 19 +++++++++++++++
 .../lib/generic/integer/bitfield_extract.inc  | 16 +++++++++++++
 .../integer/bitfield_extract_signed.cl        | 20 ++++++++++++++++
 .../integer/bitfield_extract_unsigned.cl      | 20 ++++++++++++++++
 .../lib/generic/integer/bitfield_insert.cl    | 17 ++++++++++++++
 .../lib/generic/integer/bitfield_insert.inc   | 13 +++++++++++
 27 files changed, 428 insertions(+)
 create mode 100644 libclc/clc/include/clc/integer/clc_bit_reverse.h
 create mode 100644 libclc/clc/include/clc/integer/clc_bitfield_extract.inc
 create mode 100644 libclc/clc/include/clc/integer/clc_bitfield_extract_signed.h
 create mode 100644 
libclc/clc/include/clc/integer/clc_bitfield_extract_unsigned.h
 create mode 100644 libclc/clc/include/clc/integer/clc_bitfield_insert.h
 create mode 100644 libclc/clc/include/clc/integer/clc_bitfield_insert.inc
 create mode 100644 libclc/clc/lib/generic/integer/clc_bit_reverse.cl
 create mode 100644 
libclc/clc/lib/generic/integer/clc_bitfield_extract_signed.cl
 create mode 100644 
libclc/clc/lib/generic/integer/clc_bitfield_extract_signed.inc
 create mode 100644 
libclc/clc/lib/generic/integer/clc_bitfield_extract_unsigned.cl
 create mode 100644 
libclc/clc/lib/generic/integer/clc_bitfield_extract_unsigned.inc
 create mode 100644 libclc/clc/lib/generic/integer/clc_bitfield_insert.cl
 create mode 100644 libclc/clc/lib/generic/integer/clc_bitfield_insert.inc
 create mode 100644 libclc/opencl/include/clc/opencl/integer/bit_reverse.h
 create mode 100644 
libclc/opencl/include/clc/opencl/integer/bitfield_extract.inc
 create mode 100644 
libclc/opencl/include/clc/opencl/integer/bitfield_extract_signed.h
 create mode 100644 
libclc/opencl/include/clc/opencl/integer/bitfield_extract_unsigned.h
 create mode 100644 libclc/opencl/include/clc/opencl/integer/bitfield_insert.h
 create mode 100644 libclc/opencl/include/clc/opencl/integer/bitfield_insert.inc
 create mode 100644 libclc/opencl/lib/generic/integer/bit_reverse.cl
 create mode 100644 libclc/opencl/lib/generic/integer/bitfield_extract.inc
 create mode 100644 libclc/opencl/lib/generic/integer/bitfield_extract_signed.cl
 create mode 100644 
libclc/opencl/lib/generic/integer/bitfield_extract_unsigned.cl
 create mode 100644 libclc/opencl/lib/generic/integer/bitfield_insert.cl
 create mode 100644 libclc/opencl/lib/generic/integer/bitfield_insert.inc

diff --git a/libclc/clc/include/clc/integer/clc_bit_reverse.h 
b/libclc/clc/include/clc/integer/clc_bit_reverse.h
new file mode 100644
index 0000000000000..c945e326c74fa
--- /dev/null
+++ b/libclc/clc/include/clc/integer/clc_bit_reverse.h
@@ -0,0 +1,19 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef __CLC_INTEGER_CLC_BIT_REVERSE_H__
+#define __CLC_INTEGER_CLC_BIT_REVERSE_H__
+
+#define FUNCTION __clc_bit_reverse
+#define __CLC_BODY <clc/shared/unary_decl.inc>
+
+#include <clc/integer/gentype.inc>
+
+#undef FUNCTION
+
+#endif // __CLC_INTEGER_CLC_BIT_REVERSE_H__
diff --git a/libclc/clc/include/clc/integer/clc_bitfield_extract.inc 
b/libclc/clc/include/clc/integer/clc_bitfield_extract.inc
new file mode 100644
index 0000000000000..c93eff08de0bc
--- /dev/null
+++ b/libclc/clc/include/clc/integer/clc_bitfield_extract.inc
@@ -0,0 +1,10 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+_CLC_OVERLOAD _CLC_DECL __RETTYPE FUNCTION(__CLC_GENTYPE base, uint offset,
+                                           uint count);
diff --git a/libclc/clc/include/clc/integer/clc_bitfield_extract_signed.h 
b/libclc/clc/include/clc/integer/clc_bitfield_extract_signed.h
new file mode 100644
index 0000000000000..fec5bf0b272e0
--- /dev/null
+++ b/libclc/clc/include/clc/integer/clc_bitfield_extract_signed.h
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef __CLC_INTEGER_CLC_BITFIELD_EXTRACT_SIGNED_H__
+#define __CLC_INTEGER_CLC_BITFIELD_EXTRACT_SIGNED_H__
+
+#include <clc/internal/clc.h>
+
+#define FUNCTION __clc_bitfield_extract_signed
+#define __RETTYPE __CLC_S_GENTYPE
+
+#define __CLC_BODY <clc/integer/clc_bitfield_extract.inc>
+#include <clc/integer/gentype.inc>
+
+#undef __RETTYPE
+#undef FUNCTION
+
+#endif // __CLC_INTEGER_CLC_BITFIELD_EXTRACT_SIGNED_H__
diff --git a/libclc/clc/include/clc/integer/clc_bitfield_extract_unsigned.h 
b/libclc/clc/include/clc/integer/clc_bitfield_extract_unsigned.h
new file mode 100644
index 0000000000000..ddbbf2bd92483
--- /dev/null
+++ b/libclc/clc/include/clc/integer/clc_bitfield_extract_unsigned.h
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef __CLC_INTEGER_CLC_BITFIELD_EXTRACT_SIGNED_H__
+#define __CLC_INTEGER_CLC_BITFIELD_EXTRACT_SIGNED_H__
+
+#include <clc/internal/clc.h>
+
+#define FUNCTION __clc_bitfield_extract_unsigned
+#define __RETTYPE __CLC_U_GENTYPE
+
+#define __CLC_BODY <clc/integer/clc_bitfield_extract.inc>
+#include <clc/integer/gentype.inc>
+
+#undef __RETTYPE
+#undef FUNCTION
+
+#endif // __CLC_INTEGER_CLC_BITFIELD_EXTRACT_SIGNED_H__
diff --git a/libclc/clc/include/clc/integer/clc_bitfield_insert.h 
b/libclc/clc/include/clc/integer/clc_bitfield_insert.h
new file mode 100644
index 0000000000000..4e15d7884988b
--- /dev/null
+++ b/libclc/clc/include/clc/integer/clc_bitfield_insert.h
@@ -0,0 +1,17 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef __CLC_INTEGER_CLC_BITFIELD_INSERT_H__
+#define __CLC_INTEGER_CLC_BITFIELD_INSERT_H__
+
+#include <clc/internal/clc.h>
+
+#define __CLC_BODY <clc/integer/clc_bitfield_insert.inc>
+#include <clc/integer/gentype.inc>
+
+#endif // __CLC_INTEGER_CLC_BITFIELD_INSERT_H__
diff --git a/libclc/clc/include/clc/integer/clc_bitfield_insert.inc 
b/libclc/clc/include/clc/integer/clc_bitfield_insert.inc
new file mode 100644
index 0000000000000..de9a42f34223f
--- /dev/null
+++ b/libclc/clc/include/clc/integer/clc_bitfield_insert.inc
@@ -0,0 +1,10 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __clc_bitfield_insert(
+    __CLC_GENTYPE base, __CLC_GENTYPE insert, uint offset, uint count);
diff --git a/libclc/clc/lib/generic/SOURCES b/libclc/clc/lib/generic/SOURCES
index bf8736a726315..9d792c4b3d28d 100644
--- a/libclc/clc/lib/generic/SOURCES
+++ b/libclc/clc/lib/generic/SOURCES
@@ -15,6 +15,10 @@ geometric/clc_normalize.cl
 integer/clc_abs.cl
 integer/clc_abs_diff.cl
 integer/clc_add_sat.cl
+integer/clc_bitfield_extract_signed.cl
+integer/clc_bitfield_extract_unsigned.cl
+integer/clc_bitfield_insert.cl
+integer/clc_bit_reverse.cl
 integer/clc_clz.cl
 integer/clc_ctz.cl
 integer/clc_hadd.cl
diff --git a/libclc/clc/lib/generic/integer/clc_bit_reverse.cl 
b/libclc/clc/lib/generic/integer/clc_bit_reverse.cl
new file mode 100644
index 0000000000000..439957383f583
--- /dev/null
+++ b/libclc/clc/lib/generic/integer/clc_bit_reverse.cl
@@ -0,0 +1,15 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include <clc/integer/clc_bit_reverse.h>
+
+#define FUNCTION __clc_bit_reverse
+#define __IMPL_FUNCTION(x) __builtin_elementwise_bitreverse
+#define __CLC_BODY <clc/shared/unary_def.inc>
+
+#include <clc/integer/gentype.inc>
diff --git a/libclc/clc/lib/generic/integer/clc_bitfield_extract_signed.cl 
b/libclc/clc/lib/generic/integer/clc_bitfield_extract_signed.cl
new file mode 100644
index 0000000000000..d779ed6a43593
--- /dev/null
+++ b/libclc/clc/lib/generic/integer/clc_bitfield_extract_signed.cl
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include <clc/integer/clc_bitfield_extract_signed.h>
+
+#define __CLC_BODY <clc_bitfield_extract_signed.inc>
+#include <clc/integer/gentype.inc>
diff --git a/libclc/clc/lib/generic/integer/clc_bitfield_extract_signed.inc 
b/libclc/clc/lib/generic/integer/clc_bitfield_extract_signed.inc
new file mode 100644
index 0000000000000..84cae2166f7ce
--- /dev/null
+++ b/libclc/clc/lib/generic/integer/clc_bitfield_extract_signed.inc
@@ -0,0 +1,19 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+_CLC_OVERLOAD _CLC_DEF __CLC_S_GENTYPE
+__clc_bitfield_extract_signed(__CLC_GENTYPE base, uint offset, uint count) {
+  if (count == 0)
+    return 0;
+  __CLC_U_GENTYPE x = __CLC_AS_U_GENTYPE(base)
+                      << (__CLC_GENSIZE - offset - count);
+  // Implement an arithmetic shift right.
+  __CLC_U_GENTYPE s = -(x >> (__CLC_GENSIZE - 1));
+  __CLC_U_GENTYPE result = ((s ^ x) >> (__CLC_GENSIZE - count)) ^ s;
+  return __CLC_AS_S_GENTYPE(result);
+}
diff --git a/libclc/clc/lib/generic/integer/clc_bitfield_extract_unsigned.cl 
b/libclc/clc/lib/generic/integer/clc_bitfield_extract_unsigned.cl
new file mode 100644
index 0000000000000..bf7db401034dc
--- /dev/null
+++ b/libclc/clc/lib/generic/integer/clc_bitfield_extract_unsigned.cl
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include <clc/integer/clc_bitfield_extract_unsigned.h>
+
+#define __CLC_BODY <clc_bitfield_extract_unsigned.inc>
+#include <clc/integer/gentype.inc>
diff --git a/libclc/clc/lib/generic/integer/clc_bitfield_extract_unsigned.inc 
b/libclc/clc/lib/generic/integer/clc_bitfield_extract_unsigned.inc
new file mode 100644
index 0000000000000..bc81ce5c98b09
--- /dev/null
+++ b/libclc/clc/lib/generic/integer/clc_bitfield_extract_unsigned.inc
@@ -0,0 +1,16 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+_CLC_OVERLOAD _CLC_DEF __CLC_U_GENTYPE
+__clc_bitfield_extract_unsigned(__CLC_GENTYPE base, uint offset, uint count) {
+  if (count == 0)
+    return 0;
+  __CLC_U_GENTYPE result = __CLC_AS_U_GENTYPE(base)
+                           << (__CLC_GENSIZE - offset - count);
+  return result >> (__CLC_GENSIZE - count);
+}
diff --git a/libclc/clc/lib/generic/integer/clc_bitfield_insert.cl 
b/libclc/clc/lib/generic/integer/clc_bitfield_insert.cl
new file mode 100644
index 0000000000000..a40fc804f2187
--- /dev/null
+++ b/libclc/clc/lib/generic/integer/clc_bitfield_insert.cl
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include <clc/integer/clc_bitfield_insert.h>
+
+#define __CLC_BODY <clc_bitfield_insert.inc>
+#include <clc/integer/gentype.inc>
diff --git a/libclc/clc/lib/generic/integer/clc_bitfield_insert.inc 
b/libclc/clc/lib/generic/integer/clc_bitfield_insert.inc
new file mode 100644
index 0000000000000..ad8dac28750cc
--- /dev/null
+++ b/libclc/clc/lib/generic/integer/clc_bitfield_insert.inc
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_bitfield_insert(__CLC_GENTYPE base,
+                                                           __CLC_GENTYPE 
insert,
+                                                           uint offset,
+                                                           uint count) {
+  __CLC_U_GENTYPE u_base = __CLC_AS_U_GENTYPE(base);
+  __CLC_U_GENTYPE u_insert = __CLC_AS_U_GENTYPE(insert);
+  __CLC_U_GENTYPE mask = (((__CLC_U_GENTYPE)1 << count) - (__CLC_U_GENTYPE)1)
+                         << offset;
+  mask = count < __CLC_GENSIZE ? mask : ~(__CLC_U_GENTYPE)0;
+  __CLC_U_GENTYPE result = ((u_insert << offset) & mask) | (u_base & ~mask);
+  return __CLC_AS_GENTYPE(result);
+}
diff --git a/libclc/opencl/include/clc/opencl/integer/bit_reverse.h 
b/libclc/opencl/include/clc/opencl/integer/bit_reverse.h
new file mode 100644
index 0000000000000..8fe949cd9d573
--- /dev/null
+++ b/libclc/opencl/include/clc/opencl/integer/bit_reverse.h
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef __CLC_OPENCL_INTEGER_BIT_REVERSE_H__
+#define __CLC_OPENCL_INTEGER_BIT_REVERSE_H__
+
+#include <clc/opencl/opencl-base.h>
+
+#define FUNCTION bit_reverse
+#define __CLC_BODY <clc/shared/unary_decl.inc>
+
+#include <clc/integer/gentype.inc>
+
+#undef FUNCTION
+
+#endif // __CLC_OPENCL_INTEGER_BIT_REVERSE_H__
diff --git a/libclc/opencl/include/clc/opencl/integer/bitfield_extract.inc 
b/libclc/opencl/include/clc/opencl/integer/bitfield_extract.inc
new file mode 100644
index 0000000000000..c93eff08de0bc
--- /dev/null
+++ b/libclc/opencl/include/clc/opencl/integer/bitfield_extract.inc
@@ -0,0 +1,10 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+_CLC_OVERLOAD _CLC_DECL __RETTYPE FUNCTION(__CLC_GENTYPE base, uint offset,
+                                           uint count);
diff --git a/libclc/opencl/include/clc/opencl/integer/bitfield_extract_signed.h 
b/libclc/opencl/include/clc/opencl/integer/bitfield_extract_signed.h
new file mode 100644
index 0000000000000..94ae8c6b00353
--- /dev/null
+++ b/libclc/opencl/include/clc/opencl/integer/bitfield_extract_signed.h
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef __CLC_OPENCL_INTEGER_BITFIELD_EXTRACT_SIGNED_H__
+#define __CLC_OPENCL_INTEGER_BITFIELD_EXTRACT_SIGNED_H__
+
+#include <clc/opencl/opencl-base.h>
+
+#define FUNCTION bitfield_extract_signed
+#define __RETTYPE __CLC_S_GENTYPE
+
+#define __CLC_BODY <clc/opencl/integer/bitfield_extract.inc>
+#include <clc/integer/gentype.inc>
+
+#undef __RETTYPE
+#undef FUNCTION
+
+#endif // __CLC_OPENCL_INTEGER_BITFIELD_EXTRACT_SIGNED_H__
diff --git 
a/libclc/opencl/include/clc/opencl/integer/bitfield_extract_unsigned.h 
b/libclc/opencl/include/clc/opencl/integer/bitfield_extract_unsigned.h
new file mode 100644
index 0000000000000..fb43f158cb7b6
--- /dev/null
+++ b/libclc/opencl/include/clc/opencl/integer/bitfield_extract_unsigned.h
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef __CLC_OPENCL_INTEGER_BITFIELD_EXTRACT_UNSIGNED_H__
+#define __CLC_OPENCL_INTEGER_BITFIELD_EXTRACT_UNSIGNED_H__
+
+#include <clc/opencl/opencl-base.h>
+
+#define FUNCTION bitfield_extract_unsigned
+#define __RETTYPE __CLC_U_GENTYPE
+
+#define __CLC_BODY <clc/opencl/integer/bitfield_extract.inc>
+#include <clc/integer/gentype.inc>
+
+#undef __RETTYPE
+#undef FUNCTION
+
+#endif // __CLC_OPENCL_INTEGER_BITFIELD_EXTRACT_UNSIGNED_H__
diff --git a/libclc/opencl/include/clc/opencl/integer/bitfield_insert.h 
b/libclc/opencl/include/clc/opencl/integer/bitfield_insert.h
new file mode 100644
index 0000000000000..6409069aa4bce
--- /dev/null
+++ b/libclc/opencl/include/clc/opencl/integer/bitfield_insert.h
@@ -0,0 +1,19 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef __CLC_OPENCL_INTEGER_BITFIELD_INSERT_H__
+#define __CLC_OPENCL_INTEGER_BITFIELD_INSERT_H__
+
+#include <clc/opencl/opencl-base.h>
+
+#define __CLC_BODY <clc/integer/clc_bitfield_insert.inc>
+#include <clc/integer/gentype.inc>
+
+#undef FUNCTION
+
+#endif // __CLC_OPENCL_INTEGER_BITFIELD_INSERT_H__
diff --git a/libclc/opencl/include/clc/opencl/integer/bitfield_insert.inc 
b/libclc/opencl/include/clc/opencl/integer/bitfield_insert.inc
new file mode 100644
index 0000000000000..7d4143dab2a45
--- /dev/null
+++ b/libclc/opencl/include/clc/opencl/integer/bitfield_insert.inc
@@ -0,0 +1,11 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE bitfield_insert(__CLC_GENTYPE base,
+                                                      __CLC_GENTYPE insert,
+                                                      uint offset, uint count);
diff --git a/libclc/opencl/lib/generic/SOURCES 
b/libclc/opencl/lib/generic/SOURCES
index 46ce6d6e36c24..a59a82ee325ec 100644
--- a/libclc/opencl/lib/generic/SOURCES
+++ b/libclc/opencl/lib/generic/SOURCES
@@ -43,6 +43,10 @@ geometric/normalize.cl
 integer/abs.cl
 integer/abs_diff.cl
 integer/add_sat.cl
+integer/bitfield_extract_signed.cl
+integer/bitfield_extract_unsigned.cl
+integer/bitfield_insert.cl
+integer/bit_reverse.cl
 integer/clz.cl
 integer/ctz.cl
 integer/hadd.cl
diff --git a/libclc/opencl/lib/generic/integer/bit_reverse.cl 
b/libclc/opencl/lib/generic/integer/bit_reverse.cl
new file mode 100644
index 0000000000000..23181b6b3eba5
--- /dev/null
+++ b/libclc/opencl/lib/generic/integer/bit_reverse.cl
@@ -0,0 +1,19 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifdef cl_khr_extended_bit_ops
+
+#include <clc/integer/clc_bit_reverse.h>
+#include <clc/opencl/integer/bit_reverse.h>
+
+#define FUNCTION bit_reverse
+#define __CLC_BODY <clc/shared/unary_def.inc>
+
+#include <clc/integer/gentype.inc>
+
+#endif // cl_khr_extended_bit_ops
diff --git a/libclc/opencl/lib/generic/integer/bitfield_extract.inc 
b/libclc/opencl/lib/generic/integer/bitfield_extract.inc
new file mode 100644
index 0000000000000..0262f67732afc
--- /dev/null
+++ b/libclc/opencl/lib/generic/integer/bitfield_extract.inc
@@ -0,0 +1,16 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef __IMPL_FUNCTION
+#define __IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
+#endif
+
+_CLC_OVERLOAD _CLC_DEF __RETTYPE FUNCTION(__CLC_GENTYPE base, uint offset,
+                                          uint count) {
+  return __IMPL_FUNCTION(FUNCTION)(base, offset, count);
+}
diff --git a/libclc/opencl/lib/generic/integer/bitfield_extract_signed.cl 
b/libclc/opencl/lib/generic/integer/bitfield_extract_signed.cl
new file mode 100644
index 0000000000000..e16e861a167b8
--- /dev/null
+++ b/libclc/opencl/lib/generic/integer/bitfield_extract_signed.cl
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifdef cl_khr_extended_bit_ops
+
+#include <clc/integer/clc_bitfield_extract_signed.h>
+#include <clc/opencl/integer/bitfield_extract_signed.h>
+
+#define FUNCTION bitfield_extract_signed
+#define __RETTYPE __CLC_S_GENTYPE
+
+#define __CLC_BODY <bitfield_extract.inc>
+#include <clc/integer/gentype.inc>
+
+#endif // cl_khr_extended_bit_ops
diff --git a/libclc/opencl/lib/generic/integer/bitfield_extract_unsigned.cl 
b/libclc/opencl/lib/generic/integer/bitfield_extract_unsigned.cl
new file mode 100644
index 0000000000000..29ea70e720d17
--- /dev/null
+++ b/libclc/opencl/lib/generic/integer/bitfield_extract_unsigned.cl
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifdef cl_khr_extended_bit_ops
+
+#include <clc/integer/clc_bitfield_extract_unsigned.h>
+#include <clc/opencl/integer/bitfield_extract_unsigned.h>
+
+#define FUNCTION bitfield_extract_unsigned
+#define __RETTYPE __CLC_U_GENTYPE
+
+#define __CLC_BODY <bitfield_extract.inc>
+#include <clc/integer/gentype.inc>
+
+#endif // cl_khr_extended_bit_ops
diff --git a/libclc/opencl/lib/generic/integer/bitfield_insert.cl 
b/libclc/opencl/lib/generic/integer/bitfield_insert.cl
new file mode 100644
index 0000000000000..c054661177736
--- /dev/null
+++ b/libclc/opencl/lib/generic/integer/bitfield_insert.cl
@@ -0,0 +1,17 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifdef cl_khr_extended_bit_ops
+
+#include <clc/integer/clc_bitfield_insert.h>
+#include <clc/opencl/integer/bitfield_insert.h>
+
+#define __CLC_BODY <bitfield_insert.inc>
+#include <clc/integer/gentype.inc>
+
+#endif // cl_khr_extended_bit_ops
diff --git a/libclc/opencl/lib/generic/integer/bitfield_insert.inc 
b/libclc/opencl/lib/generic/integer/bitfield_insert.inc
new file mode 100644
index 0000000000000..b1f45907a4361
--- /dev/null
+++ b/libclc/opencl/lib/generic/integer/bitfield_insert.inc
@@ -0,0 +1,13 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE bitfield_insert(__CLC_GENTYPE base,
+                                                     __CLC_GENTYPE insert,
+                                                     uint offset, uint count) {
+  return __clc_bitfield_insert(base, insert, offset, count);
+}

>From 78d4dd1d13d67fcde2573c0389e057c765ee05e0 Mon Sep 17 00:00:00 2001
From: Wenju He <wenju...@intel.com>
Date: Thu, 17 Jul 2025 02:26:05 +0200
Subject: [PATCH 2/3] add cl_khr_extended_bit_ops to opencl header, rename
 clc_bitfield_extract.inc to clc_bitfield_extract_decl.inc,
 bitfield_extract.inc to bitfield_extract_decl.inc / bitfield_extract_def.inc

---
 ...c_bitfield_extract.inc => clc_bitfield_extract_decl.inc} | 0
 .../clc/include/clc/integer/clc_bitfield_extract_signed.h   | 2 +-
 .../clc/include/clc/integer/clc_bitfield_extract_unsigned.h | 2 +-
 libclc/opencl/include/clc/opencl/integer/bit_reverse.h      | 4 ++++
 .../{bitfield_extract.inc => bitfield_extract_decl.inc}     | 0
 .../include/clc/opencl/integer/bitfield_extract_signed.h    | 6 +++++-
 .../include/clc/opencl/integer/bitfield_extract_unsigned.h  | 6 +++++-
 libclc/opencl/include/clc/opencl/integer/bitfield_insert.h  | 4 ++++
 .../{bitfield_extract.inc => bitfield_extract_def.inc}      | 0
 .../opencl/lib/generic/integer/bitfield_extract_signed.cl   | 2 +-
 .../opencl/lib/generic/integer/bitfield_extract_unsigned.cl | 2 +-
 11 files changed, 22 insertions(+), 6 deletions(-)
 rename libclc/clc/include/clc/integer/{clc_bitfield_extract.inc => 
clc_bitfield_extract_decl.inc} (100%)
 rename libclc/opencl/include/clc/opencl/integer/{bitfield_extract.inc => 
bitfield_extract_decl.inc} (100%)
 rename libclc/opencl/lib/generic/integer/{bitfield_extract.inc => 
bitfield_extract_def.inc} (100%)

diff --git a/libclc/clc/include/clc/integer/clc_bitfield_extract.inc 
b/libclc/clc/include/clc/integer/clc_bitfield_extract_decl.inc
similarity index 100%
rename from libclc/clc/include/clc/integer/clc_bitfield_extract.inc
rename to libclc/clc/include/clc/integer/clc_bitfield_extract_decl.inc
diff --git a/libclc/clc/include/clc/integer/clc_bitfield_extract_signed.h 
b/libclc/clc/include/clc/integer/clc_bitfield_extract_signed.h
index fec5bf0b272e0..9c2e047b8be00 100644
--- a/libclc/clc/include/clc/integer/clc_bitfield_extract_signed.h
+++ b/libclc/clc/include/clc/integer/clc_bitfield_extract_signed.h
@@ -14,7 +14,7 @@
 #define FUNCTION __clc_bitfield_extract_signed
 #define __RETTYPE __CLC_S_GENTYPE
 
-#define __CLC_BODY <clc/integer/clc_bitfield_extract.inc>
+#define __CLC_BODY <clc/integer/clc_bitfield_extract_decl.inc>
 #include <clc/integer/gentype.inc>
 
 #undef __RETTYPE
diff --git a/libclc/clc/include/clc/integer/clc_bitfield_extract_unsigned.h 
b/libclc/clc/include/clc/integer/clc_bitfield_extract_unsigned.h
index ddbbf2bd92483..95305a3027e5d 100644
--- a/libclc/clc/include/clc/integer/clc_bitfield_extract_unsigned.h
+++ b/libclc/clc/include/clc/integer/clc_bitfield_extract_unsigned.h
@@ -14,7 +14,7 @@
 #define FUNCTION __clc_bitfield_extract_unsigned
 #define __RETTYPE __CLC_U_GENTYPE
 
-#define __CLC_BODY <clc/integer/clc_bitfield_extract.inc>
+#define __CLC_BODY <clc/integer/clc_bitfield_extract_decl.inc>
 #include <clc/integer/gentype.inc>
 
 #undef __RETTYPE
diff --git a/libclc/opencl/include/clc/opencl/integer/bit_reverse.h 
b/libclc/opencl/include/clc/opencl/integer/bit_reverse.h
index 8fe949cd9d573..46b589557631d 100644
--- a/libclc/opencl/include/clc/opencl/integer/bit_reverse.h
+++ b/libclc/opencl/include/clc/opencl/integer/bit_reverse.h
@@ -9,6 +9,8 @@
 #ifndef __CLC_OPENCL_INTEGER_BIT_REVERSE_H__
 #define __CLC_OPENCL_INTEGER_BIT_REVERSE_H__
 
+#ifdef cl_khr_extended_bit_ops
+
 #include <clc/opencl/opencl-base.h>
 
 #define FUNCTION bit_reverse
@@ -18,4 +20,6 @@
 
 #undef FUNCTION
 
+#endif // cl_khr_extended_bit_ops
+
 #endif // __CLC_OPENCL_INTEGER_BIT_REVERSE_H__
diff --git a/libclc/opencl/include/clc/opencl/integer/bitfield_extract.inc 
b/libclc/opencl/include/clc/opencl/integer/bitfield_extract_decl.inc
similarity index 100%
rename from libclc/opencl/include/clc/opencl/integer/bitfield_extract.inc
rename to libclc/opencl/include/clc/opencl/integer/bitfield_extract_decl.inc
diff --git a/libclc/opencl/include/clc/opencl/integer/bitfield_extract_signed.h 
b/libclc/opencl/include/clc/opencl/integer/bitfield_extract_signed.h
index 94ae8c6b00353..140ce8b1523f4 100644
--- a/libclc/opencl/include/clc/opencl/integer/bitfield_extract_signed.h
+++ b/libclc/opencl/include/clc/opencl/integer/bitfield_extract_signed.h
@@ -9,15 +9,19 @@
 #ifndef __CLC_OPENCL_INTEGER_BITFIELD_EXTRACT_SIGNED_H__
 #define __CLC_OPENCL_INTEGER_BITFIELD_EXTRACT_SIGNED_H__
 
+#ifdef cl_khr_extended_bit_ops
+
 #include <clc/opencl/opencl-base.h>
 
 #define FUNCTION bitfield_extract_signed
 #define __RETTYPE __CLC_S_GENTYPE
 
-#define __CLC_BODY <clc/opencl/integer/bitfield_extract.inc>
+#define __CLC_BODY <clc/opencl/integer/bitfield_extract_decl.inc>
 #include <clc/integer/gentype.inc>
 
 #undef __RETTYPE
 #undef FUNCTION
 
+#endif // cl_khr_extended_bit_ops
+
 #endif // __CLC_OPENCL_INTEGER_BITFIELD_EXTRACT_SIGNED_H__
diff --git 
a/libclc/opencl/include/clc/opencl/integer/bitfield_extract_unsigned.h 
b/libclc/opencl/include/clc/opencl/integer/bitfield_extract_unsigned.h
index fb43f158cb7b6..e128ff34a0403 100644
--- a/libclc/opencl/include/clc/opencl/integer/bitfield_extract_unsigned.h
+++ b/libclc/opencl/include/clc/opencl/integer/bitfield_extract_unsigned.h
@@ -9,15 +9,19 @@
 #ifndef __CLC_OPENCL_INTEGER_BITFIELD_EXTRACT_UNSIGNED_H__
 #define __CLC_OPENCL_INTEGER_BITFIELD_EXTRACT_UNSIGNED_H__
 
+#ifdef cl_khr_extended_bit_ops
+
 #include <clc/opencl/opencl-base.h>
 
 #define FUNCTION bitfield_extract_unsigned
 #define __RETTYPE __CLC_U_GENTYPE
 
-#define __CLC_BODY <clc/opencl/integer/bitfield_extract.inc>
+#define __CLC_BODY <clc/opencl/integer/bitfield_extract_decl.inc>
 #include <clc/integer/gentype.inc>
 
 #undef __RETTYPE
 #undef FUNCTION
 
+#endif // cl_khr_extended_bit_ops
+
 #endif // __CLC_OPENCL_INTEGER_BITFIELD_EXTRACT_UNSIGNED_H__
diff --git a/libclc/opencl/include/clc/opencl/integer/bitfield_insert.h 
b/libclc/opencl/include/clc/opencl/integer/bitfield_insert.h
index 6409069aa4bce..e77d7a4f0b957 100644
--- a/libclc/opencl/include/clc/opencl/integer/bitfield_insert.h
+++ b/libclc/opencl/include/clc/opencl/integer/bitfield_insert.h
@@ -9,6 +9,8 @@
 #ifndef __CLC_OPENCL_INTEGER_BITFIELD_INSERT_H__
 #define __CLC_OPENCL_INTEGER_BITFIELD_INSERT_H__
 
+#ifdef cl_khr_extended_bit_ops
+
 #include <clc/opencl/opencl-base.h>
 
 #define __CLC_BODY <clc/integer/clc_bitfield_insert.inc>
@@ -16,4 +18,6 @@
 
 #undef FUNCTION
 
+#endif // cl_khr_extended_bit_ops
+
 #endif // __CLC_OPENCL_INTEGER_BITFIELD_INSERT_H__
diff --git a/libclc/opencl/lib/generic/integer/bitfield_extract.inc 
b/libclc/opencl/lib/generic/integer/bitfield_extract_def.inc
similarity index 100%
rename from libclc/opencl/lib/generic/integer/bitfield_extract.inc
rename to libclc/opencl/lib/generic/integer/bitfield_extract_def.inc
diff --git a/libclc/opencl/lib/generic/integer/bitfield_extract_signed.cl 
b/libclc/opencl/lib/generic/integer/bitfield_extract_signed.cl
index e16e861a167b8..eaa4ac779cfd1 100644
--- a/libclc/opencl/lib/generic/integer/bitfield_extract_signed.cl
+++ b/libclc/opencl/lib/generic/integer/bitfield_extract_signed.cl
@@ -14,7 +14,7 @@
 #define FUNCTION bitfield_extract_signed
 #define __RETTYPE __CLC_S_GENTYPE
 
-#define __CLC_BODY <bitfield_extract.inc>
+#define __CLC_BODY <bitfield_extract_def.inc>
 #include <clc/integer/gentype.inc>
 
 #endif // cl_khr_extended_bit_ops
diff --git a/libclc/opencl/lib/generic/integer/bitfield_extract_unsigned.cl 
b/libclc/opencl/lib/generic/integer/bitfield_extract_unsigned.cl
index 29ea70e720d17..fd63d5d6dee30 100644
--- a/libclc/opencl/lib/generic/integer/bitfield_extract_unsigned.cl
+++ b/libclc/opencl/lib/generic/integer/bitfield_extract_unsigned.cl
@@ -14,7 +14,7 @@
 #define FUNCTION bitfield_extract_unsigned
 #define __RETTYPE __CLC_U_GENTYPE
 
-#define __CLC_BODY <bitfield_extract.inc>
+#define __CLC_BODY <bitfield_extract_def.inc>
 #include <clc/integer/gentype.inc>
 
 #endif // cl_khr_extended_bit_ops

>From 5d7c86eae50e01fdc8d60abd464be58a35679fdf Mon Sep 17 00:00:00 2001
From: Wenju He <wenju...@intel.com>
Date: Thu, 17 Jul 2025 07:11:52 +0200
Subject: [PATCH 3/3] delete redundant
 clc/opencl/integer/bitfield_extract_decl.inc
 clc/opencl/integer/bitfield_insert.inc

---
 libclc/clc/include/clc/integer/clc_bitfield_insert.h  |  1 +
 .../clc/include/clc/integer/clc_bitfield_insert.inc   |  5 +++--
 .../clc/opencl/integer/bitfield_extract_decl.inc      | 10 ----------
 .../clc/opencl/integer/bitfield_extract_signed.h      |  2 +-
 .../clc/opencl/integer/bitfield_extract_unsigned.h    |  2 +-
 .../include/clc/opencl/integer/bitfield_insert.inc    | 11 -----------
 libclc/opencl/lib/generic/integer/bitfield_insert.cl  |  3 ++-
 7 files changed, 8 insertions(+), 26 deletions(-)
 delete mode 100644 
libclc/opencl/include/clc/opencl/integer/bitfield_extract_decl.inc
 delete mode 100644 libclc/opencl/include/clc/opencl/integer/bitfield_insert.inc

diff --git a/libclc/clc/include/clc/integer/clc_bitfield_insert.h 
b/libclc/clc/include/clc/integer/clc_bitfield_insert.h
index 4e15d7884988b..f4d36b2ad2d2e 100644
--- a/libclc/clc/include/clc/integer/clc_bitfield_insert.h
+++ b/libclc/clc/include/clc/integer/clc_bitfield_insert.h
@@ -11,6 +11,7 @@
 
 #include <clc/internal/clc.h>
 
+#define FUNCTION __clc_bitfield_insert
 #define __CLC_BODY <clc/integer/clc_bitfield_insert.inc>
 #include <clc/integer/gentype.inc>
 
diff --git a/libclc/clc/include/clc/integer/clc_bitfield_insert.inc 
b/libclc/clc/include/clc/integer/clc_bitfield_insert.inc
index de9a42f34223f..22f58bdc09830 100644
--- a/libclc/clc/include/clc/integer/clc_bitfield_insert.inc
+++ b/libclc/clc/include/clc/integer/clc_bitfield_insert.inc
@@ -6,5 +6,6 @@
 //
 
//===----------------------------------------------------------------------===//
 
-_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __clc_bitfield_insert(
-    __CLC_GENTYPE base, __CLC_GENTYPE insert, uint offset, uint count);
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION(__CLC_GENTYPE base,
+                                               __CLC_GENTYPE insert,
+                                               uint offset, uint count);
diff --git a/libclc/opencl/include/clc/opencl/integer/bitfield_extract_decl.inc 
b/libclc/opencl/include/clc/opencl/integer/bitfield_extract_decl.inc
deleted file mode 100644
index c93eff08de0bc..0000000000000
--- a/libclc/opencl/include/clc/opencl/integer/bitfield_extract_decl.inc
+++ /dev/null
@@ -1,10 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-_CLC_OVERLOAD _CLC_DECL __RETTYPE FUNCTION(__CLC_GENTYPE base, uint offset,
-                                           uint count);
diff --git a/libclc/opencl/include/clc/opencl/integer/bitfield_extract_signed.h 
b/libclc/opencl/include/clc/opencl/integer/bitfield_extract_signed.h
index 140ce8b1523f4..0a902b2a21d6d 100644
--- a/libclc/opencl/include/clc/opencl/integer/bitfield_extract_signed.h
+++ b/libclc/opencl/include/clc/opencl/integer/bitfield_extract_signed.h
@@ -16,7 +16,7 @@
 #define FUNCTION bitfield_extract_signed
 #define __RETTYPE __CLC_S_GENTYPE
 
-#define __CLC_BODY <clc/opencl/integer/bitfield_extract_decl.inc>
+#define __CLC_BODY <clc/integer/clc_bitfield_extract_decl.inc>
 #include <clc/integer/gentype.inc>
 
 #undef __RETTYPE
diff --git 
a/libclc/opencl/include/clc/opencl/integer/bitfield_extract_unsigned.h 
b/libclc/opencl/include/clc/opencl/integer/bitfield_extract_unsigned.h
index e128ff34a0403..28064c08b113e 100644
--- a/libclc/opencl/include/clc/opencl/integer/bitfield_extract_unsigned.h
+++ b/libclc/opencl/include/clc/opencl/integer/bitfield_extract_unsigned.h
@@ -16,7 +16,7 @@
 #define FUNCTION bitfield_extract_unsigned
 #define __RETTYPE __CLC_U_GENTYPE
 
-#define __CLC_BODY <clc/opencl/integer/bitfield_extract_decl.inc>
+#define __CLC_BODY <clc/integer/clc_bitfield_extract_decl.inc>
 #include <clc/integer/gentype.inc>
 
 #undef __RETTYPE
diff --git a/libclc/opencl/include/clc/opencl/integer/bitfield_insert.inc 
b/libclc/opencl/include/clc/opencl/integer/bitfield_insert.inc
deleted file mode 100644
index 7d4143dab2a45..0000000000000
--- a/libclc/opencl/include/clc/opencl/integer/bitfield_insert.inc
+++ /dev/null
@@ -1,11 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE bitfield_insert(__CLC_GENTYPE base,
-                                                      __CLC_GENTYPE insert,
-                                                      uint offset, uint count);
diff --git a/libclc/opencl/lib/generic/integer/bitfield_insert.cl 
b/libclc/opencl/lib/generic/integer/bitfield_insert.cl
index c054661177736..6b441155f393b 100644
--- a/libclc/opencl/lib/generic/integer/bitfield_insert.cl
+++ b/libclc/opencl/lib/generic/integer/bitfield_insert.cl
@@ -11,7 +11,8 @@
 #include <clc/integer/clc_bitfield_insert.h>
 #include <clc/opencl/integer/bitfield_insert.h>
 
-#define __CLC_BODY <bitfield_insert.inc>
+#define FUNCTION bitfield_insert
+#define __CLC_BODY <clc/integer/clc_bitfield_insert.inc>
 #include <clc/integer/gentype.inc>
 
 #endif // cl_khr_extended_bit_ops

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to