[llvm] [SPIRV] Add support for `cl_khr_extended_bit_ops` (PR #120571)

Marcos Maronas via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 19 05:31:15 PST 2024


https://github.com/maarquitos14 updated https://github.com/llvm/llvm-project/pull/120571

>From 95252e29c6a333c4a1fb46322ab35adcde0d1331 Mon Sep 17 00:00:00 2001
From: "Maronas, Marcos" <marcos.maronas at intel.com>
Date: Wed, 27 Nov 2024 18:03:37 +0100
Subject: [PATCH 1/5] [SPIR-V] Add support for cl_khr_extended_bit_ops
 extension

---
 llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp       |  45 +++++++
 llvm/lib/Target/SPIRV/SPIRVBuiltins.td        |   7 ++
 .../cl_khr_extended_bit_ops.ll                | 114 ++++++++++++++++++
 3 files changed, 166 insertions(+)
 create mode 100644 llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll

diff --git a/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp b/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
index 73dce230575d84..d64d9177b49219 100644
--- a/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
@@ -983,6 +983,38 @@ static bool buildBarrierInst(const SPIRV::IncomingCall *Call, unsigned Opcode,
   return true;
 }
 
+/// Helper function for building extended bit operations.
+static bool buildExtendedBitOpsInst(const SPIRV::IncomingCall *Call, unsigned Opcode,
+                             MachineIRBuilder &MIRBuilder,
+                             SPIRVGlobalRegistry *GR) {
+  const SPIRV::DemangledBuiltin *Builtin = Call->Builtin;
+  const auto *ST =
+      static_cast<const SPIRVSubtarget *>(&MIRBuilder.getMF().getSubtarget());
+  if ((Opcode == SPIRV::OpBitFieldInsert ||
+       Opcode == SPIRV::OpBitFieldSExtract ||
+       Opcode == SPIRV::OpBitFieldUExtract ||
+       Opcode == SPIRV::OpBitReverse) &&
+      !ST->canUseExtension(SPIRV::Extension::SPV_KHR_bit_instructions)) {
+    std::string DiagMsg = std::string(Builtin->Name) +
+                          ": the builtin requires the following SPIR-V "
+                          "extension: SPV_KHR_bit_instructions";
+    report_fatal_error(DiagMsg.c_str(), false);
+  }
+
+  // Generate SPIRV instruction accordingly.
+  if (Call->isSpirvOp())
+    return buildOpFromWrapper(MIRBuilder, Opcode, Call, Register(0));
+
+  // Generate the instruction.
+  auto MIB = MIRBuilder.buildInstr(Opcode)
+      .addDef(Call->ReturnRegister)
+      .addUse(GR->getSPIRVTypeID(Call->ReturnType));
+  for (unsigned i = 0; i < Call->Arguments.size(); ++i)
+    MIB.addUse(Call->Arguments[i]);
+
+  return true;
+}
+
 static unsigned getNumComponentsForDim(SPIRV::Dim::Dim dim) {
   switch (dim) {
   case SPIRV::Dim::DIM_1D:
@@ -2041,6 +2073,17 @@ static bool generateSpecConstantInst(const SPIRV::IncomingCall *Call,
   }
 }
 
+static bool generateExtendedBitOpsInst(const SPIRV::IncomingCall *Call,
+                                MachineIRBuilder &MIRBuilder,
+                                SPIRVGlobalRegistry *GR) {
+  // Lookup the instruction opcode in the TableGen records.
+  const SPIRV::DemangledBuiltin *Builtin = Call->Builtin;
+  unsigned Opcode =
+      SPIRV::lookupNativeBuiltin(Builtin->Name, Builtin->Set)->Opcode;
+
+  return buildExtendedBitOpsInst(Call, Opcode, MIRBuilder, GR);
+}
+
 static bool buildNDRange(const SPIRV::IncomingCall *Call,
                          MachineIRBuilder &MIRBuilder,
                          SPIRVGlobalRegistry *GR) {
@@ -2628,6 +2671,8 @@ std::optional<bool> lowerBuiltin(const StringRef DemangledCall,
     return generateKernelClockInst(Call.get(), MIRBuilder, GR);
   case SPIRV::CoopMatr:
     return generateCoopMatrInst(Call.get(), MIRBuilder, GR);
+  case SPIRV::ExtendedBitOps:
+    return generateExtendedBitOpsInst(Call.get(), MIRBuilder, GR);
   }
   return false;
 }
diff --git a/llvm/lib/Target/SPIRV/SPIRVBuiltins.td b/llvm/lib/Target/SPIRV/SPIRVBuiltins.td
index e0dfc25723b0cc..9cc16ea8c91833 100644
--- a/llvm/lib/Target/SPIRV/SPIRVBuiltins.td
+++ b/llvm/lib/Target/SPIRV/SPIRVBuiltins.td
@@ -64,6 +64,7 @@ def CastToPtr : BuiltinGroup;
 def Construct : BuiltinGroup;
 def CoopMatr : BuiltinGroup;
 def ICarryBorrow : BuiltinGroup;
+def ExtendedBitOps : BuiltinGroup;
 
 //===----------------------------------------------------------------------===//
 // Class defining a demangled builtin record. The information in the record
@@ -1441,6 +1442,12 @@ defm : DemangledNativeBuiltin<"__spirv_SatConvertSToU", OpenCL_std, Convert, 1,
 defm : DemangledNativeBuiltin<"__spirv_SatConvertUToS", OpenCL_std, Convert, 1, 1, OpSatConvertUToS>;
 defm : DemangledNativeBuiltin<"__spirv_ConvertUToPtr", OpenCL_std, Convert, 1, 1, OpConvertUToPtr>;
 
+// cl_khr_extended_bit_ops / SPV_KHR_bit_instructions
+defm : DemangledNativeBuiltin<"bitfield_insert", OpenCL_std, ExtendedBitOps, 4, 4, OpBitFieldInsert>;
+defm : DemangledNativeBuiltin<"bitfield_extract_signed", OpenCL_std, ExtendedBitOps, 3, 3, OpBitFieldSExtract>;
+defm : DemangledNativeBuiltin<"bitfield_extract_unsigned", OpenCL_std, ExtendedBitOps, 3, 3, OpBitFieldUExtract>;
+defm : DemangledNativeBuiltin<"bit_reverse", OpenCL_std, ExtendedBitOps, 1, 1, OpBitReverse>;
+
 // cl_intel_bfloat16_conversions / SPV_INTEL_bfloat16_conversion
 // Multiclass used to define at the same time both a demangled builtin records
 // and a corresponding convert builtin records.
diff --git a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll
new file mode 100644
index 00000000000000..e447bdf11616ed
--- /dev/null
+++ b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll
@@ -0,0 +1,114 @@
+; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s --spirv-ext=+SPV_KHR_bit_instructions -o - | FileCheck %s --check-prefix=CHECK-EXTENSION
+; RUN: not llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o %t.spvt 2>&1 | FileCheck %s --check-prefix=CHECK-NO-EXTENSION
+; ModuleID = 'cl_khr_extended_bit_ops.cl.tmp.bc'
+source_filename = "cl_khr_extended_bit_ops.cl"
+target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64-G1"
+target triple = "spir-unknown-unknown"
+
+; CHECK-EXTENSION: Capability BitInstructions
+; CHECK-EXTENSION: Extension "SPV_KHR_bit_instructions"
+; CHECK-NO-EXTENSION: LLVM ERROR: bitfield_insert: the builtin requires the following SPIR-V extension: SPV_KHR_bit_instructions
+
+; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+; CHECK-EXTENSION: %[[#insertbase:]] = OpFunctionParameter %[[#]] 
+; CHECK-EXTENSION: %[[#insertinsert:]] = OpFunctionParameter %[[#]] 
+; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase]] %[[#insertinsert]] 
+; Function Attrs: convergent mustprogress nofree norecurse nounwind willreturn memory(argmem: write)
+define dso_local spir_kernel void @testInsert(<2 x i32> noundef %b, <2 x i32> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 8 %res) local_unnamed_addr #0 !kernel_arg_addr_space !2 !kernel_arg_access_qual !3 !kernel_arg_type !4 !kernel_arg_base_type !5 !kernel_arg_type_qual !6 !kernel_arg_host_accessible !7 !kernel_arg_pipe_depth !8 !kernel_arg_pipe_io !6 !kernel_arg_buffer_location !6 {
+entry:
+  %call = tail call spir_func <2 x i32> @_Z15bitfield_insertDv2_iS_jj(<2 x i32> noundef %b, <2 x i32> noundef %i, i32 noundef 4, i32 noundef 2) #2
+  store <2 x i32> %call, ptr addrspace(1) %res, align 8, !tbaa !9
+  ret void
+}
+
+; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(none)
+declare spir_func <2 x i32> @_Z15bitfield_insertDv2_iS_jj(<2 x i32> noundef, <2 x i32> noundef, i32 noundef, i32 noundef) local_unnamed_addr #1
+
+; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] 
+; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] 
+; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
+; Function Attrs: convergent mustprogress nofree norecurse nounwind willreturn memory(argmem: write)
+define dso_local spir_kernel void @testExtractS(i16 noundef signext %b, i16 noundef zeroext %bu, ptr addrspace(1) nocapture noundef writeonly align 2 %res) local_unnamed_addr #0 !kernel_arg_addr_space !2 !kernel_arg_access_qual !3 !kernel_arg_type !12 !kernel_arg_base_type !12 !kernel_arg_type_qual !6 !kernel_arg_host_accessible !7 !kernel_arg_pipe_depth !8 !kernel_arg_pipe_io !6 !kernel_arg_buffer_location !6 {
+entry:
+  %call = tail call spir_func signext i16 @_Z23bitfield_extract_signedsjj(i16 noundef signext %b, i32 noundef 5, i32 noundef 4) #2
+  %call1 = tail call spir_func signext i16 @_Z23bitfield_extract_signedtjj(i16 noundef zeroext %bu, i32 noundef 5, i32 noundef 4) #2
+  %add = add i16 %call1, %call
+  store i16 %add, ptr addrspace(1) %res, align 2, !tbaa !13
+  ret void
+}
+
+; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(none)
+declare spir_func signext i16 @_Z23bitfield_extract_signedsjj(i16 noundef signext, i32 noundef, i32 noundef) local_unnamed_addr #1
+
+; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(none)
+declare spir_func signext i16 @_Z23bitfield_extract_signedtjj(i16 noundef zeroext, i32 noundef, i32 noundef) local_unnamed_addr #1
+
+; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] 
+; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] 
+; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
+; Function Attrs: convergent mustprogress nofree norecurse nounwind willreturn memory(argmem: write)
+define dso_local spir_kernel void @testExtractU(<8 x i8> noundef %b, <8 x i8> noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 8 %res) local_unnamed_addr #0 !kernel_arg_addr_space !2 !kernel_arg_access_qual !3 !kernel_arg_type !15 !kernel_arg_base_type !16 !kernel_arg_type_qual !6 !kernel_arg_host_accessible !7 !kernel_arg_pipe_depth !8 !kernel_arg_pipe_io !6 !kernel_arg_buffer_location !6 {
+entry:
+  %call = tail call spir_func <8 x i8> @_Z25bitfield_extract_unsignedDv8_cjj(<8 x i8> noundef %b, i32 noundef 3, i32 noundef 4) #2
+  %call1 = tail call spir_func <8 x i8> @_Z25bitfield_extract_unsignedDv8_hjj(<8 x i8> noundef %bu, i32 noundef 3, i32 noundef 4) #2
+  %add = add <8 x i8> %call1, %call
+  store <8 x i8> %add, ptr addrspace(1) %res, align 8, !tbaa !9
+  ret void
+}
+
+; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(none)
+declare spir_func <8 x i8> @_Z25bitfield_extract_unsignedDv8_cjj(<8 x i8> noundef, i32 noundef, i32 noundef) local_unnamed_addr #1
+
+; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(none)
+declare spir_func <8 x i8> @_Z25bitfield_extract_unsignedDv8_hjj(<8 x i8> noundef, i32 noundef, i32 noundef) local_unnamed_addr #1
+
+; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] 
+; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+; Function Attrs: convergent mustprogress nofree norecurse nounwind willreturn memory(argmem: write)
+define dso_local spir_kernel void @testBitReverse(<4 x i64> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 32 %res) local_unnamed_addr #0 !kernel_arg_addr_space !17 !kernel_arg_access_qual !18 !kernel_arg_type !19 !kernel_arg_base_type !20 !kernel_arg_type_qual !21 !kernel_arg_host_accessible !22 !kernel_arg_pipe_depth !23 !kernel_arg_pipe_io !21 !kernel_arg_buffer_location !21 {
+entry:
+  %call = tail call spir_func <4 x i64> @_Z11bit_reverseDv4_m(<4 x i64> noundef %b) #2
+  store <4 x i64> %call, ptr addrspace(1) %res, align 32, !tbaa !9
+  ret void
+}
+
+; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(none)
+declare spir_func <4 x i64> @_Z11bit_reverseDv4_m(<4 x i64> noundef) local_unnamed_addr #1
+
+attributes #0 = { convergent mustprogress nofree norecurse nounwind willreturn memory(argmem: write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "uniform-work-group-size"="false" }
+attributes #1 = { convergent mustprogress nofree nounwind willreturn memory(none) "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
+attributes #2 = { convergent nounwind willreturn memory(none) }
+
+!opencl.ocl.version = !{!0}
+!opencl.spir.version = !{!0}
+!llvm.ident = !{!1}
+
+!0 = !{i32 2, i32 0}
+!1 = !{!"Intel(R) oneAPI DPC++/C++ Compiler 2025.1.0 (2025.x.0.YYYYMMDD)"}
+!2 = !{i32 0, i32 0, i32 1}
+!3 = !{!"none", !"none", !"none"}
+!4 = !{!"int2", !"int2", !"int2*"}
+!5 = !{!"int __attribute__((ext_vector_type(2)))", !"int __attribute__((ext_vector_type(2)))", !"int __attribute__((ext_vector_type(2)))*"}
+!6 = !{!"", !"", !""}
+!7 = !{i1 false, i1 false, i1 false}
+!8 = !{i32 0, i32 0, i32 0}
+!9 = !{!10, !10, i64 0}
+!10 = !{!"omnipotent char", !11, i64 0}
+!11 = !{!"Simple C/C++ TBAA"}
+!12 = !{!"short", !"ushort", !"short*"}
+!13 = !{!14, !14, i64 0}
+!14 = !{!"short", !10, i64 0}
+!15 = !{!"char8", !"uchar8", !"uchar8*"}
+!16 = !{!"char __attribute__((ext_vector_type(8)))", !"uchar __attribute__((ext_vector_type(8)))", !"uchar __attribute__((ext_vector_type(8)))*"}
+!17 = !{i32 0, i32 1}
+!18 = !{!"none", !"none"}
+!19 = !{!"ulong4", !"ulong4*"}
+!20 = !{!"ulong __attribute__((ext_vector_type(4)))", !"ulong __attribute__((ext_vector_type(4)))*"}
+!21 = !{!"", !""}
+!22 = !{i1 false, i1 false}
+!23 = !{i32 0, i32 0}
\ No newline at end of file

>From debfc1f5ef682cbf2b44ddcacc0b1a7c6bda5599 Mon Sep 17 00:00:00 2001
From: "Maronas, Marcos" <marcos.maronas at intel.com>
Date: Wed, 18 Dec 2024 13:14:09 +0100
Subject: [PATCH 2/5] Change test from .ll file to .cl file.

---
 .../cl_khr_extended_bit_ops.cl                | 909 ++++++++++++++++++
 .../cl_khr_extended_bit_ops.ll                | 114 ---
 llvm/test/lit.cfg.py                          |   4 +-
 3 files changed, 912 insertions(+), 115 deletions(-)
 create mode 100644 llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.cl
 delete mode 100644 llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll

diff --git a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.cl b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.cl
new file mode 100644
index 00000000000000..4788c4c9f12519
--- /dev/null
+++ b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.cl
@@ -0,0 +1,909 @@
+// RUN: %clang_cc1 -triple spir-unknown-unknown -O1 -cl-std=CL2.0 -fdeclare-opencl-builtins -finclude-default-header -emit-llvm-bc %s -o %t.bc
+// RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %t.bc --spirv-ext=+SPV_KHR_bit_instructions -o - | FileCheck %s --check-prefix=CHECK-EXTENSION
+// RUN: not llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %t.bc -o %t.spvt 2>&1 | FileCheck %s --check-prefix=CHECK-NO-EXTENSION
+
+// CHECK-SPIRV: Capability BitInstructions
+// CHECK-SPIRV: Extension "SPV_KHR_bit_instructions"
+// CHECK-NO-EXTENSION: LLVM ERROR: bitfield_insert: the builtin requires the following SPIR-V extension: SPV_KHR_bit_instructions
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_long:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_long:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long]] %[[#insertinsert_long]]kernel void testInsert_long(long b, long i, global long *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_ulong:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ulong:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong]] %[[#insertinsert_ulong]]kernel void testInsert_ulong(ulong b, ulong i, global ulong *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_int:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_int:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int]] %[[#insertinsert_int]]kernel void testInsert_int(int b, int i, global int *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_uint:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uint:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint]] %[[#insertinsert_uint]]kernel void testInsert_uint(uint b, uint i, global uint *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_short:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_short:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short]] %[[#insertinsert_short]]kernel void testInsert_short(short b, short i, global short *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_ushort:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ushort:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort]] %[[#insertinsert_ushort]]kernel void testInsert_ushort(ushort b, ushort i, global ushort *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_long2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_long2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long2]] %[[#insertinsert_long2]]kernel void testInsert_long2(long2 b, long2 i, global long2 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_ulong2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ulong2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong2]] %[[#insertinsert_ulong2]]kernel void testInsert_ulong2(ulong2 b, ulong2 i, global ulong2 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_int2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_int2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int2]] %[[#insertinsert_int2]]kernel void testInsert_int2(int2 b, int2 i, global int2 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_uint2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uint2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint2]] %[[#insertinsert_uint2]]kernel void testInsert_uint2(uint2 b, uint2 i, global uint2 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_short2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_short2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short2]] %[[#insertinsert_short2]]kernel void testInsert_short2(short2 b, short2 i, global short2 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_ushort2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ushort2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort2]] %[[#insertinsert_ushort2]]kernel void testInsert_ushort2(ushort2 b, ushort2 i, global ushort2 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_char2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_char2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char2]] %[[#insertinsert_char2]]kernel void testInsert_char2(char2 b, char2 i, global char2 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_uchar2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uchar2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar2]] %[[#insertinsert_uchar2]]kernel void testInsert_uchar2(uchar2 b, uchar2 i, global uchar2 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_long3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_long3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long3]] %[[#insertinsert_long3]]kernel void testInsert_long3(long3 b, long3 i, global long3 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_ulong3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ulong3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong3]] %[[#insertinsert_ulong3]]kernel void testInsert_ulong3(ulong3 b, ulong3 i, global ulong3 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_int3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_int3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int3]] %[[#insertinsert_int3]]kernel void testInsert_int3(int3 b, int3 i, global int3 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_uint3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uint3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint3]] %[[#insertinsert_uint3]]kernel void testInsert_uint3(uint3 b, uint3 i, global uint3 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_short3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_short3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short3]] %[[#insertinsert_short3]]kernel void testInsert_short3(short3 b, short3 i, global short3 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_ushort3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ushort3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort3]] %[[#insertinsert_ushort3]]kernel void testInsert_ushort3(ushort3 b, ushort3 i, global ushort3 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_char3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_char3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char3]] %[[#insertinsert_char3]]kernel void testInsert_char3(char3 b, char3 i, global char3 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_uchar3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uchar3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar3]] %[[#insertinsert_uchar3]]kernel void testInsert_uchar3(uchar3 b, uchar3 i, global uchar3 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_long4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_long4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long4]] %[[#insertinsert_long4]]kernel void testInsert_long4(long4 b, long4 i, global long4 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_ulong4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ulong4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong4]] %[[#insertinsert_ulong4]]kernel void testInsert_ulong4(ulong4 b, ulong4 i, global ulong4 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_int4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_int4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int4]] %[[#insertinsert_int4]]kernel void testInsert_int4(int4 b, int4 i, global int4 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_uint4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uint4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint4]] %[[#insertinsert_uint4]]kernel void testInsert_uint4(uint4 b, uint4 i, global uint4 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_short4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_short4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short4]] %[[#insertinsert_short4]]kernel void testInsert_short4(short4 b, short4 i, global short4 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_ushort4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ushort4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort4]] %[[#insertinsert_ushort4]]kernel void testInsert_ushort4(ushort4 b, ushort4 i, global ushort4 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_char4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_char4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char4]] %[[#insertinsert_char4]]kernel void testInsert_char4(char4 b, char4 i, global char4 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_uchar4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uchar4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar4]] %[[#insertinsert_uchar4]]kernel void testInsert_uchar4(uchar4 b, uchar4 i, global uchar4 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_long8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_long8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long8]] %[[#insertinsert_long8]]kernel void testInsert_long8(long8 b, long8 i, global long8 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_ulong8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ulong8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong8]] %[[#insertinsert_ulong8]]kernel void testInsert_ulong8(ulong8 b, ulong8 i, global ulong8 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_int8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_int8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int8]] %[[#insertinsert_int8]]kernel void testInsert_int8(int8 b, int8 i, global int8 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_uint8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uint8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint8]] %[[#insertinsert_uint8]]kernel void testInsert_uint8(uint8 b, uint8 i, global uint8 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_short8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_short8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short8]] %[[#insertinsert_short8]]kernel void testInsert_short8(short8 b, short8 i, global short8 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_ushort8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ushort8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort8]] %[[#insertinsert_ushort8]]kernel void testInsert_ushort8(ushort8 b, ushort8 i, global ushort8 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_char8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_char8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char8]] %[[#insertinsert_char8]]kernel void testInsert_char8(char8 b, char8 i, global char8 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_uchar8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uchar8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar8]] %[[#insertinsert_uchar8]]kernel void testInsert_uchar8(uchar8 b, uchar8 i, global uchar8 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_long16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_long16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long16]] %[[#insertinsert_long16]]kernel void testInsert_long16(long16 b, long16 i, global long16 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_ulong16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ulong16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong16]] %[[#insertinsert_ulong16]]kernel void testInsert_ulong16(ulong16 b, ulong16 i, global ulong16 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_int16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_int16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int16]] %[[#insertinsert_int16]]kernel void testInsert_int16(int16 b, int16 i, global int16 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_uint16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uint16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint16]] %[[#insertinsert_uint16]]kernel void testInsert_uint16(uint16 b, uint16 i, global uint16 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_short16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_short16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short16]] %[[#insertinsert_short16]]kernel void testInsert_short16(short16 b, short16 i, global short16 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_ushort16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ushort16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort16]] %[[#insertinsert_ushort16]]kernel void testInsert_ushort16(ushort16 b, ushort16 i, global ushort16 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_char16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_char16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char16]] %[[#insertinsert_char16]]kernel void testInsert_char16(char16 b, char16 i, global char16 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#insertbase_uchar16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uchar16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar16]] %[[#insertinsert_uchar16]]kernel void testInsert_uchar16(uchar16 b, uchar16 i, global uchar16 *res) {
+  *res = bitfield_insert(b, i, 4, 2);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
+kernel void testExtractS_long(long b, ulong bu, global long *res) {
+  *res = bitfield_extract_signed(b, 5, 4);
+  *res += bitfield_extract_signed(bu, 5, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
+kernel void testExtractS_int(int b, uint bu, global int *res) {
+  *res = bitfield_extract_signed(b, 5, 4);
+  *res += bitfield_extract_signed(bu, 5, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
+kernel void testExtractS_short(short b, ushort bu, global short *res) {
+  *res = bitfield_extract_signed(b, 5, 4);
+  *res += bitfield_extract_signed(bu, 5, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
+kernel void testExtractS_char(char b, uchar bu, global char *res) {
+  *res = bitfield_extract_signed(b, 5, 4);
+  *res += bitfield_extract_signed(bu, 5, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
+kernel void testExtractS_long2(long b, ulong bu, global long *res) {
+  *res = bitfield_extract_signed(b, 5, 4);
+  *res += bitfield_extract_signed(bu, 5, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
+kernel void testExtractS_int2(int b, uint bu, global int *res) {
+  *res = bitfield_extract_signed(b, 5, 4);
+  *res += bitfield_extract_signed(bu, 5, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
+kernel void testExtractS_short2(short b, ushort bu, global short *res) {
+  *res = bitfield_extract_signed(b, 5, 4);
+  *res += bitfield_extract_signed(bu, 5, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
+kernel void testExtractS_char2(char b, uchar bu, global char *res) {
+  *res = bitfield_extract_signed(b, 5, 4);
+  *res += bitfield_extract_signed(bu, 5, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
+kernel void testExtractS_long3(long b, ulong bu, global long *res) {
+  *res = bitfield_extract_signed(b, 5, 4);
+  *res += bitfield_extract_signed(bu, 5, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
+kernel void testExtractS_int3(int b, uint bu, global int *res) {
+  *res = bitfield_extract_signed(b, 5, 4);
+  *res += bitfield_extract_signed(bu, 5, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
+kernel void testExtractS_short3(short b, ushort bu, global short *res) {
+  *res = bitfield_extract_signed(b, 5, 4);
+  *res += bitfield_extract_signed(bu, 5, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
+kernel void testExtractS_char3(char b, uchar bu, global char *res) {
+  *res = bitfield_extract_signed(b, 5, 4);
+  *res += bitfield_extract_signed(bu, 5, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
+kernel void testExtractS_long4(long b, ulong bu, global long *res) {
+  *res = bitfield_extract_signed(b, 5, 4);
+  *res += bitfield_extract_signed(bu, 5, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
+kernel void testExtractS_int4(int b, uint bu, global int *res) {
+  *res = bitfield_extract_signed(b, 5, 4);
+  *res += bitfield_extract_signed(bu, 5, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
+kernel void testExtractS_short4(short b, ushort bu, global short *res) {
+  *res = bitfield_extract_signed(b, 5, 4);
+  *res += bitfield_extract_signed(bu, 5, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
+kernel void testExtractS_char4(char b, uchar bu, global char *res) {
+  *res = bitfield_extract_signed(b, 5, 4);
+  *res += bitfield_extract_signed(bu, 5, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
+kernel void testExtractS_long8(long b, ulong bu, global long *res) {
+  *res = bitfield_extract_signed(b, 5, 4);
+  *res += bitfield_extract_signed(bu, 5, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
+kernel void testExtractS_int8(int b, uint bu, global int *res) {
+  *res = bitfield_extract_signed(b, 5, 4);
+  *res += bitfield_extract_signed(bu, 5, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
+kernel void testExtractS_short8(short b, ushort bu, global short *res) {
+  *res = bitfield_extract_signed(b, 5, 4);
+  *res += bitfield_extract_signed(bu, 5, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
+kernel void testExtractS_char8(char b, uchar bu, global char *res) {
+  *res = bitfield_extract_signed(b, 5, 4);
+  *res += bitfield_extract_signed(bu, 5, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
+kernel void testExtractS_long16(long b, ulong bu, global long *res) {
+  *res = bitfield_extract_signed(b, 5, 4);
+  *res += bitfield_extract_signed(bu, 5, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
+kernel void testExtractS_int16(int b, uint bu, global int *res) {
+  *res = bitfield_extract_signed(b, 5, 4);
+  *res += bitfield_extract_signed(bu, 5, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
+kernel void testExtractS_short16(short b, ushort bu, global short *res) {
+  *res = bitfield_extract_signed(b, 5, 4);
+  *res += bitfield_extract_signed(bu, 5, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
+kernel void testExtractS_char16(char b, uchar bu, global char *res) {
+  *res = bitfield_extract_signed(b, 5, 4);
+  *res += bitfield_extract_signed(bu, 5, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
+kernel void testExtractU_long(long b, ulong bu, global ulong *res) {
+  *res = bitfield_extract_unsigned(b, 3, 4);
+  *res += bitfield_extract_unsigned(bu, 3, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
+kernel void testExtractU_int(int b, uint bu, global uint *res) {
+  *res = bitfield_extract_unsigned(b, 3, 4);
+  *res += bitfield_extract_unsigned(bu, 3, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
+kernel void testExtractU_short(short b, ushort bu, global ushort *res) {
+  *res = bitfield_extract_unsigned(b, 3, 4);
+  *res += bitfield_extract_unsigned(bu, 3, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
+kernel void testExtractU_char(char b, uchar bu, global uchar *res) {
+  *res = bitfield_extract_unsigned(b, 3, 4);
+  *res += bitfield_extract_unsigned(bu, 3, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
+kernel void testExtractU_long2(long2 b, ulong2 bu, global ulong2 *res) {
+  *res = bitfield_extract_unsigned(b, 3, 4);
+  *res += bitfield_extract_unsigned(bu, 3, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
+kernel void testExtractU_int2(int2 b, uint2 bu, global uint2 *res) {
+  *res = bitfield_extract_unsigned(b, 3, 4);
+  *res += bitfield_extract_unsigned(bu, 3, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
+kernel void testExtractU_short2(short2 b, ushort2 bu, global ushort2 *res) {
+  *res = bitfield_extract_unsigned(b, 3, 4);
+  *res += bitfield_extract_unsigned(bu, 3, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
+kernel void testExtractU_char2(char2 b, uchar2 bu, global uchar2 *res) {
+  *res = bitfield_extract_unsigned(b, 3, 4);
+  *res += bitfield_extract_unsigned(bu, 3, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
+kernel void testExtractU_long3(long3 b, ulong3 bu, global ulong3 *res) {
+  *res = bitfield_extract_unsigned(b, 3, 4);
+  *res += bitfield_extract_unsigned(bu, 3, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
+kernel void testExtractU_int3(int3 b, uint3 bu, global uint3 *res) {
+  *res = bitfield_extract_unsigned(b, 3, 4);
+  *res += bitfield_extract_unsigned(bu, 3, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
+kernel void testExtractU_short3(short3 b, ushort3 bu, global ushort3 *res) {
+  *res = bitfield_extract_unsigned(b, 3, 4);
+  *res += bitfield_extract_unsigned(bu, 3, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
+kernel void testExtractU_char3(char3 b, uchar3 bu, global uchar3 *res) {
+  *res = bitfield_extract_unsigned(b, 3, 4);
+  *res += bitfield_extract_unsigned(bu, 3, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
+kernel void testExtractU_long4(long4 b, ulong4 bu, global ulong4 *res) {
+  *res = bitfield_extract_unsigned(b, 3, 4);
+  *res += bitfield_extract_unsigned(bu, 3, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
+kernel void testExtractU_int4(int4 b, uint4 bu, global uint4 *res) {
+  *res = bitfield_extract_unsigned(b, 3, 4);
+  *res += bitfield_extract_unsigned(bu, 3, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
+kernel void testExtractU_short4(short4 b, ushort4 bu, global ushort4 *res) {
+  *res = bitfield_extract_unsigned(b, 3, 4);
+  *res += bitfield_extract_unsigned(bu, 3, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
+kernel void testExtractU_char4(char4 b, uchar4 bu, global uchar4 *res) {
+  *res = bitfield_extract_unsigned(b, 3, 4);
+  *res += bitfield_extract_unsigned(bu, 3, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
+kernel void testExtractU_long8(long8 b, ulong8 bu, global ulong8 *res) {
+  *res = bitfield_extract_unsigned(b, 3, 4);
+  *res += bitfield_extract_unsigned(bu, 3, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
+kernel void testExtractU_int8(int8 b, uint8 bu, global uint8 *res) {
+  *res = bitfield_extract_unsigned(b, 3, 4);
+  *res += bitfield_extract_unsigned(bu, 3, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
+kernel void testExtractU_short8(short8 b, ushort8 bu, global ushort8 *res) {
+  *res = bitfield_extract_unsigned(b, 3, 4);
+  *res += bitfield_extract_unsigned(bu, 3, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
+kernel void testExtractU_char8(char8 b, uchar8 bu, global uchar8 *res) {
+  *res = bitfield_extract_unsigned(b, 3, 4);
+  *res += bitfield_extract_unsigned(bu, 3, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
+kernel void testExtractU_long16(long16 b, ulong16 bu, global ulong16 *res) {
+  *res = bitfield_extract_unsigned(b, 3, 4);
+  *res += bitfield_extract_unsigned(bu, 3, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
+kernel void testExtractU_int16(int16 b, uint16 bu, global uint16 *res) {
+  *res = bitfield_extract_unsigned(b, 3, 4);
+  *res += bitfield_extract_unsigned(bu, 3, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
+kernel void testExtractU_short16(short16 b, ushort16 bu, global ushort16 *res) {
+  *res = bitfield_extract_unsigned(b, 3, 4);
+  *res += bitfield_extract_unsigned(bu, 3, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
+kernel void testExtractU_char16(char16 b, uchar16 bu, global uchar16 *res) {
+  *res = bitfield_extract_unsigned(b, 3, 4);
+  *res += bitfield_extract_unsigned(bu, 3, 4);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_long(long b, global long *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_ulong(ulong b, global ulong *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_int(int b, global int *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_uint(uint b, global uint *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_short(short b, global short *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_ushort(ushort b, global ushort *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_char(char b, global char *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_uchar(uchar b, global uchar *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_long2(long2 b, global long2 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_ulong2(ulong2 b, global ulong2 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_int2(int2 b, global int2 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_uint2(uint2 b, global uint2 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_short2(short2 b, global short2 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_ushort2(ushort2 b, global ushort2 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_char2(char2 b, global char2 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_uchar2(uchar2 b, global uchar2 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_long3(long3 b, global long3 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_ulong3(ulong3 b, global ulong3 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_int3(int3 b, global int3 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_uint3(uint3 b, global uint3 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_short3(short3 b, global short3 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_ushort3(ushort3 b, global ushort3 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_char3(char3 b, global char3 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_uchar3(uchar3 b, global uchar3 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_long4(long4 b, global long4 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_ulong4(ulong4 b, global ulong4 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_int4(int4 b, global int4 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_uint4(uint4 b, global uint4 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_short4(short4 b, global short4 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_ushort4(ushort4 b, global ushort4 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_char4(char4 b, global char4 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_uchar4(uchar4 b, global uchar4 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_long8(long8 b, global long8 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_ulong8(ulong8 b, global ulong8 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_int8(int8 b, global int8 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_uint8(uint8 b, global uint8 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_short8(short8 b, global short8 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_ushort8(ushort8 b, global ushort8 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_char8(char8 b, global char8 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_uchar8(uchar8 b, global uchar8 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_long16(long16 b, global long16 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_ulong16(ulong16 b, global ulong16 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_int16(int16 b, global int16 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_uint16(uint16 b, global uint16 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_short16(short16 b, global short16 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_ushort16(ushort16 b, global ushort16 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_char16(char16 b, global char16 *res) {
+  *res = bit_reverse(b);
+}
+
+// CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+kernel void testBitReverse_uchar16(uchar16 b, global uchar16 *res) {
+  *res = bit_reverse(b);
+}
diff --git a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll
deleted file mode 100644
index e447bdf11616ed..00000000000000
--- a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.ll
+++ /dev/null
@@ -1,114 +0,0 @@
-; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s --spirv-ext=+SPV_KHR_bit_instructions -o - | FileCheck %s --check-prefix=CHECK-EXTENSION
-; RUN: not llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o %t.spvt 2>&1 | FileCheck %s --check-prefix=CHECK-NO-EXTENSION
-; ModuleID = 'cl_khr_extended_bit_ops.cl.tmp.bc'
-source_filename = "cl_khr_extended_bit_ops.cl"
-target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64-G1"
-target triple = "spir-unknown-unknown"
-
-; CHECK-EXTENSION: Capability BitInstructions
-; CHECK-EXTENSION: Extension "SPV_KHR_bit_instructions"
-; CHECK-NO-EXTENSION: LLVM ERROR: bitfield_insert: the builtin requires the following SPIR-V extension: SPV_KHR_bit_instructions
-
-; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-; CHECK-EXTENSION: %[[#insertbase:]] = OpFunctionParameter %[[#]] 
-; CHECK-EXTENSION: %[[#insertinsert:]] = OpFunctionParameter %[[#]] 
-; CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase]] %[[#insertinsert]] 
-; Function Attrs: convergent mustprogress nofree norecurse nounwind willreturn memory(argmem: write)
-define dso_local spir_kernel void @testInsert(<2 x i32> noundef %b, <2 x i32> noundef %i, ptr addrspace(1) nocapture noundef writeonly align 8 %res) local_unnamed_addr #0 !kernel_arg_addr_space !2 !kernel_arg_access_qual !3 !kernel_arg_type !4 !kernel_arg_base_type !5 !kernel_arg_type_qual !6 !kernel_arg_host_accessible !7 !kernel_arg_pipe_depth !8 !kernel_arg_pipe_io !6 !kernel_arg_buffer_location !6 {
-entry:
-  %call = tail call spir_func <2 x i32> @_Z15bitfield_insertDv2_iS_jj(<2 x i32> noundef %b, <2 x i32> noundef %i, i32 noundef 4, i32 noundef 2) #2
-  store <2 x i32> %call, ptr addrspace(1) %res, align 8, !tbaa !9
-  ret void
-}
-
-; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(none)
-declare spir_func <2 x i32> @_Z15bitfield_insertDv2_iS_jj(<2 x i32> noundef, <2 x i32> noundef, i32 noundef, i32 noundef) local_unnamed_addr #1
-
-; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-; CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]] 
-; CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]] 
-; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
-; CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
-; Function Attrs: convergent mustprogress nofree norecurse nounwind willreturn memory(argmem: write)
-define dso_local spir_kernel void @testExtractS(i16 noundef signext %b, i16 noundef zeroext %bu, ptr addrspace(1) nocapture noundef writeonly align 2 %res) local_unnamed_addr #0 !kernel_arg_addr_space !2 !kernel_arg_access_qual !3 !kernel_arg_type !12 !kernel_arg_base_type !12 !kernel_arg_type_qual !6 !kernel_arg_host_accessible !7 !kernel_arg_pipe_depth !8 !kernel_arg_pipe_io !6 !kernel_arg_buffer_location !6 {
-entry:
-  %call = tail call spir_func signext i16 @_Z23bitfield_extract_signedsjj(i16 noundef signext %b, i32 noundef 5, i32 noundef 4) #2
-  %call1 = tail call spir_func signext i16 @_Z23bitfield_extract_signedtjj(i16 noundef zeroext %bu, i32 noundef 5, i32 noundef 4) #2
-  %add = add i16 %call1, %call
-  store i16 %add, ptr addrspace(1) %res, align 2, !tbaa !13
-  ret void
-}
-
-; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(none)
-declare spir_func signext i16 @_Z23bitfield_extract_signedsjj(i16 noundef signext, i32 noundef, i32 noundef) local_unnamed_addr #1
-
-; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(none)
-declare spir_func signext i16 @_Z23bitfield_extract_signedtjj(i16 noundef zeroext, i32 noundef, i32 noundef) local_unnamed_addr #1
-
-; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-; CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]] 
-; CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]] 
-; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
-; CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
-; Function Attrs: convergent mustprogress nofree norecurse nounwind willreturn memory(argmem: write)
-define dso_local spir_kernel void @testExtractU(<8 x i8> noundef %b, <8 x i8> noundef %bu, ptr addrspace(1) nocapture noundef writeonly align 8 %res) local_unnamed_addr #0 !kernel_arg_addr_space !2 !kernel_arg_access_qual !3 !kernel_arg_type !15 !kernel_arg_base_type !16 !kernel_arg_type_qual !6 !kernel_arg_host_accessible !7 !kernel_arg_pipe_depth !8 !kernel_arg_pipe_io !6 !kernel_arg_buffer_location !6 {
-entry:
-  %call = tail call spir_func <8 x i8> @_Z25bitfield_extract_unsignedDv8_cjj(<8 x i8> noundef %b, i32 noundef 3, i32 noundef 4) #2
-  %call1 = tail call spir_func <8 x i8> @_Z25bitfield_extract_unsignedDv8_hjj(<8 x i8> noundef %bu, i32 noundef 3, i32 noundef 4) #2
-  %add = add <8 x i8> %call1, %call
-  store <8 x i8> %add, ptr addrspace(1) %res, align 8, !tbaa !9
-  ret void
-}
-
-; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(none)
-declare spir_func <8 x i8> @_Z25bitfield_extract_unsignedDv8_cjj(<8 x i8> noundef, i32 noundef, i32 noundef) local_unnamed_addr #1
-
-; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(none)
-declare spir_func <8 x i8> @_Z25bitfield_extract_unsignedDv8_hjj(<8 x i8> noundef, i32 noundef, i32 noundef) local_unnamed_addr #1
-
-; CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-; CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]] 
-; CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
-; Function Attrs: convergent mustprogress nofree norecurse nounwind willreturn memory(argmem: write)
-define dso_local spir_kernel void @testBitReverse(<4 x i64> noundef %b, ptr addrspace(1) nocapture noundef writeonly align 32 %res) local_unnamed_addr #0 !kernel_arg_addr_space !17 !kernel_arg_access_qual !18 !kernel_arg_type !19 !kernel_arg_base_type !20 !kernel_arg_type_qual !21 !kernel_arg_host_accessible !22 !kernel_arg_pipe_depth !23 !kernel_arg_pipe_io !21 !kernel_arg_buffer_location !21 {
-entry:
-  %call = tail call spir_func <4 x i64> @_Z11bit_reverseDv4_m(<4 x i64> noundef %b) #2
-  store <4 x i64> %call, ptr addrspace(1) %res, align 32, !tbaa !9
-  ret void
-}
-
-; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(none)
-declare spir_func <4 x i64> @_Z11bit_reverseDv4_m(<4 x i64> noundef) local_unnamed_addr #1
-
-attributes #0 = { convergent mustprogress nofree norecurse nounwind willreturn memory(argmem: write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "uniform-work-group-size"="false" }
-attributes #1 = { convergent mustprogress nofree nounwind willreturn memory(none) "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
-attributes #2 = { convergent nounwind willreturn memory(none) }
-
-!opencl.ocl.version = !{!0}
-!opencl.spir.version = !{!0}
-!llvm.ident = !{!1}
-
-!0 = !{i32 2, i32 0}
-!1 = !{!"Intel(R) oneAPI DPC++/C++ Compiler 2025.1.0 (2025.x.0.YYYYMMDD)"}
-!2 = !{i32 0, i32 0, i32 1}
-!3 = !{!"none", !"none", !"none"}
-!4 = !{!"int2", !"int2", !"int2*"}
-!5 = !{!"int __attribute__((ext_vector_type(2)))", !"int __attribute__((ext_vector_type(2)))", !"int __attribute__((ext_vector_type(2)))*"}
-!6 = !{!"", !"", !""}
-!7 = !{i1 false, i1 false, i1 false}
-!8 = !{i32 0, i32 0, i32 0}
-!9 = !{!10, !10, i64 0}
-!10 = !{!"omnipotent char", !11, i64 0}
-!11 = !{!"Simple C/C++ TBAA"}
-!12 = !{!"short", !"ushort", !"short*"}
-!13 = !{!14, !14, i64 0}
-!14 = !{!"short", !10, i64 0}
-!15 = !{!"char8", !"uchar8", !"uchar8*"}
-!16 = !{!"char __attribute__((ext_vector_type(8)))", !"uchar __attribute__((ext_vector_type(8)))", !"uchar __attribute__((ext_vector_type(8)))*"}
-!17 = !{i32 0, i32 1}
-!18 = !{!"none", !"none"}
-!19 = !{!"ulong4", !"ulong4*"}
-!20 = !{!"ulong __attribute__((ext_vector_type(4)))", !"ulong __attribute__((ext_vector_type(4)))*"}
-!21 = !{!"", !""}
-!22 = !{i1 false, i1 false}
-!23 = !{i32 0, i32 0}
\ No newline at end of file
diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py
index 5a03a85386e0aa..0d2e414d1d9f8f 100644
--- a/llvm/test/lit.cfg.py
+++ b/llvm/test/lit.cfg.py
@@ -22,7 +22,7 @@
 
 # suffixes: A list of file extensions to treat as test files. This is overriden
 # by individual lit.local.cfg files in the test subdirectories.
-config.suffixes = [".ll", ".c", ".test", ".txt", ".s", ".mir", ".yaml", ".spv"]
+config.suffixes = [".ll", ".c", ".test", ".txt", ".s", ".mir", ".yaml", ".spv", ".cl"]
 
 # excludes: A list of directories to exclude from the testsuite. The 'Inputs'
 # subdirectories contain auxiliary inputs for various tests in their parent
@@ -35,6 +35,8 @@
 # test_exec_root: The root path where tests should be run.
 config.test_exec_root = os.path.join(config.llvm_obj_root, "test")
 
+llvm_config.use_clang()
+
 # Tweak the PATH to include the tools dir.
 llvm_config.with_environment("PATH", config.llvm_tools_dir, append_path=True)
 

>From cc61409d353a40f62d3a137f3c7436aa00df779d Mon Sep 17 00:00:00 2001
From: "Maronas, Marcos" <marcos.maronas at intel.com>
Date: Wed, 18 Dec 2024 13:15:36 +0100
Subject: [PATCH 3/5] Add __spirv_CODE wrappers for extended bit instructions.

---
 llvm/lib/Target/SPIRV/SPIRVBuiltins.td | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/llvm/lib/Target/SPIRV/SPIRVBuiltins.td b/llvm/lib/Target/SPIRV/SPIRVBuiltins.td
index 9cc16ea8c91833..9a146b331ffc10 100644
--- a/llvm/lib/Target/SPIRV/SPIRVBuiltins.td
+++ b/llvm/lib/Target/SPIRV/SPIRVBuiltins.td
@@ -1444,9 +1444,13 @@ defm : DemangledNativeBuiltin<"__spirv_ConvertUToPtr", OpenCL_std, Convert, 1, 1
 
 // cl_khr_extended_bit_ops / SPV_KHR_bit_instructions
 defm : DemangledNativeBuiltin<"bitfield_insert", OpenCL_std, ExtendedBitOps, 4, 4, OpBitFieldInsert>;
+defm : DemangledNativeBuiltin<"__spirv_BitFieldInsert", OpenCL_std, ExtendedBitOps, 4, 4, OpBitFieldInsert>;
 defm : DemangledNativeBuiltin<"bitfield_extract_signed", OpenCL_std, ExtendedBitOps, 3, 3, OpBitFieldSExtract>;
+defm : DemangledNativeBuiltin<"__spirv_BitFieldSExtract", OpenCL_std, ExtendedBitOps, 3, 3, OpBitFieldSExtract>;
 defm : DemangledNativeBuiltin<"bitfield_extract_unsigned", OpenCL_std, ExtendedBitOps, 3, 3, OpBitFieldUExtract>;
+defm : DemangledNativeBuiltin<"__spirv_BitFieldUExtract", OpenCL_std, ExtendedBitOps, 3, 3, OpBitFieldUExtract>;
 defm : DemangledNativeBuiltin<"bit_reverse", OpenCL_std, ExtendedBitOps, 1, 1, OpBitReverse>;
+defm : DemangledNativeBuiltin<"__spirv_BitReverse", OpenCL_std, ExtendedBitOps, 1, 1, OpBitReverse>;
 
 // cl_intel_bfloat16_conversions / SPV_INTEL_bfloat16_conversion
 // Multiclass used to define at the same time both a demangled builtin records

>From 8a11b979ce6f8788e968e89ace6463200f091119 Mon Sep 17 00:00:00 2001
From: "Maronas, Marcos" <marcos.maronas at intel.com>
Date: Thu, 19 Dec 2024 13:36:01 +0100
Subject: [PATCH 4/5] Undo changes on higher level directory LIT config.

---
 .../cl_khr_extended_bit_ops.cl                | 566 +++++++++++++-----
 llvm/test/CodeGen/SPIRV/lit.local.cfg         |   6 +
 llvm/test/lit.cfg.py                          |   4 +-
 3 files changed, 431 insertions(+), 145 deletions(-)

diff --git a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.cl b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.cl
index 4788c4c9f12519..4f7fd131f6f9a9 100644
--- a/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.cl
+++ b/llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions/cl_khr_extended_bit_ops.cl
@@ -7,237 +7,377 @@
 // CHECK-NO-EXTENSION: LLVM ERROR: bitfield_insert: the builtin requires the following SPIR-V extension: SPV_KHR_bit_instructions
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_long:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_long:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long]] %[[#insertinsert_long]]kernel void testInsert_long(long b, long i, global long *res) {
+// CHECK-EXTENSION: %[[#insertbase_long:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_long:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long]] %[[#insertinsert_long]]
+kernel void testInsert_long(long b, long i, global long *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_ulong:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ulong:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong]] %[[#insertinsert_ulong]]kernel void testInsert_ulong(ulong b, ulong i, global ulong *res) {
+// CHECK-EXTENSION: %[[#insertbase_ulong:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_ulong:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong]] %[[#insertinsert_ulong]]
+kernel void testInsert_ulong(ulong b, ulong i, global ulong *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_int:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_int:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int]] %[[#insertinsert_int]]kernel void testInsert_int(int b, int i, global int *res) {
+// CHECK-EXTENSION: %[[#insertbase_int:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_int:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int]] %[[#insertinsert_int]]
+kernel void testInsert_int(int b, int i, global int *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_uint:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uint:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint]] %[[#insertinsert_uint]]kernel void testInsert_uint(uint b, uint i, global uint *res) {
+// CHECK-EXTENSION: %[[#insertbase_uint:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_uint:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint]] %[[#insertinsert_uint]]
+kernel void testInsert_uint(uint b, uint i, global uint *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_short:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_short:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short]] %[[#insertinsert_short]]kernel void testInsert_short(short b, short i, global short *res) {
+// CHECK-EXTENSION: %[[#insertbase_short:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_short:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short]] %[[#insertinsert_short]]
+kernel void testInsert_short(short b, short i, global short *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_ushort:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ushort:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort]] %[[#insertinsert_ushort]]kernel void testInsert_ushort(ushort b, ushort i, global ushort *res) {
+// CHECK-EXTENSION: %[[#insertbase_ushort:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_ushort:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort]] %[[#insertinsert_ushort]]
+kernel void testInsert_ushort(ushort b, ushort i, global ushort *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_long2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_long2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long2]] %[[#insertinsert_long2]]kernel void testInsert_long2(long2 b, long2 i, global long2 *res) {
+// CHECK-EXTENSION: %[[#insertbase_long2:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_long2:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long2]] %[[#insertinsert_long2]]
+kernel void testInsert_long2(long2 b, long2 i, global long2 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_ulong2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ulong2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong2]] %[[#insertinsert_ulong2]]kernel void testInsert_ulong2(ulong2 b, ulong2 i, global ulong2 *res) {
+// CHECK-EXTENSION: %[[#insertbase_ulong2:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_ulong2:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong2]] %[[#insertinsert_ulong2]]
+kernel void testInsert_ulong2(ulong2 b, ulong2 i, global ulong2 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_int2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_int2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int2]] %[[#insertinsert_int2]]kernel void testInsert_int2(int2 b, int2 i, global int2 *res) {
+// CHECK-EXTENSION: %[[#insertbase_int2:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_int2:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int2]] %[[#insertinsert_int2]]
+kernel void testInsert_int2(int2 b, int2 i, global int2 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_uint2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uint2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint2]] %[[#insertinsert_uint2]]kernel void testInsert_uint2(uint2 b, uint2 i, global uint2 *res) {
+// CHECK-EXTENSION: %[[#insertbase_uint2:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_uint2:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint2]] %[[#insertinsert_uint2]]
+kernel void testInsert_uint2(uint2 b, uint2 i, global uint2 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_short2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_short2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short2]] %[[#insertinsert_short2]]kernel void testInsert_short2(short2 b, short2 i, global short2 *res) {
+// CHECK-EXTENSION: %[[#insertbase_short2:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_short2:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short2]] %[[#insertinsert_short2]]
+kernel void testInsert_short2(short2 b, short2 i, global short2 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_ushort2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ushort2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort2]] %[[#insertinsert_ushort2]]kernel void testInsert_ushort2(ushort2 b, ushort2 i, global ushort2 *res) {
+// CHECK-EXTENSION: %[[#insertbase_ushort2:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_ushort2:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort2]] %[[#insertinsert_ushort2]]
+kernel void testInsert_ushort2(ushort2 b, ushort2 i, global ushort2 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_char2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_char2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char2]] %[[#insertinsert_char2]]kernel void testInsert_char2(char2 b, char2 i, global char2 *res) {
+// CHECK-EXTENSION: %[[#insertbase_char2:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_char2:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char2]] %[[#insertinsert_char2]]
+kernel void testInsert_char2(char2 b, char2 i, global char2 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_uchar2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uchar2:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar2]] %[[#insertinsert_uchar2]]kernel void testInsert_uchar2(uchar2 b, uchar2 i, global uchar2 *res) {
+// CHECK-EXTENSION: %[[#insertbase_uchar2:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_uchar2:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar2]] %[[#insertinsert_uchar2]]
+kernel void testInsert_uchar2(uchar2 b, uchar2 i, global uchar2 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_long3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_long3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long3]] %[[#insertinsert_long3]]kernel void testInsert_long3(long3 b, long3 i, global long3 *res) {
+// CHECK-EXTENSION: %[[#insertbase_long3:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_long3:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long3]] %[[#insertinsert_long3]]
+kernel void testInsert_long3(long3 b, long3 i, global long3 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_ulong3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ulong3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong3]] %[[#insertinsert_ulong3]]kernel void testInsert_ulong3(ulong3 b, ulong3 i, global ulong3 *res) {
+// CHECK-EXTENSION: %[[#insertbase_ulong3:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_ulong3:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong3]] %[[#insertinsert_ulong3]]
+kernel void testInsert_ulong3(ulong3 b, ulong3 i, global ulong3 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_int3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_int3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int3]] %[[#insertinsert_int3]]kernel void testInsert_int3(int3 b, int3 i, global int3 *res) {
+// CHECK-EXTENSION: %[[#insertbase_int3:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_int3:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int3]] %[[#insertinsert_int3]]
+kernel void testInsert_int3(int3 b, int3 i, global int3 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_uint3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uint3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint3]] %[[#insertinsert_uint3]]kernel void testInsert_uint3(uint3 b, uint3 i, global uint3 *res) {
+// CHECK-EXTENSION: %[[#insertbase_uint3:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_uint3:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint3]] %[[#insertinsert_uint3]]
+kernel void testInsert_uint3(uint3 b, uint3 i, global uint3 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_short3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_short3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short3]] %[[#insertinsert_short3]]kernel void testInsert_short3(short3 b, short3 i, global short3 *res) {
+// CHECK-EXTENSION: %[[#insertbase_short3:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_short3:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short3]] %[[#insertinsert_short3]]
+kernel void testInsert_short3(short3 b, short3 i, global short3 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_ushort3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ushort3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort3]] %[[#insertinsert_ushort3]]kernel void testInsert_ushort3(ushort3 b, ushort3 i, global ushort3 *res) {
+// CHECK-EXTENSION: %[[#insertbase_ushort3:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_ushort3:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort3]] %[[#insertinsert_ushort3]]
+kernel void testInsert_ushort3(ushort3 b, ushort3 i, global ushort3 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_char3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_char3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char3]] %[[#insertinsert_char3]]kernel void testInsert_char3(char3 b, char3 i, global char3 *res) {
+// CHECK-EXTENSION: %[[#insertbase_char3:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_char3:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char3]] %[[#insertinsert_char3]]
+kernel void testInsert_char3(char3 b, char3 i, global char3 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_uchar3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uchar3:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar3]] %[[#insertinsert_uchar3]]kernel void testInsert_uchar3(uchar3 b, uchar3 i, global uchar3 *res) {
+// CHECK-EXTENSION: %[[#insertbase_uchar3:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_uchar3:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar3]] %[[#insertinsert_uchar3]]
+kernel void testInsert_uchar3(uchar3 b, uchar3 i, global uchar3 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_long4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_long4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long4]] %[[#insertinsert_long4]]kernel void testInsert_long4(long4 b, long4 i, global long4 *res) {
+// CHECK-EXTENSION: %[[#insertbase_long4:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_long4:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long4]] %[[#insertinsert_long4]]
+kernel void testInsert_long4(long4 b, long4 i, global long4 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_ulong4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ulong4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong4]] %[[#insertinsert_ulong4]]kernel void testInsert_ulong4(ulong4 b, ulong4 i, global ulong4 *res) {
+// CHECK-EXTENSION: %[[#insertbase_ulong4:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_ulong4:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong4]] %[[#insertinsert_ulong4]]
+kernel void testInsert_ulong4(ulong4 b, ulong4 i, global ulong4 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_int4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_int4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int4]] %[[#insertinsert_int4]]kernel void testInsert_int4(int4 b, int4 i, global int4 *res) {
+// CHECK-EXTENSION: %[[#insertbase_int4:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_int4:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int4]] %[[#insertinsert_int4]]
+kernel void testInsert_int4(int4 b, int4 i, global int4 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_uint4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uint4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint4]] %[[#insertinsert_uint4]]kernel void testInsert_uint4(uint4 b, uint4 i, global uint4 *res) {
+// CHECK-EXTENSION: %[[#insertbase_uint4:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_uint4:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint4]] %[[#insertinsert_uint4]]
+kernel void testInsert_uint4(uint4 b, uint4 i, global uint4 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_short4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_short4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short4]] %[[#insertinsert_short4]]kernel void testInsert_short4(short4 b, short4 i, global short4 *res) {
+// CHECK-EXTENSION: %[[#insertbase_short4:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_short4:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short4]] %[[#insertinsert_short4]]
+kernel void testInsert_short4(short4 b, short4 i, global short4 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_ushort4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ushort4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort4]] %[[#insertinsert_ushort4]]kernel void testInsert_ushort4(ushort4 b, ushort4 i, global ushort4 *res) {
+// CHECK-EXTENSION: %[[#insertbase_ushort4:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_ushort4:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort4]] %[[#insertinsert_ushort4]]
+kernel void testInsert_ushort4(ushort4 b, ushort4 i, global ushort4 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_char4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_char4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char4]] %[[#insertinsert_char4]]kernel void testInsert_char4(char4 b, char4 i, global char4 *res) {
+// CHECK-EXTENSION: %[[#insertbase_char4:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_char4:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char4]] %[[#insertinsert_char4]]
+kernel void testInsert_char4(char4 b, char4 i, global char4 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_uchar4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uchar4:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar4]] %[[#insertinsert_uchar4]]kernel void testInsert_uchar4(uchar4 b, uchar4 i, global uchar4 *res) {
+// CHECK-EXTENSION: %[[#insertbase_uchar4:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_uchar4:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar4]] %[[#insertinsert_uchar4]]
+kernel void testInsert_uchar4(uchar4 b, uchar4 i, global uchar4 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_long8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_long8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long8]] %[[#insertinsert_long8]]kernel void testInsert_long8(long8 b, long8 i, global long8 *res) {
+// CHECK-EXTENSION: %[[#insertbase_long8:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_long8:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long8]] %[[#insertinsert_long8]]
+kernel void testInsert_long8(long8 b, long8 i, global long8 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_ulong8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ulong8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong8]] %[[#insertinsert_ulong8]]kernel void testInsert_ulong8(ulong8 b, ulong8 i, global ulong8 *res) {
+// CHECK-EXTENSION: %[[#insertbase_ulong8:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_ulong8:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong8]] %[[#insertinsert_ulong8]]
+kernel void testInsert_ulong8(ulong8 b, ulong8 i, global ulong8 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_int8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_int8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int8]] %[[#insertinsert_int8]]kernel void testInsert_int8(int8 b, int8 i, global int8 *res) {
+// CHECK-EXTENSION: %[[#insertbase_int8:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_int8:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int8]] %[[#insertinsert_int8]]
+kernel void testInsert_int8(int8 b, int8 i, global int8 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_uint8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uint8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint8]] %[[#insertinsert_uint8]]kernel void testInsert_uint8(uint8 b, uint8 i, global uint8 *res) {
+// CHECK-EXTENSION: %[[#insertbase_uint8:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_uint8:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint8]] %[[#insertinsert_uint8]]
+kernel void testInsert_uint8(uint8 b, uint8 i, global uint8 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_short8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_short8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short8]] %[[#insertinsert_short8]]kernel void testInsert_short8(short8 b, short8 i, global short8 *res) {
+// CHECK-EXTENSION: %[[#insertbase_short8:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_short8:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short8]] %[[#insertinsert_short8]]
+kernel void testInsert_short8(short8 b, short8 i, global short8 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_ushort8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ushort8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort8]] %[[#insertinsert_ushort8]]kernel void testInsert_ushort8(ushort8 b, ushort8 i, global ushort8 *res) {
+// CHECK-EXTENSION: %[[#insertbase_ushort8:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_ushort8:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort8]] %[[#insertinsert_ushort8]]
+kernel void testInsert_ushort8(ushort8 b, ushort8 i, global ushort8 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_char8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_char8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char8]] %[[#insertinsert_char8]]kernel void testInsert_char8(char8 b, char8 i, global char8 *res) {
+// CHECK-EXTENSION: %[[#insertbase_char8:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_char8:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char8]] %[[#insertinsert_char8]]
+kernel void testInsert_char8(char8 b, char8 i, global char8 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_uchar8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uchar8:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar8]] %[[#insertinsert_uchar8]]kernel void testInsert_uchar8(uchar8 b, uchar8 i, global uchar8 *res) {
+// CHECK-EXTENSION: %[[#insertbase_uchar8:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_uchar8:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar8]] %[[#insertinsert_uchar8]]
+kernel void testInsert_uchar8(uchar8 b, uchar8 i, global uchar8 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_long16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_long16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long16]] %[[#insertinsert_long16]]kernel void testInsert_long16(long16 b, long16 i, global long16 *res) {
+// CHECK-EXTENSION: %[[#insertbase_long16:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_long16:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_long16]] %[[#insertinsert_long16]]
+kernel void testInsert_long16(long16 b, long16 i, global long16 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_ulong16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ulong16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong16]] %[[#insertinsert_ulong16]]kernel void testInsert_ulong16(ulong16 b, ulong16 i, global ulong16 *res) {
+// CHECK-EXTENSION: %[[#insertbase_ulong16:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_ulong16:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ulong16]] %[[#insertinsert_ulong16]]
+kernel void testInsert_ulong16(ulong16 b, ulong16 i, global ulong16 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_int16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_int16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int16]] %[[#insertinsert_int16]]kernel void testInsert_int16(int16 b, int16 i, global int16 *res) {
+// CHECK-EXTENSION: %[[#insertbase_int16:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_int16:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_int16]] %[[#insertinsert_int16]]
+kernel void testInsert_int16(int16 b, int16 i, global int16 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_uint16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uint16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint16]] %[[#insertinsert_uint16]]kernel void testInsert_uint16(uint16 b, uint16 i, global uint16 *res) {
+// CHECK-EXTENSION: %[[#insertbase_uint16:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_uint16:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uint16]] %[[#insertinsert_uint16]]
+kernel void testInsert_uint16(uint16 b, uint16 i, global uint16 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_short16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_short16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short16]] %[[#insertinsert_short16]]kernel void testInsert_short16(short16 b, short16 i, global short16 *res) {
+// CHECK-EXTENSION: %[[#insertbase_short16:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_short16:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_short16]] %[[#insertinsert_short16]]
+kernel void testInsert_short16(short16 b, short16 i, global short16 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_ushort16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_ushort16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort16]] %[[#insertinsert_ushort16]]kernel void testInsert_ushort16(ushort16 b, ushort16 i, global ushort16 *res) {
+// CHECK-EXTENSION: %[[#insertbase_ushort16:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_ushort16:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_ushort16]] %[[#insertinsert_ushort16]]
+kernel void testInsert_ushort16(ushort16 b, ushort16 i, global ushort16 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_char16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_char16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char16]] %[[#insertinsert_char16]]kernel void testInsert_char16(char16 b, char16 i, global char16 *res) {
+// CHECK-EXTENSION: %[[#insertbase_char16:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_char16:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_char16]] %[[#insertinsert_char16]]
+kernel void testInsert_char16(char16 b, char16 i, global char16 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#insertbase_uchar16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#insertinsert_uchar16:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar16]] %[[#insertinsert_uchar16]]kernel void testInsert_uchar16(uchar16 b, uchar16 i, global uchar16 *res) {
+// CHECK-EXTENSION: %[[#insertbase_uchar16:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#insertinsert_uchar16:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldInsert %[[#]] %[[#insertbase_uchar16]] %[[#insertinsert_uchar16]]
+kernel void testInsert_uchar16(uchar16 b, uchar16 i, global uchar16 *res) {
   *res = bitfield_insert(b, i, 4, 2);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
 kernel void testExtractS_long(long b, ulong bu, global long *res) {
   *res = bitfield_extract_signed(b, 5, 4);
@@ -245,7 +385,9 @@ kernel void testExtractS_long(long b, ulong bu, global long *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
 kernel void testExtractS_int(int b, uint bu, global int *res) {
   *res = bitfield_extract_signed(b, 5, 4);
@@ -253,7 +395,9 @@ kernel void testExtractS_int(int b, uint bu, global int *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
 kernel void testExtractS_short(short b, ushort bu, global short *res) {
   *res = bitfield_extract_signed(b, 5, 4);
@@ -261,7 +405,9 @@ kernel void testExtractS_short(short b, ushort bu, global short *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
 kernel void testExtractS_char(char b, uchar bu, global char *res) {
   *res = bitfield_extract_signed(b, 5, 4);
@@ -269,7 +415,9 @@ kernel void testExtractS_char(char b, uchar bu, global char *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
 kernel void testExtractS_long2(long b, ulong bu, global long *res) {
   *res = bitfield_extract_signed(b, 5, 4);
@@ -277,7 +425,9 @@ kernel void testExtractS_long2(long b, ulong bu, global long *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
 kernel void testExtractS_int2(int b, uint bu, global int *res) {
   *res = bitfield_extract_signed(b, 5, 4);
@@ -285,7 +435,9 @@ kernel void testExtractS_int2(int b, uint bu, global int *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
 kernel void testExtractS_short2(short b, ushort bu, global short *res) {
   *res = bitfield_extract_signed(b, 5, 4);
@@ -293,7 +445,9 @@ kernel void testExtractS_short2(short b, ushort bu, global short *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
 kernel void testExtractS_char2(char b, uchar bu, global char *res) {
   *res = bitfield_extract_signed(b, 5, 4);
@@ -301,7 +455,9 @@ kernel void testExtractS_char2(char b, uchar bu, global char *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
 kernel void testExtractS_long3(long b, ulong bu, global long *res) {
   *res = bitfield_extract_signed(b, 5, 4);
@@ -309,7 +465,9 @@ kernel void testExtractS_long3(long b, ulong bu, global long *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
 kernel void testExtractS_int3(int b, uint bu, global int *res) {
   *res = bitfield_extract_signed(b, 5, 4);
@@ -317,7 +475,9 @@ kernel void testExtractS_int3(int b, uint bu, global int *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
 kernel void testExtractS_short3(short b, ushort bu, global short *res) {
   *res = bitfield_extract_signed(b, 5, 4);
@@ -325,7 +485,9 @@ kernel void testExtractS_short3(short b, ushort bu, global short *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
 kernel void testExtractS_char3(char b, uchar bu, global char *res) {
   *res = bitfield_extract_signed(b, 5, 4);
@@ -333,7 +495,9 @@ kernel void testExtractS_char3(char b, uchar bu, global char *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
 kernel void testExtractS_long4(long b, ulong bu, global long *res) {
   *res = bitfield_extract_signed(b, 5, 4);
@@ -341,7 +505,9 @@ kernel void testExtractS_long4(long b, ulong bu, global long *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
 kernel void testExtractS_int4(int b, uint bu, global int *res) {
   *res = bitfield_extract_signed(b, 5, 4);
@@ -349,7 +515,9 @@ kernel void testExtractS_int4(int b, uint bu, global int *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
 kernel void testExtractS_short4(short b, ushort bu, global short *res) {
   *res = bitfield_extract_signed(b, 5, 4);
@@ -357,7 +525,9 @@ kernel void testExtractS_short4(short b, ushort bu, global short *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
 kernel void testExtractS_char4(char b, uchar bu, global char *res) {
   *res = bitfield_extract_signed(b, 5, 4);
@@ -365,7 +535,9 @@ kernel void testExtractS_char4(char b, uchar bu, global char *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
 kernel void testExtractS_long8(long b, ulong bu, global long *res) {
   *res = bitfield_extract_signed(b, 5, 4);
@@ -373,7 +545,9 @@ kernel void testExtractS_long8(long b, ulong bu, global long *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
 kernel void testExtractS_int8(int b, uint bu, global int *res) {
   *res = bitfield_extract_signed(b, 5, 4);
@@ -381,7 +555,9 @@ kernel void testExtractS_int8(int b, uint bu, global int *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
 kernel void testExtractS_short8(short b, ushort bu, global short *res) {
   *res = bitfield_extract_signed(b, 5, 4);
@@ -389,7 +565,9 @@ kernel void testExtractS_short8(short b, ushort bu, global short *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
 kernel void testExtractS_char8(char b, uchar bu, global char *res) {
   *res = bitfield_extract_signed(b, 5, 4);
@@ -397,7 +575,9 @@ kernel void testExtractS_char8(char b, uchar bu, global char *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
 kernel void testExtractS_long16(long b, ulong bu, global long *res) {
   *res = bitfield_extract_signed(b, 5, 4);
@@ -405,7 +585,9 @@ kernel void testExtractS_long16(long b, ulong bu, global long *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
 kernel void testExtractS_int16(int b, uint bu, global int *res) {
   *res = bitfield_extract_signed(b, 5, 4);
@@ -413,7 +595,9 @@ kernel void testExtractS_int16(int b, uint bu, global int *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
 kernel void testExtractS_short16(short b, ushort bu, global short *res) {
   *res = bitfield_extract_signed(b, 5, 4);
@@ -421,7 +605,9 @@ kernel void testExtractS_short16(short b, ushort bu, global short *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
+// CHECK-EXTENSION: %[[#sextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#sextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldSExtract %[[#]] %[[#sextractbaseu]]
 kernel void testExtractS_char16(char b, uchar bu, global char *res) {
   *res = bitfield_extract_signed(b, 5, 4);
@@ -429,7 +615,9 @@ kernel void testExtractS_char16(char b, uchar bu, global char *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
 kernel void testExtractU_long(long b, ulong bu, global ulong *res) {
   *res = bitfield_extract_unsigned(b, 3, 4);
@@ -437,7 +625,9 @@ kernel void testExtractU_long(long b, ulong bu, global ulong *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
 kernel void testExtractU_int(int b, uint bu, global uint *res) {
   *res = bitfield_extract_unsigned(b, 3, 4);
@@ -445,7 +635,9 @@ kernel void testExtractU_int(int b, uint bu, global uint *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
 kernel void testExtractU_short(short b, ushort bu, global ushort *res) {
   *res = bitfield_extract_unsigned(b, 3, 4);
@@ -453,7 +645,9 @@ kernel void testExtractU_short(short b, ushort bu, global ushort *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
 kernel void testExtractU_char(char b, uchar bu, global uchar *res) {
   *res = bitfield_extract_unsigned(b, 3, 4);
@@ -461,7 +655,9 @@ kernel void testExtractU_char(char b, uchar bu, global uchar *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
 kernel void testExtractU_long2(long2 b, ulong2 bu, global ulong2 *res) {
   *res = bitfield_extract_unsigned(b, 3, 4);
@@ -469,7 +665,9 @@ kernel void testExtractU_long2(long2 b, ulong2 bu, global ulong2 *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
 kernel void testExtractU_int2(int2 b, uint2 bu, global uint2 *res) {
   *res = bitfield_extract_unsigned(b, 3, 4);
@@ -477,7 +675,9 @@ kernel void testExtractU_int2(int2 b, uint2 bu, global uint2 *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
 kernel void testExtractU_short2(short2 b, ushort2 bu, global ushort2 *res) {
   *res = bitfield_extract_unsigned(b, 3, 4);
@@ -485,7 +685,9 @@ kernel void testExtractU_short2(short2 b, ushort2 bu, global ushort2 *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
 kernel void testExtractU_char2(char2 b, uchar2 bu, global uchar2 *res) {
   *res = bitfield_extract_unsigned(b, 3, 4);
@@ -493,7 +695,9 @@ kernel void testExtractU_char2(char2 b, uchar2 bu, global uchar2 *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
 kernel void testExtractU_long3(long3 b, ulong3 bu, global ulong3 *res) {
   *res = bitfield_extract_unsigned(b, 3, 4);
@@ -501,7 +705,9 @@ kernel void testExtractU_long3(long3 b, ulong3 bu, global ulong3 *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
 kernel void testExtractU_int3(int3 b, uint3 bu, global uint3 *res) {
   *res = bitfield_extract_unsigned(b, 3, 4);
@@ -509,7 +715,9 @@ kernel void testExtractU_int3(int3 b, uint3 bu, global uint3 *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
 kernel void testExtractU_short3(short3 b, ushort3 bu, global ushort3 *res) {
   *res = bitfield_extract_unsigned(b, 3, 4);
@@ -517,7 +725,9 @@ kernel void testExtractU_short3(short3 b, ushort3 bu, global ushort3 *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
 kernel void testExtractU_char3(char3 b, uchar3 bu, global uchar3 *res) {
   *res = bitfield_extract_unsigned(b, 3, 4);
@@ -525,7 +735,9 @@ kernel void testExtractU_char3(char3 b, uchar3 bu, global uchar3 *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
 kernel void testExtractU_long4(long4 b, ulong4 bu, global ulong4 *res) {
   *res = bitfield_extract_unsigned(b, 3, 4);
@@ -533,7 +745,9 @@ kernel void testExtractU_long4(long4 b, ulong4 bu, global ulong4 *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
 kernel void testExtractU_int4(int4 b, uint4 bu, global uint4 *res) {
   *res = bitfield_extract_unsigned(b, 3, 4);
@@ -541,7 +755,9 @@ kernel void testExtractU_int4(int4 b, uint4 bu, global uint4 *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
 kernel void testExtractU_short4(short4 b, ushort4 bu, global ushort4 *res) {
   *res = bitfield_extract_unsigned(b, 3, 4);
@@ -549,7 +765,9 @@ kernel void testExtractU_short4(short4 b, ushort4 bu, global ushort4 *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
 kernel void testExtractU_char4(char4 b, uchar4 bu, global uchar4 *res) {
   *res = bitfield_extract_unsigned(b, 3, 4);
@@ -557,7 +775,9 @@ kernel void testExtractU_char4(char4 b, uchar4 bu, global uchar4 *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
 kernel void testExtractU_long8(long8 b, ulong8 bu, global ulong8 *res) {
   *res = bitfield_extract_unsigned(b, 3, 4);
@@ -565,7 +785,9 @@ kernel void testExtractU_long8(long8 b, ulong8 bu, global ulong8 *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
 kernel void testExtractU_int8(int8 b, uint8 bu, global uint8 *res) {
   *res = bitfield_extract_unsigned(b, 3, 4);
@@ -573,7 +795,9 @@ kernel void testExtractU_int8(int8 b, uint8 bu, global uint8 *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
 kernel void testExtractU_short8(short8 b, ushort8 bu, global ushort8 *res) {
   *res = bitfield_extract_unsigned(b, 3, 4);
@@ -581,7 +805,9 @@ kernel void testExtractU_short8(short8 b, ushort8 bu, global ushort8 *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
 kernel void testExtractU_char8(char8 b, uchar8 bu, global uchar8 *res) {
   *res = bitfield_extract_unsigned(b, 3, 4);
@@ -589,7 +815,9 @@ kernel void testExtractU_char8(char8 b, uchar8 bu, global uchar8 *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
 kernel void testExtractU_long16(long16 b, ulong16 bu, global ulong16 *res) {
   *res = bitfield_extract_unsigned(b, 3, 4);
@@ -597,7 +825,9 @@ kernel void testExtractU_long16(long16 b, ulong16 bu, global ulong16 *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
 kernel void testExtractU_int16(int16 b, uint16 bu, global uint16 *res) {
   *res = bitfield_extract_unsigned(b, 3, 4);
@@ -605,7 +835,9 @@ kernel void testExtractU_int16(int16 b, uint16 bu, global uint16 *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
 kernel void testExtractU_short16(short16 b, ushort16 bu, global ushort16 *res) {
   *res = bitfield_extract_unsigned(b, 3, 4);
@@ -613,7 +845,9 @@ kernel void testExtractU_short16(short16 b, ushort16 bu, global ushort16 *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
+// CHECK-EXTENSION: %[[#uextractbase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#uextractbaseu:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbase]]
 // CHECK-EXTENSION: %[[#]] = OpBitFieldUExtract %[[#]] %[[#uextractbaseu]]
 kernel void testExtractU_char16(char16 b, uchar16 bu, global uchar16 *res) {
   *res = bitfield_extract_unsigned(b, 3, 4);
@@ -621,289 +855,337 @@ kernel void testExtractU_char16(char16 b, uchar16 bu, global uchar16 *res) {
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_long(long b, global long *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_ulong(ulong b, global ulong *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_int(int b, global int *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_uint(uint b, global uint *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_short(short b, global short *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_ushort(ushort b, global ushort *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_char(char b, global char *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_uchar(uchar b, global uchar *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_long2(long2 b, global long2 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_ulong2(ulong2 b, global ulong2 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_int2(int2 b, global int2 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_uint2(uint2 b, global uint2 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_short2(short2 b, global short2 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_ushort2(ushort2 b, global ushort2 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_char2(char2 b, global char2 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_uchar2(uchar2 b, global uchar2 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_long3(long3 b, global long3 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_ulong3(ulong3 b, global ulong3 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_int3(int3 b, global int3 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_uint3(uint3 b, global uint3 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_short3(short3 b, global short3 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_ushort3(ushort3 b, global ushort3 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_char3(char3 b, global char3 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_uchar3(uchar3 b, global uchar3 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_long4(long4 b, global long4 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_ulong4(ulong4 b, global ulong4 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_int4(int4 b, global int4 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_uint4(uint4 b, global uint4 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_short4(short4 b, global short4 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_ushort4(ushort4 b, global ushort4 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_char4(char4 b, global char4 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_uchar4(uchar4 b, global uchar4 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_long8(long8 b, global long8 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_ulong8(ulong8 b, global ulong8 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_int8(int8 b, global int8 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_uint8(uint8 b, global uint8 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_short8(short8 b, global short8 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_ushort8(ushort8 b, global ushort8 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_char8(char8 b, global char8 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_uchar8(uchar8 b, global uchar8 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_long16(long16 b, global long16 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_ulong16(ulong16 b, global ulong16 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_int16(int16 b, global int16 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_uint16(uint16 b, global uint16 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_short16(short16 b, global short16 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_ushort16(ushort16 b, global ushort16 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_char16(char16 b, global char16 *res) {
   *res = bit_reverse(b);
 }
 
 // CHECK-EXTENSION: %[[#]] = OpFunction %[[#]] None %[[#]]
-// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
+// CHECK-EXTENSION: %[[#reversebase:]] = OpFunctionParameter %[[#]]
+// CHECK-EXTENSION: %[[#]] = OpBitReverse %[[#]] %[[#reversebase]]
 kernel void testBitReverse_uchar16(uchar16 b, global uchar16 *res) {
   *res = bit_reverse(b);
 }
diff --git a/llvm/test/CodeGen/SPIRV/lit.local.cfg b/llvm/test/CodeGen/SPIRV/lit.local.cfg
index 4655633a256827..adf18069481839 100644
--- a/llvm/test/CodeGen/SPIRV/lit.local.cfg
+++ b/llvm/test/CodeGen/SPIRV/lit.local.cfg
@@ -1,6 +1,12 @@
+import lit.llvm
+
 if not "SPIRV" in config.root.targets:
     config.unsupported = True
 
+lit.llvm.initialize(lit_config, config)
+lit.llvm.llvm_config.use_clang()
+config.suffixes.add(".cl")
+
 spirv_sim_root = os.path.join(config.llvm_src_root, "utils", "spirv-sim")
 
 config.substitutions.append(
diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py
index 0d2e414d1d9f8f..5a03a85386e0aa 100644
--- a/llvm/test/lit.cfg.py
+++ b/llvm/test/lit.cfg.py
@@ -22,7 +22,7 @@
 
 # suffixes: A list of file extensions to treat as test files. This is overriden
 # by individual lit.local.cfg files in the test subdirectories.
-config.suffixes = [".ll", ".c", ".test", ".txt", ".s", ".mir", ".yaml", ".spv", ".cl"]
+config.suffixes = [".ll", ".c", ".test", ".txt", ".s", ".mir", ".yaml", ".spv"]
 
 # excludes: A list of directories to exclude from the testsuite. The 'Inputs'
 # subdirectories contain auxiliary inputs for various tests in their parent
@@ -35,8 +35,6 @@
 # test_exec_root: The root path where tests should be run.
 config.test_exec_root = os.path.join(config.llvm_obj_root, "test")
 
-llvm_config.use_clang()
-
 # Tweak the PATH to include the tools dir.
 llvm_config.with_environment("PATH", config.llvm_tools_dir, append_path=True)
 

>From 54128bbf1dc8d43949fde2f43337a4e372445c1d Mon Sep 17 00:00:00 2001
From: "Maronas, Marcos" <marcos.maronas at intel.com>
Date: Thu, 19 Dec 2024 14:30:55 +0100
Subject: [PATCH 5/5] Fix clang-format issues.

---
 llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp b/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
index d64d9177b49219..24166d31f78b28 100644
--- a/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
@@ -984,16 +984,16 @@ static bool buildBarrierInst(const SPIRV::IncomingCall *Call, unsigned Opcode,
 }
 
 /// Helper function for building extended bit operations.
-static bool buildExtendedBitOpsInst(const SPIRV::IncomingCall *Call, unsigned Opcode,
-                             MachineIRBuilder &MIRBuilder,
-                             SPIRVGlobalRegistry *GR) {
+static bool buildExtendedBitOpsInst(const SPIRV::IncomingCall *Call,
+                                    unsigned Opcode,
+                                    MachineIRBuilder &MIRBuilder,
+                                    SPIRVGlobalRegistry *GR) {
   const SPIRV::DemangledBuiltin *Builtin = Call->Builtin;
   const auto *ST =
       static_cast<const SPIRVSubtarget *>(&MIRBuilder.getMF().getSubtarget());
   if ((Opcode == SPIRV::OpBitFieldInsert ||
        Opcode == SPIRV::OpBitFieldSExtract ||
-       Opcode == SPIRV::OpBitFieldUExtract ||
-       Opcode == SPIRV::OpBitReverse) &&
+       Opcode == SPIRV::OpBitFieldUExtract || Opcode == SPIRV::OpBitReverse) &&
       !ST->canUseExtension(SPIRV::Extension::SPV_KHR_bit_instructions)) {
     std::string DiagMsg = std::string(Builtin->Name) +
                           ": the builtin requires the following SPIR-V "
@@ -1007,8 +1007,8 @@ static bool buildExtendedBitOpsInst(const SPIRV::IncomingCall *Call, unsigned Op
 
   // Generate the instruction.
   auto MIB = MIRBuilder.buildInstr(Opcode)
-      .addDef(Call->ReturnRegister)
-      .addUse(GR->getSPIRVTypeID(Call->ReturnType));
+                 .addDef(Call->ReturnRegister)
+                 .addUse(GR->getSPIRVTypeID(Call->ReturnType));
   for (unsigned i = 0; i < Call->Arguments.size(); ++i)
     MIB.addUse(Call->Arguments[i]);
 
@@ -2074,8 +2074,8 @@ static bool generateSpecConstantInst(const SPIRV::IncomingCall *Call,
 }
 
 static bool generateExtendedBitOpsInst(const SPIRV::IncomingCall *Call,
-                                MachineIRBuilder &MIRBuilder,
-                                SPIRVGlobalRegistry *GR) {
+                                       MachineIRBuilder &MIRBuilder,
+                                       SPIRVGlobalRegistry *GR) {
   // Lookup the instruction opcode in the TableGen records.
   const SPIRV::DemangledBuiltin *Builtin = Call->Builtin;
   unsigned Opcode =



More information about the llvm-commits mailing list